NewEmptyPrometheusResponse returns an empty successful Prometheus query range response.
(instant bool)
| 283 | |
| 284 | // NewEmptyPrometheusResponse returns an empty successful Prometheus query range response. |
| 285 | func NewEmptyPrometheusResponse(instant bool) *PrometheusResponse { |
| 286 | if instant { |
| 287 | return &PrometheusResponse{ |
| 288 | Status: StatusSuccess, |
| 289 | Data: PrometheusData{ |
| 290 | ResultType: model.ValVector.String(), |
| 291 | Result: PrometheusQueryResult{ |
| 292 | Result: &PrometheusQueryResult_Vector{}, |
| 293 | }, |
| 294 | }, |
| 295 | } |
| 296 | } |
| 297 | return &PrometheusResponse{ |
| 298 | Status: StatusSuccess, |
| 299 | Data: PrometheusData{ |
| 300 | ResultType: model.ValMatrix.String(), |
| 301 | Result: PrometheusQueryResult{ |
| 302 | Result: &PrometheusQueryResult_Matrix{}, |
| 303 | }, |
| 304 | }, |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | func encodeSampleStream(ptr unsafe.Pointer, stream *jsoniter.Stream) { |
| 309 | ss := (*SampleStream)(ptr) |