mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-24 11:20:18 +01:00
2ac5f00d98
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/891 This commit also adds `"isPartial":{true|false}` field to `/api/v1/*` responses. `"isPartial":true` is set when the response is based on a partial data because some of vmstorage nodes weren't available during query processing.
26 lines
691 B
Plaintext
26 lines
691 B
Plaintext
{% import (
|
|
"github.com/valyala/quicktemplate"
|
|
) %}
|
|
|
|
{% 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, resultsCh <-chan *quicktemplate.ByteBuffer) %}
|
|
{
|
|
"status":"success",
|
|
"isPartial":{% if isPartial %}true{% else %}false{% endif %},
|
|
"data":[
|
|
{% code bb, ok := <-resultsCh %}
|
|
{% if ok %}
|
|
{%z= bb.B %}
|
|
{% code quicktemplate.ReleaseByteBuffer(bb) %}
|
|
{% for bb := range resultsCh %}
|
|
,{%z= bb.B %}
|
|
{% code quicktemplate.ReleaseByteBuffer(bb) %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
]
|
|
}
|
|
{% endfunc %}
|
|
{% endstripspace %}
|