Skip to content

Commit c1ebc6d

Browse files
authored
[Observability][Shannon] Fix protocol observations request errors (#437)
## Summary Fix protocol observations request errors
1 parent 5635598 commit c1ebc6d

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

metrics/protocol/shannon/metrics.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ const (
2929
relaysActiveRequestsMetric = "shannon_relays_active"
3030

3131
// WebSocket connection metrics
32-
websocketConnectionsTotalMetric = "shannon_websocket_connections_total"
33-
websocketConnectionErrorsMetric = "shannon_websocket_connection_errors_total"
32+
websocketConnectionsTotalMetric = "shannon_websocket_connections_total"
33+
websocketConnectionErrorsMetric = "shannon_websocket_connection_errors_total"
3434
websocketConnectionsActiveMetric = "shannon_websocket_connections_active"
3535

3636
// WebSocket message metrics
@@ -107,6 +107,8 @@ var (
107107
[]string{"service_id", "success", "error_type", "used_fallback"},
108108
)
109109

110+
// TODO_IMPROVE(@adshmh): This should be called endpointErrorsTotal
111+
//
110112
// relaysErrorsTotal tracks relay errors from Shannon protocol
111113
// Labels:
112114
// - service_id: Target service identifier
@@ -364,8 +366,23 @@ func PublishMetrics(
364366

365367
// Process each observation for metrics
366368
for _, observationSet := range shannonObservations {
369+
370+
// Check for request processing errors.
371+
// e.g. error fetching a session for the target service.
372+
if observationSet.GetRequestError() != nil {
373+
// Record the relay total with success/failure status
374+
recordRelayTotal(logger, observationSet)
375+
376+
// Request processing encountered error.
377+
// Skip endpoint observations.
378+
continue
379+
}
380+
381+
// TODO_IMPROVE(@adshmh): Replace dynamic type casts with nil checks.
382+
//
367383
// Handle different types of observations based on the oneof field
368384
switch obsData := observationSet.GetObservationData().(type) {
385+
369386
case *protocolobservations.ShannonRequestObservations_HttpObservations:
370387
// HTTP observations - existing metrics processing
371388
httpObservations := obsData.HttpObservations

protocol/shannon/sanctioned_endpoints_store.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (ses *sanctionedEndpointsStore) ApplyObservations(shannonObservations []*pr
7373
for _, observationSet := range shannonObservations {
7474
httpObservations := observationSet.GetHttpObservations()
7575
if httpObservations == nil {
76-
logger.Warn().Msg("❌ SHOULD NEVER HAPPEN: skipping processing: received empty HTTP observations")
76+
logger.With("observation_set", observationSet).Warn().Msg("❌ SHOULD NEVER HAPPEN: skipping processing: received empty HTTP observations")
7777
continue
7878
}
7979

0 commit comments

Comments
 (0)