Documentation
¶
Index ¶
- Variables
- func IncrementRequestCount(requestType, node string)
- func IncrementRequestStatusCount(requestType, node string, statusCode int)
- func PrepareMetricsServer(addr string, path string) *http.Server
- func RegisterMetric(metric prometheus.Collector) error
- func SetServiceName(name string)
- func UpdateNodeCount(nodeType string, count float64)
- func UpdateNodeHealth(nodeType, node string, healthy bool)
Constants ¶
This section is empty.
Variables ¶
var NodeCounts *prometheus.GaugeVec
NodeCounts is a gauge that tracks the number of available nodes for each type
var NodeHealth *prometheus.GaugeVec
NodeHealth is a gauge that tracks the health status of each node It has the following labels:
- type: The type of node (rest/rpc/grpc)
- node: The node identifier (usually the host)
Value is 1 if healthy, 0 if unhealthy
var RequestCount *prometheus.CounterVec
RequestCount is a counter that tracks the number of requests per node for each type. It has the following labels:
- type: The type of request (rest/rpc/grpc)
- node: The node handling the request
var RequestStatusCount *prometheus.CounterVec
RequestStatusCount is a counter that tracks the number of requests by status code. It has the following labels:
- type: The type of request (rest/rpc/grpc)
- node: The node handling the request
- status_code: The HTTP status code of the response
Functions ¶
func IncrementRequestCount ¶
func IncrementRequestCount(requestType, node string)
IncrementRequestCount increments the request count for a specific type and node.
func IncrementRequestStatusCount ¶
IncrementRequestStatusCount increments the request count for a specific type, node, and status code.
func PrepareMetricsServer ¶
PrepareMetricsServer prepares a new HTTP server for Prometheus metrics.
func RegisterMetric ¶ added in v0.0.4
func RegisterMetric(metric prometheus.Collector) error
RegisterMetric registers a new metric with the custom registry. This ensures all future metrics automatically get service labels.
func SetServiceName ¶ added in v0.0.4
func SetServiceName(name string)
SetServiceName sets the global service name for all metrics.
func UpdateNodeCount ¶
UpdateNodeCount updates the node count for a specific type.
func UpdateNodeHealth ¶
UpdateNodeHealth updates the health status for a specific node.
Types ¶
This section is empty.