@@ -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
0 commit comments