mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-20 23:46:23 +01:00
cdd89d9cc2
The response has been broken in 7d5d33fd71
33 lines
999 B
Plaintext
33 lines
999 B
Plaintext
{% import (
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/storage"
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/querytracer"
|
|
) %}
|
|
|
|
{% stripspace %}
|
|
SeriesResponse generates response for /api/v1/series.
|
|
See https://prometheus.io/docs/prometheus/latest/querying/api/#finding-series-by-label-matchers
|
|
{% func SeriesResponse(isPartial bool, metricNames []string, qt *querytracer.Tracer, qtDone func()) %}
|
|
{
|
|
"status":"success",
|
|
"isPartial":{% if isPartial %}true{% else %}false{% endif %},
|
|
"data":[
|
|
{% code var mn storage.MetricName %}
|
|
{% for i, metricName := range metricNames %}
|
|
{% code err := mn.UnmarshalString(metricName) %}
|
|
{% if err != nil %}
|
|
{%q= "cannot unmarshal metricName: " + err.Error() %}
|
|
{% else %}
|
|
{%= metricNameObject(&mn) %}
|
|
{% endif %}
|
|
{% if i+1 < len(metricNames) %},{% endif %}
|
|
{% endfor %}
|
|
]
|
|
{% code
|
|
qt.Printf("generate response: series=%d", len(metricNames))
|
|
qtDone()
|
|
%}
|
|
{%= dumpQueryTrace(qt) %}
|
|
}
|
|
{% endfunc %}
|
|
{% endstripspace %}
|