Codebase list golang-github-go-kit-kit / 905b602
metrics: further clarification to docs Peter Bourgon 7 years ago
1 changed file(s) with 14 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
2020 // many code paths somewhat dynamically. The concept of With is fully supported
2121 // in some backends like Prometheus, and not supported in other backends like
2222 // Graphite. So, With may be a no-op, depending on the concrete implementation
23 // you choose.
23 // you choose. Please check the implementation to know for sure. For
24 // implementations that don't provide With, it's necessary to fully parameterize
25 // each metric in the metric name, e.g.
26 //
27 // // Statsd
28 // c := statsd.NewCounter("request_duration_MyMethod_200")
29 // c.Add(1)
30 //
31 // // Prometheus
32 // c := prometheus.NewCounter(stdprometheus.CounterOpts{
33 // Name: "request_duration",
34 // ...
35 // }, []string{"method", "status_code"})
36 // c.With("method", "MyMethod", "status_code", strconv.Itoa(code)).Add(1)
2437 //
2538 // Usage
2639 //