// Code generated by qtc from "metric_names_usage_response.qtpl". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details.

//line app/vmselect/stats/metric_names_usage_response.qtpl:1
package stats

//line app/vmselect/stats/metric_names_usage_response.qtpl:1
import (
	"github.com/VictoriaMetrics/VictoriaMetrics/lib/querytracer"
	"github.com/VictoriaMetrics/VictoriaMetrics/lib/storage"
)

// MetricNamesStatsResponse generates response for /api/v1/status/metric_names_stats .

//line app/vmselect/stats/metric_names_usage_response.qtpl:8
import (
	qtio422016 "io"

	qt422016 "github.com/valyala/quicktemplate"
)

//line app/vmselect/stats/metric_names_usage_response.qtpl:8
var (
	_ = qtio422016.Copy
	_ = qt422016.AcquireByteBuffer
)

//line app/vmselect/stats/metric_names_usage_response.qtpl:8
func StreamMetricNamesStatsResponse(qw422016 *qt422016.Writer, stats *storage.MetricNamesStatsResponse, qt *querytracer.Tracer) {
//line app/vmselect/stats/metric_names_usage_response.qtpl:8
	qw422016.N().S(`{"status":"success","statsCollectedSince":`)
//line app/vmselect/stats/metric_names_usage_response.qtpl:11
	qw422016.N().DUL(stats.CollectedSinceTs)
//line app/vmselect/stats/metric_names_usage_response.qtpl:11
	qw422016.N().S(`,"statsCollectedRecordsTotal":`)
//line app/vmselect/stats/metric_names_usage_response.qtpl:12
	qw422016.N().DUL(stats.TotalRecords)
//line app/vmselect/stats/metric_names_usage_response.qtpl:12
	qw422016.N().S(`,"trackerMemoryMaxSizeBytes":`)
//line app/vmselect/stats/metric_names_usage_response.qtpl:13
	qw422016.N().DUL(stats.MaxSizeBytes)
//line app/vmselect/stats/metric_names_usage_response.qtpl:13
	qw422016.N().S(`,"trackerCurrentMemoryUsageBytes":`)
//line app/vmselect/stats/metric_names_usage_response.qtpl:14
	qw422016.N().DUL(stats.CurrentSizeBytes)
//line app/vmselect/stats/metric_names_usage_response.qtpl:14
	qw422016.N().S(`,"records":[`)
//line app/vmselect/stats/metric_names_usage_response.qtpl:17
	for i, r := range stats.Records {
//line app/vmselect/stats/metric_names_usage_response.qtpl:17
		qw422016.N().S(`{"metricName":`)
//line app/vmselect/stats/metric_names_usage_response.qtpl:19
		qw422016.N().Q(r.MetricName)
//line app/vmselect/stats/metric_names_usage_response.qtpl:19
		qw422016.N().S(`,"queryRequestsCount":`)
//line app/vmselect/stats/metric_names_usage_response.qtpl:20
		qw422016.N().DUL(r.RequestsCount)
//line app/vmselect/stats/metric_names_usage_response.qtpl:20
		qw422016.N().S(`,"lastQueryRequestTimestamp":`)
//line app/vmselect/stats/metric_names_usage_response.qtpl:21
		qw422016.N().DUL(r.LastRequestTs)
//line app/vmselect/stats/metric_names_usage_response.qtpl:21
		qw422016.N().S(`}`)
//line app/vmselect/stats/metric_names_usage_response.qtpl:23
		if i+1 < len(stats.Records) {
//line app/vmselect/stats/metric_names_usage_response.qtpl:23
			qw422016.N().S(`,`)
//line app/vmselect/stats/metric_names_usage_response.qtpl:23
		}
//line app/vmselect/stats/metric_names_usage_response.qtpl:24
	}
//line app/vmselect/stats/metric_names_usage_response.qtpl:24
	qw422016.N().S(`]`)
//line app/vmselect/stats/metric_names_usage_response.qtpl:26
	qt.Done()

//line app/vmselect/stats/metric_names_usage_response.qtpl:27
	traceJSON := qt.ToJSON()

//line app/vmselect/stats/metric_names_usage_response.qtpl:28
	if traceJSON != "" {
//line app/vmselect/stats/metric_names_usage_response.qtpl:28
		qw422016.N().S(`,"trace":`)
//line app/vmselect/stats/metric_names_usage_response.qtpl:28
		qw422016.N().S(traceJSON)
//line app/vmselect/stats/metric_names_usage_response.qtpl:28
	}
//line app/vmselect/stats/metric_names_usage_response.qtpl:28
	qw422016.N().S(`}`)
//line app/vmselect/stats/metric_names_usage_response.qtpl:31
}

//line app/vmselect/stats/metric_names_usage_response.qtpl:31
func WriteMetricNamesStatsResponse(qq422016 qtio422016.Writer, stats *storage.MetricNamesStatsResponse, qt *querytracer.Tracer) {
//line app/vmselect/stats/metric_names_usage_response.qtpl:31
	qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vmselect/stats/metric_names_usage_response.qtpl:31
	StreamMetricNamesStatsResponse(qw422016, stats, qt)
//line app/vmselect/stats/metric_names_usage_response.qtpl:31
	qt422016.ReleaseWriter(qw422016)
//line app/vmselect/stats/metric_names_usage_response.qtpl:31
}

//line app/vmselect/stats/metric_names_usage_response.qtpl:31
func MetricNamesStatsResponse(stats *storage.MetricNamesStatsResponse, qt *querytracer.Tracer) string {
//line app/vmselect/stats/metric_names_usage_response.qtpl:31
	qb422016 := qt422016.AcquireByteBuffer()
//line app/vmselect/stats/metric_names_usage_response.qtpl:31
	WriteMetricNamesStatsResponse(qb422016, stats, qt)
//line app/vmselect/stats/metric_names_usage_response.qtpl:31
	qs422016 := string(qb422016.B)
//line app/vmselect/stats/metric_names_usage_response.qtpl:31
	qt422016.ReleaseByteBuffer(qb422016)
//line app/vmselect/stats/metric_names_usage_response.qtpl:31
	return qs422016
//line app/vmselect/stats/metric_names_usage_response.qtpl:31
}
