Documentation
¶
Index ¶
- Constants
- func Enable(b bool)
- func GetCounter(name metrics.MetricName, labels metrics.Labels) metrics.Counter
- func GetGauge(name metrics.MetricName, labels metrics.Labels) metrics.Gauge
- func GetObserver(name metrics.MetricName, labels metrics.Labels) metrics.Observer
- func IsEnabled() bool
- func NewMetrics(reg *prometheus.Registry) metrics.Metrics
- func Noop() metrics.Metrics
- func RegisterServiceStatusFunc(fn ServiceStatusFunc)
- func Registry() *prometheus.Registry
- type ServiceStatusFunc
Constants ¶
const ( // Number of services. Labels: host. MetricServicesGauge metrics.MetricName = "tnet_services" // Total service requests. Labels: host, service, client. MetricServiceRequestsCounter metrics.MetricName = "tnet_service_requests_total" // Number of in-flight requests. Labels: host, service, client. MetricServiceRequestsInFlightGauge metrics.MetricName = "tnet_service_requests_in_flight" // Request duration histogram. Labels: host, service. MetricServiceRequestsDurationObserver metrics.MetricName = "tnet_service_request_duration_seconds" // Total service input data transfer size in bytes. Labels: host, service, client. MetricServiceTransferInputBytesCounter metrics.MetricName = "tnet_service_transfer_input_bytes_total" // Total service output data transfer size in bytes. Labels: host, service, client. MetricServiceTransferOutputBytesCounter metrics.MetricName = "tnet_service_transfer_output_bytes_total" // Chain node connect duration histogram. Labels: host, chain, node. MetricNodeConnectDurationObserver metrics.MetricName = "tnet_chain_node_connect_duration_seconds" // Total service handler errors. Labels: host, service, client. MetricServiceHandlerErrorsCounter metrics.MetricName = "tnet_service_handler_errors_total" // Total chain connect errors. Labels: host, chain, node. MetricChainErrorsCounter metrics.MetricName = "tnet_chain_errors_total" // Total recorder records. Labels: host, recorder. MetricRecorderRecordsCounter metrics.MetricName = "tnet_recorder_records_total" // Number of services in each state. Labels: host, state. MetricServiceStatusGauge metrics.MetricName = "tnet_service_status" )
Variables ¶
This section is empty.
Functions ¶
func Enable ¶ added in v0.0.3
func Enable(b bool)
Enable enables or disables metrics collection globally. When disabled, all GetCounter, GetGauge, and GetObserver calls return noop implementations.
func GetCounter ¶
GetCounter returns a Counter for the given name and labels. When metrics are disabled, a noop implementation is returned.
func GetGauge ¶
GetGauge returns a Gauge for the given name and labels. When metrics are disabled, a noop implementation is returned.
func GetObserver ¶
GetObserver returns an Observer for the given name and labels. When metrics are disabled, a noop implementation is returned.
func NewMetrics ¶
func NewMetrics(reg *prometheus.Registry) metrics.Metrics
NewMetrics returns a Prometheus-based Metrics implementation. All metrics are registered with the given registry. Use nil to register with the default Prometheus registry.
func Noop ¶
Noop returns a Metrics implementation whose counters, gauges, and observers are all no-ops.
func RegisterServiceStatusFunc ¶ added in v0.28.1
func RegisterServiceStatusFunc(fn ServiceStatusFunc)
RegisterServiceStatusFunc registers a callback invoked at each scrape to collect the aggregate service status counts, exposed as MetricServiceStatusGauge.
func Registry ¶ added in v0.28.1
func Registry() *prometheus.Registry
Registry returns the custom Prometheus registry that holds all TNET metrics plus the Go and process collectors. The metrics HTTP endpoint should serve from this registry rather than prometheus.DefaultGatherer.
Types ¶
type ServiceStatusFunc ¶ added in v0.28.1
ServiceStatusFunc returns the number of services in each state, keyed by state name (e.g. "running", "ready", "failed", "closed").