Skip to content

Commit 25ba1fd

Browse files
committed
Reorder schema
1 parent 2102f13 commit 25ba1fd

File tree

7 files changed

+16
-14
lines changed

7 files changed

+16
-14
lines changed

internal/controller/telemetry/collector.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ type Data struct {
6666
ControlPlanePodCount int64
6767
// NginxOneConnectionEnabled is a boolean that indicates whether the connection to the Nginx One Console is enabled.
6868
NginxOneConnectionEnabled bool
69+
// InferencePoolCount is the number of InferencePools that are referenced by at least one Route.
70+
InferencePoolCount int64
6971
}
7072

7173
// NGFResourceCounts stores the counts of all relevant resources that NGF processes and generates configuration from.
@@ -105,8 +107,6 @@ type NGFResourceCounts struct {
105107
UpstreamSettingsPolicyCount int64
106108
// GatewayAttachedNpCount is the total number of NginxProxy resources that are attached to a Gateway.
107109
GatewayAttachedNpCount int64
108-
// InferencePoolCount is the number of InferencePools that are referenced by at least one Route.
109-
InferencePoolCount int64
110110
}
111111

112112
// DataCollectorConfig holds configuration parameters for DataCollectorImpl.
@@ -176,6 +176,8 @@ func (c DataCollectorImpl) Collect(ctx context.Context) (Data, error) {
176176

177177
nginxPodCount := getNginxPodCount(g, clusterInfo.NodeCount)
178178

179+
inferencePoolCount := int64(len(g.ReferencedInferencePools))
180+
179181
data := Data{
180182
Data: tel.Data{
181183
ProjectName: "NGF",
@@ -196,6 +198,7 @@ func (c DataCollectorImpl) Collect(ctx context.Context) (Data, error) {
196198
NginxPodCount: nginxPodCount,
197199
ControlPlanePodCount: int64(replicaCount),
198200
NginxOneConnectionEnabled: c.cfg.NginxOneConsoleConnection,
201+
InferencePoolCount: inferencePoolCount,
199202
}
200203

201204
return data, nil
@@ -267,8 +270,6 @@ func collectGraphResourceCount(
267270

268271
ngfResourceCounts.GatewayAttachedNpCount = gatewayAttachedNPCount
269272

270-
ngfResourceCounts.InferencePoolCount = int64(len(g.ReferencedInferencePools))
271-
272273
return ngfResourceCounts
273274
}
274275

internal/controller/telemetry/collector_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,6 @@ var _ = Describe("Collector", Ordered, func() {
492492
SnippetsFilterCount: 3,
493493
UpstreamSettingsPolicyCount: 1,
494494
GatewayAttachedNpCount: 2,
495-
InferencePoolCount: 3,
496495
}
497496
expData.ClusterVersion = "1.29.2"
498497
expData.ClusterPlatform = "kind"
@@ -526,6 +525,8 @@ var _ = Describe("Collector", Ordered, func() {
526525
expData.ControlPlanePodCount = int64(2)
527526
expData.NginxOneConnectionEnabled = true
528527

528+
expData.InferencePoolCount = 3
529+
529530
data, err := dataCollector.Collect(ctx)
530531
Expect(err).ToNot(HaveOccurred())
531532

@@ -790,9 +791,9 @@ var _ = Describe("Collector", Ordered, func() {
790791
UpstreamSettingsPolicyCount: 1,
791792
GatewayAttachedNpCount: 1,
792793
BackendTLSPolicyCount: 1,
793-
InferencePoolCount: 1,
794794
}
795795
expData.NginxPodCount = 1
796+
expData.InferencePoolCount = 1
796797

797798
data, err := dataCollector.Collect(ctx)
798799

internal/controller/telemetry/data.avdl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@ attached at the Gateway level. */
105105
/** GatewayAttachedNpCount is the total number of NginxProxy resources that are attached to a Gateway. */
106106
long? GatewayAttachedNpCount = null;
107107

108-
/** InferencePoolCount is the number of InferencePools that are referenced by at least one Route. */
109-
long? InferencePoolCount = null;
110-
111108
/** NginxPodCount is the total number of Nginx data plane Pods. */
112109
long? NginxPodCount = null;
113110

@@ -117,5 +114,8 @@ attached at the Gateway level. */
117114
/** NginxOneConnectionEnabled is a boolean that indicates whether the connection to the Nginx One Console is enabled. */
118115
boolean? NginxOneConnectionEnabled = null;
119116

117+
/** InferencePoolCount is the number of InferencePools that are referenced by at least one Route. */
118+
long? InferencePoolCount = null;
119+
120120
}
121121
}

internal/controller/telemetry/data_attributes_generated.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ func (d *Data) Attributes() []attribute.KeyValue {
2323
attrs = append(attrs, attribute.Int64("NginxPodCount", d.NginxPodCount))
2424
attrs = append(attrs, attribute.Int64("ControlPlanePodCount", d.ControlPlanePodCount))
2525
attrs = append(attrs, attribute.Bool("NginxOneConnectionEnabled", d.NginxOneConnectionEnabled))
26+
attrs = append(attrs, attribute.Int64("InferencePoolCount", d.InferencePoolCount))
2627

2728
return attrs
2829
}

internal/controller/telemetry/data_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ func TestDataAttributes(t *testing.T) {
4141
SnippetsFilterCount: 13,
4242
UpstreamSettingsPolicyCount: 14,
4343
GatewayAttachedNpCount: 15,
44-
InferencePoolCount: 16,
4544
},
4645
SnippetsFiltersDirectives: []string{"main-three-count", "http-two-count", "server-one-count"},
4746
SnippetsFiltersDirectivesCount: []int64{3, 2, 1},
4847
NginxPodCount: 3,
4948
ControlPlanePodCount: 3,
5049
NginxOneConnectionEnabled: true,
50+
InferencePoolCount: 16,
5151
}
5252

5353
expected := []attribute.KeyValue{
@@ -84,10 +84,10 @@ func TestDataAttributes(t *testing.T) {
8484
attribute.Int64("SnippetsFilterCount", 13),
8585
attribute.Int64("UpstreamSettingsPolicyCount", 14),
8686
attribute.Int64("GatewayAttachedNpCount", 15),
87-
attribute.Int64("InferencePoolCount", 16),
8887
attribute.Int64("NginxPodCount", 3),
8988
attribute.Int64("ControlPlanePodCount", 3),
9089
attribute.Bool("NginxOneConnectionEnabled", true),
90+
attribute.Int64("InferencePoolCount", 16),
9191
}
9292

9393
result := data.Attributes()
@@ -131,10 +131,10 @@ func TestDataAttributesWithEmptyData(t *testing.T) {
131131
attribute.Int64("SnippetsFilterCount", 0),
132132
attribute.Int64("UpstreamSettingsPolicyCount", 0),
133133
attribute.Int64("GatewayAttachedNpCount", 0),
134-
attribute.Int64("InferencePoolCount", 0),
135134
attribute.Int64("NginxPodCount", 0),
136135
attribute.Int64("ControlPlanePodCount", 0),
137136
attribute.Bool("NginxOneConnectionEnabled", false),
137+
attribute.Int64("InferencePoolCount", 0),
138138
}
139139

140140
result := data.Attributes()

internal/controller/telemetry/ngfresourcecounts_attributes_generated.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ func (d *NGFResourceCounts) Attributes() []attribute.KeyValue {
2828
attrs = append(attrs, attribute.Int64("SnippetsFilterCount", d.SnippetsFilterCount))
2929
attrs = append(attrs, attribute.Int64("UpstreamSettingsPolicyCount", d.UpstreamSettingsPolicyCount))
3030
attrs = append(attrs, attribute.Int64("GatewayAttachedNpCount", d.GatewayAttachedNpCount))
31-
attrs = append(attrs, attribute.Int64("InferencePoolCount", d.InferencePoolCount))
3231

3332
return attrs
3433
}

tests/suite/telemetry_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ var _ = Describe("Telemetry test with OTel collector", Label("telemetry"), func(
9393
"SnippetsFilterCount: Int(0)",
9494
"UpstreamSettingsPolicyCount: Int(0)",
9595
"GatewayAttachedNpCount: Int(0)",
96-
"InferencePoolCount: Int(0)",
9796
"NginxPodCount: Int(0)",
9897
"ControlPlanePodCount: Int(1)",
9998
"NginxOneConnectionEnabled: Bool(false)",
99+
"InferencePoolCount: Int(0)",
100100
},
101101
)
102102
})

0 commit comments

Comments
 (0)