forked from mirror/client_golang
Add ``baseLabels`` to the registration signature.
This commit is contained in:
parent
e53e7ec940
commit
1134be8073
|
@ -57,12 +57,15 @@ func main() {
|
||||||
zed_rpc_calls := &metrics.CounterMetric{}
|
zed_rpc_calls := &metrics.CounterMetric{}
|
||||||
|
|
||||||
metrics := registry.NewRegistry()
|
metrics := registry.NewRegistry()
|
||||||
metrics.Register("rpc_latency_foo_microseconds", "RPC latency for foo service.", foo_rpc_latency)
|
|
||||||
metrics.Register("rpc_calls_foo_total", "RPC calls for foo service.", foo_rpc_calls)
|
nilBaseLabels := make(map[string]string)
|
||||||
metrics.Register("rpc_latency_bar_microseconds", "RPC latency for bar service.", bar_rpc_latency)
|
|
||||||
metrics.Register("rpc_calls_bar_total", "RPC calls for bar service.", bar_rpc_calls)
|
metrics.Register("rpc_latency_foo_microseconds", "RPC latency for foo service.", nilBaseLabels, foo_rpc_latency)
|
||||||
metrics.Register("rpc_latency_zed_microseconds", "RPC latency for zed service.", zed_rpc_latency)
|
metrics.Register("rpc_calls_foo_total", "RPC calls for foo service.", nilBaseLabels, foo_rpc_calls)
|
||||||
metrics.Register("rpc_calls_zed_total", "RPC calls for zed service.", zed_rpc_calls)
|
metrics.Register("rpc_latency_bar_microseconds", "RPC latency for bar service.", nilBaseLabels, bar_rpc_latency)
|
||||||
|
metrics.Register("rpc_calls_bar_total", "RPC calls for bar service.", nilBaseLabels, bar_rpc_calls)
|
||||||
|
metrics.Register("rpc_latency_zed_microseconds", "RPC latency for zed service.", nilBaseLabels, zed_rpc_latency)
|
||||||
|
metrics.Register("rpc_calls_zed_total", "RPC calls for zed service.", nilBaseLabels, zed_rpc_calls)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
|
|
18
registry.go
18
registry.go
|
@ -100,14 +100,14 @@ var DefaultRegistry = NewRegistry()
|
||||||
/*
|
/*
|
||||||
Associate a Metric with the DefaultRegistry.
|
Associate a Metric with the DefaultRegistry.
|
||||||
*/
|
*/
|
||||||
func Register(name, unusedDocstring string, metric metrics.Metric) {
|
func Register(name, unusedDocstring string, unusedBaseLabels map[string]string, metric metrics.Metric) {
|
||||||
DefaultRegistry.Register(name, unusedDocstring, metric)
|
DefaultRegistry.Register(name, unusedDocstring, unusedBaseLabels, metric)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Register a metric with a given name. Name should be globally unique.
|
Register a metric with a given name. Name should be globally unique.
|
||||||
*/
|
*/
|
||||||
func (r *Registry) Register(name, unusedDocstring string, metric metrics.Metric) {
|
func (r *Registry) Register(name, unusedDocstring string, unusedBaseLabels map[string]string, metric metrics.Metric) {
|
||||||
r.mutex.Lock()
|
r.mutex.Lock()
|
||||||
defer r.mutex.Unlock()
|
defer r.mutex.Unlock()
|
||||||
|
|
||||||
|
@ -175,9 +175,11 @@ func (registry *Registry) YieldExporter() http.HandlerFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
DefaultRegistry.Register("requests_metrics_total", "A counter of the total requests made against the telemetry system.", requestCount)
|
nilBaseLabels := make(map[string]string)
|
||||||
DefaultRegistry.Register("requests_metrics_latency_logarithmic_accumulating_microseconds", "A histogram of the response latency for requests made against the telemetry system.", requestLatencyLogarithmicAccumulating)
|
|
||||||
DefaultRegistry.Register("requests_metrics_latency_equal_accumulating_microseconds", "A histogram of the response latency for requests made against the telemetry system.", requestLatencyEqualAccumulating)
|
DefaultRegistry.Register("requests_metrics_total", "A counter of the total requests made against the telemetry system.", nilBaseLabels, requestCount)
|
||||||
DefaultRegistry.Register("requests_metrics_latency_logarithmic_tallying_microseconds", "A histogram of the response latency for requests made against the telemetry system.", requestLatencyLogarithmicTallying)
|
DefaultRegistry.Register("requests_metrics_latency_logarithmic_accumulating_microseconds", "A histogram of the response latency for requests made against the telemetry system.", nilBaseLabels, requestLatencyLogarithmicAccumulating)
|
||||||
DefaultRegistry.Register("request_metrics_latency_equal_tallying_microseconds", "A histogram of the response latency for requests made against the telemetry system.", requestLatencyEqualTallying)
|
DefaultRegistry.Register("requests_metrics_latency_equal_accumulating_microseconds", "A histogram of the response latency for requests made against the telemetry system.", nilBaseLabels, requestLatencyEqualAccumulating)
|
||||||
|
DefaultRegistry.Register("requests_metrics_latency_logarithmic_tallying_microseconds", "A histogram of the response latency for requests made against the telemetry system.", nilBaseLabels, requestLatencyLogarithmicTallying)
|
||||||
|
DefaultRegistry.Register("request_metrics_latency_equal_tallying_microseconds", "A histogram of the response latency for requests made against the telemetry system.", nilBaseLabels, requestLatencyEqualTallying)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue