2019-05-22 21:16:55 +00:00
|
|
|
{% import (
|
2022-06-28 09:55:20 +00:00
|
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/storage"
|
2022-05-31 23:31:40 +00:00
|
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/querytracer"
|
2019-05-22 21:16:55 +00:00
|
|
|
) %}
|
|
|
|
|
|
|
|
{% stripspace %}
|
|
|
|
SeriesResponse generates response for /api/v1/series.
|
|
|
|
See https://prometheus.io/docs/prometheus/latest/querying/api/#finding-series-by-label-matchers
|
2022-06-28 14:36:27 +00:00
|
|
|
{% func SeriesResponse(isPartial bool, metricNames []string, qt *querytracer.Tracer, qtDone func()) %}
|
2019-05-22 21:16:55 +00:00
|
|
|
{
|
|
|
|
"status":"success",
|
2020-11-14 10:36:21 +00:00
|
|
|
"isPartial":{% if isPartial %}true{% else %}false{% endif %},
|
2019-05-22 21:16:55 +00:00
|
|
|
"data":[
|
2022-06-28 14:36:27 +00:00
|
|
|
{% code var mn storage.MetricName %}
|
|
|
|
{% for i, metricName := range metricNames %}
|
|
|
|
{% code err := mn.UnmarshalString(metricName) %}
|
|
|
|
{% if err != nil %}
|
2022-07-05 22:33:35 +00:00
|
|
|
{%q= "cannot unmarshal metricName: " + err.Error() %}
|
2022-06-28 14:36:27 +00:00
|
|
|
{% else %}
|
|
|
|
{%= metricNameObject(&mn) %}
|
|
|
|
{% endif %}
|
|
|
|
{% if i+1 < len(metricNames) %},{% endif %}
|
2022-06-28 09:55:20 +00:00
|
|
|
{% endfor %}
|
2019-05-22 21:16:55 +00:00
|
|
|
]
|
2022-05-31 23:31:40 +00:00
|
|
|
{% code
|
2022-06-28 14:36:27 +00:00
|
|
|
qt.Printf("generate response: series=%d", len(metricNames))
|
2022-05-31 23:31:40 +00:00
|
|
|
qtDone()
|
|
|
|
%}
|
|
|
|
{%= dumpQueryTrace(qt) %}
|
2019-05-22 21:16:55 +00:00
|
|
|
}
|
|
|
|
{% endfunc %}
|
|
|
|
{% endstripspace %}
|