Add docstrings in registration signature.

This commit is contained in:
Matt T. Proud 2013-01-15 20:10:04 +01:00
parent 4aad7189f1
commit e53e7ec940
2 changed files with 14 additions and 14 deletions

View File

@ -57,12 +57,12 @@ func main() {
zed_rpc_calls := &metrics.CounterMetric{} zed_rpc_calls := &metrics.CounterMetric{}
metrics := registry.NewRegistry() metrics := registry.NewRegistry()
metrics.Register("rpc_latency_foo_microseconds", foo_rpc_latency) metrics.Register("rpc_latency_foo_microseconds", "RPC latency for foo service.", foo_rpc_latency)
metrics.Register("rpc_calls_foo_total", foo_rpc_calls) metrics.Register("rpc_calls_foo_total", "RPC calls for foo service.", foo_rpc_calls)
metrics.Register("rpc_latency_bar_microseconds", bar_rpc_latency) metrics.Register("rpc_latency_bar_microseconds", "RPC latency for bar service.", bar_rpc_latency)
metrics.Register("rpc_calls_bar_total", bar_rpc_calls) metrics.Register("rpc_calls_bar_total", "RPC calls for bar service.", bar_rpc_calls)
metrics.Register("rpc_latency_zed_microseconds", zed_rpc_latency) metrics.Register("rpc_latency_zed_microseconds", "RPC latency for zed service.", zed_rpc_latency)
metrics.Register("rpc_calls_zed_total", zed_rpc_calls) metrics.Register("rpc_calls_zed_total", "RPC calls for zed service.", zed_rpc_calls)
go func() { go func() {
for { for {

View File

@ -100,14 +100,14 @@ var DefaultRegistry = NewRegistry()
/* /*
Associate a Metric with the DefaultRegistry. Associate a Metric with the DefaultRegistry.
*/ */
func Register(name string, metric metrics.Metric) { func Register(name, unusedDocstring string, metric metrics.Metric) {
DefaultRegistry.Register(name, metric) DefaultRegistry.Register(name, unusedDocstring, 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 string, metric metrics.Metric) { func (r *Registry) Register(name, unusedDocstring string, metric metrics.Metric) {
r.mutex.Lock() r.mutex.Lock()
defer r.mutex.Unlock() defer r.mutex.Unlock()
@ -175,9 +175,9 @@ func (registry *Registry) YieldExporter() http.HandlerFunc {
} }
func init() { func init() {
DefaultRegistry.Register("requests_metrics_total", requestCount) DefaultRegistry.Register("requests_metrics_total", "A counter of the total requests made against the telemetry system.", requestCount)
DefaultRegistry.Register("requests_metrics_latency_logarithmic_accumulating_microseconds", requestLatencyLogarithmicAccumulating) 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", requestLatencyEqualAccumulating) 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_latency_logarithmic_tallying_microseconds", requestLatencyLogarithmicTallying) DefaultRegistry.Register("requests_metrics_latency_logarithmic_tallying_microseconds", "A histogram of the response latency for requests made against the telemetry system.", requestLatencyLogarithmicTallying)
DefaultRegistry.Register("request_metrics_latency_equal_tallying_microseconds", requestLatencyEqualTallying) DefaultRegistry.Register("request_metrics_latency_equal_tallying_microseconds", "A histogram of the response latency for requests made against the telemetry system.", requestLatencyEqualTallying)
} }