metrics

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NodeCounts *prometheus.GaugeVec

NodeCounts is a gauge that tracks the number of available nodes for each type

View Source
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

View Source
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
View Source
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

func IncrementRequestStatusCount(requestType, node string, statusCode int)

IncrementRequestStatusCount increments the request count for a specific type, node, and status code.

func PrepareMetricsServer

func PrepareMetricsServer(addr string, path string) *http.Server

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

func UpdateNodeCount(nodeType string, count float64)

UpdateNodeCount updates the node count for a specific type.

func UpdateNodeHealth

func UpdateNodeHealth(nodeType, node string, healthy bool)

UpdateNodeHealth updates the health status for a specific node.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL