Skip to content

Commit

Permalink
feat(metrics): add no_error to ack
Browse files Browse the repository at this point in the history
Signed-off-by: slonka <slonka@users.noreply.github.com>
  • Loading branch information
slonka committed Apr 21, 2024
1 parent 82a952a commit 616365d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/util/xds/stats_callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const (
failedCallingWebhook = "failed calling webhook"
userErrorType = "user"
otherErrorType = "other"
noErrorType = "no_error"
)

type VersionExtractor = func(metadata *structpb.Struct) string
Expand Down Expand Up @@ -167,7 +168,7 @@ func (s *statsCallbacks) OnStreamRequest(streamID int64, request DiscoveryReques
if request.HasErrors() {
s.requestsReceivedMetric.WithLabelValues(request.GetTypeUrl(), "NACK", classifyError(request.ErrorMsg())).Inc()
} else {
s.requestsReceivedMetric.WithLabelValues(request.GetTypeUrl(), "ACK").Inc()
s.requestsReceivedMetric.WithLabelValues(request.GetTypeUrl(), "ACK", noErrorType).Inc()
}

if configTime, exists := s.takeConfigTimeFromQueue(request.VersionInfo()); exists {
Expand Down Expand Up @@ -222,7 +223,7 @@ func (s *statsCallbacks) OnStreamDeltaRequest(streamID int64, request DeltaDisco
if request.HasErrors() {
s.requestsReceivedMetric.WithLabelValues(request.GetTypeUrl(), "NACK", classifyError(request.ErrorMsg())).Inc()
} else {
s.requestsReceivedMetric.WithLabelValues(request.GetTypeUrl(), "ACK").Inc()
s.requestsReceivedMetric.WithLabelValues(request.GetTypeUrl(), "ACK", noErrorType).Inc()
}

// Delta only has an initial version, therefore we need to change the key to nodeID and typeURL.
Expand Down

0 comments on commit 616365d

Please sign in to comment.