2019-05-22 23:16:55 +02:00
|
|
|
{% import (
|
|
|
|
"github.com/valyala/quicktemplate"
|
2022-06-01 01:29:19 +02:00
|
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/querytracer"
|
2019-05-22 23:16:55 +02: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-01 01:29:19 +02:00
|
|
|
{% func SeriesResponse(resultsCh <-chan *quicktemplate.ByteBuffer, qt *querytracer.Tracer, qtDone func()) %}
|
2019-05-22 23:16:55 +02:00
|
|
|
{
|
2022-06-01 01:29:19 +02:00
|
|
|
{% code seriesCount := 0 %}
|
2019-05-22 23:16:55 +02:00
|
|
|
"status":"success",
|
|
|
|
"data":[
|
|
|
|
{% code bb, ok := <-resultsCh %}
|
|
|
|
{% if ok %}
|
|
|
|
{%z= bb.B %}
|
2022-06-01 01:29:19 +02:00
|
|
|
{% code
|
|
|
|
quicktemplate.ReleaseByteBuffer(bb)
|
|
|
|
seriesCount++
|
|
|
|
%}
|
2019-05-22 23:16:55 +02:00
|
|
|
{% for bb := range resultsCh %}
|
|
|
|
,{%z= bb.B %}
|
2022-06-01 01:29:19 +02:00
|
|
|
{% code
|
|
|
|
quicktemplate.ReleaseByteBuffer(bb)
|
|
|
|
seriesCount++
|
|
|
|
%}
|
2019-05-22 23:16:55 +02:00
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
]
|
2022-06-01 01:29:19 +02:00
|
|
|
{% code
|
|
|
|
qt.Printf("generate response: series=%d", seriesCount)
|
|
|
|
qtDone()
|
|
|
|
%}
|
|
|
|
{%= dumpQueryTrace(qt) %}
|
2019-05-22 23:16:55 +02:00
|
|
|
}
|
|
|
|
{% endfunc %}
|
|
|
|
{% endstripspace %}
|