mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
41958ed5dd
See https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#query-tracing Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1403
37 lines
903 B
Text
37 lines
903 B
Text
{% import (
|
|
"github.com/valyala/quicktemplate"
|
|
"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(resultsCh <-chan *quicktemplate.ByteBuffer, qt *querytracer.Tracer, qtDone func()) %}
|
|
{
|
|
{% code seriesCount := 0 %}
|
|
"status":"success",
|
|
"data":[
|
|
{% code bb, ok := <-resultsCh %}
|
|
{% if ok %}
|
|
{%z= bb.B %}
|
|
{% code
|
|
quicktemplate.ReleaseByteBuffer(bb)
|
|
seriesCount++
|
|
%}
|
|
{% for bb := range resultsCh %}
|
|
,{%z= bb.B %}
|
|
{% code
|
|
quicktemplate.ReleaseByteBuffer(bb)
|
|
seriesCount++
|
|
%}
|
|
{% endfor %}
|
|
{% endif %}
|
|
]
|
|
{% code
|
|
qt.Printf("generate response: series=%d", seriesCount)
|
|
qtDone()
|
|
%}
|
|
{%= dumpQueryTrace(qt) %}
|
|
}
|
|
{% endfunc %}
|
|
{% endstripspace %}
|