Skip to content

Commit

Permalink
Add installed architecture to telemetry data
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sjberman committed Feb 21, 2024
1 parent 6a11016 commit a7e5000
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/mode/static/telemetry/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"runtime"

appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -52,6 +53,7 @@ type Data struct {
ProjectMetadata ProjectMetadata
ClusterID string
ImageSource string
Arch string
NGFResourceCounts NGFResourceCounts
NodeCount int
NGFReplicaCount int
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions internal/mode/static/telemetry/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"reflect"
"runtime"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -124,6 +125,7 @@ var _ = Describe("Collector", Ordered, func() {
NGFReplicaCount: 1,
ClusterID: string(kubeNamespace.GetUID()),
ImageSource: "local",
Arch: runtime.GOARCH,
}

k8sClientReader = &eventsfakes.FakeReader{}
Expand Down

0 comments on commit a7e5000

Please sign in to comment.