Prometheus Metrics

October 10, 2023 ยท View on GitHub

Gubernator can be monitored realtime using Prometheus metrics.

Enabling Metric Collection

Metrics are exposed under two possible deployment scenarios:

  1. Gubernator deployed as a standalone daemon.
    • Metrics endpoint published at the HTTP /metrics URI.
  2. Gubernator embedded as a Go module.
    • The dependant codebase is responsible for publishing the HTTP /metrics URI.
    • See daemon.go for examples using the promhttp module.

Finally, configure a Prometheus job to scrape the server's /metrics URI.

Metrics

MetricTypeDescription
gubernator_cache_access_countCounterThe count of LRUCache accesses during rate checks.
gubernator_cache_sizeGaugeThe number of items in LRU Cache which holds the rate limits.
gubernator_check_error_counterCounterThe number of errors while checking rate limits.
gubernator_command_counterCounterThe count of commands processed by each worker in WorkerPool.
gubernator_concurrent_checks_counterGaugeThe number of concurrent GetRateLimits API calls.
gubernator_func_durationSummaryThe timings of key functions in Gubernator in seconds.
gubernator_getratelimit_counterCounterThe count of getLocalRateLimit() calls. Label "calltype" may be "local" for calls handled by the same peer, "forward" for calls forwarded to another peer, or "global" for global rate limits.
gubernator_grpc_request_countsCounterThe count of gRPC requests.
gubernator_grpc_request_durationSummaryThe timings of gRPC requests in seconds.
gubernator_over_limit_counterCounterThe number of rate limit checks that are over the limit.
gubernator_worker_queue_lengthGaugeThe count of requests queued up in WorkerPool.

Global Behavior

MetricTypeDescription
gubernator_broadcast_counterCounterThe count of broadcasts.
gubernator_broadcast_durationSummaryThe timings of GLOBAL broadcasts to peers in seconds.
gubernator_global_queue_lengthGaugeThe count of requests queued up for global broadcast. This is only used for GetRateLimit requests using global behavior.

Batch Behavior

MetricTypeDescription
gubernator_batch_queue_lengthGaugeThe getRateLimitsBatch() queue length in PeerClient. This represents rate checks queued by for batching to a remote peer.
gubernator_batch_send_durationSummaryThe timings of batch send operations to a remote peer.
gubernator_batch_send_retriesCounterThe count of retries occurred in asyncRequests() forwarding a request to another peer.