metricToStatsd encodes a metric in the statsd text protocol format. The metric lock is held before entering this function.
(_ string, m *metrics.Metric, l *metrics.LabelSet, _ time.Duration)
| 25 | // metricToStatsd encodes a metric in the statsd text protocol format. The |
| 26 | // metric lock is held before entering this function. |
| 27 | func metricToStatsd(_ string, m *metrics.Metric, l *metrics.LabelSet, _ time.Duration) string { |
| 28 | var t string |
| 29 | switch m.Kind { |
| 30 | case metrics.Counter: |
| 31 | t = "c" // StatsD Counter |
| 32 | case metrics.Gauge: |
| 33 | t = "g" // StatsD Gauge |
| 34 | case metrics.Timer: |
| 35 | t = "ms" // StatsD Timer |
| 36 | } |
| 37 | return fmt.Sprintf("%s%s.%s:%s|%s", |
| 38 | *statsdPrefix, |
| 39 | m.Program, |
| 40 | formatLabels(m.Name, l.Labels, ".", ".", "_"), |
| 41 | l.Datum.ValueString(), t) |
| 42 | } |
nothing calls this directly
no test coverage detected