From 694a557f2fcfe72be0e4f8139ad05bc87d1df765 Mon Sep 17 00:00:00 2001 From: Benjamin Jee Date: Thu, 27 Jun 2024 11:56:59 -0700 Subject: [PATCH 1/5] Add collection of policy counts --- internal/mode/static/telemetry/collector.go | 31 +++++++ .../mode/static/telemetry/collector_test.go | 92 ++++++++++++++----- 2 files changed, 101 insertions(+), 22 deletions(-) diff --git a/internal/mode/static/telemetry/collector.go b/internal/mode/static/telemetry/collector.go index c73d9b6b6c..dbb7eda4a6 100644 --- a/internal/mode/static/telemetry/collector.go +++ b/internal/mode/static/telemetry/collector.go @@ -14,6 +14,7 @@ import ( k8sversion "k8s.io/apimachinery/pkg/util/version" "sigs.k8s.io/controller-runtime/pkg/client" + "github.com/nginxinc/nginx-gateway-fabric/internal/framework/kinds" "github.com/nginxinc/nginx-gateway-fabric/internal/mode/static/config" "github.com/nginxinc/nginx-gateway-fabric/internal/mode/static/state/dataplane" "github.com/nginxinc/nginx-gateway-fabric/internal/mode/static/state/graph" @@ -71,6 +72,15 @@ type NGFResourceCounts struct { GRPCRouteCount int64 // BackendTLSPolicyCount is the number of relevant BackendTLSPolicies. BackendTLSPolicyCount int64 + // GatewayAttachedClientSettingsPolicyCount is the number of relevant ClientSettingsPolicies + // attached at the Gateway level. + GatewayAttachedClientSettingsPolicyCount int64 + // RouteAttachedClientSettingsPolicyCount is the number of relevant ClientSettingsPolicies attached at the Route level. + RouteAttachedClientSettingsPolicyCount int64 + // ObservabilityPolicyCount is the number of relevant ObservabilityPolicies. + ObservabilityPolicyCount int64 + // NGINXProxyCount is the number of NGINXProxies. + NGINXProxyCount int64 } // DataCollectorConfig holds configuration parameters for DataCollectorImpl. @@ -190,6 +200,27 @@ func collectGraphResourceCount( ngfResourceCounts.BackendTLSPolicyCount = int64(len(g.BackendTLSPolicies)) + for policyKey, policy := range g.NGFPolicies { + switch gvk := policyKey.GVK; gvk.Kind { + case kinds.ClientSettingsPolicy: + if policy.TargetRefs == nil { + continue + } + + if policy.TargetRefs[0].Kind == kinds.Gateway { + ngfResourceCounts.GatewayAttachedClientSettingsPolicyCount++ + } else { + ngfResourceCounts.RouteAttachedClientSettingsPolicyCount++ + } + case kinds.ObservabilityPolicy: + ngfResourceCounts.ObservabilityPolicyCount++ + } + } + + if g.NginxProxy != nil { + ngfResourceCounts.NGINXProxyCount = 1 + } + return ngfResourceCounts, nil } diff --git a/internal/mode/static/telemetry/collector_test.go b/internal/mode/static/telemetry/collector_test.go index 599ed516d2..f002c4d5e2 100644 --- a/internal/mode/static/telemetry/collector_test.go +++ b/internal/mode/static/telemetry/collector_test.go @@ -12,11 +12,13 @@ import ( appsv1 "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" "github.com/nginxinc/nginx-gateway-fabric/internal/framework/events/eventsfakes" + "github.com/nginxinc/nginx-gateway-fabric/internal/framework/kinds" "github.com/nginxinc/nginx-gateway-fabric/internal/mode/static/config" "github.com/nginxinc/nginx-gateway-fabric/internal/mode/static/state/dataplane" "github.com/nginxinc/nginx-gateway-fabric/internal/mode/static/state/graph" @@ -304,6 +306,25 @@ var _ = Describe("Collector", Ordered, func() { {Namespace: "test", Name: "backendTLSPolicy-2"}: {}, {Namespace: "test", Name: "backendTLSPolicy-3"}: {}, }, + NGFPolicies: map[graph.PolicyKey]*graph.Policy{ + { + NsName: types.NamespacedName{Namespace: "test", Name: "ClientSettingsPolicy-1"}, + GVK: schema.GroupVersionKind{Kind: kinds.ClientSettingsPolicy}, + }: {TargetRefs: []graph.PolicyTargetRef{{Kind: kinds.Gateway}}}, + { + NsName: types.NamespacedName{Namespace: "test", Name: "ClientSettingsPolicy-2"}, + GVK: schema.GroupVersionKind{Kind: kinds.ClientSettingsPolicy}, + }: {TargetRefs: []graph.PolicyTargetRef{{Kind: kinds.HTTPRoute}}}, + { + NsName: types.NamespacedName{Namespace: "test", Name: "ClientSettingsPolicy-3"}, + GVK: schema.GroupVersionKind{Kind: kinds.ClientSettingsPolicy}, + }: {TargetRefs: []graph.PolicyTargetRef{{Kind: kinds.GRPCRoute}}}, + { + NsName: types.NamespacedName{Namespace: "test", Name: "ObservabilityPolicy-1"}, + GVK: schema.GroupVersionKind{Kind: kinds.ObservabilityPolicy}, + }: {}, + }, + NginxProxy: &graph.NginxProxy{}, } config := &dataplane.Configuration{ @@ -342,14 +363,18 @@ var _ = Describe("Collector", Ordered, func() { expData.ClusterNodeCount = 3 expData.NGFResourceCounts = telemetry.NGFResourceCounts{ - GatewayCount: 3, - GatewayClassCount: 3, - HTTPRouteCount: 3, - SecretCount: 3, - ServiceCount: 3, - EndpointCount: 4, - GRPCRouteCount: 2, - BackendTLSPolicyCount: 3, + GatewayCount: 3, + GatewayClassCount: 3, + HTTPRouteCount: 3, + SecretCount: 3, + ServiceCount: 3, + EndpointCount: 4, + GRPCRouteCount: 2, + BackendTLSPolicyCount: 3, + GatewayAttachedClientSettingsPolicyCount: 1, + RouteAttachedClientSettingsPolicyCount: 2, + ObservabilityPolicyCount: 1, + NGINXProxyCount: 1, } expData.ClusterVersion = "1.29.2" expData.ClusterPlatform = "kind" @@ -495,6 +520,21 @@ var _ = Describe("Collector", Ordered, func() { ReferencedServices: map[types.NamespacedName]struct{}{ client.ObjectKeyFromObject(svc): {}, }, + NGFPolicies: map[graph.PolicyKey]*graph.Policy{ + { + NsName: types.NamespacedName{Namespace: "test", Name: "ClientSettingsPolicy-1"}, + GVK: schema.GroupVersionKind{Kind: kinds.ClientSettingsPolicy}, + }: {TargetRefs: []graph.PolicyTargetRef{{Kind: kinds.Gateway}}}, + { + NsName: types.NamespacedName{Namespace: "test", Name: "ClientSettingsPolicy-2"}, + GVK: schema.GroupVersionKind{Kind: kinds.ClientSettingsPolicy}, + }: {TargetRefs: []graph.PolicyTargetRef{{Kind: kinds.HTTPRoute}}}, + { + NsName: types.NamespacedName{Namespace: "test", Name: "ObservabilityPolicy-1"}, + GVK: schema.GroupVersionKind{Kind: kinds.ObservabilityPolicy}, + }: {}, + }, + NginxProxy: &graph.NginxProxy{}, } config1 = &dataplane.Configuration{ @@ -557,12 +597,16 @@ var _ = Describe("Collector", Ordered, func() { fakeConfigurationGetter.GetLatestConfigurationReturns(config1) expData.NGFResourceCounts = telemetry.NGFResourceCounts{ - GatewayCount: 1, - GatewayClassCount: 1, - HTTPRouteCount: 1, - SecretCount: 1, - ServiceCount: 1, - EndpointCount: 1, + GatewayCount: 1, + GatewayClassCount: 1, + HTTPRouteCount: 1, + SecretCount: 1, + ServiceCount: 1, + EndpointCount: 1, + GatewayAttachedClientSettingsPolicyCount: 1, + RouteAttachedClientSettingsPolicyCount: 1, + ObservabilityPolicyCount: 1, + NGINXProxyCount: 1, } data, err := dataCollector.Collect(ctx) @@ -575,14 +619,18 @@ var _ = Describe("Collector", Ordered, func() { fakeGraphGetter.GetLatestGraphReturns(&graph.Graph{}) fakeConfigurationGetter.GetLatestConfigurationReturns(invalidUpstreamsConfig) expData.NGFResourceCounts = telemetry.NGFResourceCounts{ - GatewayCount: 0, - GatewayClassCount: 0, - HTTPRouteCount: 0, - SecretCount: 0, - ServiceCount: 0, - EndpointCount: 0, - GRPCRouteCount: 0, - BackendTLSPolicyCount: 0, + GatewayCount: 0, + GatewayClassCount: 0, + HTTPRouteCount: 0, + SecretCount: 0, + ServiceCount: 0, + EndpointCount: 0, + GRPCRouteCount: 0, + BackendTLSPolicyCount: 0, + GatewayAttachedClientSettingsPolicyCount: 0, + RouteAttachedClientSettingsPolicyCount: 0, + ObservabilityPolicyCount: 0, + NGINXProxyCount: 0, } data, err := dataCollector.Collect(ctx) From fe3ab00a8831f94c4dcc7c137dd1da53bac30498 Mon Sep 17 00:00:00 2001 From: Benjamin Jee Date: Thu, 27 Jun 2024 13:13:17 -0700 Subject: [PATCH 2/5] Add product telemetry data points --- internal/mode/static/telemetry/data.avdl | 13 +++++++++ internal/mode/static/telemetry/data_test.go | 28 +++++++++++++------ .../ngfresourcecounts_attributes_generated.go | 4 +++ site/content/overview/product-telemetry.md | 2 +- tests/suite/telemetry_test.go | 4 +++ 5 files changed, 42 insertions(+), 9 deletions(-) diff --git a/internal/mode/static/telemetry/data.avdl b/internal/mode/static/telemetry/data.avdl index 68880f3b4c..c1a1c3aa0e 100644 --- a/internal/mode/static/telemetry/data.avdl +++ b/internal/mode/static/telemetry/data.avdl @@ -68,6 +68,19 @@ Each value is either 'true' or 'false' for boolean flags and 'default' or 'user- /** BackendTLSPolicyCount is the number of relevant BackendTLSPolicies. */ long? BackendTLSPolicyCount = null; + /** GatewayAttachedClientSettingsPolicyCount is the number of relevant ClientSettingsPolicies +attached at the Gateway level. */ + long? GatewayAttachedClientSettingsPolicyCount = null; + + /** RouteAttachedClientSettingsPolicyCount is the number of relevant ClientSettingsPolicies attached at the Route level. */ + long? RouteAttachedClientSettingsPolicyCount = null; + + /** ObservabilityPolicyCount is the number of relevant ObservabilityPolicies. */ + long? ObservabilityPolicyCount = null; + + /** NGINXProxyCount is the number of NGINXProxies. */ + long? NGINXProxyCount = null; + /** NGFReplicaCount is the number of replicas of the NGF Pod. */ long? NGFReplicaCount = null; diff --git a/internal/mode/static/telemetry/data_test.go b/internal/mode/static/telemetry/data_test.go index a8285fc8f2..d0d9a18876 100644 --- a/internal/mode/static/telemetry/data_test.go +++ b/internal/mode/static/telemetry/data_test.go @@ -24,14 +24,18 @@ func TestDataAttributes(t *testing.T) { FlagNames: []string{"test-flag"}, FlagValues: []string{"test-value"}, NGFResourceCounts: NGFResourceCounts{ - GatewayCount: 1, - GatewayClassCount: 2, - HTTPRouteCount: 3, - SecretCount: 4, - ServiceCount: 5, - EndpointCount: 6, - GRPCRouteCount: 7, - BackendTLSPolicyCount: 8, + GatewayCount: 1, + GatewayClassCount: 2, + HTTPRouteCount: 3, + SecretCount: 4, + ServiceCount: 5, + EndpointCount: 6, + GRPCRouteCount: 7, + BackendTLSPolicyCount: 8, + GatewayAttachedClientSettingsPolicyCount: 9, + RouteAttachedClientSettingsPolicyCount: 10, + ObservabilityPolicyCount: 11, + NGINXProxyCount: 12, }, NGFReplicaCount: 3, } @@ -57,6 +61,10 @@ func TestDataAttributes(t *testing.T) { attribute.Int64("EndpointCount", 6), attribute.Int64("GRPCRouteCount", 7), attribute.Int64("BackendTLSPolicyCount", 8), + attribute.Int64("GatewayAttachedClientSettingsPolicyCount", 9), + attribute.Int64("RouteAttachedClientSettingsPolicyCount", 10), + attribute.Int64("ObservabilityPolicyCount", 11), + attribute.Int64("NGINXProxyCount", 12), attribute.Int64("NGFReplicaCount", 3), } @@ -90,6 +98,10 @@ func TestDataAttributesWithEmptyData(t *testing.T) { attribute.Int64("EndpointCount", 0), attribute.Int64("GRPCRouteCount", 0), attribute.Int64("BackendTLSPolicyCount", 0), + attribute.Int64("GatewayAttachedClientSettingsPolicyCount", 0), + attribute.Int64("RouteAttachedClientSettingsPolicyCount", 0), + attribute.Int64("ObservabilityPolicyCount", 0), + attribute.Int64("NGINXProxyCount", 0), attribute.Int64("NGFReplicaCount", 0), } diff --git a/internal/mode/static/telemetry/ngfresourcecounts_attributes_generated.go b/internal/mode/static/telemetry/ngfresourcecounts_attributes_generated.go index f32dc40c06..cc4199f183 100644 --- a/internal/mode/static/telemetry/ngfresourcecounts_attributes_generated.go +++ b/internal/mode/static/telemetry/ngfresourcecounts_attributes_generated.go @@ -23,6 +23,10 @@ func (d *NGFResourceCounts) Attributes() []attribute.KeyValue { attrs = append(attrs, attribute.Int64("EndpointCount", d.EndpointCount)) attrs = append(attrs, attribute.Int64("GRPCRouteCount", d.GRPCRouteCount)) attrs = append(attrs, attribute.Int64("BackendTLSPolicyCount", d.BackendTLSPolicyCount)) + attrs = append(attrs, attribute.Int64("GatewayAttachedClientSettingsPolicyCount", d.GatewayAttachedClientSettingsPolicyCount)) + attrs = append(attrs, attribute.Int64("RouteAttachedClientSettingsPolicyCount", d.RouteAttachedClientSettingsPolicyCount)) + attrs = append(attrs, attribute.Int64("ObservabilityPolicyCount", d.ObservabilityPolicyCount)) + attrs = append(attrs, attribute.Int64("NGINXProxyCount", d.NGINXProxyCount)) return attrs diff --git a/site/content/overview/product-telemetry.md b/site/content/overview/product-telemetry.md index 97c161579d..aa7e1b0283 100644 --- a/site/content/overview/product-telemetry.md +++ b/site/content/overview/product-telemetry.md @@ -26,7 +26,7 @@ Telemetry data is collected once every 24 hours and sent to a service managed by - **Deployment Replica Count:** the count of NGINX Gateway Fabric Pods. - **Image Build Source:** whether the image was built by GitHub or locally (values are `gha`, `local`, or `unknown`). The source repository of the images is **not** collected. - **Deployment Flags:** a list of NGINX Gateway Fabric Deployment flags that are specified by a user. The actual values of non-boolean flags are **not** collected; we only record that they are either `true` or `false` for boolean flags and `default` or `user-defined` for the rest. -- **Count of Resources:** the total count of resources related to NGINX Gateway Fabric. This includes `GatewayClasses`, `Gateways`, `HTTPRoutes`,`GRPCRoutes`, `Secrets`, `Services`, `BackendTLSPolicies`, and `Endpoints`. The data within these resources is **not** collected. +- **Count of Resources:** the total count of resources related to NGINX Gateway Fabric. This includes `GatewayClasses`, `Gateways`, `HTTPRoutes`,`GRPCRoutes`, `Secrets`, `Services`, `BackendTLSPolicies`, `ClientSettingsPolicies`, `NGINXProxies`, `ObservabilityPolicies`, and `Endpoints`. The data within these resources is **not** collected. This data is used to identify the following information: diff --git a/tests/suite/telemetry_test.go b/tests/suite/telemetry_test.go index b1517fc9af..7000e66897 100644 --- a/tests/suite/telemetry_test.go +++ b/tests/suite/telemetry_test.go @@ -80,6 +80,10 @@ var _ = Describe("Telemetry test with OTel collector", Label("telemetry"), func( "EndpointCount: Int(0)", "GRPCRouteCount: Int(0)", "BackendTLSPolicyCount: Int(0)", + "GatewayAttachedClientSettingsPolicyCount: Int(0)", + "RouteAttachedClientSettingsPolicyCount: Int(0)", + "ObservabilityPolicyCount: Int(0)", + "NGINXProxyCount: Int(0)", "NGFReplicaCount: Int(1)", }, ) From 19a1b6e5a4f327e6cff7ad74e72e19bf6a6358e2 Mon Sep 17 00:00:00 2001 From: Benjamin Jee Date: Fri, 28 Jun 2024 08:12:13 -0700 Subject: [PATCH 3/5] Add empty client settings test case --- internal/mode/static/telemetry/collector_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/mode/static/telemetry/collector_test.go b/internal/mode/static/telemetry/collector_test.go index f002c4d5e2..2fd026ee98 100644 --- a/internal/mode/static/telemetry/collector_test.go +++ b/internal/mode/static/telemetry/collector_test.go @@ -529,6 +529,10 @@ var _ = Describe("Collector", Ordered, func() { NsName: types.NamespacedName{Namespace: "test", Name: "ClientSettingsPolicy-2"}, GVK: schema.GroupVersionKind{Kind: kinds.ClientSettingsPolicy}, }: {TargetRefs: []graph.PolicyTargetRef{{Kind: kinds.HTTPRoute}}}, + { + NsName: types.NamespacedName{Namespace: "test", Name: "ClientSettingsPolicy-empty"}, + GVK: schema.GroupVersionKind{Kind: kinds.ClientSettingsPolicy}, + }: {}, { NsName: types.NamespacedName{Namespace: "test", Name: "ObservabilityPolicy-1"}, GVK: schema.GroupVersionKind{Kind: kinds.ObservabilityPolicy}, From 917bb41396b9fe94596cb54a981bcc14873316d5 Mon Sep 17 00:00:00 2001 From: Benjamin Jee Date: Fri, 28 Jun 2024 08:54:12 -0700 Subject: [PATCH 4/5] Change NGINXProxy to NginxProxy --- internal/mode/static/telemetry/collector.go | 6 +++--- internal/mode/static/telemetry/collector_test.go | 6 +++--- internal/mode/static/telemetry/data.avdl | 4 ++-- internal/mode/static/telemetry/data_test.go | 6 +++--- .../telemetry/ngfresourcecounts_attributes_generated.go | 2 +- site/content/overview/product-telemetry.md | 2 +- tests/suite/telemetry_test.go | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/mode/static/telemetry/collector.go b/internal/mode/static/telemetry/collector.go index dbb7eda4a6..3dee1e602b 100644 --- a/internal/mode/static/telemetry/collector.go +++ b/internal/mode/static/telemetry/collector.go @@ -79,8 +79,8 @@ type NGFResourceCounts struct { RouteAttachedClientSettingsPolicyCount int64 // ObservabilityPolicyCount is the number of relevant ObservabilityPolicies. ObservabilityPolicyCount int64 - // NGINXProxyCount is the number of NGINXProxies. - NGINXProxyCount int64 + // NginxProxyCount is the number of NginxProxies. + NginxProxyCount int64 } // DataCollectorConfig holds configuration parameters for DataCollectorImpl. @@ -218,7 +218,7 @@ func collectGraphResourceCount( } if g.NginxProxy != nil { - ngfResourceCounts.NGINXProxyCount = 1 + ngfResourceCounts.NginxProxyCount = 1 } return ngfResourceCounts, nil diff --git a/internal/mode/static/telemetry/collector_test.go b/internal/mode/static/telemetry/collector_test.go index 2fd026ee98..09b14b0c54 100644 --- a/internal/mode/static/telemetry/collector_test.go +++ b/internal/mode/static/telemetry/collector_test.go @@ -374,7 +374,7 @@ var _ = Describe("Collector", Ordered, func() { GatewayAttachedClientSettingsPolicyCount: 1, RouteAttachedClientSettingsPolicyCount: 2, ObservabilityPolicyCount: 1, - NGINXProxyCount: 1, + NginxProxyCount: 1, } expData.ClusterVersion = "1.29.2" expData.ClusterPlatform = "kind" @@ -610,7 +610,7 @@ var _ = Describe("Collector", Ordered, func() { GatewayAttachedClientSettingsPolicyCount: 1, RouteAttachedClientSettingsPolicyCount: 1, ObservabilityPolicyCount: 1, - NGINXProxyCount: 1, + NginxProxyCount: 1, } data, err := dataCollector.Collect(ctx) @@ -634,7 +634,7 @@ var _ = Describe("Collector", Ordered, func() { GatewayAttachedClientSettingsPolicyCount: 0, RouteAttachedClientSettingsPolicyCount: 0, ObservabilityPolicyCount: 0, - NGINXProxyCount: 0, + NginxProxyCount: 0, } data, err := dataCollector.Collect(ctx) diff --git a/internal/mode/static/telemetry/data.avdl b/internal/mode/static/telemetry/data.avdl index c1a1c3aa0e..7d32720600 100644 --- a/internal/mode/static/telemetry/data.avdl +++ b/internal/mode/static/telemetry/data.avdl @@ -78,8 +78,8 @@ attached at the Gateway level. */ /** ObservabilityPolicyCount is the number of relevant ObservabilityPolicies. */ long? ObservabilityPolicyCount = null; - /** NGINXProxyCount is the number of NGINXProxies. */ - long? NGINXProxyCount = null; + /** NginxProxyCount is the number of NginxProxies. */ + long? NginxProxyCount = null; /** NGFReplicaCount is the number of replicas of the NGF Pod. */ long? NGFReplicaCount = null; diff --git a/internal/mode/static/telemetry/data_test.go b/internal/mode/static/telemetry/data_test.go index d0d9a18876..cb4b09df86 100644 --- a/internal/mode/static/telemetry/data_test.go +++ b/internal/mode/static/telemetry/data_test.go @@ -35,7 +35,7 @@ func TestDataAttributes(t *testing.T) { GatewayAttachedClientSettingsPolicyCount: 9, RouteAttachedClientSettingsPolicyCount: 10, ObservabilityPolicyCount: 11, - NGINXProxyCount: 12, + NginxProxyCount: 12, }, NGFReplicaCount: 3, } @@ -64,7 +64,7 @@ func TestDataAttributes(t *testing.T) { attribute.Int64("GatewayAttachedClientSettingsPolicyCount", 9), attribute.Int64("RouteAttachedClientSettingsPolicyCount", 10), attribute.Int64("ObservabilityPolicyCount", 11), - attribute.Int64("NGINXProxyCount", 12), + attribute.Int64("NginxProxyCount", 12), attribute.Int64("NGFReplicaCount", 3), } @@ -101,7 +101,7 @@ func TestDataAttributesWithEmptyData(t *testing.T) { attribute.Int64("GatewayAttachedClientSettingsPolicyCount", 0), attribute.Int64("RouteAttachedClientSettingsPolicyCount", 0), attribute.Int64("ObservabilityPolicyCount", 0), - attribute.Int64("NGINXProxyCount", 0), + attribute.Int64("NginxProxyCount", 0), attribute.Int64("NGFReplicaCount", 0), } diff --git a/internal/mode/static/telemetry/ngfresourcecounts_attributes_generated.go b/internal/mode/static/telemetry/ngfresourcecounts_attributes_generated.go index cc4199f183..1224cb096a 100644 --- a/internal/mode/static/telemetry/ngfresourcecounts_attributes_generated.go +++ b/internal/mode/static/telemetry/ngfresourcecounts_attributes_generated.go @@ -26,7 +26,7 @@ func (d *NGFResourceCounts) Attributes() []attribute.KeyValue { attrs = append(attrs, attribute.Int64("GatewayAttachedClientSettingsPolicyCount", d.GatewayAttachedClientSettingsPolicyCount)) attrs = append(attrs, attribute.Int64("RouteAttachedClientSettingsPolicyCount", d.RouteAttachedClientSettingsPolicyCount)) attrs = append(attrs, attribute.Int64("ObservabilityPolicyCount", d.ObservabilityPolicyCount)) - attrs = append(attrs, attribute.Int64("NGINXProxyCount", d.NGINXProxyCount)) + attrs = append(attrs, attribute.Int64("NginxProxyCount", d.NginxProxyCount)) return attrs diff --git a/site/content/overview/product-telemetry.md b/site/content/overview/product-telemetry.md index aa7e1b0283..f69b641718 100644 --- a/site/content/overview/product-telemetry.md +++ b/site/content/overview/product-telemetry.md @@ -26,7 +26,7 @@ Telemetry data is collected once every 24 hours and sent to a service managed by - **Deployment Replica Count:** the count of NGINX Gateway Fabric Pods. - **Image Build Source:** whether the image was built by GitHub or locally (values are `gha`, `local`, or `unknown`). The source repository of the images is **not** collected. - **Deployment Flags:** a list of NGINX Gateway Fabric Deployment flags that are specified by a user. The actual values of non-boolean flags are **not** collected; we only record that they are either `true` or `false` for boolean flags and `default` or `user-defined` for the rest. -- **Count of Resources:** the total count of resources related to NGINX Gateway Fabric. This includes `GatewayClasses`, `Gateways`, `HTTPRoutes`,`GRPCRoutes`, `Secrets`, `Services`, `BackendTLSPolicies`, `ClientSettingsPolicies`, `NGINXProxies`, `ObservabilityPolicies`, and `Endpoints`. The data within these resources is **not** collected. +- **Count of Resources:** the total count of resources related to NGINX Gateway Fabric. This includes `GatewayClasses`, `Gateways`, `HTTPRoutes`,`GRPCRoutes`, `Secrets`, `Services`, `BackendTLSPolicies`, `ClientSettingsPolicies`, `NginxProxies`, `ObservabilityPolicies`, and `Endpoints`. The data within these resources is **not** collected. This data is used to identify the following information: diff --git a/tests/suite/telemetry_test.go b/tests/suite/telemetry_test.go index 7000e66897..c6a8b65fc0 100644 --- a/tests/suite/telemetry_test.go +++ b/tests/suite/telemetry_test.go @@ -83,7 +83,7 @@ var _ = Describe("Telemetry test with OTel collector", Label("telemetry"), func( "GatewayAttachedClientSettingsPolicyCount: Int(0)", "RouteAttachedClientSettingsPolicyCount: Int(0)", "ObservabilityPolicyCount: Int(0)", - "NGINXProxyCount: Int(0)", + "NginxProxyCount: Int(0)", "NGFReplicaCount: Int(1)", }, ) From d02d232aa3fa5fc5403e671cdfe1c4d9d98386d5 Mon Sep 17 00:00:00 2001 From: Benjamin Jee Date: Fri, 28 Jun 2024 08:57:23 -0700 Subject: [PATCH 5/5] Add more feedback --- internal/mode/static/telemetry/collector.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/mode/static/telemetry/collector.go b/internal/mode/static/telemetry/collector.go index 3dee1e602b..6dccd0562e 100644 --- a/internal/mode/static/telemetry/collector.go +++ b/internal/mode/static/telemetry/collector.go @@ -201,9 +201,9 @@ func collectGraphResourceCount( ngfResourceCounts.BackendTLSPolicyCount = int64(len(g.BackendTLSPolicies)) for policyKey, policy := range g.NGFPolicies { - switch gvk := policyKey.GVK; gvk.Kind { + switch policyKey.GVK.Kind { case kinds.ClientSettingsPolicy: - if policy.TargetRefs == nil { + if len(policy.TargetRefs) == 0 { continue }