mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-25 03:40:10 +01:00
01c8e12370
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6942 Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6706
62 lines
2.4 KiB
Go
62 lines
2.4 KiB
Go
// Code generated by qtc from "prometheus_error_response.qtpl". DO NOT EDIT.
|
|
// See https://github.com/valyala/quicktemplate for details.
|
|
|
|
// PrometheusErrorResponse generates error response for Prometheus Querying API.See https://prometheus.io/docs/prometheus/latest/querying/api/#format-overview
|
|
|
|
//line lib/httpserver/prometheus_error_response.qtpl:4
|
|
package httpserver
|
|
|
|
//line lib/httpserver/prometheus_error_response.qtpl:4
|
|
import (
|
|
qtio422016 "io"
|
|
|
|
qt422016 "github.com/valyala/quicktemplate"
|
|
)
|
|
|
|
//line lib/httpserver/prometheus_error_response.qtpl:4
|
|
var (
|
|
_ = qtio422016.Copy
|
|
_ = qt422016.AcquireByteBuffer
|
|
)
|
|
|
|
//line lib/httpserver/prometheus_error_response.qtpl:4
|
|
func StreamPrometheusErrorResponse(qw422016 *qt422016.Writer, statusCode int, err error) {
|
|
//line lib/httpserver/prometheus_error_response.qtpl:4
|
|
qw422016.N().S(`{"status":"error","errorType":"`)
|
|
//line lib/httpserver/prometheus_error_response.qtpl:7
|
|
qw422016.N().D(statusCode)
|
|
//line lib/httpserver/prometheus_error_response.qtpl:7
|
|
qw422016.N().S(`","error":`)
|
|
//line lib/httpserver/prometheus_error_response.qtpl:8
|
|
qw422016.N().Q(err.Error())
|
|
//line lib/httpserver/prometheus_error_response.qtpl:8
|
|
qw422016.N().S(`}`)
|
|
//line lib/httpserver/prometheus_error_response.qtpl:10
|
|
}
|
|
|
|
//line lib/httpserver/prometheus_error_response.qtpl:10
|
|
func WritePrometheusErrorResponse(qq422016 qtio422016.Writer, statusCode int, err error) {
|
|
//line lib/httpserver/prometheus_error_response.qtpl:10
|
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
//line lib/httpserver/prometheus_error_response.qtpl:10
|
|
StreamPrometheusErrorResponse(qw422016, statusCode, err)
|
|
//line lib/httpserver/prometheus_error_response.qtpl:10
|
|
qt422016.ReleaseWriter(qw422016)
|
|
//line lib/httpserver/prometheus_error_response.qtpl:10
|
|
}
|
|
|
|
//line lib/httpserver/prometheus_error_response.qtpl:10
|
|
func PrometheusErrorResponse(statusCode int, err error) string {
|
|
//line lib/httpserver/prometheus_error_response.qtpl:10
|
|
qb422016 := qt422016.AcquireByteBuffer()
|
|
//line lib/httpserver/prometheus_error_response.qtpl:10
|
|
WritePrometheusErrorResponse(qb422016, statusCode, err)
|
|
//line lib/httpserver/prometheus_error_response.qtpl:10
|
|
qs422016 := string(qb422016.B)
|
|
//line lib/httpserver/prometheus_error_response.qtpl:10
|
|
qt422016.ReleaseByteBuffer(qb422016)
|
|
//line lib/httpserver/prometheus_error_response.qtpl:10
|
|
return qs422016
|
|
//line lib/httpserver/prometheus_error_response.qtpl:10
|
|
}
|