@@ -6,7 +6,6 @@ package server
6
6
import (
7
7
"fmt"
8
8
"log/slog"
9
- "path"
10
9
"time"
11
10
12
11
"github.com/cilium/cilium/api/v1/client/daemon"
@@ -16,7 +15,6 @@ import (
16
15
"github.com/cilium/cilium/api/v1/models"
17
16
"github.com/cilium/cilium/pkg/api"
18
17
ciliumPkg "github.com/cilium/cilium/pkg/client"
19
- ciliumDefaults "github.com/cilium/cilium/pkg/defaults"
20
18
healthClientPkg "github.com/cilium/cilium/pkg/health/client"
21
19
"github.com/cilium/cilium/pkg/health/defaults"
22
20
"github.com/cilium/cilium/pkg/health/probe"
@@ -171,8 +169,6 @@ func (s *Server) collectNodeConnectivityMetrics(report *healthReport) {
171
169
if s .localStatus == nil || report == nil {
172
170
return
173
171
}
174
- localClusterName , localNodeName := getClusterNodeName (s .localStatus .Name )
175
-
176
172
endpointStatuses := make (map [healthClientPkg.ConnectivityStatusType ]int )
177
173
nodeStatuses := make (map [healthClientPkg.ConnectivityStatusType ]int )
178
174
@@ -214,70 +210,70 @@ func (s *Server) collectNodeConnectivityMetrics(report *healthReport) {
214
210
s .nodesSeen [n .Name ] = struct {}{}
215
211
216
212
// HTTP endpoint primary
217
- collectConnectivityMetric (s .logger , endpointPathStatus .PrimaryAddress .HTTP , localClusterName , localNodeName ,
213
+ collectConnectivityMetric (s .logger , endpointPathStatus .PrimaryAddress .HTTP ,
218
214
metrics .LabelPeerEndpoint , metrics .LabelTrafficHTTP , metrics .LabelAddressTypePrimary )
219
215
220
216
// HTTP endpoint secondary
221
217
for _ , secondary := range endpointPathStatus .SecondaryAddresses {
222
- collectConnectivityMetric (s .logger , secondary .HTTP , localClusterName , localNodeName ,
218
+ collectConnectivityMetric (s .logger , secondary .HTTP ,
223
219
metrics .LabelPeerEndpoint , metrics .LabelTrafficHTTP , metrics .LabelAddressTypeSecondary )
224
220
}
225
221
226
222
// HTTP node primary
227
- collectConnectivityMetric (s .logger , nodePathPrimaryAddress .HTTP , localClusterName , localNodeName ,
223
+ collectConnectivityMetric (s .logger , nodePathPrimaryAddress .HTTP ,
228
224
metrics .LabelPeerNode , metrics .LabelTrafficHTTP , metrics .LabelAddressTypePrimary )
229
225
230
226
// HTTP node secondary
231
227
for _ , secondary := range nodePathSecondaryAddress {
232
- collectConnectivityMetric (s .logger , secondary .HTTP , localClusterName , localNodeName ,
228
+ collectConnectivityMetric (s .logger , secondary .HTTP ,
233
229
metrics .LabelPeerNode , metrics .LabelTrafficHTTP , metrics .LabelAddressTypeSecondary )
234
230
}
235
231
236
232
// ICMP endpoint primary
237
- collectConnectivityMetric (s .logger , endpointPathStatus .PrimaryAddress .Icmp , localClusterName , localNodeName ,
233
+ collectConnectivityMetric (s .logger , endpointPathStatus .PrimaryAddress .Icmp ,
238
234
metrics .LabelPeerEndpoint , metrics .LabelTrafficICMP , metrics .LabelAddressTypePrimary )
239
235
240
236
// ICMP endpoint secondary
241
237
for _ , secondary := range endpointPathStatus .SecondaryAddresses {
242
- collectConnectivityMetric (s .logger , secondary .Icmp , localClusterName , localNodeName ,
238
+ collectConnectivityMetric (s .logger , secondary .Icmp ,
243
239
metrics .LabelPeerEndpoint , metrics .LabelTrafficICMP , metrics .LabelAddressTypeSecondary )
244
240
}
245
241
246
242
// ICMP node primary
247
- collectConnectivityMetric (s .logger , nodePathPrimaryAddress .Icmp , localClusterName , localNodeName ,
243
+ collectConnectivityMetric (s .logger , nodePathPrimaryAddress .Icmp ,
248
244
metrics .LabelPeerNode , metrics .LabelTrafficICMP , metrics .LabelAddressTypePrimary )
249
245
250
246
// ICMP node secondary
251
247
for _ , secondary := range nodePathSecondaryAddress {
252
- collectConnectivityMetric (s .logger , secondary .Icmp , localClusterName , localNodeName ,
248
+ collectConnectivityMetric (s .logger , secondary .Icmp ,
253
249
metrics .LabelPeerNode , metrics .LabelTrafficICMP , metrics .LabelAddressTypeSecondary )
254
250
}
255
251
}
256
252
257
253
// Aggregated health statuses for endpoint connectivity
258
254
metrics .NodeHealthConnectivityStatus .WithLabelValues (
259
- localClusterName , localNodeName , metrics .LabelPeerEndpoint , metrics .LabelReachable ).
255
+ metrics .LabelPeerEndpoint , metrics .LabelReachable ).
260
256
Set (float64 (endpointStatuses [healthClientPkg .ConnStatusReachable ]))
261
257
262
258
metrics .NodeHealthConnectivityStatus .WithLabelValues (
263
- localClusterName , localNodeName , metrics .LabelPeerEndpoint , metrics .LabelUnreachable ).
259
+ metrics .LabelPeerEndpoint , metrics .LabelUnreachable ).
264
260
Set (float64 (endpointStatuses [healthClientPkg .ConnStatusUnreachable ]))
265
261
266
262
metrics .NodeHealthConnectivityStatus .WithLabelValues (
267
- localClusterName , localNodeName , metrics .LabelPeerEndpoint , metrics .LabelUnknown ).
263
+ metrics .LabelPeerEndpoint , metrics .LabelUnknown ).
268
264
Set (float64 (endpointStatuses [healthClientPkg .ConnStatusUnknown ]))
269
265
270
266
// Aggregated health statuses for node connectivity
271
267
metrics .NodeHealthConnectivityStatus .WithLabelValues (
272
- localClusterName , localNodeName , metrics .LabelPeerNode , metrics .LabelReachable ).
268
+ metrics .LabelPeerNode , metrics .LabelReachable ).
273
269
Set (float64 (nodeStatuses [healthClientPkg .ConnStatusReachable ]))
274
270
275
271
metrics .NodeHealthConnectivityStatus .WithLabelValues (
276
- localClusterName , localNodeName , metrics .LabelPeerNode , metrics .LabelUnreachable ).
272
+ metrics .LabelPeerNode , metrics .LabelUnreachable ).
277
273
Set (float64 (nodeStatuses [healthClientPkg .ConnStatusUnreachable ]))
278
274
279
275
metrics .NodeHealthConnectivityStatus .WithLabelValues (
280
- localClusterName , localNodeName , metrics .LabelPeerNode , metrics .LabelUnknown ).
276
+ metrics .LabelPeerNode , metrics .LabelUnknown ).
281
277
Set (float64 (nodeStatuses [healthClientPkg .ConnStatusUnknown ]))
282
278
}
283
279
@@ -292,16 +288,6 @@ func collectConnectivityMetric(logger *slog.Logger, status *healthModels.Connect
292
288
}
293
289
}
294
290
295
- // getClusterNodeName returns the cluster name and node name if possible.
296
- func getClusterNodeName (str string ) (string , string ) {
297
- clusterName , nodeName := path .Split (str )
298
- if len (clusterName ) == 0 {
299
- return ciliumDefaults .ClusterName , nodeName
300
- }
301
- // remove forward slash at the end if any for cluster name
302
- return path .Dir (clusterName ), nodeName
303
- }
304
-
305
291
// GetStatusResponse returns the most recent cluster connectivity status.
306
292
func (s * Server ) GetStatusResponse () * healthModels.HealthStatusResponse {
307
293
s .RLock ()
0 commit comments