VictoriaMetrics/app/vmselect/prometheus/tenants_response.qtpl
Zakhar Bessarab e407e7243a
{app/vmstorage,app/vmselect}: add API to get list of existing tenants (#3348)
* {app/vmstorage,app/vmselect}: add API to get list of existing tenants

* {app/vmstorage,app/vmselect}: add API to get list of existing tenants

* app/vmselect: fix error message

* {app/vmstorage,app/vmselect}: fix error messages

* app/vmselect: change log level for error handling

* wip

Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
2022-11-25 10:32:45 -08:00

24 lines
524 B
Text

{% stripspace %}
{% import (
"github.com/VictoriaMetrics/VictoriaMetrics/lib/querytracer"
) %}
TenantsResponse generates response for /admin/tenants .
{% func TenantsResponse(tenants []string, qt *querytracer.Tracer) %}
{
"status":"success",
"data":[
{% for i, tenant := range tenants %}
{%q= tenant %}
{% if i+1 < len(tenants) %},{% endif %}
{% endfor %}
]
{% code
qt.Printf("generate response for %d tenants", len(tenants))
qt.Done()
%}
{%= dumpQueryTrace(qt) %}
}
{% endfunc %}
{% endstripspace %}