Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4103612
Add BuilOS to telemetry
shaun-nx Oct 7, 2025
06c853d
Run `make generate` to update data.avdl and generated attributes
shaun-nx Oct 7, 2025
aeb9042
Merge branch 'main' into feat/buildos-telemetry
shaun-nx Oct 8, 2025
4bc9935
Update module google.golang.org/grpc to v1.76.0 (#4029)
renovate[bot] Oct 8, 2025
014b64b
Update module github.com/prometheus/common to v0.67.1 (#4042)
renovate[bot] Oct 8, 2025
1d9dd4a
Update github/codeql-action action to v4 (#4043)
renovate[bot] Oct 8, 2025
3d58eb3
Update nginx Docker tag to v1.29.2 (#4041)
renovate[bot] Oct 8, 2025
db96078
Update ghcr.io/nginx/dependencies/nginx-ubi:ubi9 Docker digest to 46e…
renovate[bot] Oct 9, 2025
b7d7dd9
Pass os.Getenv("BUILD_OS") directly to manager
shaun-nx Oct 9, 2025
5e5a3c5
Fix failing unit tests
shaun-nx Oct 9, 2025
a3d5a8e
Revert data struct and add nolint
shaun-nx Oct 9, 2025
2d34749
Merge branch 'main' into feat/buildos-telemetry
shaun-nx Oct 9, 2025
00b418d
Fix //nolint lint error
shaun-nx Oct 9, 2025
8022051
Add comment about //nolint
shaun-nx Oct 9, 2025
c9b7a7d
Merge branch 'main' into feat/buildos-telemetry
shaun-nx Oct 10, 2025
e0110cb
Merge branch 'main' into feat/buildos-telemetry
shaun-nx Oct 10, 2025
75f6de7
Add buildOs to normal test case
shaun-nx Oct 10, 2025
f56e9f2
Update buildOS comment and run `make generate`
shaun-nx Oct 10, 2025
3f0b3f3
Merge branch 'main' into feat/buildos-telemetry
shaun-nx Oct 10, 2025
4153485
Merge branch 'main' into feat/buildos-telemetry
shaun-nx Oct 13, 2025
f87a2ce
Merge branch 'main' into feat/buildos-telemetry
shaun-nx Oct 13, 2025
f8cfab6
Add `ENv BUILD_OS` to Dockerfiles
shaun-nx Oct 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ COPY --from=ca-certs-provider --link /etc/ssl/certs/ca-certificates.crt /etc/ssl
USER 101:1001
ARG BUILD_AGENT
ENV BUILD_AGENT=${BUILD_AGENT}
ENV BUILD_OS=alpine
ENTRYPOINT [ "/usr/bin/gateway" ]

FROM common AS container
Expand Down
1 change: 1 addition & 0 deletions build/ubi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ COPY --from=ca-certs-provider --link /etc/ssl/certs/ca-certificates.crt /etc/ssl
USER 101:1001
ARG BUILD_AGENT
ENV BUILD_AGENT=${BUILD_AGENT}
ENV BUILD_OS=ubi

LABEL name="F5 NGINX Gateway Fabric NGINX Plus" \
maintainer="[email protected]" \
Expand Down
13 changes: 12 additions & 1 deletion internal/controller/telemetry/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"os"
"runtime"
"sort"
"strings"
Expand Down Expand Up @@ -40,7 +41,7 @@ type ConfigurationGetter interface {
// Data is telemetry data.
//
//go:generate go run -tags generator github.com/nginx/telemetry-exporter/cmd/generator -type=Data -scheme -scheme-protocol=NGFProductTelemetry -scheme-df-datatype=ngf-product-telemetry
type Data struct {
type Data struct { //nolint //required to skip golangci-lint-full fieldalignment
// ImageSource tells whether the image was built by GitHub or locally (values are 'gha', 'local', or 'unknown')
ImageSource string
tel.Data // embedding is required by the generator.
Expand All @@ -66,6 +67,8 @@ type Data struct {
ControlPlanePodCount int64
// NginxOneConnectionEnabled is a boolean that indicates whether the connection to the Nginx One Console is enabled.
NginxOneConnectionEnabled bool
// BuildOS is the base operating system the control plane was built on (e.g. alpine, ubi).
BuildOS string
}

// NGFResourceCounts stores the counts of all relevant resources that NGF processes and generates configuration from.
Expand Down Expand Up @@ -121,6 +124,8 @@ type DataCollectorConfig struct {
Version string
// ImageSource is the source of the NGF image.
ImageSource string
// BuildOS is the base operating system the control plane was built on (e.g. alpine, ubi).
BuildOS string
// Flags contains the command-line NGF flag keys and values.
Flags config.Flags
// NginxOneConsoleConnection is a boolean that indicates whether the connection to the Nginx One Console is enabled.
Expand Down Expand Up @@ -174,6 +179,11 @@ func (c DataCollectorImpl) Collect(ctx context.Context) (Data, error) {

nginxPodCount := getNginxPodCount(g, clusterInfo.NodeCount)

buildOs := os.Getenv("BUILD_OS")
if buildOs == "" {
buildOs = "alpine"
}

data := Data{
Data: tel.Data{
ProjectName: "NGF",
Expand All @@ -187,6 +197,7 @@ func (c DataCollectorImpl) Collect(ctx context.Context) (Data, error) {
},
NGFResourceCounts: graphResourceCount,
ImageSource: c.cfg.ImageSource,
BuildOS: buildOs,
FlagNames: c.cfg.Flags.Names,
FlagValues: c.cfg.Flags.Values,
SnippetsFiltersDirectives: snippetsFiltersDirectives,
Expand Down
3 changes: 3 additions & 0 deletions internal/controller/telemetry/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ var _ = Describe("Collector", Ordered, func() {
NGFResourceCounts: telemetry.NGFResourceCounts{},
ControlPlanePodCount: 1,
ImageSource: "local",
BuildOS: "alpine",
FlagNames: flags.Names,
FlagValues: flags.Values,
SnippetsFiltersDirectives: []string{},
Expand All @@ -193,6 +194,7 @@ var _ = Describe("Collector", Ordered, func() {
Version: version,
PodNSName: podNSName,
ImageSource: "local",
BuildOS: "alpine",
Flags: flags,
NginxOneConsoleConnection: true,
})
Expand Down Expand Up @@ -519,6 +521,7 @@ var _ = Describe("Collector", Ordered, func() {
expData.NginxPodCount = int64(8)
expData.ControlPlanePodCount = int64(2)
expData.NginxOneConnectionEnabled = true
expData.BuildOS = "alpine"

data, err := dataCollector.Collect(ctx)
Expect(err).ToNot(HaveOccurred())
Expand Down
3 changes: 3 additions & 0 deletions internal/controller/telemetry/data.avdl
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,8 @@ attached at the Gateway level. */
/** NginxOneConnectionEnabled is a boolean that indicates whether the connection to the Nginx One Console is enabled. */
boolean? NginxOneConnectionEnabled = null;

/** BuildOS is the base operating system the control plane was built on (e.g. alpine, ubi). */
string? BuildOS = null;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func (d *Data) Attributes() []attribute.KeyValue {
attrs = append(attrs, attribute.Int64("NginxPodCount", d.NginxPodCount))
attrs = append(attrs, attribute.Int64("ControlPlanePodCount", d.ControlPlanePodCount))
attrs = append(attrs, attribute.Bool("NginxOneConnectionEnabled", d.NginxOneConnectionEnabled))
attrs = append(attrs, attribute.String("BuildOS", d.BuildOS))

return attrs
}
Expand Down
2 changes: 2 additions & 0 deletions internal/controller/telemetry/data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func TestDataAttributes(t *testing.T) {
attribute.Int64("NginxPodCount", 3),
attribute.Int64("ControlPlanePodCount", 3),
attribute.Bool("NginxOneConnectionEnabled", true),
attribute.String("BuildOS", ""),
}

result := data.Attributes()
Expand Down Expand Up @@ -132,6 +133,7 @@ func TestDataAttributesWithEmptyData(t *testing.T) {
attribute.Int64("NginxPodCount", 0),
attribute.Int64("ControlPlanePodCount", 0),
attribute.Bool("NginxOneConnectionEnabled", false),
attribute.String("BuildOS", ""),
}

result := data.Attributes()
Expand Down
1 change: 1 addition & 0 deletions tests/suite/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ var _ = Describe("Telemetry test with OTel collector", Label("telemetry"), func(
"NginxPodCount: Int(0)",
"ControlPlanePodCount: Int(1)",
"NginxOneConnectionEnabled: Bool(false)",
"BuildOS:",
},
)
})
Expand Down
Loading