From e045860fbf449feb101d187730a46bb1cdab787a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Farkas?= Date: Thu, 13 Jul 2023 09:58:00 +0200 Subject: [PATCH] loki: generate dataplane-compliant logs dataframes (behind feature flag) (#69909) * add feature flag * prepare tests * enable dataplane-format in loki-backend --- .../feature-toggles/index.md | 1 + .../src/types/featureToggles.gen.ts | 1 + pkg/services/featuremgmt/registry.go | 6 + pkg/services/featuremgmt/toggles_gen.csv | 1 + pkg/services/featuremgmt/toggles_gen.go | 4 + pkg/tsdb/loki/frame.go | 62 ++- pkg/tsdb/loki/frame_test.go | 63 ++- pkg/tsdb/loki/framing_test.go | 6 +- pkg/tsdb/loki/loki.go | 4 +- .../testdata_dataplane/empty.golden.jsonc | 5 + pkg/tsdb/loki/testdata_dataplane/empty.json | 1 + .../matrix_gap.golden.jsonc | 87 +++++ .../loki/testdata_dataplane/matrix_gap.json | 19 + .../matrix_inf.golden.jsonc | 114 ++++++ .../loki/testdata_dataplane/matrix_inf.json | 25 ++ .../matrix_name.golden.jsonc | 75 ++++ .../loki/testdata_dataplane/matrix_name.json | 17 + .../matrix_nan.golden.jsonc | 88 +++++ .../loki/testdata_dataplane/matrix_nan.json | 16 + .../matrix_simple.golden.jsonc | 164 ++++++++ .../testdata_dataplane/matrix_simple.json | 33 ++ .../matrix_small_step.golden.jsonc | 83 ++++ .../testdata_dataplane/matrix_small_step.json | 19 + .../matrix_with_stats.golden.jsonc | 365 +++++++++++++++++ .../testdata_dataplane/matrix_with_stats.json | 60 +++ .../streams_parse_errors.golden.jsonc | 112 ++++++ .../streams_parse_errors.json | 29 ++ .../streams_simple.golden.jsonc | 357 +++++++++++++++++ .../testdata_dataplane/streams_simple.json | 80 ++++ .../vector_simple.golden.jsonc | 137 +++++++ .../testdata_dataplane/vector_simple.json | 16 + .../vector_special_values.golden.jsonc | 226 +++++++++++ .../vector_special_values.json | 20 + .../empty.golden.jsonc | 5 + .../loki/testdata_logs_dataplane/empty.json | 1 + .../matrix_gap.golden.jsonc | 88 +++++ .../testdata_logs_dataplane/matrix_gap.json | 19 + .../matrix_inf.golden.jsonc | 115 ++++++ .../testdata_logs_dataplane/matrix_inf.json | 25 ++ .../matrix_name.golden.jsonc | 76 ++++ .../testdata_logs_dataplane/matrix_name.json | 17 + .../matrix_nan.golden.jsonc | 89 +++++ .../testdata_logs_dataplane/matrix_nan.json | 16 + .../matrix_simple.golden.jsonc | 166 ++++++++ .../matrix_simple.json | 33 ++ .../matrix_small_step.golden.jsonc | 84 ++++ .../matrix_small_step.json | 19 + .../matrix_with_stats.golden.jsonc | 367 ++++++++++++++++++ .../matrix_with_stats.json | 60 +++ .../streams_parse_errors.golden.jsonc | 112 ++++++ .../streams_parse_errors.json | 29 ++ .../streams_simple.golden.jsonc | 357 +++++++++++++++++ .../streams_simple.json | 80 ++++ .../vector_simple.golden.jsonc | 139 +++++++ .../vector_simple.json | 16 + .../vector_special_values.golden.jsonc | 229 +++++++++++ .../vector_special_values.json | 20 + 57 files changed, 4435 insertions(+), 23 deletions(-) create mode 100644 pkg/tsdb/loki/testdata_dataplane/empty.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_dataplane/empty.json create mode 100644 pkg/tsdb/loki/testdata_dataplane/matrix_gap.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_dataplane/matrix_gap.json create mode 100644 pkg/tsdb/loki/testdata_dataplane/matrix_inf.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_dataplane/matrix_inf.json create mode 100644 pkg/tsdb/loki/testdata_dataplane/matrix_name.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_dataplane/matrix_name.json create mode 100644 pkg/tsdb/loki/testdata_dataplane/matrix_nan.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_dataplane/matrix_nan.json create mode 100644 pkg/tsdb/loki/testdata_dataplane/matrix_simple.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_dataplane/matrix_simple.json create mode 100644 pkg/tsdb/loki/testdata_dataplane/matrix_small_step.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_dataplane/matrix_small_step.json create mode 100644 pkg/tsdb/loki/testdata_dataplane/matrix_with_stats.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_dataplane/matrix_with_stats.json create mode 100644 pkg/tsdb/loki/testdata_dataplane/streams_parse_errors.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_dataplane/streams_parse_errors.json create mode 100644 pkg/tsdb/loki/testdata_dataplane/streams_simple.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_dataplane/streams_simple.json create mode 100644 pkg/tsdb/loki/testdata_dataplane/vector_simple.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_dataplane/vector_simple.json create mode 100644 pkg/tsdb/loki/testdata_dataplane/vector_special_values.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_dataplane/vector_special_values.json create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/empty.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/empty.json create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/matrix_gap.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/matrix_gap.json create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/matrix_inf.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/matrix_inf.json create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/matrix_name.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/matrix_name.json create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/matrix_nan.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/matrix_nan.json create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/matrix_simple.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/matrix_simple.json create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/matrix_small_step.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/matrix_small_step.json create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/matrix_with_stats.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/matrix_with_stats.json create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/streams_parse_errors.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/streams_parse_errors.json create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/streams_simple.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/streams_simple.json create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/vector_simple.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/vector_simple.json create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/vector_special_values.golden.jsonc create mode 100644 pkg/tsdb/loki/testdata_logs_dataplane/vector_special_values.json diff --git a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md index f7dc58851fc..61abf60d29c 100644 --- a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md +++ b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md @@ -103,6 +103,7 @@ Experimental features might be changed or removed without prior notice. | `prometheusResourceBrowserCache` | Displays browser caching options in Prometheus data source configuration | | `influxdbBackendMigration` | Query InfluxDB InfluxQL without the proxy | | `clientTokenRotation` | Replaces the current in-request token rotation so that the client initiates the rotation | +| `lokiLogsDataplane` | Changes logs responses from Loki to be compliant with the dataplane specification. | | `disableSSEDataplane` | Disables dataplane specific processing in server side expressions. | | `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. | diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts index e470a82ca52..c7bb1c3e7d4 100644 --- a/packages/grafana-data/src/types/featureToggles.gen.ts +++ b/packages/grafana-data/src/types/featureToggles.gen.ts @@ -78,6 +78,7 @@ export interface FeatureToggles { clientTokenRotation?: boolean; prometheusDataplane?: boolean; lokiMetricDataplane?: boolean; + lokiLogsDataplane?: boolean; dataplaneFrontendFallback?: boolean; disableSSEDataplane?: boolean; alertStateHistoryLokiSecondary?: boolean; diff --git a/pkg/services/featuremgmt/registry.go b/pkg/services/featuremgmt/registry.go index 6c2c2995a77..fccfc55ba0b 100644 --- a/pkg/services/featuremgmt/registry.go +++ b/pkg/services/featuremgmt/registry.go @@ -411,6 +411,12 @@ var ( Expression: "true", Owner: grafanaObservabilityLogsSquad, }, + { + Name: "lokiLogsDataplane", + Description: "Changes logs responses from Loki to be compliant with the dataplane specification.", + Stage: FeatureStageExperimental, + Owner: grafanaObservabilityLogsSquad, + }, { Name: "dataplaneFrontendFallback", Description: "Support dataplane contract field name change for transformations and field name matchers where the name is different", diff --git a/pkg/services/featuremgmt/toggles_gen.csv b/pkg/services/featuremgmt/toggles_gen.csv index 05fcc46eea3..b9eb5966cce 100644 --- a/pkg/services/featuremgmt/toggles_gen.csv +++ b/pkg/services/featuremgmt/toggles_gen.csv @@ -59,6 +59,7 @@ influxdbBackendMigration,experimental,@grafana/observability-metrics,false,false clientTokenRotation,experimental,@grafana/grafana-authnz-team,false,false,false,false prometheusDataplane,GA,@grafana/observability-metrics,false,false,false,false lokiMetricDataplane,GA,@grafana/observability-logs,false,false,false,false +lokiLogsDataplane,experimental,@grafana/observability-logs,false,false,false,false dataplaneFrontendFallback,GA,@grafana/observability-metrics,false,false,false,true disableSSEDataplane,experimental,@grafana/observability-metrics,false,false,false,false alertStateHistoryLokiSecondary,experimental,@grafana/alerting-squad,false,false,false,false diff --git a/pkg/services/featuremgmt/toggles_gen.go b/pkg/services/featuremgmt/toggles_gen.go index 53e962cc790..53d37a1667c 100644 --- a/pkg/services/featuremgmt/toggles_gen.go +++ b/pkg/services/featuremgmt/toggles_gen.go @@ -247,6 +247,10 @@ const ( // Changes metric responses from Loki to be compliant with the dataplane specification. FlagLokiMetricDataplane = "lokiMetricDataplane" + // FlagLokiLogsDataplane + // Changes logs responses from Loki to be compliant with the dataplane specification. + FlagLokiLogsDataplane = "lokiLogsDataplane" + // FlagDataplaneFrontendFallback // Support dataplane contract field name change for transformations and field name matchers where the name is different FlagDataplaneFrontendFallback = "dataplaneFrontendFallback" diff --git a/pkg/tsdb/loki/frame.go b/pkg/tsdb/loki/frame.go index 90fe1097139..aa9cc3f3209 100644 --- a/pkg/tsdb/loki/frame.go +++ b/pkg/tsdb/loki/frame.go @@ -12,7 +12,7 @@ import ( // we adjust the dataframes to be the way frontend & alerting // wants them. -func adjustFrame(frame *data.Frame, query *lokiQuery, setMetricFrameName bool) error { +func adjustFrame(frame *data.Frame, query *lokiQuery, setMetricFrameName bool, logsDataplane bool) error { fields := frame.Fields if len(fields) < 2 { @@ -27,7 +27,7 @@ func adjustFrame(frame *data.Frame, query *lokiQuery, setMetricFrameName bool) e if secondField.Type() == data.FieldTypeFloat64 { return adjustMetricFrame(frame, query, setMetricFrameName) } else { - return adjustLogsFrame(frame, query) + return adjustLogsFrame(frame, query, logsDataplane) } } @@ -82,7 +82,15 @@ func adjustMetricFrame(frame *data.Frame, query *lokiQuery, setFrameName bool) e return nil } -func adjustLogsFrame(frame *data.Frame, query *lokiQuery) error { +func adjustLogsFrame(frame *data.Frame, query *lokiQuery, dataplane bool) error { + if dataplane { + return adjustDataplaneLogsFrame(frame, query) + } else { + return adjustLegacyLogsFrame(frame, query) + } +} + +func adjustLegacyLogsFrame(frame *data.Frame, query *lokiQuery) error { // we check if the fields are of correct type and length fields := frame.Fields if len(fields) != 4 { @@ -138,6 +146,54 @@ func adjustLogsFrame(frame *data.Frame, query *lokiQuery) error { return nil } +func adjustDataplaneLogsFrame(frame *data.Frame, query *lokiQuery) error { + // we check if the fields are of correct type and length + fields := frame.Fields + if len(fields) != 4 { + return fmt.Errorf("invalid fields in logs frame") + } + + labelsField := fields[0] + timeField := fields[1] + lineField := fields[2] + stringTimeField := fields[3] + + if (timeField.Type() != data.FieldTypeTime) || (lineField.Type() != data.FieldTypeString) || (labelsField.Type() != data.FieldTypeJSON) || (stringTimeField.Type() != data.FieldTypeString) { + return fmt.Errorf("invalid fields in logs frame") + } + + if (timeField.Len() != lineField.Len()) || (timeField.Len() != labelsField.Len()) || (timeField.Len() != stringTimeField.Len()) { + return fmt.Errorf("invalid fields in logs frame") + } + + // this returns an error when the length of fields do not match + _, err := frame.RowLen() + if err != nil { + return err + } + + timeField.Name = "timestamp" + labelsField.Name = "attributes" + lineField.Name = "body" + + if frame.Meta == nil { + frame.Meta = &data.FrameMeta{} + } + + frame.Meta.Stats = parseStats(frame.Meta.Custom) + frame.Meta.Custom = nil + frame.Meta.Type = data.FrameTypeLogLines + + frame.Meta.ExecutedQueryString = "Expr: " + query.Expr + + idField, err := makeIdField(stringTimeField, lineField, labelsField, query.RefID) + if err != nil { + return err + } + frame.Fields = data.Fields{labelsField, timeField, lineField, idField} + return nil +} + func calculateCheckSum(time string, line string, labels []byte) (string, error) { input := []byte(line + "_") input = append(input, labels...) diff --git a/pkg/tsdb/loki/frame_test.go b/pkg/tsdb/loki/frame_test.go index f7cbc0d9a9b..fc821c5bcd6 100644 --- a/pkg/tsdb/loki/frame_test.go +++ b/pkg/tsdb/loki/frame_test.go @@ -77,9 +77,7 @@ func TestAdjustFrame(t *testing.T) { verifyFrame := func(frame *data.Frame) { fields := frame.Fields - require.Equal(t, 5, len(fields)) - - idField := fields[4] + idField := fields[len(fields)-1] require.Equal(t, "id", idField.Name) require.Equal(t, data.FieldTypeString, idField.Type()) require.Equal(t, 4, idField.Len()) @@ -91,12 +89,22 @@ func TestAdjustFrame(t *testing.T) { frame := makeFrame() - err := adjustFrame(frame, query, true) + err := adjustFrame(frame, query, true, false) require.NoError(t, err) verifyFrame(frame) frame = makeFrame() // we need to reset the frame, because adjustFrame mutates it - err = adjustFrame(frame, query, false) + err = adjustFrame(frame, query, false, false) + require.NoError(t, err) + verifyFrame(frame) + + frame = makeFrame() // we need to reset the frame, because adjustFrame mutates it + err = adjustFrame(frame, query, true, true) + require.NoError(t, err) + verifyFrame(frame) + + frame = makeFrame() // we need to reset the frame, because adjustFrame mutates it + err = adjustFrame(frame, query, false, true) require.NoError(t, err) verifyFrame(frame) }) @@ -112,6 +120,13 @@ func TestAdjustFrame(t *testing.T) { return frame } + verifyFrame := func(frame *data.Frame, expectedFrameName string) { + require.Equal(t, frame.Name, expectedFrameName) + 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") + } + query := &lokiQuery{ Expr: "up(ALERTS)", QueryType: QueryTypeRange, @@ -120,22 +135,28 @@ func TestAdjustFrame(t *testing.T) { } frame := makeFrame() - err := adjustFrame(frame, query, true) + err := adjustFrame(frame, query, true, false) 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") + verifyFrame(frame, "legend Application") frame = makeFrame() - err = adjustFrame(frame, query, false) + err = adjustFrame(frame, query, false, 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") + verifyFrame(frame, "") + + frame = makeFrame() + err = adjustFrame(frame, query, true, true) + require.NoError(t, err) + + verifyFrame(frame, "legend Application") + + frame = makeFrame() + err = adjustFrame(frame, query, false, true) + require.NoError(t, err) + + verifyFrame(frame, "") }) t.Run("should set interval-attribute in response", func(t *testing.T) { @@ -167,11 +188,19 @@ func TestAdjustFrame(t *testing.T) { frame := makeFrame() - err := adjustFrame(frame, query, true) + err := adjustFrame(frame, query, true, false) require.NoError(t, err) verifyFrame(frame) - err = adjustFrame(frame, query, false) + err = adjustFrame(frame, query, false, false) + require.NoError(t, err) + verifyFrame(frame) + + err = adjustFrame(frame, query, true, true) + require.NoError(t, err) + verifyFrame(frame) + + err = adjustFrame(frame, query, false, true) require.NoError(t, err) verifyFrame(frame) }) diff --git a/pkg/tsdb/loki/framing_test.go b/pkg/tsdb/loki/framing_test.go index 6a62b1ce3e5..3d612751852 100644 --- a/pkg/tsdb/loki/framing_test.go +++ b/pkg/tsdb/loki/framing_test.go @@ -72,8 +72,10 @@ func TestSuccessResponse(t *testing.T) { for _, test := range tt { t.Run(test.name, func(t *testing.T) { - runTest("testdata", test.filepath, test.query, ResponseOpts{metricDataplane: false}) - runTest("testdata_metric_dataplane", test.filepath, test.query, ResponseOpts{metricDataplane: true}) + runTest("testdata", test.filepath, test.query, ResponseOpts{metricDataplane: false, logsDataplane: false}) + runTest("testdata_metric_dataplane", test.filepath, test.query, ResponseOpts{metricDataplane: true, logsDataplane: false}) + runTest("testdata_logs_dataplane", test.filepath, test.query, ResponseOpts{metricDataplane: false, logsDataplane: true}) + runTest("testdata_dataplane", test.filepath, test.query, ResponseOpts{metricDataplane: true, logsDataplane: true}) }) } } diff --git a/pkg/tsdb/loki/loki.go b/pkg/tsdb/loki/loki.go index 7e15f349acf..93c8f81d39b 100644 --- a/pkg/tsdb/loki/loki.go +++ b/pkg/tsdb/loki/loki.go @@ -65,6 +65,7 @@ type QueryJSONModel struct { type ResponseOpts struct { metricDataplane bool + logsDataplane bool } func parseQueryModel(raw json.RawMessage) (*QueryJSONModel, error) { @@ -150,6 +151,7 @@ func (s *Service) QueryData(ctx context.Context, req *backend.QueryDataRequest) responseOpts := ResponseOpts{ metricDataplane: s.features.IsEnabled(featuremgmt.FlagLokiMetricDataplane), + logsDataplane: s.features.IsEnabled(featuremgmt.FlagLokiLogsDataplane), } return queryData(ctx, req, dsInfo, responseOpts, s.tracer) @@ -202,7 +204,7 @@ func runQuery(ctx context.Context, api *LokiAPI, query *lokiQuery, responseOpts } for _, frame := range frames { - if err = adjustFrame(frame, query, !responseOpts.metricDataplane); err != nil { + if err = adjustFrame(frame, query, !responseOpts.metricDataplane, responseOpts.logsDataplane); err != nil { return data.Frames{}, err } if err != nil { diff --git a/pkg/tsdb/loki/testdata_dataplane/empty.golden.jsonc b/pkg/tsdb/loki/testdata_dataplane/empty.golden.jsonc new file mode 100644 index 00000000000..e63a03ad551 --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/empty.golden.jsonc @@ -0,0 +1,5 @@ +// 🌟 This was machine generated. Do not edit. 🌟 +// 🌟 This was machine generated. Do not edit. 🌟 +{ + "status": 200 +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_dataplane/empty.json b/pkg/tsdb/loki/testdata_dataplane/empty.json new file mode 100644 index 00000000000..9e26dfeeb6e --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/empty.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_dataplane/matrix_gap.golden.jsonc b/pkg/tsdb/loki/testdata_dataplane/matrix_gap.golden.jsonc new file mode 100644 index 00000000000..1e8a5475657 --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/matrix_gap.golden.jsonc @@ -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 + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_dataplane/matrix_gap.json b/pkg/tsdb/loki/testdata_dataplane/matrix_gap.json new file mode 100644 index 00000000000..dbb9224b65d --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/matrix_gap.json @@ -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"] + ] + } + ] + } +} diff --git a/pkg/tsdb/loki/testdata_dataplane/matrix_inf.golden.jsonc b/pkg/tsdb/loki/testdata_dataplane/matrix_inf.golden.jsonc new file mode 100644 index 00000000000..37ee3459d86 --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/matrix_inf.golden.jsonc @@ -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 + ] + } + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_dataplane/matrix_inf.json b/pkg/tsdb/loki/testdata_dataplane/matrix_inf.json new file mode 100644 index 00000000000..a7f95130dc3 --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/matrix_inf.json @@ -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"] + ] + } + ] + } +} diff --git a/pkg/tsdb/loki/testdata_dataplane/matrix_name.golden.jsonc b/pkg/tsdb/loki/testdata_dataplane/matrix_name.golden.jsonc new file mode 100644 index 00000000000..76d4efd9a3a --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/matrix_name.golden.jsonc @@ -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 + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_dataplane/matrix_name.json b/pkg/tsdb/loki/testdata_dataplane/matrix_name.json new file mode 100644 index 00000000000..7870730fd9e --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/matrix_name.json @@ -0,0 +1,17 @@ +{ + "status": "success", + "data": { + "resultType": "matrix", + "result": [ + { + "metric": { + "level": "error", + "__name__": "moon" + }, + "values": [ + [1639125366.989, "0.4"] + ] + } + ] + } +} diff --git a/pkg/tsdb/loki/testdata_dataplane/matrix_nan.golden.jsonc b/pkg/tsdb/loki/testdata_dataplane/matrix_nan.golden.jsonc new file mode 100644 index 00000000000..4b3a625e366 --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/matrix_nan.golden.jsonc @@ -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 + ] + } + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_dataplane/matrix_nan.json b/pkg/tsdb/loki/testdata_dataplane/matrix_nan.json new file mode 100644 index 00000000000..e862c581992 --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/matrix_nan.json @@ -0,0 +1,16 @@ +{ + "status": "success", + "data": { + "resultType": "matrix", + "result": [ + { + "metric": {}, + "values": [ + [1643014450.417, "NaN"], + [1643014750.517, "nan"], + [1643014450.617, "nAn"] + ] + } + ] + } +} diff --git a/pkg/tsdb/loki/testdata_dataplane/matrix_simple.golden.jsonc b/pkg/tsdb/loki/testdata_dataplane/matrix_simple.golden.jsonc new file mode 100644 index 00000000000..c7436ab811a --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/matrix_simple.golden.jsonc @@ -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 + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_dataplane/matrix_simple.json b/pkg/tsdb/loki/testdata_dataplane/matrix_simple.json new file mode 100644 index 00000000000..8b3608d2f0b --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/matrix_simple.json @@ -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"] + ] + } + ] + } +} diff --git a/pkg/tsdb/loki/testdata_dataplane/matrix_small_step.golden.jsonc b/pkg/tsdb/loki/testdata_dataplane/matrix_small_step.golden.jsonc new file mode 100644 index 00000000000..6a515e6c823 --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/matrix_small_step.golden.jsonc @@ -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 + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_dataplane/matrix_small_step.json b/pkg/tsdb/loki/testdata_dataplane/matrix_small_step.json new file mode 100644 index 00000000000..7d0d2067548 --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/matrix_small_step.json @@ -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"] + ] + } + ] + } +} diff --git a/pkg/tsdb/loki/testdata_dataplane/matrix_with_stats.golden.jsonc b/pkg/tsdb/loki/testdata_dataplane/matrix_with_stats.golden.jsonc new file mode 100644 index 00000000000..dc46ac1d1e2 --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/matrix_with_stats.golden.jsonc @@ -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 + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_dataplane/matrix_with_stats.json b/pkg/tsdb/loki/testdata_dataplane/matrix_with_stats.json new file mode 100644 index 00000000000..609ce7ff170 --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/matrix_with_stats.json @@ -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 + } + } + } +} diff --git a/pkg/tsdb/loki/testdata_dataplane/streams_parse_errors.golden.jsonc b/pkg/tsdb/loki/testdata_dataplane/streams_parse_errors.golden.jsonc new file mode 100644 index 00000000000..f7d072f5bab --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/streams_parse_errors.golden.jsonc @@ -0,0 +1,112 @@ +// 🌟 This was machine generated. Do not edit. 🌟 +// +// Frame[0] { +// "type": "log-lines", +// "typeVersion": [ +// 0, +// 0 +// ], +// "executedQueryString": "Expr: query1" +// } +// Name: +// Dimensions: 4 Fields by 4 Rows +// +------------------------------------------------+-------------------------------+----------------+------------------------------+ +// | Name: attributes | Name: timestamp | Name: body | Name: id | +// | Labels: | Labels: | Labels: | Labels: | +// | Type: []json.RawMessage | Type: []time.Time | Type: []string | Type: []string | +// +------------------------------------------------+-------------------------------+----------------+------------------------------+ +// | {"__error__":"LogfmtParserErr","place":"moon"} | 2022-06-17 06:49:51 +0000 UTC | "hello1 | 1655448591000000000_44cbf4ec | +// | {"__error__":"LogfmtParserErr","place":"moon"} | 2022-06-17 06:49:54 +0000 UTC | "hello4 | 1655448594000000000_408b3f5b | +// | {"place":"moon","text":"hello3"} | 2022-06-17 06:49:52 +0000 UTC | text=hello2 | 1655448592000000000_d1b2086 | +// | {"place":"moon","text":"hello4"} | 2022-06-17 06:49:53 +0000 UTC | text=hello3 | 1655448593000000000_45714922 | +// +------------------------------------------------+-------------------------------+----------------+------------------------------+ +// +// +// 🌟 This was machine generated. Do not edit. 🌟 +{ + "status": 200, + "frames": [ + { + "schema": { + "meta": { + "type": "log-lines", + "typeVersion": [ + 0, + 0 + ], + "executedQueryString": "Expr: query1" + }, + "fields": [ + { + "name": "attributes", + "type": "other", + "typeInfo": { + "frame": "json.RawMessage" + } + }, + { + "name": "timestamp", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "body", + "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_44cbf4ec", + "1655448594000000000_408b3f5b", + "1655448592000000000_d1b2086", + "1655448593000000000_45714922" + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_dataplane/streams_parse_errors.json b/pkg/tsdb/loki/testdata_dataplane/streams_parse_errors.json new file mode 100644 index 00000000000..3df7cd09781 --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/streams_parse_errors.json @@ -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"]] + } + ] + } +} diff --git a/pkg/tsdb/loki/testdata_dataplane/streams_simple.golden.jsonc b/pkg/tsdb/loki/testdata_dataplane/streams_simple.golden.jsonc new file mode 100644 index 00000000000..44d9d82d383 --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/streams_simple.golden.jsonc @@ -0,0 +1,357 @@ +// 🌟 This was machine generated. Do not edit. 🌟 +// +// Frame[0] { +// "type": "log-lines", +// "typeVersion": [ +// 0, +// 0 +// ], +// "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: 4 Fields by 6 Rows +// +---------------------------------------+-----------------------------------------+------------------+--------------------------------+ +// | Name: attributes | Name: timestamp | Name: body | Name: id | +// | Labels: | Labels: | Labels: | Labels: | +// | Type: []json.RawMessage | Type: []time.Time | Type: []string | Type: []string | +// +---------------------------------------+-----------------------------------------+------------------+--------------------------------+ +// | {"code":"one\",","location":"moonπŸŒ™"} | 2022-02-16 16:50:44.81075712 +0000 UTC | log line error 1 | 1645030244810757120_1d8c2178 | +// | {"code":"\",two","location":"moonπŸŒ™"} | 2022-02-16 16:50:47.02773504 +0000 UTC | log line info 1 | 1645030247027735040_87a7aed2 | +// | {"code":"\",two","location":"moonπŸŒ™"} | 2022-02-16 16:50:46.277587968 +0000 UTC | log line info 2 | 1645030246277587968_318d05c9 | +// | {"code":"\",two","location":"moonπŸŒ™"} | 2022-02-16 16:50:46.277587968 +0000 UTC | log line info 2 | 1645030246277587968_318d05c9_1 | +// | {"code":"\",two","location":"moonπŸŒ™"} | 2022-02-16 16:50:45.539423744 +0000 UTC | log line info 3 | 1645030245539423744_fd17f65c | +// | {"code":"\",two","location":"moonπŸŒ™"} | 2022-02-16 16:50:44.091700992 +0000 UTC | log line info 4 | 1645030244091700992_62ae07f3 | +// +---------------------------------------+-----------------------------------------+------------------+--------------------------------+ +// +// +// 🌟 This was machine generated. Do not edit. 🌟 +{ + "status": 200, + "frames": [ + { + "schema": { + "meta": { + "type": "log-lines", + "typeVersion": [ + 0, + 0 + ], + "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": "attributes", + "type": "other", + "typeInfo": { + "frame": "json.RawMessage" + } + }, + { + "name": "timestamp", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "body", + "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_1d8c2178", + "1645030247027735040_87a7aed2", + "1645030246277587968_318d05c9", + "1645030246277587968_318d05c9_1", + "1645030245539423744_fd17f65c", + "1645030244091700992_62ae07f3" + ] + ], + "nanos": [ + null, + [ + 757120, + 735040, + 587968, + 587968, + 423744, + 700992 + ], + null, + null + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_dataplane/streams_simple.json b/pkg/tsdb/loki/testdata_dataplane/streams_simple.json new file mode 100644 index 00000000000..71c0d4ab44b --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/streams_simple.json @@ -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 + } + } + } +} diff --git a/pkg/tsdb/loki/testdata_dataplane/vector_simple.golden.jsonc b/pkg/tsdb/loki/testdata_dataplane/vector_simple.golden.jsonc new file mode 100644 index 00000000000..f51330309f2 --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/vector_simple.golden.jsonc @@ -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 + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_dataplane/vector_simple.json b/pkg/tsdb/loki/testdata_dataplane/vector_simple.json new file mode 100644 index 00000000000..7c7154c1b71 --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/vector_simple.json @@ -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"] + } + ] + } +} diff --git a/pkg/tsdb/loki/testdata_dataplane/vector_special_values.golden.jsonc b/pkg/tsdb/loki/testdata_dataplane/vector_special_values.golden.jsonc new file mode 100644 index 00000000000..08abdedd52a --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/vector_special_values.golden.jsonc @@ -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 + ] + } + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_dataplane/vector_special_values.json b/pkg/tsdb/loki/testdata_dataplane/vector_special_values.json new file mode 100644 index 00000000000..18979ea3204 --- /dev/null +++ b/pkg/tsdb/loki/testdata_dataplane/vector_special_values.json @@ -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"] + } + ] + } +} diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/empty.golden.jsonc b/pkg/tsdb/loki/testdata_logs_dataplane/empty.golden.jsonc new file mode 100644 index 00000000000..e63a03ad551 --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/empty.golden.jsonc @@ -0,0 +1,5 @@ +// 🌟 This was machine generated. Do not edit. 🌟 +// 🌟 This was machine generated. Do not edit. 🌟 +{ + "status": 200 +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/empty.json b/pkg/tsdb/loki/testdata_logs_dataplane/empty.json new file mode 100644 index 00000000000..9e26dfeeb6e --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/empty.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/matrix_gap.golden.jsonc b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_gap.golden.jsonc new file mode 100644 index 00000000000..eba2fd2f4bb --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_gap.golden.jsonc @@ -0,0 +1,88 @@ +// 🌟 This was machine generated. Do not edit. 🌟 +// +// Frame[0] { +// "type": "timeseries-multi", +// "typeVersion": [ +// 0, +// 0 +// ], +// "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": { + "name": "{}", + "meta": { + "type": "timeseries-multi", + "typeVersion": [ + 0, + 0 + ], + "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 + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/matrix_gap.json b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_gap.json new file mode 100644 index 00000000000..dbb9224b65d --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_gap.json @@ -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"] + ] + } + ] + } +} diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/matrix_inf.golden.jsonc b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_inf.golden.jsonc new file mode 100644 index 00000000000..8ffd65e7835 --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_inf.golden.jsonc @@ -0,0 +1,115 @@ +// 🌟 This was machine generated. Do not edit. 🌟 +// +// Frame[0] { +// "type": "timeseries-multi", +// "typeVersion": [ +// 0, +// 0 +// ], +// "executedQueryString": "Expr: up(ALERTS)\nStep: 42s" +// } +// Name: {level="info", location="moon", protocol="http"} +// 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": { + "name": "{level=\"info\", location=\"moon\", protocol=\"http\"}", + "meta": { + "type": "timeseries-multi", + "typeVersion": [ + 0, + 0 + ], + "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 + ] + } + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/matrix_inf.json b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_inf.json new file mode 100644 index 00000000000..a7f95130dc3 --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_inf.json @@ -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"] + ] + } + ] + } +} diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/matrix_name.golden.jsonc b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_name.golden.jsonc new file mode 100644 index 00000000000..45d2e5fd6d0 --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_name.golden.jsonc @@ -0,0 +1,76 @@ +// 🌟 This was machine generated. Do not edit. 🌟 +// +// Frame[0] { +// "type": "timeseries-multi", +// "typeVersion": [ +// 0, +// 0 +// ], +// "executedQueryString": "Expr: up(ALERTS)\nStep: 42s" +// } +// Name: {__name__="moon", level="error"} +// 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": { + "name": "{__name__=\"moon\", level=\"error\"}", + "meta": { + "type": "timeseries-multi", + "typeVersion": [ + 0, + 0 + ], + "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 + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/matrix_name.json b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_name.json new file mode 100644 index 00000000000..7870730fd9e --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_name.json @@ -0,0 +1,17 @@ +{ + "status": "success", + "data": { + "resultType": "matrix", + "result": [ + { + "metric": { + "level": "error", + "__name__": "moon" + }, + "values": [ + [1639125366.989, "0.4"] + ] + } + ] + } +} diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/matrix_nan.golden.jsonc b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_nan.golden.jsonc new file mode 100644 index 00000000000..7f9f5417919 --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_nan.golden.jsonc @@ -0,0 +1,89 @@ +// 🌟 This was machine generated. Do not edit. 🌟 +// +// Frame[0] { +// "type": "timeseries-multi", +// "typeVersion": [ +// 0, +// 0 +// ], +// "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": { + "name": "{}", + "meta": { + "type": "timeseries-multi", + "typeVersion": [ + 0, + 0 + ], + "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 + ] + } + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/matrix_nan.json b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_nan.json new file mode 100644 index 00000000000..e862c581992 --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_nan.json @@ -0,0 +1,16 @@ +{ + "status": "success", + "data": { + "resultType": "matrix", + "result": [ + { + "metric": {}, + "values": [ + [1643014450.417, "NaN"], + [1643014750.517, "nan"], + [1643014450.617, "nAn"] + ] + } + ] + } +} diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/matrix_simple.golden.jsonc b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_simple.golden.jsonc new file mode 100644 index 00000000000..d8904b596c8 --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_simple.golden.jsonc @@ -0,0 +1,166 @@ +// 🌟 This was machine generated. Do not edit. 🌟 +// +// Frame[0] { +// "type": "timeseries-multi", +// "typeVersion": [ +// 0, +// 0 +// ], +// "executedQueryString": "Expr: up(ALERTS)\nStep: 42s" +// } +// Name: {level="error", location="moon"} +// 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, +// 0 +// ], +// "executedQueryString": "Expr: up(ALERTS)\nStep: 42s" +// } +// Name: {level="info", location="mars"} +// 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": { + "name": "{level=\"error\", location=\"moon\"}", + "meta": { + "type": "timeseries-multi", + "typeVersion": [ + 0, + 0 + ], + "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": { + "name": "{level=\"info\", location=\"mars\"}", + "meta": { + "type": "timeseries-multi", + "typeVersion": [ + 0, + 0 + ], + "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 + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/matrix_simple.json b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_simple.json new file mode 100644 index 00000000000..8b3608d2f0b --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_simple.json @@ -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"] + ] + } + ] + } +} diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/matrix_small_step.golden.jsonc b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_small_step.golden.jsonc new file mode 100644 index 00000000000..6079d871213 --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_small_step.golden.jsonc @@ -0,0 +1,84 @@ +// 🌟 This was machine generated. Do not edit. 🌟 +// +// Frame[0] { +// "type": "timeseries-multi", +// "typeVersion": [ +// 0, +// 0 +// ], +// "executedQueryString": "Expr: up(ALERTS)\nStep: 42s" +// } +// Name: {level="error"} +// 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": { + "name": "{level=\"error\"}", + "meta": { + "type": "timeseries-multi", + "typeVersion": [ + 0, + 0 + ], + "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 + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/matrix_small_step.json b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_small_step.json new file mode 100644 index 00000000000..7d0d2067548 --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_small_step.json @@ -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"] + ] + } + ] + } +} diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/matrix_with_stats.golden.jsonc b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_with_stats.golden.jsonc new file mode 100644 index 00000000000..ea7a81c148b --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_with_stats.golden.jsonc @@ -0,0 +1,367 @@ +// 🌟 This was machine generated. Do not edit. 🌟 +// +// Frame[0] { +// "type": "timeseries-multi", +// "typeVersion": [ +// 0, +// 0 +// ], +// "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: {level="error", location="moon"} +// 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, +// 0 +// ], +// "executedQueryString": "Expr: up(ALERTS)\nStep: 42s" +// } +// Name: {level="info", location="mars"} +// 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": { + "name": "{level=\"error\", location=\"moon\"}", + "meta": { + "type": "timeseries-multi", + "typeVersion": [ + 0, + 0 + ], + "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": { + "name": "{level=\"info\", location=\"mars\"}", + "meta": { + "type": "timeseries-multi", + "typeVersion": [ + 0, + 0 + ], + "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 + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/matrix_with_stats.json b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_with_stats.json new file mode 100644 index 00000000000..609ce7ff170 --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/matrix_with_stats.json @@ -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 + } + } + } +} diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/streams_parse_errors.golden.jsonc b/pkg/tsdb/loki/testdata_logs_dataplane/streams_parse_errors.golden.jsonc new file mode 100644 index 00000000000..f7d072f5bab --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/streams_parse_errors.golden.jsonc @@ -0,0 +1,112 @@ +// 🌟 This was machine generated. Do not edit. 🌟 +// +// Frame[0] { +// "type": "log-lines", +// "typeVersion": [ +// 0, +// 0 +// ], +// "executedQueryString": "Expr: query1" +// } +// Name: +// Dimensions: 4 Fields by 4 Rows +// +------------------------------------------------+-------------------------------+----------------+------------------------------+ +// | Name: attributes | Name: timestamp | Name: body | Name: id | +// | Labels: | Labels: | Labels: | Labels: | +// | Type: []json.RawMessage | Type: []time.Time | Type: []string | Type: []string | +// +------------------------------------------------+-------------------------------+----------------+------------------------------+ +// | {"__error__":"LogfmtParserErr","place":"moon"} | 2022-06-17 06:49:51 +0000 UTC | "hello1 | 1655448591000000000_44cbf4ec | +// | {"__error__":"LogfmtParserErr","place":"moon"} | 2022-06-17 06:49:54 +0000 UTC | "hello4 | 1655448594000000000_408b3f5b | +// | {"place":"moon","text":"hello3"} | 2022-06-17 06:49:52 +0000 UTC | text=hello2 | 1655448592000000000_d1b2086 | +// | {"place":"moon","text":"hello4"} | 2022-06-17 06:49:53 +0000 UTC | text=hello3 | 1655448593000000000_45714922 | +// +------------------------------------------------+-------------------------------+----------------+------------------------------+ +// +// +// 🌟 This was machine generated. Do not edit. 🌟 +{ + "status": 200, + "frames": [ + { + "schema": { + "meta": { + "type": "log-lines", + "typeVersion": [ + 0, + 0 + ], + "executedQueryString": "Expr: query1" + }, + "fields": [ + { + "name": "attributes", + "type": "other", + "typeInfo": { + "frame": "json.RawMessage" + } + }, + { + "name": "timestamp", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "body", + "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_44cbf4ec", + "1655448594000000000_408b3f5b", + "1655448592000000000_d1b2086", + "1655448593000000000_45714922" + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/streams_parse_errors.json b/pkg/tsdb/loki/testdata_logs_dataplane/streams_parse_errors.json new file mode 100644 index 00000000000..3df7cd09781 --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/streams_parse_errors.json @@ -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"]] + } + ] + } +} diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/streams_simple.golden.jsonc b/pkg/tsdb/loki/testdata_logs_dataplane/streams_simple.golden.jsonc new file mode 100644 index 00000000000..44d9d82d383 --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/streams_simple.golden.jsonc @@ -0,0 +1,357 @@ +// 🌟 This was machine generated. Do not edit. 🌟 +// +// Frame[0] { +// "type": "log-lines", +// "typeVersion": [ +// 0, +// 0 +// ], +// "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: 4 Fields by 6 Rows +// +---------------------------------------+-----------------------------------------+------------------+--------------------------------+ +// | Name: attributes | Name: timestamp | Name: body | Name: id | +// | Labels: | Labels: | Labels: | Labels: | +// | Type: []json.RawMessage | Type: []time.Time | Type: []string | Type: []string | +// +---------------------------------------+-----------------------------------------+------------------+--------------------------------+ +// | {"code":"one\",","location":"moonπŸŒ™"} | 2022-02-16 16:50:44.81075712 +0000 UTC | log line error 1 | 1645030244810757120_1d8c2178 | +// | {"code":"\",two","location":"moonπŸŒ™"} | 2022-02-16 16:50:47.02773504 +0000 UTC | log line info 1 | 1645030247027735040_87a7aed2 | +// | {"code":"\",two","location":"moonπŸŒ™"} | 2022-02-16 16:50:46.277587968 +0000 UTC | log line info 2 | 1645030246277587968_318d05c9 | +// | {"code":"\",two","location":"moonπŸŒ™"} | 2022-02-16 16:50:46.277587968 +0000 UTC | log line info 2 | 1645030246277587968_318d05c9_1 | +// | {"code":"\",two","location":"moonπŸŒ™"} | 2022-02-16 16:50:45.539423744 +0000 UTC | log line info 3 | 1645030245539423744_fd17f65c | +// | {"code":"\",two","location":"moonπŸŒ™"} | 2022-02-16 16:50:44.091700992 +0000 UTC | log line info 4 | 1645030244091700992_62ae07f3 | +// +---------------------------------------+-----------------------------------------+------------------+--------------------------------+ +// +// +// 🌟 This was machine generated. Do not edit. 🌟 +{ + "status": 200, + "frames": [ + { + "schema": { + "meta": { + "type": "log-lines", + "typeVersion": [ + 0, + 0 + ], + "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": "attributes", + "type": "other", + "typeInfo": { + "frame": "json.RawMessage" + } + }, + { + "name": "timestamp", + "type": "time", + "typeInfo": { + "frame": "time.Time" + } + }, + { + "name": "body", + "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_1d8c2178", + "1645030247027735040_87a7aed2", + "1645030246277587968_318d05c9", + "1645030246277587968_318d05c9_1", + "1645030245539423744_fd17f65c", + "1645030244091700992_62ae07f3" + ] + ], + "nanos": [ + null, + [ + 757120, + 735040, + 587968, + 587968, + 423744, + 700992 + ], + null, + null + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/streams_simple.json b/pkg/tsdb/loki/testdata_logs_dataplane/streams_simple.json new file mode 100644 index 00000000000..71c0d4ab44b --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/streams_simple.json @@ -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 + } + } + } +} diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/vector_simple.golden.jsonc b/pkg/tsdb/loki/testdata_logs_dataplane/vector_simple.golden.jsonc new file mode 100644 index 00000000000..56b61d137bd --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/vector_simple.golden.jsonc @@ -0,0 +1,139 @@ +// 🌟 This was machine generated. Do not edit. 🌟 +// +// Frame[0] { +// "type": "timeseries-multi", +// "typeVersion": [ +// 0, +// 0 +// ], +// "executedQueryString": "Expr: query1" +// } +// Name: {level="error", location="moon"} +// 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": "timeseries-multi", +// "typeVersion": [ +// 0, +// 0 +// ], +// "executedQueryString": "Expr: query1" +// } +// Name: {level="info", location="moon"} +// 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": { + "name": "{level=\"error\", location=\"moon\"}", + "meta": { + "type": "timeseries-multi", + "typeVersion": [ + 0, + 0 + ], + "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": { + "name": "{level=\"info\", location=\"moon\"}", + "meta": { + "type": "timeseries-multi", + "typeVersion": [ + 0, + 0 + ], + "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 + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/vector_simple.json b/pkg/tsdb/loki/testdata_logs_dataplane/vector_simple.json new file mode 100644 index 00000000000..7c7154c1b71 --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/vector_simple.json @@ -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"] + } + ] + } +} diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/vector_special_values.golden.jsonc b/pkg/tsdb/loki/testdata_logs_dataplane/vector_special_values.golden.jsonc new file mode 100644 index 00000000000..6db425707cb --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/vector_special_values.golden.jsonc @@ -0,0 +1,229 @@ +// 🌟 This was machine generated. Do not edit. 🌟 +// +// Frame[0] { +// "type": "timeseries-multi", +// "typeVersion": [ +// 0, +// 0 +// ], +// "executedQueryString": "Expr: query1" +// } +// Name: {level="error", location="moon"} +// 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": "timeseries-multi", +// "typeVersion": [ +// 0, +// 0 +// ], +// "executedQueryString": "Expr: query1" +// } +// Name: {level="info", location="moon"} +// 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": "timeseries-multi", +// "typeVersion": [ +// 0, +// 0 +// ], +// "executedQueryString": "Expr: query1" +// } +// Name: {level="debug", location="moon"} +// 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": { + "name": "{level=\"error\", location=\"moon\"}", + "meta": { + "type": "timeseries-multi", + "typeVersion": [ + 0, + 0 + ], + "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": { + "name": "{level=\"info\", location=\"moon\"}", + "meta": { + "type": "timeseries-multi", + "typeVersion": [ + 0, + 0 + ], + "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": { + "name": "{level=\"debug\", location=\"moon\"}", + "meta": { + "type": "timeseries-multi", + "typeVersion": [ + 0, + 0 + ], + "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 + ] + } + ] + } + } + ] +} \ No newline at end of file diff --git a/pkg/tsdb/loki/testdata_logs_dataplane/vector_special_values.json b/pkg/tsdb/loki/testdata_logs_dataplane/vector_special_values.json new file mode 100644 index 00000000000..18979ea3204 --- /dev/null +++ b/pkg/tsdb/loki/testdata_logs_dataplane/vector_special_values.json @@ -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"] + } + ] + } +}