metricToCollectd encodes the metric data in the collectd text protocol format. The metric lock is held before entering this function.
(hostname string, m *metrics.Metric, l *metrics.LabelSet, interval time.Duration)
| 31 | // metricToCollectd encodes the metric data in the collectd text protocol format. The |
| 32 | // metric lock is held before entering this function. |
| 33 | func metricToCollectd(hostname string, m *metrics.Metric, l *metrics.LabelSet, interval time.Duration) string { |
| 34 | return fmt.Sprintf(collectdFormat, |
| 35 | hostname, |
| 36 | *collectdPrefix, |
| 37 | m.Program, |
| 38 | kindToCollectdType(m.Kind), |
| 39 | formatLabels(m.Name, l.Labels, "-", "-", "_"), |
| 40 | int64(interval.Seconds()), |
| 41 | l.Datum.TimeString(), |
| 42 | l.Datum.ValueString()) |
| 43 | } |
| 44 | |
| 45 | func kindToCollectdType(kind metrics.Kind) string { |
| 46 | if kind != metrics.Timer { |
nothing calls this directly
no test coverage detected