Skip to content

Commit

Permalink
tweak metrics names
Browse files Browse the repository at this point in the history
  • Loading branch information
dvush committed Nov 12, 2024
1 parent e526f2e commit 7f8e940
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
17 changes: 6 additions & 11 deletions proxy/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ import (
var (
archiveEventsProcessedTotalCounter = metrics.NewCounter("orderflow_proxy_archive_events_processed_total")
archiveEventsProcessedErrCounter = metrics.NewCounter("orderflow_proxy_archive_events_processed_err")

archiveEventsRPCErrors = metrics.NewCounter("orderflow_proxy_events_rpc_errors")
archiveEventsRPCSentCounter = metrics.NewCounter("orderflow_proxy_events_rpc_sent")
archiveEventsRPCDuration = metrics.NewSummary("orderflow_proxy_events_rpc_duration_milliseconds")
// number of events sent successfully to orderflow archive. i.e. if we batch 10 events into 1 request this would be increment by 10
archiveEventsRPCSentCounter = metrics.NewCounter("orderflow_proxy_archive_events_sent_ok")
archiveEventsRPCDuration = metrics.NewSummary("orderflow_proxy_archive_rpc_duration_milliseconds")
archiveEventsRPCErrors = metrics.NewCounter("orderflow_proxy_archive_rpc_errors")

confighubErrorsCounter = metrics.NewCounter("orderflow_proxy_confighub_errors")

shareQueueInternalErrors = metrics.NewCounter("orderflow_proxy_share_queue_internal_errors")
apiLocalRateLimits = metrics.NewCounter("orderflow_proxy_api_local_rate_limits")

apiLocalRateLimits = metrics.NewCounter("orderflow_proxy_api_local_rate_limits")
)

const (
apiIncomingRequestsByPeer = `orderflow_proxy_api_incoming_requests_by_peer{peer="%s"}`
apiDuplicateRequestsByPeer = `orderflow_proxy_api_duplicate_requests_by_peer{peer="%s"}`

shareQueuePeerTotalRequestsLabel = `orderflow_proxy_share_queue_peer_total_requests{peer="%s"}`
shareQueuePeerStallingErrorsLabel = `orderflow_proxy_share_queue_peer_stalling_errors{peer="%s"}`
shareQueuePeerRPCErrorsLabel = `orderflow_proxy_share_queue_peer_rpc_errors{peer="%s"}`
shareQueuePeerRPCDurationLabel = `orderflow_proxy_share_queue_peer_rpc_duration_milliseconds{peer="%s"}`
Expand All @@ -44,11 +44,6 @@ func incAPILocalRateLimits() {
apiLocalRateLimits.Inc()
}

func incShareQueueTotalRequests(peer string) {
l := fmt.Sprintf(shareQueuePeerTotalRequestsLabel, peer)
metrics.GetOrCreateCounter(l).Inc()
}

func incShareQueuePeerStallingErrors(peer string) {
l := fmt.Sprintf(shareQueuePeerStallingErrorsLabel, peer)
metrics.GetOrCreateCounter(l).Inc()
Expand Down
1 change: 0 additions & 1 deletion proxy/sharing.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ func (sq *ShareQueue) proxyRequests(peer *shareQueuePeer, worker int) {
logger.Warn("Error returned from target while proxying", slog.Any("error", resp.Error))
incShareQueuePeerRPCErrors(peer.name)
}
incShareQueueTotalRequests(peer.name)
proxiedRequestCount += 1
logger.Debug("Message proxied")
}
Expand Down

0 comments on commit 7f8e940

Please sign in to comment.