mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Loki: Add feature flag to enable dataplane-compliant metric frames (#66017)
* loki: add feature flag to enable dataplane-compatible metric frames * linter fix
This commit is contained in:
parent
af3bf04f2e
commit
531caec602
@ -102,6 +102,7 @@ Alpha features might be changed or removed without prior notice.
|
||||
| `influxdbBackendMigration` | Query InfluxDB InfluxQL without the proxy |
|
||||
| `clientTokenRotation` | Replaces the current in-request token rotation so that the client initiates the rotation |
|
||||
| `prometheusDataplane` | Changes responses to from Prometheus to be compliant with the dataplane specification. In particular it sets the numeric Field.Name from 'Value' to the value of the `__name__` label when present. |
|
||||
| `lokiMetricDataplane` | Changes responses from Loki to be compliant with the dataplane specification. |
|
||||
| `alertStateHistoryLokiSecondary` | Enable Grafana to write alert state history to an external Loki instance in addition to Grafana annotations. |
|
||||
| `alertStateHistoryLokiPrimary` | Enable a remote Loki instance as the primary source for state history reads. |
|
||||
| `alertStateHistoryLokiOnly` | Disable Grafana alerts from emitting annotations when a remote Loki instance is available. |
|
||||
|
@ -86,6 +86,7 @@ export interface FeatureToggles {
|
||||
influxdbBackendMigration?: boolean;
|
||||
clientTokenRotation?: boolean;
|
||||
prometheusDataplane?: boolean;
|
||||
lokiMetricDataplane?: boolean;
|
||||
alertStateHistoryLokiSecondary?: boolean;
|
||||
alertStateHistoryLokiPrimary?: boolean;
|
||||
alertStateHistoryLokiOnly?: boolean;
|
||||
|
@ -457,6 +457,12 @@ var (
|
||||
State: FeatureStateAlpha,
|
||||
Owner: grafanaObservabilityMetricsSquad,
|
||||
},
|
||||
{
|
||||
Name: "lokiMetricDataplane",
|
||||
Description: "Changes responses from Loki to be compliant with the dataplane specification.",
|
||||
State: FeatureStateAlpha,
|
||||
Owner: grafanaObservabilityLogsSquad,
|
||||
},
|
||||
{
|
||||
Name: "alertStateHistoryLokiSecondary",
|
||||
Description: "Enable Grafana to write alert state history to an external Loki instance in addition to Grafana annotations.",
|
||||
|
@ -67,6 +67,7 @@ prometheusResourceBrowserCache,alpha,@grafana/observability-metrics,false,false,
|
||||
influxdbBackendMigration,alpha,@grafana/observability-metrics,false,false,false,true
|
||||
clientTokenRotation,alpha,@grafana/grafana-authnz-team,false,false,false,false
|
||||
prometheusDataplane,alpha,@grafana/observability-metrics,false,false,false,false
|
||||
lokiMetricDataplane,alpha,@grafana/observability-logs,false,false,false,false
|
||||
alertStateHistoryLokiSecondary,alpha,@grafana/alerting-squad,false,false,false,false
|
||||
alertStateHistoryLokiPrimary,alpha,@grafana/alerting-squad,false,false,false,false
|
||||
alertStateHistoryLokiOnly,alpha,@grafana/alerting-squad,false,false,false,false
|
||||
|
|
@ -279,6 +279,10 @@ const (
|
||||
// Changes responses to from Prometheus to be compliant with the dataplane specification. In particular it sets the numeric Field.Name from 'Value' to the value of the `__name__` label when present.
|
||||
FlagPrometheusDataplane = "prometheusDataplane"
|
||||
|
||||
// FlagLokiMetricDataplane
|
||||
// Changes responses from Loki to be compliant with the dataplane specification.
|
||||
FlagLokiMetricDataplane = "lokiMetricDataplane"
|
||||
|
||||
// FlagAlertStateHistoryLokiSecondary
|
||||
// Enable Grafana to write alert state history to an external Loki instance in addition to Grafana annotations.
|
||||
FlagAlertStateHistoryLokiSecondary = "alertStateHistoryLokiSecondary"
|
||||
|
@ -148,7 +148,7 @@ func readLokiError(body io.ReadCloser) error {
|
||||
return makeLokiError(bytes)
|
||||
}
|
||||
|
||||
func (api *LokiAPI) DataQuery(ctx context.Context, query lokiQuery) (data.Frames, error) {
|
||||
func (api *LokiAPI) DataQuery(ctx context.Context, query lokiQuery, responseOpts ResponseOpts) (data.Frames, error) {
|
||||
req, err := makeDataRequest(ctx, api.url, query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -170,7 +170,7 @@ func (api *LokiAPI) DataQuery(ctx context.Context, query lokiQuery) (data.Frames
|
||||
}
|
||||
|
||||
iter := jsoniter.Parse(jsoniter.ConfigDefault, resp.Body, 1024)
|
||||
res := converter.ReadPrometheusStyleResult(iter, converter.Options{MatrixWideSeries: false, VectorWideSeries: false})
|
||||
res := converter.ReadPrometheusStyleResult(iter, converter.Options{MatrixWideSeries: false, VectorWideSeries: false, Dataplane: responseOpts.metricDataplane})
|
||||
|
||||
if res.Error != nil {
|
||||
return nil, res.Error
|
||||
|
@ -28,7 +28,7 @@ func TestApiLogVolume(t *testing.T) {
|
||||
require.Equal(t, "Source=logvolhist", req.Header.Get("X-Query-Tags"))
|
||||
})
|
||||
|
||||
_, err := api.DataQuery(context.Background(), lokiQuery{Expr: "", SupportingQueryType: SupportingQueryLogsVolume, QueryType: QueryTypeRange})
|
||||
_, err := api.DataQuery(context.Background(), lokiQuery{Expr: "", SupportingQueryType: SupportingQueryLogsVolume, QueryType: QueryTypeRange}, ResponseOpts{})
|
||||
require.NoError(t, err)
|
||||
require.True(t, called)
|
||||
})
|
||||
@ -40,7 +40,7 @@ func TestApiLogVolume(t *testing.T) {
|
||||
require.Equal(t, "Source=logsample", req.Header.Get("X-Query-Tags"))
|
||||
})
|
||||
|
||||
_, err := api.DataQuery(context.Background(), lokiQuery{Expr: "", SupportingQueryType: SupportingQueryLogsSample, QueryType: QueryTypeRange})
|
||||
_, err := api.DataQuery(context.Background(), lokiQuery{Expr: "", SupportingQueryType: SupportingQueryLogsSample, QueryType: QueryTypeRange}, ResponseOpts{})
|
||||
require.NoError(t, err)
|
||||
require.True(t, called)
|
||||
})
|
||||
@ -52,7 +52,7 @@ func TestApiLogVolume(t *testing.T) {
|
||||
require.Equal(t, "Source=datasample", req.Header.Get("X-Query-Tags"))
|
||||
})
|
||||
|
||||
_, err := api.DataQuery(context.Background(), lokiQuery{Expr: "", SupportingQueryType: SupportingQueryDataSample, QueryType: QueryTypeRange})
|
||||
_, err := api.DataQuery(context.Background(), lokiQuery{Expr: "", SupportingQueryType: SupportingQueryDataSample, QueryType: QueryTypeRange}, ResponseOpts{})
|
||||
require.NoError(t, err)
|
||||
require.True(t, called)
|
||||
})
|
||||
@ -64,7 +64,7 @@ func TestApiLogVolume(t *testing.T) {
|
||||
require.Equal(t, "", req.Header.Get("X-Query-Tags"))
|
||||
})
|
||||
|
||||
_, err := api.DataQuery(context.Background(), lokiQuery{Expr: "", SupportingQueryType: SupportingQueryNone, QueryType: QueryTypeRange})
|
||||
_, err := api.DataQuery(context.Background(), lokiQuery{Expr: "", SupportingQueryType: SupportingQueryNone, QueryType: QueryTypeRange}, ResponseOpts{})
|
||||
require.NoError(t, err)
|
||||
require.True(t, called)
|
||||
})
|
||||
@ -133,7 +133,7 @@ func TestApiUrlHandling(t *testing.T) {
|
||||
QueryType: QueryTypeRange,
|
||||
}
|
||||
|
||||
_, err := api.DataQuery(context.Background(), query)
|
||||
_, err := api.DataQuery(context.Background(), query, ResponseOpts{})
|
||||
require.NoError(t, err)
|
||||
require.True(t, called)
|
||||
})
|
||||
@ -154,7 +154,7 @@ func TestApiUrlHandling(t *testing.T) {
|
||||
QueryType: QueryTypeInstant,
|
||||
}
|
||||
|
||||
_, err := api.DataQuery(context.Background(), query)
|
||||
_, err := api.DataQuery(context.Background(), query, ResponseOpts{})
|
||||
require.NoError(t, err)
|
||||
require.True(t, called)
|
||||
})
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
|
||||
// we adjust the dataframes to be the way frontend & alerting
|
||||
// wants them.
|
||||
func adjustFrame(frame *data.Frame, query *lokiQuery) error {
|
||||
func adjustFrame(frame *data.Frame, query *lokiQuery, setMetricFrameName bool) error {
|
||||
fields := frame.Fields
|
||||
|
||||
if len(fields) < 2 {
|
||||
@ -25,13 +25,13 @@ func adjustFrame(frame *data.Frame, query *lokiQuery) error {
|
||||
secondField := fields[1]
|
||||
|
||||
if secondField.Type() == data.FieldTypeFloat64 {
|
||||
return adjustMetricFrame(frame, query)
|
||||
return adjustMetricFrame(frame, query, setMetricFrameName)
|
||||
} else {
|
||||
return adjustLogsFrame(frame, query)
|
||||
}
|
||||
}
|
||||
|
||||
func adjustMetricFrame(frame *data.Frame, query *lokiQuery) error {
|
||||
func adjustMetricFrame(frame *data.Frame, query *lokiQuery, setFrameName bool) error {
|
||||
fields := frame.Fields
|
||||
// we check if the fields are of correct type
|
||||
if len(fields) != 2 {
|
||||
@ -50,7 +50,9 @@ func adjustMetricFrame(frame *data.Frame, query *lokiQuery) error {
|
||||
isMetricRange := query.QueryType == QueryTypeRange
|
||||
|
||||
name := formatName(labels, query)
|
||||
frame.Name = name
|
||||
if setFrameName {
|
||||
frame.Name = name
|
||||
}
|
||||
|
||||
if frame.Meta == nil {
|
||||
frame.Meta = &data.FrameMeta{}
|
||||
|
@ -50,21 +50,23 @@ func TestAdjustFrame(t *testing.T) {
|
||||
timeNs3 := strconv.FormatInt(time3.UnixNano(), 10)
|
||||
timeNs4 := strconv.FormatInt(time4.UnixNano(), 10)
|
||||
|
||||
frame := data.NewFrame("",
|
||||
data.NewField("__labels", nil, []json.RawMessage{
|
||||
json.RawMessage(`{"level":"info"}`),
|
||||
json.RawMessage(`{"level":"error"}`),
|
||||
json.RawMessage(`{"level":"error"}`),
|
||||
json.RawMessage(`{"level":"info"}`),
|
||||
}),
|
||||
data.NewField("Time", nil, []time.Time{
|
||||
time1, time2, time3, time4,
|
||||
}),
|
||||
data.NewField("Line", nil, []string{"line1", "line2", "line2", "line3"}),
|
||||
data.NewField("TS", nil, []string{
|
||||
timeNs1, timeNs2, timeNs3, timeNs4,
|
||||
}),
|
||||
)
|
||||
makeFrame := func() *data.Frame {
|
||||
return data.NewFrame("",
|
||||
data.NewField("__labels", nil, []json.RawMessage{
|
||||
json.RawMessage(`{"level":"info"}`),
|
||||
json.RawMessage(`{"level":"error"}`),
|
||||
json.RawMessage(`{"level":"error"}`),
|
||||
json.RawMessage(`{"level":"info"}`),
|
||||
}),
|
||||
data.NewField("Time", nil, []time.Time{
|
||||
time1, time2, time3, time4,
|
||||
}),
|
||||
data.NewField("Line", nil, []string{"line1", "line2", "line2", "line3"}),
|
||||
data.NewField("TS", nil, []string{
|
||||
timeNs1, timeNs2, timeNs3, timeNs4,
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
query := &lokiQuery{
|
||||
Expr: `{type="important"}`,
|
||||
@ -72,30 +74,43 @@ func TestAdjustFrame(t *testing.T) {
|
||||
RefID: "A",
|
||||
}
|
||||
|
||||
err := adjustFrame(frame, query)
|
||||
verifyFrame := func(frame *data.Frame) {
|
||||
fields := frame.Fields
|
||||
|
||||
require.Equal(t, 5, len(fields))
|
||||
|
||||
idField := fields[4]
|
||||
require.Equal(t, "id", idField.Name)
|
||||
require.Equal(t, data.FieldTypeString, idField.Type())
|
||||
require.Equal(t, 4, idField.Len())
|
||||
require.Equal(t, "1641092645000000006_a36f4e1b_A", idField.At(0))
|
||||
require.Equal(t, "1641092705000000006_1d77c9ca_A", idField.At(1))
|
||||
require.Equal(t, "1641092705000000006_1d77c9ca_1_A", idField.At(2))
|
||||
require.Equal(t, "1641092765000000006_948c1a7d_A", idField.At(3))
|
||||
}
|
||||
|
||||
frame := makeFrame()
|
||||
|
||||
err := adjustFrame(frame, query, true)
|
||||
require.NoError(t, err)
|
||||
verifyFrame(frame)
|
||||
|
||||
fields := frame.Fields
|
||||
|
||||
require.Equal(t, 5, len(fields))
|
||||
|
||||
idField := fields[4]
|
||||
require.Equal(t, "id", idField.Name)
|
||||
require.Equal(t, data.FieldTypeString, idField.Type())
|
||||
require.Equal(t, 4, idField.Len())
|
||||
require.Equal(t, "1641092645000000006_a36f4e1b_A", idField.At(0))
|
||||
require.Equal(t, "1641092705000000006_1d77c9ca_A", idField.At(1))
|
||||
require.Equal(t, "1641092705000000006_1d77c9ca_1_A", idField.At(2))
|
||||
require.Equal(t, "1641092765000000006_948c1a7d_A", idField.At(3))
|
||||
frame = makeFrame() // we need to reset the frame, because adjustFrame mutates it
|
||||
err = adjustFrame(frame, query, false)
|
||||
require.NoError(t, err)
|
||||
verifyFrame(frame)
|
||||
})
|
||||
|
||||
t.Run("naming inside metric fields should be correct", func(t *testing.T) {
|
||||
field1 := data.NewField("", nil, make([]time.Time, 0))
|
||||
field2 := data.NewField("", nil, make([]float64, 0))
|
||||
field2.Labels = data.Labels{"app": "Application", "tag2": "tag2"}
|
||||
makeFrame := func() *data.Frame {
|
||||
field1 := data.NewField("", nil, make([]time.Time, 0))
|
||||
field2 := data.NewField("", nil, make([]float64, 0))
|
||||
field2.Labels = data.Labels{"app": "Application", "tag2": "tag2"}
|
||||
|
||||
frame := data.NewFrame("test", field1, field2)
|
||||
frame.SetMeta(&data.FrameMeta{Type: data.FrameTypeTimeSeriesMulti})
|
||||
frame := data.NewFrame("", field1, field2)
|
||||
frame.SetMeta(&data.FrameMeta{Type: data.FrameTypeTimeSeriesMulti})
|
||||
return frame
|
||||
}
|
||||
|
||||
query := &lokiQuery{
|
||||
Expr: "up(ALERTS)",
|
||||
@ -104,13 +119,23 @@ func TestAdjustFrame(t *testing.T) {
|
||||
Step: time.Second * 42,
|
||||
}
|
||||
|
||||
err := adjustFrame(frame, query)
|
||||
frame := makeFrame()
|
||||
err := adjustFrame(frame, query, true)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, frame.Name, "legend Application")
|
||||
require.Equal(t, frame.Meta.ExecutedQueryString, "Expr: up(ALERTS)\nStep: 42s")
|
||||
require.Equal(t, frame.Fields[0].Config.Interval, float64(42000))
|
||||
require.Equal(t, frame.Fields[1].Config.DisplayNameFromDS, "legend Application")
|
||||
|
||||
frame = makeFrame()
|
||||
err = adjustFrame(frame, query, false)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, frame.Name, "")
|
||||
require.Equal(t, frame.Meta.ExecutedQueryString, "Expr: up(ALERTS)\nStep: 42s")
|
||||
require.Equal(t, frame.Fields[0].Config.Interval, float64(42000))
|
||||
require.Equal(t, frame.Fields[1].Config.DisplayNameFromDS, "legend Application")
|
||||
})
|
||||
|
||||
t.Run("should set interval-attribute in response", func(t *testing.T) {
|
||||
@ -119,24 +144,36 @@ func TestAdjustFrame(t *testing.T) {
|
||||
QueryType: QueryTypeRange,
|
||||
}
|
||||
|
||||
field1 := data.NewField("", nil, make([]time.Time, 0))
|
||||
field2 := data.NewField("", nil, make([]float64, 0))
|
||||
makeFrame := func() *data.Frame {
|
||||
field1 := data.NewField("", nil, make([]time.Time, 0))
|
||||
field2 := data.NewField("", nil, make([]float64, 0))
|
||||
|
||||
frame := data.NewFrame("test", field1, field2)
|
||||
frame.SetMeta(&data.FrameMeta{Type: data.FrameTypeTimeSeriesMulti})
|
||||
frame := data.NewFrame("", field1, field2)
|
||||
frame.SetMeta(&data.FrameMeta{Type: data.FrameTypeTimeSeriesMulti})
|
||||
return frame
|
||||
}
|
||||
|
||||
err := adjustFrame(frame, query)
|
||||
verifyFrame := func(frame *data.Frame) {
|
||||
// to keep the test simple, we assume the
|
||||
// first field is the time-field
|
||||
timeField := frame.Fields[0]
|
||||
require.NotNil(t, timeField)
|
||||
require.Equal(t, data.FieldTypeTime, timeField.Type())
|
||||
|
||||
timeFieldConfig := timeField.Config
|
||||
require.NotNil(t, timeFieldConfig)
|
||||
require.Equal(t, float64(42000), timeFieldConfig.Interval)
|
||||
}
|
||||
|
||||
frame := makeFrame()
|
||||
|
||||
err := adjustFrame(frame, query, true)
|
||||
require.NoError(t, err)
|
||||
verifyFrame(frame)
|
||||
|
||||
// to keep the test simple, we assume the
|
||||
// first field is the time-field
|
||||
timeField := frame.Fields[0]
|
||||
require.NotNil(t, timeField)
|
||||
require.Equal(t, data.FieldTypeTime, timeField.Type())
|
||||
|
||||
timeFieldConfig := timeField.Config
|
||||
require.NotNil(t, timeFieldConfig)
|
||||
require.Equal(t, float64(42000), timeFieldConfig.Interval)
|
||||
err = adjustFrame(frame, query, false)
|
||||
require.NoError(t, err)
|
||||
verifyFrame(frame)
|
||||
})
|
||||
|
||||
t.Run("should parse response stats", func(t *testing.T) {
|
||||
|
@ -52,23 +52,28 @@ func TestSuccessResponse(t *testing.T) {
|
||||
{name: "parse an empty response", filepath: "empty", query: matrixQuery},
|
||||
}
|
||||
|
||||
runTest := func(folder string, path string, query lokiQuery, responseOpts ResponseOpts) {
|
||||
responseFileName := filepath.Join(folder, path+".json")
|
||||
goldenFileName := path + ".golden"
|
||||
|
||||
//nolint:gosec
|
||||
bytes, err := os.ReadFile(responseFileName)
|
||||
require.NoError(t, err)
|
||||
|
||||
frames, err := runQuery(context.Background(), makeMockedAPI(http.StatusOK, "application/json", bytes, nil), &query, responseOpts)
|
||||
require.NoError(t, err)
|
||||
|
||||
dr := &backend.DataResponse{
|
||||
Frames: frames,
|
||||
Error: err,
|
||||
}
|
||||
experimental.CheckGoldenJSONResponse(t, folder, goldenFileName, dr, true)
|
||||
}
|
||||
|
||||
for _, test := range tt {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
responseFileName := filepath.Join("testdata", test.filepath+".json")
|
||||
goldenFileName := test.filepath + ".golden"
|
||||
|
||||
//nolint:gosec
|
||||
bytes, err := os.ReadFile(responseFileName)
|
||||
require.NoError(t, err)
|
||||
|
||||
frames, err := runQuery(context.Background(), makeMockedAPI(http.StatusOK, "application/json", bytes, nil), &test.query)
|
||||
require.NoError(t, err)
|
||||
|
||||
dr := &backend.DataResponse{
|
||||
Frames: frames,
|
||||
Error: err,
|
||||
}
|
||||
experimental.CheckGoldenJSONResponse(t, "testdata", goldenFileName, dr, true)
|
||||
runTest("testdata", test.filepath, test.query, ResponseOpts{metricDataplane: false})
|
||||
runTest("testdata_metric_dataplane", test.filepath, test.query, ResponseOpts{metricDataplane: true})
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -118,7 +123,7 @@ func TestErrorResponse(t *testing.T) {
|
||||
|
||||
for _, test := range tt {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
frames, err := runQuery(context.Background(), makeMockedAPI(400, test.contentType, test.body, nil), &lokiQuery{QueryType: QueryTypeRange, Direction: DirectionBackward})
|
||||
frames, err := runQuery(context.Background(), makeMockedAPI(400, test.contentType, test.body, nil), &lokiQuery{QueryType: QueryTypeRange, Direction: DirectionBackward}, ResponseOpts{})
|
||||
|
||||
require.Len(t, frames, 0)
|
||||
require.Error(t, err)
|
||||
|
@ -63,6 +63,10 @@ type QueryJSONModel struct {
|
||||
SupportingQueryType *string `json:"supportingQueryType"`
|
||||
}
|
||||
|
||||
type ResponseOpts struct {
|
||||
metricDataplane bool
|
||||
}
|
||||
|
||||
func parseQueryModel(raw json.RawMessage) (*QueryJSONModel, error) {
|
||||
model := &QueryJSONModel{}
|
||||
err := json.Unmarshal(raw, model)
|
||||
@ -144,10 +148,14 @@ func (s *Service) QueryData(ctx context.Context, req *backend.QueryDataRequest)
|
||||
return result, err
|
||||
}
|
||||
|
||||
return queryData(ctx, req, dsInfo, s.tracer)
|
||||
responseOpts := ResponseOpts{
|
||||
metricDataplane: s.features.IsEnabled(featuremgmt.FlagLokiMetricDataplane),
|
||||
}
|
||||
|
||||
return queryData(ctx, req, dsInfo, responseOpts, s.tracer)
|
||||
}
|
||||
|
||||
func queryData(ctx context.Context, req *backend.QueryDataRequest, dsInfo *datasourceInfo, tracer tracing.Tracer) (*backend.QueryDataResponse, error) {
|
||||
func queryData(ctx context.Context, req *backend.QueryDataRequest, dsInfo *datasourceInfo, responseOpts ResponseOpts, tracer tracing.Tracer) (*backend.QueryDataResponse, error) {
|
||||
result := backend.NewQueryDataResponse()
|
||||
|
||||
api := newLokiAPI(dsInfo.HTTPClient, dsInfo.URL, logger.FromContext(ctx))
|
||||
@ -170,7 +178,7 @@ func queryData(ctx context.Context, req *backend.QueryDataRequest, dsInfo *datas
|
||||
logger := logger.FromContext(ctx) // get logger with trace-id and other contextual info
|
||||
logger.Debug("Sending query", "start", query.Start, "end", query.End, "step", query.Step, "query", query.Expr)
|
||||
|
||||
frames, err := runQuery(ctx, api, query)
|
||||
frames, err := runQuery(ctx, api, query, responseOpts)
|
||||
|
||||
span.End()
|
||||
queryRes := backend.DataResponse{}
|
||||
@ -187,14 +195,14 @@ func queryData(ctx context.Context, req *backend.QueryDataRequest, dsInfo *datas
|
||||
}
|
||||
|
||||
// we extracted this part of the functionality to make it easy to unit-test it
|
||||
func runQuery(ctx context.Context, api *LokiAPI, query *lokiQuery) (data.Frames, error) {
|
||||
frames, err := api.DataQuery(ctx, *query)
|
||||
func runQuery(ctx context.Context, api *LokiAPI, query *lokiQuery, responseOpts ResponseOpts) (data.Frames, error) {
|
||||
frames, err := api.DataQuery(ctx, *query, responseOpts)
|
||||
if err != nil {
|
||||
return data.Frames{}, err
|
||||
}
|
||||
|
||||
for _, frame := range frames {
|
||||
if err = adjustFrame(frame, query); err != nil {
|
||||
if err = adjustFrame(frame, query, !responseOpts.metricDataplane); err != nil {
|
||||
return data.Frames{}, err
|
||||
}
|
||||
if err != nil {
|
||||
|
@ -17,7 +17,7 @@ func BenchmarkMatrixJson(b *testing.B) {
|
||||
|
||||
b.ResetTimer()
|
||||
for n := 0; n < b.N; n++ {
|
||||
_, _ = runQuery(context.Background(), makeMockedAPI(http.StatusOK, "application/json", bytes, nil), &lokiQuery{})
|
||||
_, _ = runQuery(context.Background(), makeMockedAPI(http.StatusOK, "application/json", bytes, nil), &lokiQuery{}, ResponseOpts{})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
{
|
||||
"status": 200
|
||||
}
|
1
pkg/tsdb/loki/testdata_metric_dataplane/empty.json
Normal file
1
pkg/tsdb/loki/testdata_metric_dataplane/empty.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
@ -0,0 +1,87 @@
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
//
|
||||
// Frame[0] {
|
||||
// "type": "timeseries-multi",
|
||||
// "typeVersion": [
|
||||
// 0,
|
||||
// 1
|
||||
// ],
|
||||
// "executedQueryString": "Expr: up(ALERTS)\nStep: 42s"
|
||||
// }
|
||||
// Name:
|
||||
// Dimensions: 2 Fields by 6 Rows
|
||||
// +-----------------------------------+-----------------+
|
||||
// | Name: Time | Name: Value |
|
||||
// | Labels: | Labels: |
|
||||
// | Type: []time.Time | Type: []float64 |
|
||||
// +-----------------------------------+-----------------+
|
||||
// | 2022-01-24 08:54:13.815 +0000 UTC | 50 |
|
||||
// | 2022-01-24 08:59:13.815 +0000 UTC | 57 |
|
||||
// | 2022-01-24 09:04:13.815 +0000 UTC | 55 |
|
||||
// | 2022-01-24 09:34:13.815 +0000 UTC | 54 |
|
||||
// | 2022-01-24 09:39:13.815 +0000 UTC | 55 |
|
||||
// | 2022-01-24 09:44:13.815 +0000 UTC | 56 |
|
||||
// +-----------------------------------+-----------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
{
|
||||
"status": 200,
|
||||
"frames": [
|
||||
{
|
||||
"schema": {
|
||||
"meta": {
|
||||
"type": "timeseries-multi",
|
||||
"typeVersion": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"executedQueryString": "Expr: up(ALERTS)\nStep: 42s"
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "Time",
|
||||
"type": "time",
|
||||
"typeInfo": {
|
||||
"frame": "time.Time"
|
||||
},
|
||||
"config": {
|
||||
"interval": 42000
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Value",
|
||||
"type": "number",
|
||||
"typeInfo": {
|
||||
"frame": "float64"
|
||||
},
|
||||
"labels": {},
|
||||
"config": {
|
||||
"displayNameFromDS": "{}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
1643014453815,
|
||||
1643014753815,
|
||||
1643015053815,
|
||||
1643016853815,
|
||||
1643017153815,
|
||||
1643017453815
|
||||
],
|
||||
[
|
||||
50,
|
||||
57,
|
||||
55,
|
||||
54,
|
||||
55,
|
||||
56
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
19
pkg/tsdb/loki/testdata_metric_dataplane/matrix_gap.json
Normal file
19
pkg/tsdb/loki/testdata_metric_dataplane/matrix_gap.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"resultType": "matrix",
|
||||
"result": [
|
||||
{
|
||||
"metric": {},
|
||||
"values": [
|
||||
[1643014453.815, "50"],
|
||||
[1643014753.815, "57"],
|
||||
[1643015053.815, "55"],
|
||||
[1643016853.815, "54"],
|
||||
[1643017153.815, "55"],
|
||||
[1643017453.815, "56"]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
114
pkg/tsdb/loki/testdata_metric_dataplane/matrix_inf.golden.jsonc
Normal file
114
pkg/tsdb/loki/testdata_metric_dataplane/matrix_inf.golden.jsonc
Normal file
@ -0,0 +1,114 @@
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
//
|
||||
// Frame[0] {
|
||||
// "type": "timeseries-multi",
|
||||
// "typeVersion": [
|
||||
// 0,
|
||||
// 1
|
||||
// ],
|
||||
// "executedQueryString": "Expr: up(ALERTS)\nStep: 42s"
|
||||
// }
|
||||
// Name:
|
||||
// Dimensions: 2 Fields by 8 Rows
|
||||
// +---------------------------------+--------------------------------------------------+
|
||||
// | Name: Time | Name: Value |
|
||||
// | Labels: | Labels: level=info, location=moon, protocol=http |
|
||||
// | Type: []time.Time | Type: []float64 |
|
||||
// +---------------------------------+--------------------------------------------------+
|
||||
// | 2022-01-24 10:53:31.1 +0000 UTC | +Inf |
|
||||
// | 2022-01-24 10:58:31.2 +0000 UTC | -Inf |
|
||||
// | 2022-01-24 10:53:31.3 +0000 UTC | +Inf |
|
||||
// | 2022-01-24 10:58:31.4 +0000 UTC | -Inf |
|
||||
// | 2022-01-24 10:53:31.5 +0000 UTC | +Inf |
|
||||
// | 2022-01-24 10:58:31.6 +0000 UTC | -Inf |
|
||||
// | 2022-01-24 10:53:31.7 +0000 UTC | +Inf |
|
||||
// | 2022-01-24 10:58:31.8 +0000 UTC | -Inf |
|
||||
// +---------------------------------+--------------------------------------------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
{
|
||||
"status": 200,
|
||||
"frames": [
|
||||
{
|
||||
"schema": {
|
||||
"meta": {
|
||||
"type": "timeseries-multi",
|
||||
"typeVersion": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"executedQueryString": "Expr: up(ALERTS)\nStep: 42s"
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "Time",
|
||||
"type": "time",
|
||||
"typeInfo": {
|
||||
"frame": "time.Time"
|
||||
},
|
||||
"config": {
|
||||
"interval": 42000
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Value",
|
||||
"type": "number",
|
||||
"typeInfo": {
|
||||
"frame": "float64"
|
||||
},
|
||||
"labels": {
|
||||
"level": "info",
|
||||
"location": "moon",
|
||||
"protocol": "http"
|
||||
},
|
||||
"config": {
|
||||
"displayNameFromDS": "{level=\"info\", location=\"moon\", protocol=\"http\"}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
1643021611100,
|
||||
1643021911200,
|
||||
1643021611300,
|
||||
1643021911400,
|
||||
1643021611500,
|
||||
1643021911600,
|
||||
1643021611700,
|
||||
1643021911800
|
||||
],
|
||||
[
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
]
|
||||
],
|
||||
"entities": [
|
||||
null,
|
||||
{
|
||||
"Inf": [
|
||||
0,
|
||||
2,
|
||||
4,
|
||||
6
|
||||
],
|
||||
"NegInf": [
|
||||
1,
|
||||
3,
|
||||
5,
|
||||
7
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
25
pkg/tsdb/loki/testdata_metric_dataplane/matrix_inf.json
Normal file
25
pkg/tsdb/loki/testdata_metric_dataplane/matrix_inf.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"resultType": "matrix",
|
||||
"result": [
|
||||
{
|
||||
"metric": {
|
||||
"level": "info",
|
||||
"location": "moon",
|
||||
"protocol": "http"
|
||||
},
|
||||
"values": [
|
||||
[1643021611.1, "+Inf"],
|
||||
[1643021911.2, "-Inf"],
|
||||
[1643021611.3, "+Infinity"],
|
||||
[1643021911.4, "-Infinity"],
|
||||
[1643021611.5, "+inf"],
|
||||
[1643021911.6, "-infinity"],
|
||||
[1643021611.7, "+iNf"],
|
||||
[1643021911.8, "-INfInItY"]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
//
|
||||
// Frame[0] {
|
||||
// "type": "timeseries-multi",
|
||||
// "typeVersion": [
|
||||
// 0,
|
||||
// 1
|
||||
// ],
|
||||
// "executedQueryString": "Expr: up(ALERTS)\nStep: 42s"
|
||||
// }
|
||||
// Name:
|
||||
// Dimensions: 2 Fields by 1 Rows
|
||||
// +-----------------------------------+------------------------------------+
|
||||
// | Name: Time | Name: Value |
|
||||
// | Labels: | Labels: __name__=moon, level=error |
|
||||
// | Type: []time.Time | Type: []float64 |
|
||||
// +-----------------------------------+------------------------------------+
|
||||
// | 2021-12-10 08:36:06.989 +0000 UTC | 0.4 |
|
||||
// +-----------------------------------+------------------------------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
{
|
||||
"status": 200,
|
||||
"frames": [
|
||||
{
|
||||
"schema": {
|
||||
"meta": {
|
||||
"type": "timeseries-multi",
|
||||
"typeVersion": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"executedQueryString": "Expr: up(ALERTS)\nStep: 42s"
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "Time",
|
||||
"type": "time",
|
||||
"typeInfo": {
|
||||
"frame": "time.Time"
|
||||
},
|
||||
"config": {
|
||||
"interval": 42000
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Value",
|
||||
"type": "number",
|
||||
"typeInfo": {
|
||||
"frame": "float64"
|
||||
},
|
||||
"labels": {
|
||||
"__name__": "moon",
|
||||
"level": "error"
|
||||
},
|
||||
"config": {
|
||||
"displayNameFromDS": "{__name__=\"moon\", level=\"error\"}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
1639125366989
|
||||
],
|
||||
[
|
||||
0.4
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
17
pkg/tsdb/loki/testdata_metric_dataplane/matrix_name.json
Normal file
17
pkg/tsdb/loki/testdata_metric_dataplane/matrix_name.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"resultType": "matrix",
|
||||
"result": [
|
||||
{
|
||||
"metric": {
|
||||
"level": "error",
|
||||
"__name__": "moon"
|
||||
},
|
||||
"values": [
|
||||
[1639125366.989, "0.4"]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
//
|
||||
// Frame[0] {
|
||||
// "type": "timeseries-multi",
|
||||
// "typeVersion": [
|
||||
// 0,
|
||||
// 1
|
||||
// ],
|
||||
// "executedQueryString": "Expr: up(ALERTS)\nStep: 42s"
|
||||
// }
|
||||
// Name:
|
||||
// Dimensions: 2 Fields by 3 Rows
|
||||
// +-----------------------------------+-----------------+
|
||||
// | Name: Time | Name: Value |
|
||||
// | Labels: | Labels: |
|
||||
// | Type: []time.Time | Type: []float64 |
|
||||
// +-----------------------------------+-----------------+
|
||||
// | 2022-01-24 08:54:10.417 +0000 UTC | NaN |
|
||||
// | 2022-01-24 08:59:10.517 +0000 UTC | NaN |
|
||||
// | 2022-01-24 08:54:10.617 +0000 UTC | NaN |
|
||||
// +-----------------------------------+-----------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
{
|
||||
"status": 200,
|
||||
"frames": [
|
||||
{
|
||||
"schema": {
|
||||
"meta": {
|
||||
"type": "timeseries-multi",
|
||||
"typeVersion": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"executedQueryString": "Expr: up(ALERTS)\nStep: 42s"
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "Time",
|
||||
"type": "time",
|
||||
"typeInfo": {
|
||||
"frame": "time.Time"
|
||||
},
|
||||
"config": {
|
||||
"interval": 42000
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Value",
|
||||
"type": "number",
|
||||
"typeInfo": {
|
||||
"frame": "float64"
|
||||
},
|
||||
"labels": {},
|
||||
"config": {
|
||||
"displayNameFromDS": "{}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
1643014450417,
|
||||
1643014750517,
|
||||
1643014450617
|
||||
],
|
||||
[
|
||||
null,
|
||||
null,
|
||||
null
|
||||
]
|
||||
],
|
||||
"entities": [
|
||||
null,
|
||||
{
|
||||
"NaN": [
|
||||
0,
|
||||
1,
|
||||
2
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
16
pkg/tsdb/loki/testdata_metric_dataplane/matrix_nan.json
Normal file
16
pkg/tsdb/loki/testdata_metric_dataplane/matrix_nan.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"resultType": "matrix",
|
||||
"result": [
|
||||
{
|
||||
"metric": {},
|
||||
"values": [
|
||||
[1643014450.417, "NaN"],
|
||||
[1643014750.517, "nan"],
|
||||
[1643014450.617, "nAn"]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,164 @@
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
//
|
||||
// Frame[0] {
|
||||
// "type": "timeseries-multi",
|
||||
// "typeVersion": [
|
||||
// 0,
|
||||
// 1
|
||||
// ],
|
||||
// "executedQueryString": "Expr: up(ALERTS)\nStep: 42s"
|
||||
// }
|
||||
// Name:
|
||||
// Dimensions: 2 Fields by 4 Rows
|
||||
// +-----------------------------------+------------------------------------+
|
||||
// | Name: Time | Name: Value |
|
||||
// | Labels: | Labels: level=error, location=moon |
|
||||
// | Type: []time.Time | Type: []float64 |
|
||||
// +-----------------------------------+------------------------------------+
|
||||
// | 2021-12-10 08:36:06.989 +0000 UTC | 0.4 |
|
||||
// | 2021-12-10 08:36:46.989 +0000 UTC | 0.2 |
|
||||
// | 2021-12-10 08:36:56.989 +0000 UTC | 0.2 |
|
||||
// | 2021-12-10 08:37:46.989 +0000 UTC | 0.6 |
|
||||
// +-----------------------------------+------------------------------------+
|
||||
//
|
||||
//
|
||||
//
|
||||
// Frame[1] {
|
||||
// "type": "timeseries-multi",
|
||||
// "typeVersion": [
|
||||
// 0,
|
||||
// 1
|
||||
// ],
|
||||
// "executedQueryString": "Expr: up(ALERTS)\nStep: 42s"
|
||||
// }
|
||||
// Name:
|
||||
// Dimensions: 2 Fields by 5 Rows
|
||||
// +-----------------------------------+-----------------------------------+
|
||||
// | Name: Time | Name: Value |
|
||||
// | Labels: | Labels: level=info, location=mars |
|
||||
// | Type: []time.Time | Type: []float64 |
|
||||
// +-----------------------------------+-----------------------------------+
|
||||
// | 2021-12-10 08:36:26.989 +0000 UTC | 0.6 |
|
||||
// | 2021-12-10 08:36:36.989 +0000 UTC | 0.8 |
|
||||
// | 2021-12-10 08:36:46.989 +0000 UTC | 0.8 |
|
||||
// | 2021-12-10 08:36:56.989 +0000 UTC | 0.8 |
|
||||
// | 2021-12-10 08:37:56.989 +0000 UTC | 2.6 |
|
||||
// +-----------------------------------+-----------------------------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
{
|
||||
"status": 200,
|
||||
"frames": [
|
||||
{
|
||||
"schema": {
|
||||
"meta": {
|
||||
"type": "timeseries-multi",
|
||||
"typeVersion": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"executedQueryString": "Expr: up(ALERTS)\nStep: 42s"
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "Time",
|
||||
"type": "time",
|
||||
"typeInfo": {
|
||||
"frame": "time.Time"
|
||||
},
|
||||
"config": {
|
||||
"interval": 42000
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Value",
|
||||
"type": "number",
|
||||
"typeInfo": {
|
||||
"frame": "float64"
|
||||
},
|
||||
"labels": {
|
||||
"level": "error",
|
||||
"location": "moon"
|
||||
},
|
||||
"config": {
|
||||
"displayNameFromDS": "{level=\"error\", location=\"moon\"}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
1639125366989,
|
||||
1639125406989,
|
||||
1639125416989,
|
||||
1639125466989
|
||||
],
|
||||
[
|
||||
0.4,
|
||||
0.2,
|
||||
0.2,
|
||||
0.6
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"schema": {
|
||||
"meta": {
|
||||
"type": "timeseries-multi",
|
||||
"typeVersion": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"executedQueryString": "Expr: up(ALERTS)\nStep: 42s"
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "Time",
|
||||
"type": "time",
|
||||
"typeInfo": {
|
||||
"frame": "time.Time"
|
||||
},
|
||||
"config": {
|
||||
"interval": 42000
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Value",
|
||||
"type": "number",
|
||||
"typeInfo": {
|
||||
"frame": "float64"
|
||||
},
|
||||
"labels": {
|
||||
"level": "info",
|
||||
"location": "mars"
|
||||
},
|
||||
"config": {
|
||||
"displayNameFromDS": "{level=\"info\", location=\"mars\"}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
1639125386989,
|
||||
1639125396989,
|
||||
1639125406989,
|
||||
1639125416989,
|
||||
1639125476989
|
||||
],
|
||||
[
|
||||
0.6,
|
||||
0.8,
|
||||
0.8,
|
||||
0.8,
|
||||
2.6
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
33
pkg/tsdb/loki/testdata_metric_dataplane/matrix_simple.json
Normal file
33
pkg/tsdb/loki/testdata_metric_dataplane/matrix_simple.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"resultType": "matrix",
|
||||
"result": [
|
||||
{
|
||||
"metric": {
|
||||
"level": "error",
|
||||
"location": "moon"
|
||||
},
|
||||
"values": [
|
||||
[1639125366.989, "0.4"],
|
||||
[1639125406.989, "0.2"],
|
||||
[1639125416.989, "0.2"],
|
||||
[1639125466.989, "0.6"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"metric": {
|
||||
"level": "info",
|
||||
"location": "mars"
|
||||
},
|
||||
"values": [
|
||||
[1639125386.989, "0.6"],
|
||||
[1639125396.989, "0.8"],
|
||||
[1639125406.989, "0.8"],
|
||||
[1639125416.989, "0.8"],
|
||||
[1639125476.989, "2.6"]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
//
|
||||
// Frame[0] {
|
||||
// "type": "timeseries-multi",
|
||||
// "typeVersion": [
|
||||
// 0,
|
||||
// 1
|
||||
// ],
|
||||
// "executedQueryString": "Expr: up(ALERTS)\nStep: 42s"
|
||||
// }
|
||||
// Name:
|
||||
// Dimensions: 2 Fields by 4 Rows
|
||||
// +-----------------------------------+---------------------+
|
||||
// | Name: Time | Name: Value |
|
||||
// | Labels: | Labels: level=error |
|
||||
// | Type: []time.Time | Type: []float64 |
|
||||
// +-----------------------------------+---------------------+
|
||||
// | 2021-12-10 08:36:06.511 +0000 UTC | 0.4 |
|
||||
// | 2021-12-10 08:36:46.512 +0000 UTC | 0.2 |
|
||||
// | 2021-12-10 08:36:56.513 +0000 UTC | 0.2 |
|
||||
// | 2021-12-10 08:37:46.514 +0000 UTC | 0.6 |
|
||||
// +-----------------------------------+---------------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
{
|
||||
"status": 200,
|
||||
"frames": [
|
||||
{
|
||||
"schema": {
|
||||
"meta": {
|
||||
"type": "timeseries-multi",
|
||||
"typeVersion": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"executedQueryString": "Expr: up(ALERTS)\nStep: 42s"
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "Time",
|
||||
"type": "time",
|
||||
"typeInfo": {
|
||||
"frame": "time.Time"
|
||||
},
|
||||
"config": {
|
||||
"interval": 42000
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Value",
|
||||
"type": "number",
|
||||
"typeInfo": {
|
||||
"frame": "float64"
|
||||
},
|
||||
"labels": {
|
||||
"level": "error"
|
||||
},
|
||||
"config": {
|
||||
"displayNameFromDS": "{level=\"error\"}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
1639125366511,
|
||||
1639125406512,
|
||||
1639125416513,
|
||||
1639125466514
|
||||
],
|
||||
[
|
||||
0.4,
|
||||
0.2,
|
||||
0.2,
|
||||
0.6
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"resultType": "matrix",
|
||||
"result": [
|
||||
{
|
||||
"metric": {
|
||||
"level": "error"
|
||||
},
|
||||
"values": [
|
||||
[1639125366.511, "0.4"],
|
||||
[1639125406.512, "0.2"],
|
||||
[1639125416.513, "0.2"],
|
||||
[1639125466.514, "0.6"]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,365 @@
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
//
|
||||
// Frame[0] {
|
||||
// "type": "timeseries-multi",
|
||||
// "typeVersion": [
|
||||
// 0,
|
||||
// 1
|
||||
// ],
|
||||
// "stats": [
|
||||
// {
|
||||
// "displayName": "Summary: bytes processed per second",
|
||||
// "unit": "Bps",
|
||||
// "value": 3507022
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Summary: lines processed per second",
|
||||
// "value": 24818
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Summary: total bytes processed",
|
||||
// "unit": "decbytes",
|
||||
// "value": 7772
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Summary: total lines processed",
|
||||
// "value": 55
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Summary: exec time",
|
||||
// "unit": "s",
|
||||
// "value": 0.002216125
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Store: total chunks ref",
|
||||
// "value": 2
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Store: total chunks downloaded",
|
||||
// "value": 3
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Store: chunks download time",
|
||||
// "unit": "s",
|
||||
// "value": 0.000390958
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Store: head chunk bytes",
|
||||
// "unit": "decbytes",
|
||||
// "value": 4
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Store: head chunk lines",
|
||||
// "value": 5
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Store: decompressed bytes",
|
||||
// "unit": "decbytes",
|
||||
// "value": 7772
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Store: decompressed lines",
|
||||
// "value": 55
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Store: compressed bytes",
|
||||
// "unit": "decbytes",
|
||||
// "value": 31432
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Store: total duplicates",
|
||||
// "value": 6
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: total reached",
|
||||
// "value": 7
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: total chunks matched",
|
||||
// "value": 8
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: total batches",
|
||||
// "value": 9
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: total lines sent",
|
||||
// "value": 10
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: head chunk bytes",
|
||||
// "unit": "decbytes",
|
||||
// "value": 11
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: head chunk lines",
|
||||
// "value": 12
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: decompressed bytes",
|
||||
// "unit": "decbytes",
|
||||
// "value": 13
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: decompressed lines",
|
||||
// "value": 14
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: compressed bytes",
|
||||
// "unit": "decbytes",
|
||||
// "value": 15
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: total duplicates",
|
||||
// "value": 16
|
||||
// }
|
||||
// ],
|
||||
// "executedQueryString": "Expr: up(ALERTS)\nStep: 42s"
|
||||
// }
|
||||
// Name:
|
||||
// Dimensions: 2 Fields by 2 Rows
|
||||
// +-----------------------------------+------------------------------------+
|
||||
// | Name: Time | Name: Value |
|
||||
// | Labels: | Labels: level=error, location=moon |
|
||||
// | Type: []time.Time | Type: []float64 |
|
||||
// +-----------------------------------+------------------------------------+
|
||||
// | 2021-12-10 08:36:06.989 +0000 UTC | 0.4 |
|
||||
// | 2021-12-10 08:36:46.989 +0000 UTC | 0.2 |
|
||||
// +-----------------------------------+------------------------------------+
|
||||
//
|
||||
//
|
||||
//
|
||||
// Frame[1] {
|
||||
// "type": "timeseries-multi",
|
||||
// "typeVersion": [
|
||||
// 0,
|
||||
// 1
|
||||
// ],
|
||||
// "executedQueryString": "Expr: up(ALERTS)\nStep: 42s"
|
||||
// }
|
||||
// Name:
|
||||
// Dimensions: 2 Fields by 2 Rows
|
||||
// +-----------------------------------+-----------------------------------+
|
||||
// | Name: Time | Name: Value |
|
||||
// | Labels: | Labels: level=info, location=mars |
|
||||
// | Type: []time.Time | Type: []float64 |
|
||||
// +-----------------------------------+-----------------------------------+
|
||||
// | 2021-12-10 08:36:26.989 +0000 UTC | 0.6 |
|
||||
// | 2021-12-10 08:36:36.989 +0000 UTC | 0.8 |
|
||||
// +-----------------------------------+-----------------------------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
{
|
||||
"status": 200,
|
||||
"frames": [
|
||||
{
|
||||
"schema": {
|
||||
"meta": {
|
||||
"type": "timeseries-multi",
|
||||
"typeVersion": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"stats": [
|
||||
{
|
||||
"displayName": "Summary: bytes processed per second",
|
||||
"unit": "Bps",
|
||||
"value": 3507022
|
||||
},
|
||||
{
|
||||
"displayName": "Summary: lines processed per second",
|
||||
"value": 24818
|
||||
},
|
||||
{
|
||||
"displayName": "Summary: total bytes processed",
|
||||
"unit": "decbytes",
|
||||
"value": 7772
|
||||
},
|
||||
{
|
||||
"displayName": "Summary: total lines processed",
|
||||
"value": 55
|
||||
},
|
||||
{
|
||||
"displayName": "Summary: exec time",
|
||||
"unit": "s",
|
||||
"value": 0.002216125
|
||||
},
|
||||
{
|
||||
"displayName": "Store: total chunks ref",
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"displayName": "Store: total chunks downloaded",
|
||||
"value": 3
|
||||
},
|
||||
{
|
||||
"displayName": "Store: chunks download time",
|
||||
"unit": "s",
|
||||
"value": 0.000390958
|
||||
},
|
||||
{
|
||||
"displayName": "Store: head chunk bytes",
|
||||
"unit": "decbytes",
|
||||
"value": 4
|
||||
},
|
||||
{
|
||||
"displayName": "Store: head chunk lines",
|
||||
"value": 5
|
||||
},
|
||||
{
|
||||
"displayName": "Store: decompressed bytes",
|
||||
"unit": "decbytes",
|
||||
"value": 7772
|
||||
},
|
||||
{
|
||||
"displayName": "Store: decompressed lines",
|
||||
"value": 55
|
||||
},
|
||||
{
|
||||
"displayName": "Store: compressed bytes",
|
||||
"unit": "decbytes",
|
||||
"value": 31432
|
||||
},
|
||||
{
|
||||
"displayName": "Store: total duplicates",
|
||||
"value": 6
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: total reached",
|
||||
"value": 7
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: total chunks matched",
|
||||
"value": 8
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: total batches",
|
||||
"value": 9
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: total lines sent",
|
||||
"value": 10
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: head chunk bytes",
|
||||
"unit": "decbytes",
|
||||
"value": 11
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: head chunk lines",
|
||||
"value": 12
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: decompressed bytes",
|
||||
"unit": "decbytes",
|
||||
"value": 13
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: decompressed lines",
|
||||
"value": 14
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: compressed bytes",
|
||||
"unit": "decbytes",
|
||||
"value": 15
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: total duplicates",
|
||||
"value": 16
|
||||
}
|
||||
],
|
||||
"executedQueryString": "Expr: up(ALERTS)\nStep: 42s"
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "Time",
|
||||
"type": "time",
|
||||
"typeInfo": {
|
||||
"frame": "time.Time"
|
||||
},
|
||||
"config": {
|
||||
"interval": 42000
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Value",
|
||||
"type": "number",
|
||||
"typeInfo": {
|
||||
"frame": "float64"
|
||||
},
|
||||
"labels": {
|
||||
"level": "error",
|
||||
"location": "moon"
|
||||
},
|
||||
"config": {
|
||||
"displayNameFromDS": "{level=\"error\", location=\"moon\"}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
1639125366989,
|
||||
1639125406989
|
||||
],
|
||||
[
|
||||
0.4,
|
||||
0.2
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"schema": {
|
||||
"meta": {
|
||||
"type": "timeseries-multi",
|
||||
"typeVersion": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"executedQueryString": "Expr: up(ALERTS)\nStep: 42s"
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "Time",
|
||||
"type": "time",
|
||||
"typeInfo": {
|
||||
"frame": "time.Time"
|
||||
},
|
||||
"config": {
|
||||
"interval": 42000
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Value",
|
||||
"type": "number",
|
||||
"typeInfo": {
|
||||
"frame": "float64"
|
||||
},
|
||||
"labels": {
|
||||
"level": "info",
|
||||
"location": "mars"
|
||||
},
|
||||
"config": {
|
||||
"displayNameFromDS": "{level=\"info\", location=\"mars\"}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
1639125386989,
|
||||
1639125396989
|
||||
],
|
||||
[
|
||||
0.6,
|
||||
0.8
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"resultType": "matrix",
|
||||
"result": [
|
||||
{
|
||||
"metric": {
|
||||
"level": "error",
|
||||
"location": "moon"
|
||||
},
|
||||
"values": [
|
||||
[1639125366.989, "0.4"],
|
||||
[1639125406.989, "0.2"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"metric": {
|
||||
"level": "info",
|
||||
"location": "mars"
|
||||
},
|
||||
"values": [
|
||||
[1639125386.989, "0.6"],
|
||||
[1639125396.989, "0.8"]
|
||||
]
|
||||
}
|
||||
],
|
||||
"stats": {
|
||||
"summary": {
|
||||
"bytesProcessedPerSecond": 3507022,
|
||||
"linesProcessedPerSecond": 24818,
|
||||
"totalBytesProcessed": 7772,
|
||||
"totalLinesProcessed": 55,
|
||||
"execTime": 0.002216125
|
||||
},
|
||||
"store": {
|
||||
"totalChunksRef": 2,
|
||||
"totalChunksDownloaded": 3,
|
||||
"chunksDownloadTime": 0.000390958,
|
||||
"headChunkBytes": 4,
|
||||
"headChunkLines": 5,
|
||||
"decompressedBytes": 7772,
|
||||
"decompressedLines": 55,
|
||||
"compressedBytes": 31432,
|
||||
"totalDuplicates": 6
|
||||
},
|
||||
"ingester": {
|
||||
"totalReached": 7,
|
||||
"totalChunksMatched": 8,
|
||||
"totalBatches": 9,
|
||||
"totalLinesSent": 10,
|
||||
"headChunkBytes": 11,
|
||||
"headChunkLines": 12,
|
||||
"decompressedBytes": 13,
|
||||
"decompressedLines": 14,
|
||||
"compressedBytes": 15,
|
||||
"totalDuplicates": 16
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
//
|
||||
// Frame[0] {
|
||||
// "typeVersion": [
|
||||
// 0,
|
||||
// 0
|
||||
// ],
|
||||
// "custom": {
|
||||
// "frameType": "LabeledTimeValues"
|
||||
// },
|
||||
// "executedQueryString": "Expr: query1"
|
||||
// }
|
||||
// Name:
|
||||
// Dimensions: 5 Fields by 4 Rows
|
||||
// +------------------------------------------------+-------------------------------+----------------+---------------------+---------------------------------+
|
||||
// | Name: labels | Name: Time | Name: Line | Name: tsNs | Name: id |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []json.RawMessage | Type: []time.Time | Type: []string | Type: []string | Type: []string |
|
||||
// +------------------------------------------------+-------------------------------+----------------+---------------------+---------------------------------+
|
||||
// | {"__error__":"LogfmtParserErr","place":"moon"} | 2022-06-17 06:49:51 +0000 UTC | "hello1 | 1655448591000000000 | 1655448591000000000_44cbf4ec_sq |
|
||||
// | {"__error__":"LogfmtParserErr","place":"moon"} | 2022-06-17 06:49:54 +0000 UTC | "hello4 | 1655448594000000000 | 1655448594000000000_408b3f5b_sq |
|
||||
// | {"place":"moon","text":"hello3"} | 2022-06-17 06:49:52 +0000 UTC | text=hello2 | 1655448592000000000 | 1655448592000000000_d1b2086_sq |
|
||||
// | {"place":"moon","text":"hello4"} | 2022-06-17 06:49:53 +0000 UTC | text=hello3 | 1655448593000000000 | 1655448593000000000_45714922_sq |
|
||||
// +------------------------------------------------+-------------------------------+----------------+---------------------+---------------------------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
{
|
||||
"status": 200,
|
||||
"frames": [
|
||||
{
|
||||
"schema": {
|
||||
"meta": {
|
||||
"typeVersion": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"custom": {
|
||||
"frameType": "LabeledTimeValues"
|
||||
},
|
||||
"executedQueryString": "Expr: query1"
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "labels",
|
||||
"type": "other",
|
||||
"typeInfo": {
|
||||
"frame": "json.RawMessage"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Time",
|
||||
"type": "time",
|
||||
"typeInfo": {
|
||||
"frame": "time.Time"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Line",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "tsNs",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
{
|
||||
"__error__": "LogfmtParserErr",
|
||||
"place": "moon"
|
||||
},
|
||||
{
|
||||
"__error__": "LogfmtParserErr",
|
||||
"place": "moon"
|
||||
},
|
||||
{
|
||||
"place": "moon",
|
||||
"text": "hello3"
|
||||
},
|
||||
{
|
||||
"place": "moon",
|
||||
"text": "hello4"
|
||||
}
|
||||
],
|
||||
[
|
||||
1655448591000,
|
||||
1655448594000,
|
||||
1655448592000,
|
||||
1655448593000
|
||||
],
|
||||
[
|
||||
"\"hello1",
|
||||
"\"hello4",
|
||||
"text=hello2",
|
||||
"text=hello3"
|
||||
],
|
||||
[
|
||||
"1655448591000000000",
|
||||
"1655448594000000000",
|
||||
"1655448592000000000",
|
||||
"1655448593000000000"
|
||||
],
|
||||
[
|
||||
"1655448591000000000_44cbf4ec_sq",
|
||||
"1655448594000000000_408b3f5b_sq",
|
||||
"1655448592000000000_d1b2086_sq",
|
||||
"1655448593000000000_45714922_sq"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"resultType": "streams",
|
||||
"result": [
|
||||
{
|
||||
"stream": { "__error__": "LogfmtParserErr", "place": "moon" },
|
||||
"values": [
|
||||
["1655448591000000000", "\"hello1"],
|
||||
["1655448594000000000", "\"hello4"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"stream": {
|
||||
"place": "moon",
|
||||
"text": "hello3"
|
||||
},
|
||||
"values": [["1655448592000000000", "text=hello2"]]
|
||||
},
|
||||
{
|
||||
"stream": {
|
||||
"place": "moon",
|
||||
"text": "hello4"
|
||||
},
|
||||
"values": [["1655448593000000000", "text=hello3"]]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,377 @@
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
//
|
||||
// Frame[0] {
|
||||
// "typeVersion": [
|
||||
// 0,
|
||||
// 0
|
||||
// ],
|
||||
// "custom": {
|
||||
// "frameType": "LabeledTimeValues"
|
||||
// },
|
||||
// "stats": [
|
||||
// {
|
||||
// "displayName": "Summary: bytes processed per second",
|
||||
// "unit": "Bps",
|
||||
// "value": 3507022
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Summary: lines processed per second",
|
||||
// "value": 24818
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Summary: total bytes processed",
|
||||
// "unit": "decbytes",
|
||||
// "value": 7772
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Summary: total lines processed",
|
||||
// "value": 55
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Summary: exec time",
|
||||
// "unit": "s",
|
||||
// "value": 0.002216125
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Store: total chunks ref",
|
||||
// "value": 2
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Store: total chunks downloaded",
|
||||
// "value": 3
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Store: chunks download time",
|
||||
// "unit": "s",
|
||||
// "value": 0.000390958
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Store: head chunk bytes",
|
||||
// "unit": "decbytes",
|
||||
// "value": 4
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Store: head chunk lines",
|
||||
// "value": 5
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Store: decompressed bytes",
|
||||
// "unit": "decbytes",
|
||||
// "value": 7772
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Store: decompressed lines",
|
||||
// "value": 55
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Store: compressed bytes",
|
||||
// "unit": "decbytes",
|
||||
// "value": 31432
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Store: total duplicates",
|
||||
// "value": 6
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: total reached",
|
||||
// "value": 7
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: total chunks matched",
|
||||
// "value": 8
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: total batches",
|
||||
// "value": 9
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: total lines sent",
|
||||
// "value": 10
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: head chunk bytes",
|
||||
// "unit": "decbytes",
|
||||
// "value": 11
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: head chunk lines",
|
||||
// "value": 12
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: decompressed bytes",
|
||||
// "unit": "decbytes",
|
||||
// "value": 13
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: decompressed lines",
|
||||
// "value": 14
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: compressed bytes",
|
||||
// "unit": "decbytes",
|
||||
// "value": 15
|
||||
// },
|
||||
// {
|
||||
// "displayName": "Ingester: total duplicates",
|
||||
// "value": 16
|
||||
// }
|
||||
// ],
|
||||
// "executedQueryString": "Expr: query1"
|
||||
// }
|
||||
// Name:
|
||||
// Dimensions: 5 Fields by 6 Rows
|
||||
// +---------------------------------------+-----------------------------------------+------------------+---------------------+-----------------------------------+
|
||||
// | Name: labels | Name: Time | Name: Line | Name: tsNs | Name: id |
|
||||
// | Labels: | Labels: | Labels: | Labels: | Labels: |
|
||||
// | Type: []json.RawMessage | Type: []time.Time | Type: []string | Type: []string | Type: []string |
|
||||
// +---------------------------------------+-----------------------------------------+------------------+---------------------+-----------------------------------+
|
||||
// | {"code":"one\",","location":"moon🌙"} | 2022-02-16 16:50:44.81075712 +0000 UTC | log line error 1 | 1645030244810757120 | 1645030244810757120_1d8c2178_sq |
|
||||
// | {"code":"\",two","location":"moon🌙"} | 2022-02-16 16:50:47.02773504 +0000 UTC | log line info 1 | 1645030247027735040 | 1645030247027735040_87a7aed2_sq |
|
||||
// | {"code":"\",two","location":"moon🌙"} | 2022-02-16 16:50:46.277587968 +0000 UTC | log line info 2 | 1645030246277587968 | 1645030246277587968_318d05c9_sq |
|
||||
// | {"code":"\",two","location":"moon🌙"} | 2022-02-16 16:50:46.277587968 +0000 UTC | log line info 2 | 1645030246277587968 | 1645030246277587968_318d05c9_1_sq |
|
||||
// | {"code":"\",two","location":"moon🌙"} | 2022-02-16 16:50:45.539423744 +0000 UTC | log line info 3 | 1645030245539423744 | 1645030245539423744_fd17f65c_sq |
|
||||
// | {"code":"\",two","location":"moon🌙"} | 2022-02-16 16:50:44.091700992 +0000 UTC | log line info 4 | 1645030244091700992 | 1645030244091700992_62ae07f3_sq |
|
||||
// +---------------------------------------+-----------------------------------------+------------------+---------------------+-----------------------------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
{
|
||||
"status": 200,
|
||||
"frames": [
|
||||
{
|
||||
"schema": {
|
||||
"meta": {
|
||||
"typeVersion": [
|
||||
0,
|
||||
0
|
||||
],
|
||||
"custom": {
|
||||
"frameType": "LabeledTimeValues"
|
||||
},
|
||||
"stats": [
|
||||
{
|
||||
"displayName": "Summary: bytes processed per second",
|
||||
"unit": "Bps",
|
||||
"value": 3507022
|
||||
},
|
||||
{
|
||||
"displayName": "Summary: lines processed per second",
|
||||
"value": 24818
|
||||
},
|
||||
{
|
||||
"displayName": "Summary: total bytes processed",
|
||||
"unit": "decbytes",
|
||||
"value": 7772
|
||||
},
|
||||
{
|
||||
"displayName": "Summary: total lines processed",
|
||||
"value": 55
|
||||
},
|
||||
{
|
||||
"displayName": "Summary: exec time",
|
||||
"unit": "s",
|
||||
"value": 0.002216125
|
||||
},
|
||||
{
|
||||
"displayName": "Store: total chunks ref",
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"displayName": "Store: total chunks downloaded",
|
||||
"value": 3
|
||||
},
|
||||
{
|
||||
"displayName": "Store: chunks download time",
|
||||
"unit": "s",
|
||||
"value": 0.000390958
|
||||
},
|
||||
{
|
||||
"displayName": "Store: head chunk bytes",
|
||||
"unit": "decbytes",
|
||||
"value": 4
|
||||
},
|
||||
{
|
||||
"displayName": "Store: head chunk lines",
|
||||
"value": 5
|
||||
},
|
||||
{
|
||||
"displayName": "Store: decompressed bytes",
|
||||
"unit": "decbytes",
|
||||
"value": 7772
|
||||
},
|
||||
{
|
||||
"displayName": "Store: decompressed lines",
|
||||
"value": 55
|
||||
},
|
||||
{
|
||||
"displayName": "Store: compressed bytes",
|
||||
"unit": "decbytes",
|
||||
"value": 31432
|
||||
},
|
||||
{
|
||||
"displayName": "Store: total duplicates",
|
||||
"value": 6
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: total reached",
|
||||
"value": 7
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: total chunks matched",
|
||||
"value": 8
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: total batches",
|
||||
"value": 9
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: total lines sent",
|
||||
"value": 10
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: head chunk bytes",
|
||||
"unit": "decbytes",
|
||||
"value": 11
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: head chunk lines",
|
||||
"value": 12
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: decompressed bytes",
|
||||
"unit": "decbytes",
|
||||
"value": 13
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: decompressed lines",
|
||||
"value": 14
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: compressed bytes",
|
||||
"unit": "decbytes",
|
||||
"value": 15
|
||||
},
|
||||
{
|
||||
"displayName": "Ingester: total duplicates",
|
||||
"value": 16
|
||||
}
|
||||
],
|
||||
"executedQueryString": "Expr: query1"
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "labels",
|
||||
"type": "other",
|
||||
"typeInfo": {
|
||||
"frame": "json.RawMessage"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Time",
|
||||
"type": "time",
|
||||
"typeInfo": {
|
||||
"frame": "time.Time"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Line",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "tsNs",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "string",
|
||||
"typeInfo": {
|
||||
"frame": "string"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
{
|
||||
"code": "one\",",
|
||||
"location": "moon🌙"
|
||||
},
|
||||
{
|
||||
"code": "\",two",
|
||||
"location": "moon🌙"
|
||||
},
|
||||
{
|
||||
"code": "\",two",
|
||||
"location": "moon🌙"
|
||||
},
|
||||
{
|
||||
"code": "\",two",
|
||||
"location": "moon🌙"
|
||||
},
|
||||
{
|
||||
"code": "\",two",
|
||||
"location": "moon🌙"
|
||||
},
|
||||
{
|
||||
"code": "\",two",
|
||||
"location": "moon🌙"
|
||||
}
|
||||
],
|
||||
[
|
||||
1645030244810,
|
||||
1645030247027,
|
||||
1645030246277,
|
||||
1645030246277,
|
||||
1645030245539,
|
||||
1645030244091
|
||||
],
|
||||
[
|
||||
"log line error 1",
|
||||
"log line info 1",
|
||||
"log line info 2",
|
||||
"log line info 2",
|
||||
"log line info 3",
|
||||
"log line info 4"
|
||||
],
|
||||
[
|
||||
"1645030244810757120",
|
||||
"1645030247027735040",
|
||||
"1645030246277587968",
|
||||
"1645030246277587968",
|
||||
"1645030245539423744",
|
||||
"1645030244091700992"
|
||||
],
|
||||
[
|
||||
"1645030244810757120_1d8c2178_sq",
|
||||
"1645030247027735040_87a7aed2_sq",
|
||||
"1645030246277587968_318d05c9_sq",
|
||||
"1645030246277587968_318d05c9_1_sq",
|
||||
"1645030245539423744_fd17f65c_sq",
|
||||
"1645030244091700992_62ae07f3_sq"
|
||||
]
|
||||
],
|
||||
"nanos": [
|
||||
null,
|
||||
[
|
||||
757120,
|
||||
735040,
|
||||
587968,
|
||||
587968,
|
||||
423744,
|
||||
700992
|
||||
],
|
||||
null,
|
||||
null,
|
||||
null
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
80
pkg/tsdb/loki/testdata_metric_dataplane/streams_simple.json
Normal file
80
pkg/tsdb/loki/testdata_metric_dataplane/streams_simple.json
Normal file
@ -0,0 +1,80 @@
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"resultType": "streams",
|
||||
"result": [
|
||||
{
|
||||
"stream": {
|
||||
"code": "one\",",
|
||||
"location": "moon🌙"
|
||||
},
|
||||
"values": [
|
||||
[
|
||||
"1645030244810757120",
|
||||
"log line error 1"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"stream": {
|
||||
"code": "\",two",
|
||||
"location": "moon🌙"
|
||||
},
|
||||
"values": [
|
||||
[
|
||||
"1645030247027735040",
|
||||
"log line info 1"
|
||||
],
|
||||
[
|
||||
"1645030246277587968",
|
||||
"log line info 2"
|
||||
],
|
||||
[
|
||||
"1645030246277587968",
|
||||
"log line info 2"
|
||||
],
|
||||
[
|
||||
"1645030245539423744",
|
||||
"log line info 3"
|
||||
],
|
||||
[
|
||||
"1645030244091700992",
|
||||
"log line info 4"
|
||||
]
|
||||
]
|
||||
}
|
||||
],
|
||||
"stats": {
|
||||
"summary": {
|
||||
"bytesProcessedPerSecond": 3507022,
|
||||
"linesProcessedPerSecond": 24818,
|
||||
"totalBytesProcessed": 7772,
|
||||
"totalLinesProcessed": 55,
|
||||
"execTime": 0.002216125
|
||||
},
|
||||
"store": {
|
||||
"totalChunksRef": 2,
|
||||
"totalChunksDownloaded": 3,
|
||||
"chunksDownloadTime": 0.000390958,
|
||||
"headChunkBytes": 4,
|
||||
"headChunkLines": 5,
|
||||
"decompressedBytes": 7772,
|
||||
"decompressedLines": 55,
|
||||
"compressedBytes": 31432,
|
||||
"totalDuplicates": 6
|
||||
},
|
||||
"ingester": {
|
||||
"totalReached": 7,
|
||||
"totalChunksMatched": 8,
|
||||
"totalBatches": 9,
|
||||
"totalLinesSent": 10,
|
||||
"headChunkBytes": 11,
|
||||
"headChunkLines": 12,
|
||||
"decompressedBytes": 13,
|
||||
"decompressedLines": 14,
|
||||
"compressedBytes": 15,
|
||||
"totalDuplicates": 16
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
//
|
||||
// Frame[0] {
|
||||
// "type": "numeric-multi",
|
||||
// "typeVersion": [
|
||||
// 0,
|
||||
// 1
|
||||
// ],
|
||||
// "executedQueryString": "Expr: query1"
|
||||
// }
|
||||
// Name:
|
||||
// Dimensions: 2 Fields by 1 Rows
|
||||
// +-------------------------------+------------------------------------+
|
||||
// | Name: Time | Name: Value |
|
||||
// | Labels: | Labels: level=error, location=moon |
|
||||
// | Type: []time.Time | Type: []float64 |
|
||||
// +-------------------------------+------------------------------------+
|
||||
// | 2022-02-16 16:41:39 +0000 UTC | 23 |
|
||||
// +-------------------------------+------------------------------------+
|
||||
//
|
||||
//
|
||||
//
|
||||
// Frame[1] {
|
||||
// "type": "numeric-multi",
|
||||
// "typeVersion": [
|
||||
// 0,
|
||||
// 1
|
||||
// ],
|
||||
// "executedQueryString": "Expr: query1"
|
||||
// }
|
||||
// Name:
|
||||
// Dimensions: 2 Fields by 1 Rows
|
||||
// +-------------------------------+-----------------------------------+
|
||||
// | Name: Time | Name: Value |
|
||||
// | Labels: | Labels: level=info, location=moon |
|
||||
// | Type: []time.Time | Type: []float64 |
|
||||
// +-------------------------------+-----------------------------------+
|
||||
// | 2022-02-16 16:41:39 +0000 UTC | 47 |
|
||||
// +-------------------------------+-----------------------------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
{
|
||||
"status": 200,
|
||||
"frames": [
|
||||
{
|
||||
"schema": {
|
||||
"meta": {
|
||||
"type": "numeric-multi",
|
||||
"typeVersion": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"executedQueryString": "Expr: query1"
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "Time",
|
||||
"type": "time",
|
||||
"typeInfo": {
|
||||
"frame": "time.Time"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Value",
|
||||
"type": "number",
|
||||
"typeInfo": {
|
||||
"frame": "float64"
|
||||
},
|
||||
"labels": {
|
||||
"level": "error",
|
||||
"location": "moon"
|
||||
},
|
||||
"config": {
|
||||
"displayNameFromDS": "{level=\"error\", location=\"moon\"}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
1645029699000
|
||||
],
|
||||
[
|
||||
23
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"schema": {
|
||||
"meta": {
|
||||
"type": "numeric-multi",
|
||||
"typeVersion": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"executedQueryString": "Expr: query1"
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "Time",
|
||||
"type": "time",
|
||||
"typeInfo": {
|
||||
"frame": "time.Time"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Value",
|
||||
"type": "number",
|
||||
"typeInfo": {
|
||||
"frame": "float64"
|
||||
},
|
||||
"labels": {
|
||||
"level": "info",
|
||||
"location": "moon"
|
||||
},
|
||||
"config": {
|
||||
"displayNameFromDS": "{level=\"info\", location=\"moon\"}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
1645029699000
|
||||
],
|
||||
[
|
||||
47
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
16
pkg/tsdb/loki/testdata_metric_dataplane/vector_simple.json
Normal file
16
pkg/tsdb/loki/testdata_metric_dataplane/vector_simple.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"resultType": "vector",
|
||||
"result": [
|
||||
{
|
||||
"metric": { "level": "error", "location": "moon"},
|
||||
"value": [1645029699, "23"]
|
||||
},
|
||||
{
|
||||
"metric": { "level": "info", "location": "moon" },
|
||||
"value": [1645029699, "47"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,226 @@
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
//
|
||||
// Frame[0] {
|
||||
// "type": "numeric-multi",
|
||||
// "typeVersion": [
|
||||
// 0,
|
||||
// 1
|
||||
// ],
|
||||
// "executedQueryString": "Expr: query1"
|
||||
// }
|
||||
// Name:
|
||||
// Dimensions: 2 Fields by 1 Rows
|
||||
// +-------------------------------+------------------------------------+
|
||||
// | Name: Time | Name: Value |
|
||||
// | Labels: | Labels: level=error, location=moon |
|
||||
// | Type: []time.Time | Type: []float64 |
|
||||
// +-------------------------------+------------------------------------+
|
||||
// | 2022-02-16 16:41:39 +0000 UTC | +Inf |
|
||||
// +-------------------------------+------------------------------------+
|
||||
//
|
||||
//
|
||||
//
|
||||
// Frame[1] {
|
||||
// "type": "numeric-multi",
|
||||
// "typeVersion": [
|
||||
// 0,
|
||||
// 1
|
||||
// ],
|
||||
// "executedQueryString": "Expr: query1"
|
||||
// }
|
||||
// Name:
|
||||
// Dimensions: 2 Fields by 1 Rows
|
||||
// +-------------------------------+-----------------------------------+
|
||||
// | Name: Time | Name: Value |
|
||||
// | Labels: | Labels: level=info, location=moon |
|
||||
// | Type: []time.Time | Type: []float64 |
|
||||
// +-------------------------------+-----------------------------------+
|
||||
// | 2022-02-16 16:41:39 +0000 UTC | -Inf |
|
||||
// +-------------------------------+-----------------------------------+
|
||||
//
|
||||
//
|
||||
//
|
||||
// Frame[2] {
|
||||
// "type": "numeric-multi",
|
||||
// "typeVersion": [
|
||||
// 0,
|
||||
// 1
|
||||
// ],
|
||||
// "executedQueryString": "Expr: query1"
|
||||
// }
|
||||
// Name:
|
||||
// Dimensions: 2 Fields by 1 Rows
|
||||
// +-------------------------------+------------------------------------+
|
||||
// | Name: Time | Name: Value |
|
||||
// | Labels: | Labels: level=debug, location=moon |
|
||||
// | Type: []time.Time | Type: []float64 |
|
||||
// +-------------------------------+------------------------------------+
|
||||
// | 2022-02-16 16:41:39 +0000 UTC | NaN |
|
||||
// +-------------------------------+------------------------------------+
|
||||
//
|
||||
//
|
||||
// 🌟 This was machine generated. Do not edit. 🌟
|
||||
{
|
||||
"status": 200,
|
||||
"frames": [
|
||||
{
|
||||
"schema": {
|
||||
"meta": {
|
||||
"type": "numeric-multi",
|
||||
"typeVersion": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"executedQueryString": "Expr: query1"
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "Time",
|
||||
"type": "time",
|
||||
"typeInfo": {
|
||||
"frame": "time.Time"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Value",
|
||||
"type": "number",
|
||||
"typeInfo": {
|
||||
"frame": "float64"
|
||||
},
|
||||
"labels": {
|
||||
"level": "error",
|
||||
"location": "moon"
|
||||
},
|
||||
"config": {
|
||||
"displayNameFromDS": "{level=\"error\", location=\"moon\"}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
1645029699000
|
||||
],
|
||||
[
|
||||
null
|
||||
]
|
||||
],
|
||||
"entities": [
|
||||
null,
|
||||
{
|
||||
"Inf": [
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"schema": {
|
||||
"meta": {
|
||||
"type": "numeric-multi",
|
||||
"typeVersion": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"executedQueryString": "Expr: query1"
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "Time",
|
||||
"type": "time",
|
||||
"typeInfo": {
|
||||
"frame": "time.Time"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Value",
|
||||
"type": "number",
|
||||
"typeInfo": {
|
||||
"frame": "float64"
|
||||
},
|
||||
"labels": {
|
||||
"level": "info",
|
||||
"location": "moon"
|
||||
},
|
||||
"config": {
|
||||
"displayNameFromDS": "{level=\"info\", location=\"moon\"}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
1645029699000
|
||||
],
|
||||
[
|
||||
null
|
||||
]
|
||||
],
|
||||
"entities": [
|
||||
null,
|
||||
{
|
||||
"NegInf": [
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"schema": {
|
||||
"meta": {
|
||||
"type": "numeric-multi",
|
||||
"typeVersion": [
|
||||
0,
|
||||
1
|
||||
],
|
||||
"executedQueryString": "Expr: query1"
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"name": "Time",
|
||||
"type": "time",
|
||||
"typeInfo": {
|
||||
"frame": "time.Time"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Value",
|
||||
"type": "number",
|
||||
"typeInfo": {
|
||||
"frame": "float64"
|
||||
},
|
||||
"labels": {
|
||||
"level": "debug",
|
||||
"location": "moon"
|
||||
},
|
||||
"config": {
|
||||
"displayNameFromDS": "{level=\"debug\", location=\"moon\"}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"values": [
|
||||
[
|
||||
1645029699000
|
||||
],
|
||||
[
|
||||
null
|
||||
]
|
||||
],
|
||||
"entities": [
|
||||
null,
|
||||
{
|
||||
"NaN": [
|
||||
0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"resultType": "vector",
|
||||
"result": [
|
||||
{
|
||||
"metric": { "level": "error", "location": "moon"},
|
||||
"value": [1645029699, "+Inf"]
|
||||
},
|
||||
{
|
||||
"metric": { "level": "info", "location": "moon" },
|
||||
"value": [1645029699, "-Inf"]
|
||||
},
|
||||
{
|
||||
"metric": { "level": "debug", "location": "moon" },
|
||||
"value": [1645029699, "NaN"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user