Skip to content

Commit 59d431c

Browse files
committed
Change way of count for ProxySettingsPolicy
1 parent 73c60fb commit 59d431c

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

internal/controller/telemetry/collector.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,10 @@ func CountProxySettingsPolicies(g *graph.Graph) (int64, int64) {
151151
continue
152152
}
153153

154-
for _, tr := range policy.TargetRefs {
155-
switch tr.Kind {
156-
case kinds.Gateway:
157-
gatewayAttachedProxySettingsPolicyCount++
158-
case kinds.HTTPRoute, kinds.GRPCRoute:
159-
routeAttachedProxySettingsPolicyCount++
160-
}
154+
if policy.TargetRefs[0].Kind == kinds.Gateway {
155+
gatewayAttachedProxySettingsPolicyCount++
156+
} else {
157+
routeAttachedProxySettingsPolicyCount++
161158
}
162159
}
163160
}

internal/controller/telemetry/collector_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ var _ = Describe("Collector", Ordered, func() {
546546

547547
expData.InferencePoolCount = 3
548548
expData.GatewayAttachedProxySettingsPolicyCount = 2
549-
expData.RouteAttachedProxySettingsPolicyCount = 4
549+
expData.RouteAttachedProxySettingsPolicyCount = 2
550550

551551
data, err := dataCollector.Collect(ctx)
552552
Expect(err).ToNot(HaveOccurred())
@@ -832,7 +832,7 @@ var _ = Describe("Collector", Ordered, func() {
832832
expData.NginxPodCount = 1
833833
expData.InferencePoolCount = 1
834834
expData.GatewayAttachedProxySettingsPolicyCount = 2
835-
expData.RouteAttachedProxySettingsPolicyCount = 3
835+
expData.RouteAttachedProxySettingsPolicyCount = 1
836836

837837
data, err := dataCollector.Collect(ctx)
838838

0 commit comments

Comments
 (0)