From a7e5000438e42eb3128ccdaf893fdf78f669ddb1 Mon Sep 17 00:00:00 2001 From: Saylor Berman Date: Wed, 21 Feb 2024 11:00:44 -0700 Subject: [PATCH] Add installed architecture to telemetry data Problem: As a maintainer of NGF/NIC I want to record the architecture used (ARM, x86, etc) from all participating NGF installations So that I can ensure used architectures are tested. Solution: Use the golang runtime library to extract the architecture --- internal/mode/static/telemetry/collector.go | 3 +++ internal/mode/static/telemetry/collector_test.go | 2 ++ 2 files changed, 5 insertions(+) diff --git a/internal/mode/static/telemetry/collector.go b/internal/mode/static/telemetry/collector.go index 8bc4fdeb2c..b4240543ed 100644 --- a/internal/mode/static/telemetry/collector.go +++ b/internal/mode/static/telemetry/collector.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "runtime" appsv1 "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" @@ -52,6 +53,7 @@ type Data struct { ProjectMetadata ProjectMetadata ClusterID string ImageSource string + Arch string NGFResourceCounts NGFResourceCounts NodeCount int NGFReplicaCount int @@ -119,6 +121,7 @@ func (c DataCollectorImpl) Collect(ctx context.Context) (Data, error) { NGFReplicaCount: ngfReplicaCount, ClusterID: clusterID, ImageSource: c.cfg.ImageSource, + Arch: runtime.GOARCH, } return data, nil diff --git a/internal/mode/static/telemetry/collector_test.go b/internal/mode/static/telemetry/collector_test.go index 3fe8287b02..4b8c0991e8 100644 --- a/internal/mode/static/telemetry/collector_test.go +++ b/internal/mode/static/telemetry/collector_test.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "reflect" + "runtime" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -124,6 +125,7 @@ var _ = Describe("Collector", Ordered, func() { NGFReplicaCount: 1, ClusterID: string(kubeNamespace.GetUID()), ImageSource: "local", + Arch: runtime.GOARCH, } k8sClientReader = &eventsfakes.FakeReader{}