Skip to content

Commit 0d1d49a

Browse files
authored
Add installed architecture to telemetry data (#1604)
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
1 parent 6a11016 commit 0d1d49a

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

internal/mode/static/telemetry/collector.go

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"runtime"
78

89
appsv1 "k8s.io/api/apps/v1"
910
v1 "k8s.io/api/core/v1"
@@ -52,6 +53,7 @@ type Data struct {
5253
ProjectMetadata ProjectMetadata
5354
ClusterID string
5455
ImageSource string
56+
Arch string
5557
NGFResourceCounts NGFResourceCounts
5658
NodeCount int
5759
NGFReplicaCount int
@@ -119,6 +121,7 @@ func (c DataCollectorImpl) Collect(ctx context.Context) (Data, error) {
119121
NGFReplicaCount: ngfReplicaCount,
120122
ClusterID: clusterID,
121123
ImageSource: c.cfg.ImageSource,
124+
Arch: runtime.GOARCH,
122125
}
123126

124127
return data, nil

internal/mode/static/telemetry/collector_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"errors"
66
"fmt"
77
"reflect"
8+
"runtime"
89

910
. "github.com/onsi/ginkgo/v2"
1011
. "github.com/onsi/gomega"
@@ -124,6 +125,7 @@ var _ = Describe("Collector", Ordered, func() {
124125
NGFReplicaCount: 1,
125126
ClusterID: string(kubeNamespace.GetUID()),
126127
ImageSource: "local",
128+
Arch: runtime.GOARCH,
127129
}
128130

129131
k8sClientReader = &eventsfakes.FakeReader{}

0 commit comments

Comments
 (0)