2019-05-22 21:16:55 +00:00
|
|
|
{% import (
|
|
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/app/vmselect/netstorage"
|
|
|
|
) %}
|
|
|
|
|
|
|
|
{% stripspace %}
|
|
|
|
|
|
|
|
// Federate writes rs in /federate format.
|
|
|
|
// See https://prometheus.io/docs/prometheus/latest/federation/
|
|
|
|
{% func Federate(rs *netstorage.Result) %}
|
|
|
|
{% if len(rs.Timestamps) == 0 || len(rs.Values) == 0 %}{% return %}{% endif %}
|
|
|
|
{%= prometheusMetricName(&rs.MetricName) %}{% space %}
|
|
|
|
{%f= rs.Values[len(rs.Values)-1] %}{% space %}
|
2019-10-17 15:22:56 +00:00
|
|
|
{%dl= rs.Timestamps[len(rs.Timestamps)-1] %}{% newline %}
|
2019-05-22 21:16:55 +00:00
|
|
|
{% endfunc %}
|
|
|
|
|
|
|
|
{% endstripspace %}
|