From c8ecd0679b959665a7200d8a785d7e0b386cdbb8 Mon Sep 17 00:00:00 2001 From: Marcus Andersson Date: Tue, 4 Apr 2023 07:17:10 +0200 Subject: [PATCH 01/80] PluginExtensions: Adding full targets to the panel menu context (#65861) * Making sure we add the whole query to the dashboard panel context. * Adding some more tests. * Synced with main. --- .../src/types/pluginExtensions.ts | 9 ++--- .../dashboard/utils/getPanelMenu.test.ts | 4 +- .../features/dashboard/utils/getPanelMenu.ts | 7 +--- .../extensions/getPluginExtensions.test.ts | 39 +++++++++++++++++++ 4 files changed, 47 insertions(+), 12 deletions(-) diff --git a/packages/grafana-data/src/types/pluginExtensions.ts b/packages/grafana-data/src/types/pluginExtensions.ts index 796c4c6e24b..0d1fc7ff143 100644 --- a/packages/grafana-data/src/types/pluginExtensions.ts +++ b/packages/grafana-data/src/types/pluginExtensions.ts @@ -1,3 +1,5 @@ +import { DataQuery } from '@grafana/schema'; + import { RawTimeRange, TimeZone } from './time'; // Plugin Extensions types @@ -73,7 +75,7 @@ export type PluginExtensionPanelContext = { timeRange: RawTimeRange; timeZone: TimeZone; dashboard: Dashboard; - targets: Target[]; + targets: DataQuery[]; }; type Dashboard = { @@ -81,8 +83,3 @@ type Dashboard = { title: string; tags: string[]; }; - -type Target = { - pluginId: string; - refId: string; -}; diff --git a/public/app/features/dashboard/utils/getPanelMenu.test.ts b/public/app/features/dashboard/utils/getPanelMenu.test.ts index 41c0011959c..391f4bf82c1 100644 --- a/public/app/features/dashboard/utils/getPanelMenu.test.ts +++ b/public/app/features/dashboard/utils/getPanelMenu.test.ts @@ -228,7 +228,9 @@ describe('getPanelMenu()', () => { targets: [ { refId: 'A', - pluginId: 'testdata', + datasource: { + type: 'testdata', + }, }, ], dashboard: { diff --git a/public/app/features/dashboard/utils/getPanelMenu.ts b/public/app/features/dashboard/utils/getPanelMenu.ts index c8b7dea7086..405e971c6a0 100644 --- a/public/app/features/dashboard/utils/getPanelMenu.ts +++ b/public/app/features/dashboard/utils/getPanelMenu.ts @@ -332,16 +332,13 @@ function createExtensionContext(panel: PanelModel, dashboard: DashboardModel): P id: panel.id, pluginId: panel.type, title: panel.title, - timeRange: Object.assign({}, dashboard.time), + timeRange: dashboard.time, timeZone: dashboard.timezone, dashboard: { uid: dashboard.uid, title: dashboard.title, tags: Array.from(dashboard.tags), }, - targets: panel.targets.map((t) => ({ - refId: t.refId, - pluginId: t.datasource?.type ?? 'unknown', - })), + targets: panel.targets, }; } diff --git a/public/app/features/plugins/extensions/getPluginExtensions.test.ts b/public/app/features/plugins/extensions/getPluginExtensions.test.ts index d68b0e1f130..54d5b63b838 100644 --- a/public/app/features/plugins/extensions/getPluginExtensions.test.ts +++ b/public/app/features/plugins/extensions/getPluginExtensions.test.ts @@ -246,4 +246,43 @@ describe('getPluginExtensions()', () => { expect(global.console.warn).toHaveBeenCalledTimes(1); expect(global.console.warn).toHaveBeenCalledWith('[Plugin Extensions] Something went wrong!'); }); + + test('should pass a frozen copy of the context to the onClick() function', () => { + const context = { title: 'New title from the context!' }; + + link2.path = undefined; + link2.onClick = jest.fn(); + + const registry = createPluginExtensionRegistry([{ pluginId, extensionConfigs: [link2] }]); + const { extensions } = getPluginExtensions({ registry, context, extensionPointId: extensionPoint2 }); + const [extension] = extensions; + + assertPluginExtensionLink(extension); + extension.onClick?.({} as React.MouseEvent); + + const helpers = (link2.onClick as jest.Mock).mock.calls[0][1]; + + expect(link2.configure).toHaveBeenCalledTimes(1); + expect(Object.isFrozen(helpers.context)).toBe(true); + expect(() => { + helpers.context.title = 'New title'; + }).toThrow(); + }); + + test('should should not freeze the original context', () => { + const context = { + title: 'New title from the context!', + nested: { title: 'title' }, + array: ['a'], + }; + + const registry = createPluginExtensionRegistry([{ pluginId, extensionConfigs: [link2] }]); + getPluginExtensions({ registry, context, extensionPointId: extensionPoint2 }); + + expect(() => { + context.title = 'Updating the title'; + context.nested.title = 'new title'; + context.array.push('b'); + }).not.toThrow(); + }); }); From 673aee30c2fac3d6eefdb4c8a3fa40865122564c Mon Sep 17 00:00:00 2001 From: gotjosh Date: Tue, 4 Apr 2023 08:42:07 +0100 Subject: [PATCH 02/80] Feature Flags: Remove dev-mode and alpha from grpc server feature flag (#65789) * Feature Flags: Remove dev-mode from grpc server feature flag --------- Co-authored-by: Todd Treece Co-authored-by: Ryan McKinley --- .../configure-grafana/feature-toggles/index.md | 2 +- pkg/services/featuremgmt/registry.go | 9 ++++----- pkg/services/featuremgmt/toggles_gen.csv | 2 +- pkg/services/featuremgmt/toggles_gen.go | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) 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 d6061a3ee0a..1da4beab3fd 100644 --- a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md +++ b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md @@ -47,6 +47,7 @@ Some stable features are enabled by default. You can disable a stable feature by | `validateDashboardsOnSave` | Validate dashboard JSON POSTed to api/dashboards/db | | `autoMigrateOldPanels` | Migrate old angular panels to supported versions (graph, table-old, worldmap, etc) | | `disableAngular` | Dynamic flag to disable angular at runtime. The preferred method is to set `angular_support_enabled` to `false` in the [security] settings, which allows you to change the state at runtime. | +| `grpcServer` | Run the GRPC server | | `accessControlOnCall` | Access control primitives for OnCall | | `alertingNoNormalState` | Stop maintaining state of alerts that are not firing | | `disableElasticsearchBackendExploreQuery` | Disable executing of Elasticsearch Explore queries trough backend | @@ -113,6 +114,5 @@ The following toggles require explicitly setting Grafana's [app mode]({{< relref | Feature toggle name | Description | | ------------------- | --------------------------------------------------- | | `k8s` | Explore native k8s integrations | -| `grpcServer` | Run GRPC server | | `entityStore` | SQL-based entity store (requires storage flag also) | | `nestedFolders` | Enable folder nesting | diff --git a/pkg/services/featuremgmt/registry.go b/pkg/services/featuremgmt/registry.go index b4b8e57d68d..c3f84f0dee1 100644 --- a/pkg/services/featuremgmt/registry.go +++ b/pkg/services/featuremgmt/registry.go @@ -237,11 +237,10 @@ var ( Owner: grafanaUserEssentialsSquad, }, { - Name: "grpcServer", - Description: "Run GRPC server", - State: FeatureStateAlpha, - RequiresDevMode: true, - Owner: grafanaAppPlatformSquad, + Name: "grpcServer", + Description: "Run the GRPC server", + State: FeatureStateBeta, + Owner: grafanaAppPlatformSquad, }, { Name: "entityStore", diff --git a/pkg/services/featuremgmt/toggles_gen.csv b/pkg/services/featuremgmt/toggles_gen.csv index 576b6897651..ee34a99f725 100644 --- a/pkg/services/featuremgmt/toggles_gen.csv +++ b/pkg/services/featuremgmt/toggles_gen.csv @@ -34,7 +34,7 @@ logRequestsInstrumentedAsUnknown,alpha,@grafana/hosted-grafana-team,false,false, dataConnectionsConsole,stable,@grafana/plugins-platform-backend,false,false,false,false internationalization,stable,@grafana/user-essentials,false,false,false,false topnav,stable,@grafana/user-essentials,false,false,false,false -grpcServer,alpha,@grafana/grafana-app-platform-squad,true,false,false,false +grpcServer,beta,@grafana/grafana-app-platform-squad,false,false,false,false entityStore,alpha,@grafana/grafana-app-platform-squad,true,false,false,false cloudWatchCrossAccountQuerying,stable,@grafana/aws-plugins,false,false,false,false redshiftAsyncQueryDataSupport,alpha,@grafana/aws-plugins,false,false,false,true diff --git a/pkg/services/featuremgmt/toggles_gen.go b/pkg/services/featuremgmt/toggles_gen.go index a18c1c22196..e7c96cbe473 100644 --- a/pkg/services/featuremgmt/toggles_gen.go +++ b/pkg/services/featuremgmt/toggles_gen.go @@ -148,7 +148,7 @@ const ( FlagTopnav = "topnav" // FlagGrpcServer - // Run GRPC server + // Run the GRPC server FlagGrpcServer = "grpcServer" // FlagEntityStore From 1c6f8fd902082e22e2071427b7279f4f6c9f4a75 Mon Sep 17 00:00:00 2001 From: Kousik Mitra Date: Tue, 4 Apr 2023 15:16:10 +0530 Subject: [PATCH 03/80] Service Accounts: Allow unsetting token expiry date (#65862) * Fix: toggle to switch between no expiry * Remove redudant curly brace --- .../components/CreateTokenModal.tsx | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/public/app/features/serviceaccounts/components/CreateTokenModal.tsx b/public/app/features/serviceaccounts/components/CreateTokenModal.tsx index 85d78cd940f..a86e578c277 100644 --- a/public/app/features/serviceaccounts/components/CreateTokenModal.tsx +++ b/public/app/features/serviceaccounts/components/CreateTokenModal.tsx @@ -109,16 +109,14 @@ export const CreateTokenModal = ({ isOpen, token, serviceAccountLogin, onCreateT }} /> - {!isWithExpirationDate && ( - - - - )} + + + {isWithExpirationDate && ( Date: Tue, 4 Apr 2023 10:51:21 +0100 Subject: [PATCH 04/80] Loki docs: Reorder content of the loki docs (#65798) * reorder content of the loki docs * move explain query --- .../datasources/loki/query-editor/index.md | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/docs/sources/datasources/loki/query-editor/index.md b/docs/sources/datasources/loki/query-editor/index.md index abbce0d0c73..708a0d98ede 100644 --- a/docs/sources/datasources/loki/query-editor/index.md +++ b/docs/sources/datasources/loki/query-editor/index.md @@ -54,45 +54,10 @@ Code mode's autocompletion feature works automatically while typing. The query editor can autocomplete static functions, aggregations, and keywords, and also dynamic items like labels. The autocompletion dropdown includes documentation for the suggested items where available. -### Label browser - -You can use the Loki label browser to navigate through your labels and values, and build queries. - -**To navigate Loki and build a query:** - -1. Choose labels to locate. -1. Search for the values of your selected labels. - - The search field supports fuzzy search, and the label browser also supports faceting to list only possible label combinations. - -1. Choose a query type between [**logs query**]({{< relref "#create-a-log-query" >}}) and [**rate metrics query**]({{< relref "#create-a-metric-query" >}}). - You can also validate the selector. - -{{< figure src="/static/img/docs/v75/loki_label_browser.png" class="docs-image--no-shadow" max-width="800px" caption="The Loki label browser" >}} - -### Configure query settings - -| Name | Description | -| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **Type** | Selects the query type to run. The `instant` type queries against a single point in time. We use the "To" time from the time range. The `range` type queries over the selected range of time. | -| **Line limit** | Defines the upper limit for the number of log lines returned by a query. The default is Loki's configured maximum lines limit. | -| **Legend** | _(Available only in a dashboard)_ Controls the time series name, using a name or pattern. For example, `{{hostname}}` is replaced with the label value for the label `hostname`. | -| **Resolution** | Sets the step parameter of Loki metrics range queries. With a resolution of `1/1`, each pixel corresponds to one data point. `1/2` retrieves one data point for every other pixel, `1/10` retrieves one data point per 10 pixels, and so on. Lower resolutions perform better. | - ## Builder mode Use Builder mode to visually construct queries, without needing to manually enter LogQL. -### Review toolbar features - -In addition to the **Run query** button and mode switcher, Builder mode provides additional elements: - -| Name | Description | -| ------------------------- | ----------------------------------------------------------------------------------------- | -| **Kick start your query** | A list of useful operation patterns you can use to add multiple operations to your query. | -| **Label browser** | Used to navigate through your labels and values, and also build queries. | -| **Explain query** | Displays a step-by-step explanation of all query components and operations. | - ### Use the Labels selector Select labels and their values from the dropdown list. @@ -125,10 +90,6 @@ To re-order operations manually, drag the operation box by its name and drop it In same cases the query editor can detect which operations would be most appropriate for a selected log stream. In such cases it will show a hint next to the `+ Operations` button. Click on the hint to add the operations to your query. -### Explain query - -This section is only shown if the `Explain query` switch from the query editor top toolbar is set to `on`. It shows a step by step explanation of all query parts and the operations. - ## Create a log query Loki log queries return the contents of the log lines. @@ -205,6 +166,45 @@ You can use LogQL to wrap a log query with functions that create metrics from yo For more information about metric queries, refer to the [Loki metric queries documentation](/docs/loki/latest/logql/metric_queries/). +## Review toolbar features + +In addition to the **Run query** button and mode switcher, Builder mode provides additional elements: + +| Name | Description | +| ------------------------- | ----------------------------------------------------------------------------------------- | +| **Kick start your query** | A list of useful operation patterns you can use to add multiple operations to your query. | +| **Label browser** | Used to navigate through your labels and values, and also build queries. | +| **Explain query** | Displays a step-by-step explanation of all query components and operations. | + +### Label browser + +You can use the Loki label browser to navigate through your labels and values, and build queries. + +**To navigate Loki and build a query:** + +1. Choose labels to locate. +1. Search for the values of your selected labels. + + The search field supports fuzzy search, and the label browser also supports faceting to list only possible label combinations. + +1. Choose a query type between [**logs query**]({{< relref "#create-a-log-query" >}}) and [**rate metrics query**]({{< relref "#create-a-metric-query" >}}). + You can also validate the selector. + +{{< figure src="/static/img/docs/v75/loki_label_browser.png" class="docs-image--no-shadow" max-width="800px" caption="The Loki label browser" >}} + +### Explain query + +This section is only shown if the `Explain query` switch from the query editor top toolbar is set to `on`. It shows a step by step explanation of all query parts and the operations. + +## Configure query settings + +| Name | Description | +| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| **Type** | Selects the query type to run. The `instant` type queries against a single point in time. We use the "To" time from the time range. The `range` type queries over the selected range of time. | +| **Line limit** | Defines the upper limit for the number of log lines returned by a query. The default is Loki's configured maximum lines limit. | +| **Legend** | _(Available only in a dashboard)_ Controls the time series name, using a name or pattern. For example, `{{hostname}}` is replaced with the label value for the label `hostname`. | +| **Resolution** | Sets the step parameter of Loki metrics range queries. With a resolution of `1/1`, each pixel corresponds to one data point. `1/2` retrieves one data point for every other pixel, `1/10` retrieves one data point per 10 pixels, and so on. Lower resolutions perform better. | + ## Apply annotations [Annotations]({{< relref "../../../dashboards/build-dashboards/annotate-visualizations" >}}) overlay rich event information on top of graphs. From 958ce289b2dd40b0c4bb55ee5ccee7cfc65ac817 Mon Sep 17 00:00:00 2001 From: Gareth Dawson Date: Tue, 4 Apr 2023 10:52:30 +0100 Subject: [PATCH 05/80] Loki docs: Use images instead of text description for operation settings (#65838) use images instead of text description --- docs/sources/datasources/loki/query-editor/index.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/sources/datasources/loki/query-editor/index.md b/docs/sources/datasources/loki/query-editor/index.md index 708a0d98ede..b3cea436004 100644 --- a/docs/sources/datasources/loki/query-editor/index.md +++ b/docs/sources/datasources/loki/query-editor/index.md @@ -73,11 +73,11 @@ The query editor groups operations into related sections, and you can type while The query editor displays a query's operations as boxes in the operations section. Each operation's header displays its name, and additional action buttons appear when you hover your cursor over the header: -| Button | Action | -| ------ | ----------------------------------------------------------------- | -| `v` | Replaces the operation with different operation of the same type. | -| `info` | Opens the operation's description tooltip. | -| `x` | Removes the operation. | +| Button | Action | +| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | +| {{< figure src="/static/img/docs/v95/loki_operation_replace.png" class="docs-image--no-shadow" max-width="30px" >}} | Replaces the operation with different operation of the same type. | +| {{< figure src="/static/img/docs/v95/loki_operation_description.png" class="docs-image--no-shadow" max-width="30px" >}} | Opens the operation's description tooltip. | +| {{< figure src="/static/img/docs/v95/loki_operation_remove.png" class="docs-image--no-shadow" max-width="30px" >}} | Removes the operation. | Some operations have additional parameters under the operation header. For details about each operation, use the `info` button to view the operation's description, or refer to the [Loki documentation](/docs/loki/latest/operations/). From ed45991e1b6dfe25a28c25e4c2309be9fa1a5058 Mon Sep 17 00:00:00 2001 From: Dominik Prokop Date: Tue, 4 Apr 2023 12:02:29 +0200 Subject: [PATCH 06/80] Scenes: Add refresh picker to demos and dashboard loader (#64292) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Torkel Ödegaard --- public/app/features/scenes/dashboard/DashboardsLoader.ts | 9 ++++++++- public/app/features/scenes/scenes/gridMultiTimeRange.tsx | 3 ++- public/app/features/scenes/scenes/gridMultiple.tsx | 3 ++- .../app/features/scenes/scenes/gridWithMultipleData.tsx | 3 ++- public/app/features/scenes/scenes/queryVariableDemo.tsx | 3 ++- public/app/features/scenes/scenes/sceneWithRows.tsx | 3 ++- public/app/features/scenes/scenes/transformations.tsx | 3 ++- public/app/features/scenes/scenes/variablesDemo.tsx | 5 +++-- 8 files changed, 23 insertions(+), 9 deletions(-) diff --git a/public/app/features/scenes/dashboard/DashboardsLoader.ts b/public/app/features/scenes/dashboard/DashboardsLoader.ts index 663ee91d789..18632e11682 100644 --- a/public/app/features/scenes/dashboard/DashboardsLoader.ts +++ b/public/app/features/scenes/dashboard/DashboardsLoader.ts @@ -19,6 +19,7 @@ import { DataSourceVariable, QueryVariable, ConstantVariable, + SceneRefreshPicker, SceneDataTransformer, SceneGridItem, } from '@grafana/scenes'; @@ -178,7 +179,13 @@ export function createDashboardSceneFromDashboardModel(oldModel: DashboardModel) children: createSceneObjectsForPanels(oldModel.panels), }), $timeRange: new SceneTimeRange(oldModel.time), - actions: [new SceneTimePicker({})], + actions: [ + new SceneTimePicker({}), + new SceneRefreshPicker({ + refresh: oldModel.refresh, + intervals: oldModel.timepicker.refresh_intervals, + }), + ], $variables: variables, ...(variables && { controls: [new VariableValueSelectors({})], diff --git a/public/app/features/scenes/scenes/gridMultiTimeRange.tsx b/public/app/features/scenes/scenes/gridMultiTimeRange.tsx index 3969e858028..68381d27ac5 100644 --- a/public/app/features/scenes/scenes/gridMultiTimeRange.tsx +++ b/public/app/features/scenes/scenes/gridMultiTimeRange.tsx @@ -4,6 +4,7 @@ import { SceneTimePicker, SceneGridLayout, SceneTimeRange, + SceneRefreshPicker, SceneGridItem, } from '@grafana/scenes'; import { TestDataQueryType } from 'app/plugins/datasource/testdata/dataquery.gen'; @@ -77,6 +78,6 @@ export function getGridWithMultipleTimeRanges(): DashboardScene { }), $timeRange: globalTimeRange, $data: getQueryRunnerWithRandomWalkQuery(), - actions: [new SceneTimePicker({})], + actions: [new SceneTimePicker({}), new SceneRefreshPicker({})], }); } diff --git a/public/app/features/scenes/scenes/gridMultiple.tsx b/public/app/features/scenes/scenes/gridMultiple.tsx index 635b09c427f..beabe50e0c7 100644 --- a/public/app/features/scenes/scenes/gridMultiple.tsx +++ b/public/app/features/scenes/scenes/gridMultiple.tsx @@ -4,6 +4,7 @@ import { SceneFlexLayout, SceneGridLayout, SceneTimeRange, + SceneRefreshPicker, SceneGridItem, SceneFlexItem, } from '@grafana/scenes'; @@ -135,6 +136,6 @@ export function getMultipleGridLayoutTest(): DashboardScene { }), $timeRange: new SceneTimeRange(), $data: getQueryRunnerWithRandomWalkQuery(), - actions: [new SceneTimePicker({})], + actions: [new SceneTimePicker({}), new SceneRefreshPicker({})], }); } diff --git a/public/app/features/scenes/scenes/gridWithMultipleData.tsx b/public/app/features/scenes/scenes/gridWithMultipleData.tsx index 90999900208..b377b44a38c 100644 --- a/public/app/features/scenes/scenes/gridWithMultipleData.tsx +++ b/public/app/features/scenes/scenes/gridWithMultipleData.tsx @@ -4,6 +4,7 @@ import { SceneTimePicker, SceneGridLayout, SceneTimeRange, + SceneRefreshPicker, SceneGridItem, } from '@grafana/scenes'; import { TestDataQueryType } from 'app/plugins/datasource/testdata/dataquery.gen'; @@ -119,6 +120,6 @@ export function getGridWithMultipleData(): DashboardScene { }), $timeRange: new SceneTimeRange(), $data: getQueryRunnerWithRandomWalkQuery(), - actions: [new SceneTimePicker({})], + actions: [new SceneTimePicker({}), new SceneRefreshPicker({})], }); } diff --git a/public/app/features/scenes/scenes/queryVariableDemo.tsx b/public/app/features/scenes/scenes/queryVariableDemo.tsx index 303dc3490fa..809eea886ac 100644 --- a/public/app/features/scenes/scenes/queryVariableDemo.tsx +++ b/public/app/features/scenes/scenes/queryVariableDemo.tsx @@ -9,6 +9,7 @@ import { CustomVariable, DataSourceVariable, QueryVariable, + SceneRefreshPicker, SceneFlexItem, } from '@grafana/scenes'; @@ -61,7 +62,7 @@ export function getQueryVariableDemo(): DashboardScene { ], }), $timeRange: new SceneTimeRange(), - actions: [new SceneTimePicker({})], + actions: [new SceneTimePicker({}), new SceneRefreshPicker({})], controls: [new VariableValueSelectors({})], }); } diff --git a/public/app/features/scenes/scenes/sceneWithRows.tsx b/public/app/features/scenes/scenes/sceneWithRows.tsx index ef925e0da70..e4ffc455652 100644 --- a/public/app/features/scenes/scenes/sceneWithRows.tsx +++ b/public/app/features/scenes/scenes/sceneWithRows.tsx @@ -4,6 +4,7 @@ import { SceneTimePicker, SceneFlexLayout, SceneTimeRange, + SceneRefreshPicker, SceneFlexItem, } from '@grafana/scenes'; @@ -64,6 +65,6 @@ export function getSceneWithRows(): DashboardScene { }), $timeRange: new SceneTimeRange(), $data: getQueryRunnerWithRandomWalkQuery(), - actions: [new SceneTimePicker({})], + actions: [new SceneTimePicker({}), new SceneRefreshPicker({})], }); } diff --git a/public/app/features/scenes/scenes/transformations.tsx b/public/app/features/scenes/scenes/transformations.tsx index 43b8878ff70..4309c41971a 100644 --- a/public/app/features/scenes/scenes/transformations.tsx +++ b/public/app/features/scenes/scenes/transformations.tsx @@ -4,6 +4,7 @@ import { VizPanel, SceneDataTransformer, SceneTimeRange, + SceneRefreshPicker, SceneFlexItem, } from '@grafana/scenes'; @@ -75,6 +76,6 @@ export function getTransformationsDemo(): DashboardScene { }), $timeRange: new SceneTimeRange(), $data: getQueryRunnerWithRandomWalkQuery(), - actions: [new SceneTimePicker({})], + actions: [new SceneTimePicker({}), new SceneRefreshPicker({})], }); } diff --git a/public/app/features/scenes/scenes/variablesDemo.tsx b/public/app/features/scenes/scenes/variablesDemo.tsx index f1002e208e7..02ab81d9a92 100644 --- a/public/app/features/scenes/scenes/variablesDemo.tsx +++ b/public/app/features/scenes/scenes/variablesDemo.tsx @@ -10,6 +10,7 @@ import { DataSourceVariable, TestVariable, NestedScene, + SceneRefreshPicker, TextBoxVariable, SceneFlexItem, } from '@grafana/scenes'; @@ -126,7 +127,7 @@ export function getVariablesDemo(): DashboardScene { ], }), $timeRange: new SceneTimeRange(), - actions: [new SceneTimePicker({})], + actions: [new SceneTimePicker({}), new SceneRefreshPicker({})], controls: [new VariableValueSelectors({})], }); } @@ -193,7 +194,7 @@ export function getVariablesDemoWithAll(): DashboardScene { ], }), $timeRange: new SceneTimeRange(), - actions: [new SceneTimePicker({})], + actions: [new SceneTimePicker({}), new SceneRefreshPicker({})], controls: [new VariableValueSelectors({})], }); } From bf5f61319a75798fb54a7d634e56318524e78e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 4 Apr 2023 12:46:04 +0200 Subject: [PATCH 07/80] Scenes: update to v0.3 (#65886) --- package.json | 2 +- .../features/scenes/apps/SceneRadioToggle.tsx | 4 +-- .../features/scenes/apps/SceneSearchBox.tsx | 4 +-- .../scenes/dashboard/DashboardScene.tsx | 10 ++----- yarn.lock | 29 +++++++------------ 5 files changed, 18 insertions(+), 31 deletions(-) diff --git a/package.json b/package.json index 4b7f3ca6efc..bb179a21e63 100644 --- a/package.json +++ b/package.json @@ -266,7 +266,7 @@ "@grafana/lezer-logql": "0.1.2", "@grafana/monaco-logql": "^0.0.7", "@grafana/runtime": "workspace:*", - "@grafana/scenes": "^0.2.0", + "@grafana/scenes": "^0.3.0", "@grafana/schema": "workspace:*", "@grafana/ui": "workspace:*", "@kusto/monaco-kusto": "5.3.6", diff --git a/public/app/features/scenes/apps/SceneRadioToggle.tsx b/public/app/features/scenes/apps/SceneRadioToggle.tsx index 060b9327de2..b821a420f18 100644 --- a/public/app/features/scenes/apps/SceneRadioToggle.tsx +++ b/public/app/features/scenes/apps/SceneRadioToggle.tsx @@ -1,10 +1,10 @@ import React from 'react'; import { SelectableValue } from '@grafana/data'; -import { SceneComponentProps, SceneObjectBase, SceneObjectStatePlain } from '@grafana/scenes'; +import { SceneComponentProps, SceneObjectBase, SceneObjectState } from '@grafana/scenes'; import { RadioButtonGroup } from '@grafana/ui'; -export interface SceneRadioToggleState extends SceneObjectStatePlain { +export interface SceneRadioToggleState extends SceneObjectState { options: Array>; value: string; onChange: (value: string) => void; diff --git a/public/app/features/scenes/apps/SceneSearchBox.tsx b/public/app/features/scenes/apps/SceneSearchBox.tsx index 0a4a5dfb57c..1e5ebd6a24d 100644 --- a/public/app/features/scenes/apps/SceneSearchBox.tsx +++ b/public/app/features/scenes/apps/SceneSearchBox.tsx @@ -1,9 +1,9 @@ import React from 'react'; -import { SceneComponentProps, SceneObjectStatePlain, SceneObjectBase } from '@grafana/scenes'; +import { SceneComponentProps, SceneObjectState, SceneObjectBase } from '@grafana/scenes'; import { Input } from '@grafana/ui'; -export interface SceneSearchBoxState extends SceneObjectStatePlain { +export interface SceneSearchBoxState extends SceneObjectState { value: string; } diff --git a/public/app/features/scenes/dashboard/DashboardScene.tsx b/public/app/features/scenes/dashboard/DashboardScene.tsx index 433c7e65926..8f3a8ffcdb2 100644 --- a/public/app/features/scenes/dashboard/DashboardScene.tsx +++ b/public/app/features/scenes/dashboard/DashboardScene.tsx @@ -3,18 +3,12 @@ import React from 'react'; import { GrafanaTheme2, PageLayoutType } from '@grafana/data'; import { config, locationService } from '@grafana/runtime'; -import { - UrlSyncManager, - SceneObjectBase, - SceneComponentProps, - SceneObject, - SceneObjectStatePlain, -} from '@grafana/scenes'; +import { UrlSyncManager, SceneObjectBase, SceneComponentProps, SceneObject, SceneObjectState } from '@grafana/scenes'; import { PageToolbar, ToolbarButton, useStyles2 } from '@grafana/ui'; import { AppChromeUpdate } from 'app/core/components/AppChrome/AppChromeUpdate'; import { Page } from 'app/core/components/Page/Page'; -interface DashboardSceneState extends SceneObjectStatePlain { +interface DashboardSceneState extends SceneObjectState { title: string; uid?: string; body: SceneObject; diff --git a/yarn.lock b/yarn.lock index b49d85f229d..7f087daffcb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3107,14 +3107,14 @@ __metadata: languageName: unknown linkType: soft -"@grafana/e2e-selectors@npm:^9.4.3": - version: 9.4.3 - resolution: "@grafana/e2e-selectors@npm:9.4.3" +"@grafana/e2e-selectors@npm:canary": + version: 9.5.0-109075pre + resolution: "@grafana/e2e-selectors@npm:9.5.0-109075pre" dependencies: "@grafana/tsconfig": ^1.2.0-rc1 - tslib: 2.4.1 + tslib: 2.5.0 typescript: 4.8.4 - checksum: 85a88cdf4adb643ff863b15f96fc6c04ecb7567c27cc526a00c157eb02575e55adc1e7701d58e1b48f00f24951c332fbb191cd2b5a8e74cd0c545543777e82af + checksum: 46b7853aeaab0ac2823a0add250c421632eb324f4f74e3633e0db58bf68920ef8bcbdc3666b17dbb4ac0af7c1d52777016fc7796a1b0a19bf5d3451945aca270 languageName: node linkType: hard @@ -3326,17 +3326,17 @@ __metadata: languageName: unknown linkType: soft -"@grafana/scenes@npm:^0.2.0": - version: 0.2.0 - resolution: "@grafana/scenes@npm:0.2.0" +"@grafana/scenes@npm:^0.3.0": + version: 0.3.0 + resolution: "@grafana/scenes@npm:0.3.0" dependencies: - "@grafana/e2e-selectors": ^9.4.3 + "@grafana/e2e-selectors": canary "@grafana/experimental": 1.0.1 react-grid-layout: 1.3.4 react-use: 17.4.0 react-virtualized-auto-sizer: 1.0.7 uuid: ^9.0.0 - checksum: a04fe353eec8f048de7c51079e7f7bef461b372c3c086d5ff3be46fc0e70a21e907272f0ed05a41633847a3736c5e65e441ffa20b2c18eedea813decf3eef636 + checksum: 3610cedcc150b9d6e3d6948056bb1bbbfe58d7fa0ff6e762eec6619bb0940504db867ea87e56160f27e4d93772f6203493bf87d353a1b18d2664e74a03f03a05 languageName: node linkType: hard @@ -20110,7 +20110,7 @@ __metadata: "@grafana/lezer-logql": 0.1.2 "@grafana/monaco-logql": ^0.0.7 "@grafana/runtime": "workspace:*" - "@grafana/scenes": ^0.2.0 + "@grafana/scenes": ^0.3.0 "@grafana/schema": "workspace:*" "@grafana/toolkit": "workspace:*" "@grafana/tsconfig": ^1.2.0-rc1 @@ -35667,13 +35667,6 @@ __metadata: languageName: node linkType: hard -"tslib@npm:2.4.1": - version: 2.4.1 - resolution: "tslib@npm:2.4.1" - checksum: 19480d6e0313292bd6505d4efe096a6b31c70e21cf08b5febf4da62e95c265c8f571f7b36fcc3d1a17e068032f59c269fab3459d6cd3ed6949eafecf64315fca - languageName: node - linkType: hard - "tslib@npm:2.5.0, tslib@npm:^2.0.0, tslib@npm:^2.0.1, tslib@npm:^2.4.1": version: 2.5.0 resolution: "tslib@npm:2.5.0" From d072b62960daada85fde247314e575532fc8bfac Mon Sep 17 00:00:00 2001 From: Dan Cech Date: Tue, 4 Apr 2023 21:05:35 +1000 Subject: [PATCH 08/80] Packaging: Remove chkconfig dependency (#65887) Remove chkconfig dependency This dependency prevents installation on recent opensuse as they no longer provide chkconfig. As far as I can tell we don't use it anywhere so it shouldn't be required under any modern linux using systemd, --- pkg/build/packaging/grafana.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/build/packaging/grafana.go b/pkg/build/packaging/grafana.go index 4239af6f6f7..d752feed724 100644 --- a/pkg/build/packaging/grafana.go +++ b/pkg/build/packaging/grafana.go @@ -771,8 +771,7 @@ func realPackageVariant(ctx context.Context, v config.Variant, edition config.Ed defaultFileSrc: filepath.Join(grafanaDir, "packaging", "rpm", "sysconfig", "grafana-server"), systemdFileSrc: filepath.Join(grafanaDir, "packaging", "rpm", "systemd", "grafana-server.service"), wrapperFilePath: filepath.Join(grafanaDir, "packaging", "wrappers"), - // chkconfig is depended on since our systemd service wraps a SysV init script, and that requires chkconfig - depends: []string{"/sbin/service", "chkconfig", "fontconfig", "freetype", "urw-fonts"}, + depends: []string{"/sbin/service", "fontconfig", "freetype", "urw-fonts"}, }); err != nil { return err } From 8e7633facb82c1add8b86529600d9314787ddf43 Mon Sep 17 00:00:00 2001 From: Jack Baldry Date: Tue, 4 Apr 2023 12:21:01 +0100 Subject: [PATCH 09/80] Use latest version of doc-validator (#65595) See https://github.com/grafana/technical-documentation/releases/tag/doc-validator%2Fv1.10.0 Signed-off-by: Jack Baldry --- .github/workflows/doc-validator.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/doc-validator.yml b/.github/workflows/doc-validator.yml index 5444eef33a0..d9a8ecc2521 100644 --- a/.github/workflows/doc-validator.yml +++ b/.github/workflows/doc-validator.yml @@ -7,7 +7,7 @@ jobs: doc-validator: runs-on: "ubuntu-latest" container: - image: "grafana/doc-validator:v1.9.0" + image: "grafana/doc-validator:v1.10.0" steps: - name: "Checkout code" uses: "actions/checkout@v3" From 61599de32c248d8efb1716c9fc34c325660a7c44 Mon Sep 17 00:00:00 2001 From: Andreas Christou Date: Tue, 4 Apr 2023 13:07:32 +0100 Subject: [PATCH 10/80] Chore: Update AddPanel selectors for top nav (#65871) * Update add panel selectors for top nav * trigger build --- packages/grafana-e2e/src/flows/configurePanel.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/grafana-e2e/src/flows/configurePanel.ts b/packages/grafana-e2e/src/flows/configurePanel.ts index 15d7abd8b2d..7181c06fa05 100644 --- a/packages/grafana-e2e/src/flows/configurePanel.ts +++ b/packages/grafana-e2e/src/flows/configurePanel.ts @@ -91,15 +91,15 @@ export const configurePanel = (config: PartialAddPanelConfig | PartialEditPanelC e2e.components.Panels.Panel.headerItems('Edit').click(); } else { try { - e2e.components.PageToolbar.item('Add panel').should('be.visible'); - e2e.components.PageToolbar.item('Add panel').click(); + e2e.components.PageToolbar.itemButton('Add panel button').should('be.visible'); + e2e.components.PageToolbar.itemButton('Add panel button').click(); } catch (e) { // Depending on the screen size, the "Add panel" button might be hidden e2e.components.PageToolbar.item('Show more items').click(); - e2e.components.PageToolbar.item('Add panel').last().click(); + e2e.components.PageToolbar.item('Add panel button').last().click(); } - e2e.pages.AddDashboard.addNewPanel().should('be.visible'); - e2e.pages.AddDashboard.addNewPanel().click(); + e2e.pages.AddDashboard.itemButton('Add new visualization menu item').should('be.visible'); + e2e.pages.AddDashboard.itemButton('Add new visualization menu item').click(); } if (timeRange) { From 68796a9f3190e807ebef8ee6cf34fb2a5c5e81dd Mon Sep 17 00:00:00 2001 From: Marcus Andersson Date: Tue, 4 Apr 2023 14:32:34 +0200 Subject: [PATCH 11/80] PluginExtensions: Fixed issue with incorrect type being exposed when configuring an extension (#65910) Fixed issue with wrong type required in configureExtensionLink --- packages/grafana-data/src/types/app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/grafana-data/src/types/app.ts b/packages/grafana-data/src/types/app.ts index f3ff6eafda9..f62b98ccca9 100644 --- a/packages/grafana-data/src/types/app.ts +++ b/packages/grafana-data/src/types/app.ts @@ -97,7 +97,7 @@ export class AppPlugin extends GrafanaPlugin(extension: Exclude, 'type'>) { + configureExtensionLink(extension: Omit, 'type'>) { this._extensionConfigs.push({ ...extension, type: PluginExtensionTypes.link, From 80444d60f98bb94a98e96d642a84b0a1bea042ea Mon Sep 17 00:00:00 2001 From: Ieva Date: Tue, 4 Apr 2023 14:22:02 +0100 Subject: [PATCH 12/80] Docs: define RBAC n/a for a scope (#65782) * define n/a scope * Update docs/sources/administration/roles-and-permissions/access-control/custom-role-actions-scopes/index.md Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com> * linting --------- Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com> --- .../access-control/custom-role-actions-scopes/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/sources/administration/roles-and-permissions/access-control/custom-role-actions-scopes/index.md b/docs/sources/administration/roles-and-permissions/access-control/custom-role-actions-scopes/index.md index 33c22c8a913..5176af499f4 100644 --- a/docs/sources/administration/roles-and-permissions/access-control/custom-role-actions-scopes/index.md +++ b/docs/sources/administration/roles-and-permissions/access-control/custom-role-actions-scopes/index.md @@ -207,3 +207,4 @@ The following list contains role-based access control scopes. | `settings:*` | Restrict an action to a subset of settings. For example, `settings:*` matches all settings, `settings:auth.saml:*` matches all SAML settings, and `settings:auth.saml:enabled` matches the enable property on the SAML settings. | | `teams:*`
`teams:id:*` | Restrict an action to a set of teams from an organization. For example, `teams:*` matches any team and `teams:id:1` matches the team whose ID is `1`. | | `users:*`
`users:id:*` | Restrict an action to a set of users from an organization. For example, `users:*` matches any user and `users:id:1` matches the user whose ID is `1`. | +| `n/a` | `n/a` means not applicable. If an action has `n/a` specified for the scope, then the action does not require a scope. For example, the `teams:create` action does not require a scope and allows users to create teams. | From fcabaac0375d672a9d78f8f1c4b65c3a1f548f24 Mon Sep 17 00:00:00 2001 From: Horst Gutmann Date: Tue, 4 Apr 2023 15:29:42 +0200 Subject: [PATCH 13/80] CI: Allow X.Y.Z-pre in bump-version workflow (#65924) --- .github/workflows/bump-version.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index b07cf46eeba..f98a8f141f0 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -17,13 +17,13 @@ jobs: id: regex-match with: text: ${{ github.event.inputs.version }} - regex: '^(\d+.\d+).\d+(?:-beta\d+)?$' + regex: '^(\d+.\d+).\d+(?:-(?:(beta\d+)|(pre)))?$' - uses: actions-ecosystem/action-regex-match@v2.0.2 if: ${{ inputs.version_call != '' }} id: regex-match-version-call with: text: ${{ inputs.version_call }} - regex: '^(\d+.\d+).\d+(?:-beta\d+)?$' + regex: '^(\d+.\d+).\d+(?:-(?:(beta\d+)|(pre)))?$' - name: Validate input version if: ${{ steps.regex-match.outputs.match == '' && github.event.inputs.version != '' }} run: | @@ -50,7 +50,7 @@ jobs: echo "branch_exist=$(git ls-remote --heads https://github.com/grafana/grafana.git v${{ steps.regex-match.outputs.group1 }}.x | wc -l)" >> $GITHUB_OUTPUT - name: Check input version is aligned with branch(main) - if: ${{ github.event.inputs.version != '' && steps.intermedia.outputs.branch_exist == '0' && !contains(steps.intermedia.outputs.short_ref, 'main') }} + if: ${{ github.event.inputs.version != '' && steps.intermedia.outputs.branch_exist == '0' && !contains(github.event.inputs.version, 'pre') && !contains(steps.intermedia.outputs.short_ref, 'main') }} run: | echo "When you want to deliver a new new minor version, you might want to create a new branch first \ with naming convention v[major].[minor].x, and just run the workflow on that branch. \ From 6f7363af3af17814bba41e9344c0d827d56a3e2e Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Tue, 4 Apr 2023 14:40:44 +0100 Subject: [PATCH 14/80] Dropdown: Stop Dropdown accepting a function as children (#65467) remove dropdown accepting function children --- .../src/components/Dropdown/Dropdown.tsx | 4 ++-- .../components/AppChrome/QuickAdd/QuickAdd.tsx | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/grafana-ui/src/components/Dropdown/Dropdown.tsx b/packages/grafana-ui/src/components/Dropdown/Dropdown.tsx index 4bc664e75aa..21f1e28ed8c 100644 --- a/packages/grafana-ui/src/components/Dropdown/Dropdown.tsx +++ b/packages/grafana-ui/src/components/Dropdown/Dropdown.tsx @@ -11,7 +11,7 @@ import { TooltipPlacement } from '../Tooltip/types'; export interface Props { overlay: React.ReactElement | (() => React.ReactElement); placement?: TooltipPlacement; - children: React.ReactElement | ((isOpen: boolean) => React.ReactElement); + children: React.ReactElement; /** Amount in pixels to nudge the dropdown vertically and horizontally, respectively. */ offset?: [number, number]; onVisibleChange?: (state: boolean) => void; @@ -51,7 +51,7 @@ export const Dropdown = React.memo(({ children, overlay, placement, offset, onVi return ( <> - {React.cloneElement(typeof children === 'function' ? children(visible) : children, { + {React.cloneElement(children, { ref: setTriggerRef, })} {visible && ( diff --git a/public/app/core/components/AppChrome/QuickAdd/QuickAdd.tsx b/public/app/core/components/AppChrome/QuickAdd/QuickAdd.tsx index 9a13cfb57da..c322b4c3875 100644 --- a/public/app/core/components/AppChrome/QuickAdd/QuickAdd.tsx +++ b/public/app/core/components/AppChrome/QuickAdd/QuickAdd.tsx @@ -19,6 +19,7 @@ export const QuickAdd = ({}: Props) => { const navBarTree = useSelector((state) => state.navBarTree); const breakpoint = theme.breakpoints.values.sm; + const [isOpen, setIsOpen] = useState(false); const [isSmallScreen, setIsSmallScreen] = useState(!window.matchMedia(`(min-width: ${breakpoint}px)`).matches); const createActions = useMemo(() => findCreateActions(navBarTree), [navBarTree]); @@ -46,14 +47,13 @@ export const QuickAdd = ({}: Props) => { return createActions.length > 0 ? ( <> - - {(isOpen) => - isSmallScreen ? ( - - ) : ( - - ) - } + + From fa363921854d79a7be579e19cf4d1ec548135ff0 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Tue, 4 Apr 2023 08:41:50 -0500 Subject: [PATCH 15/80] Release: Bump version to 10.0.0-pre (#65926) "Release: Updated versions in package to 10.0.0-pre" --- lerna.json | 6 ++-- package.json | 2 +- packages/grafana-data/package.json | 4 +-- packages/grafana-e2e-selectors/package.json | 2 +- packages/grafana-e2e/package.json | 4 +-- packages/grafana-eslint-rules/package.json | 2 +- packages/grafana-runtime/package.json | 8 ++--- packages/grafana-schema/package.json | 2 +- packages/grafana-toolkit/package.json | 6 ++-- packages/grafana-ui/package.json | 8 ++--- .../internal/input-datasource/package.json | 8 ++--- yarn.lock | 36 +++++++++---------- 12 files changed, 45 insertions(+), 43 deletions(-) diff --git a/lerna.json b/lerna.json index 58e6a8163bb..75716a4cd76 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,8 @@ { "npmClient": "yarn", "useWorkspaces": true, - "packages": ["packages/*"], - "version": "9.5.0-pre" + "packages": [ + "packages/*" + ], + "version": "10.0.0-pre" } diff --git a/package.json b/package.json index bb179a21e63..44bfbb1211b 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "license": "AGPL-3.0-only", "private": true, "name": "grafana", - "version": "9.5.0-pre", + "version": "10.0.0-pre", "repository": "github:grafana/grafana", "scripts": { "build": "yarn i18n:compile && NODE_ENV=production webpack --progress --config scripts/webpack/webpack.prod.js", diff --git a/packages/grafana-data/package.json b/packages/grafana-data/package.json index d997c73c4d4..70497f3d1ed 100644 --- a/packages/grafana-data/package.json +++ b/packages/grafana-data/package.json @@ -2,7 +2,7 @@ "author": "Grafana Labs", "license": "Apache-2.0", "name": "@grafana/data", - "version": "9.5.0-pre", + "version": "10.0.0-pre", "description": "Grafana Data Library", "keywords": [ "typescript" @@ -36,7 +36,7 @@ }, "dependencies": { "@braintree/sanitize-url": "6.0.2", - "@grafana/schema": "9.5.0-pre", + "@grafana/schema": "10.0.0-pre", "@types/d3-interpolate": "^3.0.0", "d3-interpolate": "3.0.1", "date-fns": "2.29.3", diff --git a/packages/grafana-e2e-selectors/package.json b/packages/grafana-e2e-selectors/package.json index 3035cfb0ba5..a3dbb13e104 100644 --- a/packages/grafana-e2e-selectors/package.json +++ b/packages/grafana-e2e-selectors/package.json @@ -2,7 +2,7 @@ "author": "Grafana Labs", "license": "Apache-2.0", "name": "@grafana/e2e-selectors", - "version": "9.5.0-pre", + "version": "10.0.0-pre", "description": "Grafana End-to-End Test Selectors Library", "keywords": [ "cli", diff --git a/packages/grafana-e2e/package.json b/packages/grafana-e2e/package.json index b22bb34adec..0b85a93aa11 100644 --- a/packages/grafana-e2e/package.json +++ b/packages/grafana-e2e/package.json @@ -2,7 +2,7 @@ "author": "Grafana Labs", "license": "Apache-2.0", "name": "@grafana/e2e", - "version": "9.5.0-pre", + "version": "10.0.0-pre", "description": "Grafana End-to-End Test Library", "keywords": [ "cli", @@ -63,7 +63,7 @@ "@babel/core": "7.20.5", "@babel/preset-env": "7.20.2", "@cypress/webpack-preprocessor": "5.17.0", - "@grafana/e2e-selectors": "9.5.0-pre", + "@grafana/e2e-selectors": "10.0.0-pre", "@grafana/tsconfig": "^1.2.0-rc1", "@mochajs/json-file-reporter": "^1.2.0", "babel-loader": "9.1.2", diff --git a/packages/grafana-eslint-rules/package.json b/packages/grafana-eslint-rules/package.json index 22c00deb65c..45daca50272 100644 --- a/packages/grafana-eslint-rules/package.json +++ b/packages/grafana-eslint-rules/package.json @@ -1,7 +1,7 @@ { "name": "@grafana/eslint-plugin", "description": "ESLint rules for use within the Grafana repo. Not suitable (or supported) for external use.", - "version": "9.5.0-pre", + "version": "10.0.0-pre", "main": "./index.cjs", "author": "Grafana Labs", "license": "Apache-2.0", diff --git a/packages/grafana-runtime/package.json b/packages/grafana-runtime/package.json index eb6e5f70c03..67798bf4475 100644 --- a/packages/grafana-runtime/package.json +++ b/packages/grafana-runtime/package.json @@ -2,7 +2,7 @@ "author": "Grafana Labs", "license": "Apache-2.0", "name": "@grafana/runtime", - "version": "9.5.0-pre", + "version": "10.0.0-pre", "description": "Grafana Runtime Library", "keywords": [ "grafana", @@ -37,10 +37,10 @@ "postpack": "mv package.json.bak package.json" }, "dependencies": { - "@grafana/data": "9.5.0-pre", - "@grafana/e2e-selectors": "9.5.0-pre", + "@grafana/data": "10.0.0-pre", + "@grafana/e2e-selectors": "10.0.0-pre", "@grafana/faro-web-sdk": "1.0.2", - "@grafana/ui": "9.5.0-pre", + "@grafana/ui": "10.0.0-pre", "@sentry/browser": "6.19.7", "history": "4.10.1", "lodash": "4.17.21", diff --git a/packages/grafana-schema/package.json b/packages/grafana-schema/package.json index 542b6a1428a..0655787fd14 100644 --- a/packages/grafana-schema/package.json +++ b/packages/grafana-schema/package.json @@ -2,7 +2,7 @@ "author": "Grafana Labs", "license": "Apache-2.0", "name": "@grafana/schema", - "version": "9.5.0-pre", + "version": "10.0.0-pre", "description": "Grafana Schema Library", "keywords": [ "typescript" diff --git a/packages/grafana-toolkit/package.json b/packages/grafana-toolkit/package.json index f0cefb49c9c..5637ed8f190 100644 --- a/packages/grafana-toolkit/package.json +++ b/packages/grafana-toolkit/package.json @@ -2,7 +2,7 @@ "author": "Grafana Labs", "license": "Apache-2.0", "name": "@grafana/toolkit", - "version": "9.5.0-pre", + "version": "10.0.0-pre", "description": "Grafana Toolkit", "keywords": [ "grafana", @@ -51,10 +51,10 @@ "@babel/preset-env": "7.18.9", "@babel/preset-react": "7.18.6", "@babel/preset-typescript": "7.18.6", - "@grafana/data": "9.5.0-pre", + "@grafana/data": "10.0.0-pre", "@grafana/eslint-config": "5.1.0", "@grafana/tsconfig": "^1.2.0-rc1", - "@grafana/ui": "9.5.0-pre", + "@grafana/ui": "10.0.0-pre", "@jest/core": "27.5.1", "@types/command-exists": "^1.2.0", "@types/eslint": "8.4.1", diff --git a/packages/grafana-ui/package.json b/packages/grafana-ui/package.json index 570b58d2d7f..09febdfebd2 100644 --- a/packages/grafana-ui/package.json +++ b/packages/grafana-ui/package.json @@ -2,7 +2,7 @@ "author": "Grafana Labs", "license": "Apache-2.0", "name": "@grafana/ui", - "version": "9.5.0-pre", + "version": "10.0.0-pre", "description": "Grafana Components Library", "keywords": [ "grafana", @@ -49,10 +49,10 @@ "dependencies": { "@emotion/css": "11.10.6", "@emotion/react": "11.10.6", - "@grafana/data": "9.5.0-pre", - "@grafana/e2e-selectors": "9.5.0-pre", + "@grafana/data": "10.0.0-pre", + "@grafana/e2e-selectors": "10.0.0-pre", "@grafana/faro-web-sdk": "1.0.2", - "@grafana/schema": "9.5.0-pre", + "@grafana/schema": "10.0.0-pre", "@leeoniya/ufuzzy": "1.0.6", "@monaco-editor/react": "4.4.6", "@popperjs/core": "2.11.6", diff --git a/plugins-bundled/internal/input-datasource/package.json b/plugins-bundled/internal/input-datasource/package.json index 9b41b602b40..202c3a7fa11 100644 --- a/plugins-bundled/internal/input-datasource/package.json +++ b/plugins-bundled/internal/input-datasource/package.json @@ -1,6 +1,6 @@ { "name": "@grafana-plugins/input-datasource", - "version": "9.5.0-pre", + "version": "10.0.0-pre", "description": "Input Datasource", "private": true, "repository": { @@ -15,15 +15,15 @@ }, "author": "Grafana Labs", "devDependencies": { - "@grafana/toolkit": "9.5.0-pre", + "@grafana/toolkit": "10.0.0-pre", "@types/jest": "26.0.15", "@types/lodash": "4.14.149", "@types/react": "17.0.30", "lodash": "4.17.21" }, "dependencies": { - "@grafana/data": "9.5.0-pre", - "@grafana/ui": "9.5.0-pre", + "@grafana/data": "10.0.0-pre", + "@grafana/ui": "10.0.0-pre", "jquery": "3.5.1", "react": "17.0.1", "react-dom": "17.0.1", diff --git a/yarn.lock b/yarn.lock index 7f087daffcb..3fe57d32bba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2988,9 +2988,9 @@ __metadata: version: 0.0.0-use.local resolution: "@grafana-plugins/input-datasource@workspace:plugins-bundled/internal/input-datasource" dependencies: - "@grafana/data": 9.5.0-pre - "@grafana/toolkit": 9.5.0-pre - "@grafana/ui": 9.5.0-pre + "@grafana/data": 10.0.0-pre + "@grafana/toolkit": 10.0.0-pre + "@grafana/ui": 10.0.0-pre "@types/jest": 26.0.15 "@types/lodash": 4.14.149 "@types/react": 17.0.30 @@ -3023,12 +3023,12 @@ __metadata: languageName: node linkType: hard -"@grafana/data@9.5.0-pre, @grafana/data@workspace:*, @grafana/data@workspace:packages/grafana-data": +"@grafana/data@10.0.0-pre, @grafana/data@workspace:*, @grafana/data@workspace:packages/grafana-data": version: 0.0.0-use.local resolution: "@grafana/data@workspace:packages/grafana-data" dependencies: "@braintree/sanitize-url": 6.0.2 - "@grafana/schema": 9.5.0-pre + "@grafana/schema": 10.0.0-pre "@grafana/tsconfig": ^1.2.0-rc1 "@rollup/plugin-commonjs": 23.0.2 "@rollup/plugin-json": 5.0.1 @@ -3088,7 +3088,7 @@ __metadata: languageName: unknown linkType: soft -"@grafana/e2e-selectors@9.5.0-pre, @grafana/e2e-selectors@workspace:*, @grafana/e2e-selectors@workspace:packages/grafana-e2e-selectors": +"@grafana/e2e-selectors@10.0.0-pre, @grafana/e2e-selectors@workspace:*, @grafana/e2e-selectors@workspace:packages/grafana-e2e-selectors": version: 0.0.0-use.local resolution: "@grafana/e2e-selectors@workspace:packages/grafana-e2e-selectors" dependencies: @@ -3125,7 +3125,7 @@ __metadata: "@babel/core": 7.20.5 "@babel/preset-env": 7.20.2 "@cypress/webpack-preprocessor": 5.17.0 - "@grafana/e2e-selectors": 9.5.0-pre + "@grafana/e2e-selectors": 10.0.0-pre "@grafana/tsconfig": ^1.2.0-rc1 "@mochajs/json-file-reporter": ^1.2.0 "@rollup/plugin-node-resolve": 15.0.1 @@ -3285,11 +3285,11 @@ __metadata: version: 0.0.0-use.local resolution: "@grafana/runtime@workspace:packages/grafana-runtime" dependencies: - "@grafana/data": 9.5.0-pre - "@grafana/e2e-selectors": 9.5.0-pre + "@grafana/data": 10.0.0-pre + "@grafana/e2e-selectors": 10.0.0-pre "@grafana/faro-web-sdk": 1.0.2 "@grafana/tsconfig": ^1.2.0-rc1 - "@grafana/ui": 9.5.0-pre + "@grafana/ui": 10.0.0-pre "@rollup/plugin-commonjs": 23.0.2 "@rollup/plugin-node-resolve": 15.0.1 "@sentry/browser": 6.19.7 @@ -3340,7 +3340,7 @@ __metadata: languageName: node linkType: hard -"@grafana/schema@9.5.0-pre, @grafana/schema@workspace:*, @grafana/schema@workspace:packages/grafana-schema": +"@grafana/schema@10.0.0-pre, @grafana/schema@workspace:*, @grafana/schema@workspace:packages/grafana-schema": version: 0.0.0-use.local resolution: "@grafana/schema@workspace:packages/grafana-schema" dependencies: @@ -3359,7 +3359,7 @@ __metadata: languageName: unknown linkType: soft -"@grafana/toolkit@9.5.0-pre, @grafana/toolkit@workspace:*, @grafana/toolkit@workspace:packages/grafana-toolkit": +"@grafana/toolkit@10.0.0-pre, @grafana/toolkit@workspace:*, @grafana/toolkit@workspace:packages/grafana-toolkit": version: 0.0.0-use.local resolution: "@grafana/toolkit@workspace:packages/grafana-toolkit" dependencies: @@ -3375,10 +3375,10 @@ __metadata: "@babel/preset-env": 7.18.9 "@babel/preset-react": 7.18.6 "@babel/preset-typescript": 7.18.6 - "@grafana/data": 9.5.0-pre + "@grafana/data": 10.0.0-pre "@grafana/eslint-config": 5.1.0 "@grafana/tsconfig": ^1.2.0-rc1 - "@grafana/ui": 9.5.0-pre + "@grafana/ui": 10.0.0-pre "@jest/core": 27.5.1 "@types/command-exists": ^1.2.0 "@types/eslint": 8.4.1 @@ -3459,17 +3459,17 @@ __metadata: languageName: node linkType: hard -"@grafana/ui@9.5.0-pre, @grafana/ui@workspace:*, @grafana/ui@workspace:packages/grafana-ui": +"@grafana/ui@10.0.0-pre, @grafana/ui@workspace:*, @grafana/ui@workspace:packages/grafana-ui": version: 0.0.0-use.local resolution: "@grafana/ui@workspace:packages/grafana-ui" dependencies: "@babel/core": 7.20.5 "@emotion/css": 11.10.6 "@emotion/react": 11.10.6 - "@grafana/data": 9.5.0-pre - "@grafana/e2e-selectors": 9.5.0-pre + "@grafana/data": 10.0.0-pre + "@grafana/e2e-selectors": 10.0.0-pre "@grafana/faro-web-sdk": 1.0.2 - "@grafana/schema": 9.5.0-pre + "@grafana/schema": 10.0.0-pre "@grafana/tsconfig": ^1.2.0-rc1 "@leeoniya/ufuzzy": 1.0.6 "@mdx-js/react": 1.6.22 From 44beef2e413aacea97c98a160decfa7608dc5b69 Mon Sep 17 00:00:00 2001 From: Matias Chomicki Date: Tue, 4 Apr 2023 15:51:41 +0200 Subject: [PATCH 16/80] Loki Query Splitting: Fix bug for mixed split durations (#65925) * Query splitting: fix next request group pointer calculation * Update unit test --- .../plugins/datasource/loki/querySplitting.test.ts | 14 ++++++++++++++ .../app/plugins/datasource/loki/querySplitting.ts | 13 ++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/public/app/plugins/datasource/loki/querySplitting.test.ts b/public/app/plugins/datasource/loki/querySplitting.test.ts index fc3a9ce69e6..1c16ea9650d 100644 --- a/public/app/plugins/datasource/loki/querySplitting.test.ts +++ b/public/app/plugins/datasource/loki/querySplitting.test.ts @@ -246,6 +246,20 @@ describe('runSplitQuery()', () => { expect(datasource.runQuery).toHaveBeenCalledTimes(3); }); }); + test('with mixed splitDuration runs the expected amount of queries', async () => { + const request = getQueryOptions({ + targets: [ + { expr: 'count_over_time({c="d"}[1m])', refId: 'A', splitDuration: '15m' }, + { expr: '{a="b"}', refId: 'B', splitDuration: '15m' }, + { expr: '{a="b"}', refId: 'C', splitDuration: '1h' }, + ], + range: range1h, + }); + await expect(runSplitQuery(datasource, request)).toEmitValuesWith(() => { + // 4 * 15m + 4 * 15m + 1 * 1h + expect(datasource.runQuery).toHaveBeenCalledTimes(9); + }); + }); test('with 1h/30m splitDuration and 1 log and 2 metric target runs 3 queries', async () => { const request = getQueryOptions({ targets: [ diff --git a/public/app/plugins/datasource/loki/querySplitting.ts b/public/app/plugins/datasource/loki/querySplitting.ts index 6c6c85267f7..865ae15bfd6 100644 --- a/public/app/plugins/datasource/loki/querySplitting.ts +++ b/public/app/plugins/datasource/loki/querySplitting.ts @@ -154,11 +154,14 @@ export function runSplitGroupedQueries(datasource: LokiDatasource, requests: Lok function getNextRequestPointers(requests: LokiGroupedRequest, requestGroup: number, requestN: number) { // There's a pending request from the next group: - if (requests[requestGroup + 1]?.partition[requestN - 1]) { - return { - nextRequestGroup: requestGroup + 1, - nextRequestN: requestN, - }; + for (let i = requestGroup + 1; i < requests.length; i++) { + const group = requests[i]; + if (group.partition[requestN - 1]) { + return { + nextRequestGroup: i, + nextRequestN: requestN, + }; + } } return { // Find the first group where `[requestN - 1]` is defined From 42be20cbf3773c109a6f3f00033b17068e590fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 4 Apr 2023 16:00:41 +0200 Subject: [PATCH 17/80] Page: Remove bottom page margin (#65082) * Remove page margin * Only remove bottom margin * revert other changes * revert another change --- public/app/core/components/AppChrome/AppChrome.tsx | 1 + public/app/core/components/PageNew/Page.tsx | 6 ++---- public/app/core/components/PageNew/SectionNav.tsx | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/app/core/components/AppChrome/AppChrome.tsx b/public/app/core/components/AppChrome/AppChrome.tsx index ef63d3f0fc6..548436f4101 100644 --- a/public/app/core/components/AppChrome/AppChrome.tsx +++ b/public/app/core/components/AppChrome/AppChrome.tsx @@ -104,6 +104,7 @@ const getStyles = (theme: GrafanaTheme2) => { boxShadow: shadow, background: theme.colors.background.primary, flexDirection: 'column', + borderBottom: `1px solid ${theme.colors.border.weak}`, }), }; }; diff --git a/public/app/core/components/PageNew/Page.tsx b/public/app/core/components/PageNew/Page.tsx index 6d9fe53dce3..73a09f82603 100644 --- a/public/app/core/components/PageNew/Page.tsx +++ b/public/app/core/components/PageNew/Page.tsx @@ -131,17 +131,15 @@ const getStyles = (theme: GrafanaTheme2) => { padding: theme.spacing(2), borderRadius: theme.shape.borderRadius(1), border: `1px solid ${theme.colors.border.weak}`, + borderBottom: 'none', background: theme.colors.background.primary, display: 'flex', flexDirection: 'column', flexGrow: 1, margin: theme.spacing(0, 0, 0, 0), - [theme.breakpoints.up('sm')]: { - margin: theme.spacing(0, 1, 1, 1), - }, [theme.breakpoints.up('md')]: { - margin: theme.spacing(2, 2, 2, 1), + margin: theme.spacing(2, 2, 0, 1), padding: theme.spacing(3), }, }), diff --git a/public/app/core/components/PageNew/SectionNav.tsx b/public/app/core/components/PageNew/SectionNav.tsx index 746ac980cc1..1b46e1a86c4 100644 --- a/public/app/core/components/PageNew/SectionNav.tsx +++ b/public/app/core/components/PageNew/SectionNav.tsx @@ -100,6 +100,7 @@ const getStyles = (theme: GrafanaTheme2) => { flexDirection: 'column', padding: theme.spacing(2, 1, 2, 2), minWidth: '250px', + [theme.breakpoints.up('md')]: { padding: theme.spacing(4.5, 1, 2, 2), }, From 819c2f4ad89d38f917c2ef916556228c618f39cb Mon Sep 17 00:00:00 2001 From: Will Browne Date: Tue, 4 Apr 2023 16:01:49 +0100 Subject: [PATCH 18/80] Plugins: Remove unnecessary CDN code (#65929) remove unnecessary code --- pkg/api/plugin_resource_test.go | 4 +- pkg/plugins/manager/loader/loader.go | 33 ++-- pkg/plugins/manager/loader/loader_test.go | 143 ++++++++++-------- .../manager/manager_integration_test.go | 4 +- 4 files changed, 98 insertions(+), 86 deletions(-) diff --git a/pkg/api/plugin_resource_test.go b/pkg/api/plugin_resource_test.go index cc37131b0a8..5abd7ed97e3 100644 --- a/pkg/api/plugin_resource_test.go +++ b/pkg/api/plugin_resource_test.go @@ -63,9 +63,9 @@ func TestCallResource(t *testing.T) { pCfg, err = config.ProvideConfig(setting.ProvideProvider(cfg), cfg) require.NoError(t, err) reg := registry.ProvideService() - cdn := pluginscdn.ProvideService(pCfg) l := loader.ProvideService(pCfg, fakes.NewFakeLicensingService(), signature.NewUnsignedAuthorizer(pCfg), - reg, provider.ProvideService(coreRegistry), finder.NewLocalFinder(), fakes.NewFakeRoleRegistry(), cdn, assetpath.ProvideService(cdn)) + reg, provider.ProvideService(coreRegistry), finder.NewLocalFinder(), fakes.NewFakeRoleRegistry(), + assetpath.ProvideService(pluginscdn.ProvideService(pCfg))) srcs := sources.ProvideService(cfg, pCfg) ps, err := store.ProvideService(reg, srcs, l) require.NoError(t, err) diff --git a/pkg/plugins/manager/loader/loader.go b/pkg/plugins/manager/loader/loader.go index adfa11d1742..6a75a5fb48f 100644 --- a/pkg/plugins/manager/loader/loader.go +++ b/pkg/plugins/manager/loader/loader.go @@ -18,7 +18,6 @@ import ( "github.com/grafana/grafana/pkg/plugins/manager/process" "github.com/grafana/grafana/pkg/plugins/manager/registry" "github.com/grafana/grafana/pkg/plugins/manager/signature" - "github.com/grafana/grafana/pkg/plugins/pluginscdn" "github.com/grafana/grafana/pkg/plugins/storage" "github.com/grafana/grafana/pkg/util" ) @@ -33,7 +32,6 @@ type Loader struct { pluginInitializer initializer.Initializer signatureValidator signature.Validator pluginStorage storage.Manager - pluginsCDN *pluginscdn.Service assetPath *assetpath.Service log log.Logger cfg *config.Cfg @@ -43,16 +41,16 @@ type Loader struct { func ProvideService(cfg *config.Cfg, license plugins.Licensing, authorizer plugins.PluginLoaderAuthorizer, pluginRegistry registry.Service, backendProvider plugins.BackendFactoryProvider, pluginFinder finder.Finder, - roleRegistry plugins.RoleRegistry, pluginsCDNService *pluginscdn.Service, assetPath *assetpath.Service) *Loader { + roleRegistry plugins.RoleRegistry, assetPath *assetpath.Service) *Loader { return New(cfg, license, authorizer, pluginRegistry, backendProvider, process.NewManager(pluginRegistry), - storage.FileSystem(log.NewPrettyLogger("loader.fs"), cfg.PluginsPath), roleRegistry, pluginsCDNService, - assetPath, pluginFinder) + storage.FileSystem(log.NewPrettyLogger("loader.fs"), cfg.PluginsPath), roleRegistry, assetPath, + pluginFinder) } func New(cfg *config.Cfg, license plugins.Licensing, authorizer plugins.PluginLoaderAuthorizer, pluginRegistry registry.Service, backendProvider plugins.BackendFactoryProvider, processManager process.Service, pluginStorage storage.Manager, roleRegistry plugins.RoleRegistry, - pluginsCDNService *pluginscdn.Service, assetPath *assetpath.Service, pluginFinder finder.Finder) *Loader { + assetPath *assetpath.Service, pluginFinder finder.Finder) *Loader { return &Loader{ pluginFinder: pluginFinder, pluginRegistry: pluginRegistry, @@ -64,7 +62,6 @@ func New(cfg *config.Cfg, license plugins.Licensing, authorizer plugins.PluginLo log: log.New("plugin.loader"), roleRegistry: roleRegistry, cfg: cfg, - pluginsCDN: pluginsCDNService, assetPath: assetPath, } } @@ -86,20 +83,12 @@ func (l *Loader) loadPlugins(ctx context.Context, src plugins.PluginSource, foun continue } - var sig plugins.Signature - if l.pluginsCDN.PluginSupported(p.Primary.JSONData.ID) { - // CDN plugins have no signature checks for now. - sig = plugins.Signature{Status: plugins.SignatureValid} - } else { - var err error - sig, err = signature.Calculate(ctx, l.log, src, p.Primary) - if err != nil { - l.log.Warn("Could not calculate plugin signature state", "pluginID", p.Primary.JSONData.ID, "err", err) - continue - } + sig, err := signature.Calculate(ctx, l.log, src, p.Primary) + if err != nil { + l.log.Warn("Could not calculate plugin signature state", "pluginID", p.Primary.JSONData.ID, "err", err) + continue } - class := src.PluginClass(ctx) - plugin, err := l.createPluginBase(p.Primary.JSONData, class, p.Primary.FS) + plugin, err := l.createPluginBase(p.Primary.JSONData, src.PluginClass(ctx), p.Primary.FS) if err != nil { l.log.Error("Could not create primary plugin base", "pluginID", p.Primary.JSONData.ID, "err", err) continue @@ -117,7 +106,7 @@ func (l *Loader) loadPlugins(ctx context.Context, src plugins.PluginSource, foun continue } - cp, err := l.createPluginBase(c.JSONData, class, c.FS) + cp, err := l.createPluginBase(c.JSONData, plugin.Class, c.FS) if err != nil { l.log.Error("Could not create child plugin base", "pluginID", p.Primary.JSONData.ID, "err", err) continue @@ -154,7 +143,7 @@ func (l *Loader) loadPlugins(ctx context.Context, src plugins.PluginSource, foun if !plugin.IsRenderer() && !plugin.IsCorePlugin() { _, err := plugin.FS.Open("module.js") if err != nil { - if errors.Is(err, plugins.ErrFileNotExist) && !l.pluginsCDN.PluginSupported(plugin.ID) { + if errors.Is(err, plugins.ErrFileNotExist) { l.log.Warn("Plugin missing module.js", "pluginID", plugin.ID, "warning", "Missing module.js, If you loaded this plugin from git, make sure to compile it.") } diff --git a/pkg/plugins/manager/loader/loader_test.go b/pkg/plugins/manager/loader/loader_test.go index 9fbaf13f295..81e09f76813 100644 --- a/pkg/plugins/manager/loader/loader_test.go +++ b/pkg/plugins/manager/loader/loader_test.go @@ -447,63 +447,6 @@ func TestLoader_Load(t *testing.T) { }, }, }, - { - name: "Load CDN plugin", - class: plugins.External, - cfg: &config.Cfg{ - PluginsCDNURLTemplate: "https://cdn.example.com", - PluginSettings: setting.PluginSettings{ - "grafana-worldmap-panel": {"cdn": "true"}, - }, - }, - pluginPaths: []string{"../testdata/cdn"}, - want: []*plugins.Plugin{ - { - JSONData: plugins.JSONData{ - ID: "grafana-worldmap-panel", - Type: "panel", - Name: "Worldmap Panel", - Info: plugins.Info{ - Version: "0.3.3", - Links: []plugins.InfoLink{ - {Name: "Project site", URL: "https://github.com/grafana/worldmap-panel"}, - {Name: "MIT License", URL: "https://github.com/grafana/worldmap-panel/blob/master/LICENSE"}, - }, - Logos: plugins.Logos{ - // Path substitution - Small: "https://cdn.example.com/grafana-worldmap-panel/0.3.3/public/plugins/grafana-worldmap-panel/images/worldmap_logo.svg", - Large: "https://cdn.example.com/grafana-worldmap-panel/0.3.3/public/plugins/grafana-worldmap-panel/images/worldmap_logo.svg", - }, - Screenshots: []plugins.Screenshots{ - { - Name: "World", - Path: "https://cdn.example.com/grafana-worldmap-panel/0.3.3/public/plugins/grafana-worldmap-panel/images/worldmap-world.png", - }, - { - Name: "USA", - Path: "https://cdn.example.com/grafana-worldmap-panel/0.3.3/public/plugins/grafana-worldmap-panel/images/worldmap-usa.png", - }, - { - Name: "Light Theme", - Path: "https://cdn.example.com/grafana-worldmap-panel/0.3.3/public/plugins/grafana-worldmap-panel/images/worldmap-light-theme.png", - }, - }, - }, - Dependencies: plugins.Dependencies{ - GrafanaVersion: "3.x.x", - Plugins: []plugins.Dependency{}, - }, - }, - FS: plugins.NewLocalFS(map[string]struct{}{ - filepath.Join(parentDir, "testdata/cdn/plugin", "plugin.json"): {}, - }, filepath.Join(parentDir, "testdata/cdn/plugin")), - Class: plugins.External, - Signature: plugins.SignatureValid, - BaseURL: "plugin-cdn/grafana-worldmap-panel/0.3.3/public/plugins/grafana-worldmap-panel", - Module: "plugin-cdn/grafana-worldmap-panel/0.3.3/public/plugins/grafana-worldmap-panel/module", - }, - }, - }, } for _, tt := range tests { reg := fakes.NewFakePluginRegistry() @@ -535,6 +478,89 @@ func TestLoader_Load(t *testing.T) { } } +func TestLoader_Load_CustomSource(t *testing.T) { + t.Run("Load a plugin", func(t *testing.T) { + parentDir, err := filepath.Abs("../") + if err != nil { + t.Errorf("could not construct absolute path of current dir") + return + } + + cfg := &config.Cfg{ + PluginsCDNURLTemplate: "https://cdn.example.com", + PluginSettings: setting.PluginSettings{ + "grafana-worldmap-panel": {"cdn": "true"}, + }, + } + + pluginPaths := []string{"../testdata/cdn"} + expected := []*plugins.Plugin{{ + JSONData: plugins.JSONData{ + ID: "grafana-worldmap-panel", + Type: "panel", + Name: "Worldmap Panel", + Info: plugins.Info{ + Version: "0.3.3", + Links: []plugins.InfoLink{ + {Name: "Project site", URL: "https://github.com/grafana/worldmap-panel"}, + {Name: "MIT License", URL: "https://github.com/grafana/worldmap-panel/blob/master/LICENSE"}, + }, + Logos: plugins.Logos{ + // Path substitution + Small: "https://cdn.example.com/grafana-worldmap-panel/0.3.3/public/plugins/grafana-worldmap-panel/images/worldmap_logo.svg", + Large: "https://cdn.example.com/grafana-worldmap-panel/0.3.3/public/plugins/grafana-worldmap-panel/images/worldmap_logo.svg", + }, + Screenshots: []plugins.Screenshots{ + { + Name: "World", + Path: "https://cdn.example.com/grafana-worldmap-panel/0.3.3/public/plugins/grafana-worldmap-panel/images/worldmap-world.png", + }, + { + Name: "USA", + Path: "https://cdn.example.com/grafana-worldmap-panel/0.3.3/public/plugins/grafana-worldmap-panel/images/worldmap-usa.png", + }, + { + Name: "Light Theme", + Path: "https://cdn.example.com/grafana-worldmap-panel/0.3.3/public/plugins/grafana-worldmap-panel/images/worldmap-light-theme.png", + }, + }, + }, + Dependencies: plugins.Dependencies{ + GrafanaVersion: "3.x.x", + Plugins: []plugins.Dependency{}, + }, + }, + FS: plugins.NewLocalFS(map[string]struct{}{ + filepath.Join(parentDir, "testdata/cdn/plugin", "plugin.json"): {}, + }, filepath.Join(parentDir, "testdata/cdn/plugin")), + Class: plugins.Bundled, + Signature: plugins.SignatureValid, + BaseURL: "plugin-cdn/grafana-worldmap-panel/0.3.3/public/plugins/grafana-worldmap-panel", + Module: "plugin-cdn/grafana-worldmap-panel/0.3.3/public/plugins/grafana-worldmap-panel/module", + }} + + l := newLoader(cfg) + got, err := l.Load(context.Background(), &fakes.FakePluginSource{ + PluginClassFunc: func(ctx context.Context) plugins.Class { + return plugins.Bundled + }, + PluginURIsFunc: func(ctx context.Context) []string { + return pluginPaths + }, + DefaultSignatureFunc: func(ctx context.Context) (plugins.Signature, bool) { + return plugins.Signature{ + Status: plugins.SignatureValid, + }, true + }, + }) + + require.NoError(t, err) + if !cmp.Equal(got, expected, compareOpts...) { + t.Fatalf("Result mismatch (-want +got):\n%s", cmp.Diff(got, expected, compareOpts...)) + } + }) +} + func TestLoader_setDefaultNavURL(t *testing.T) { t.Run("When including a dashboard with DefaultNav: true", func(t *testing.T) { pluginWithDashboard := &plugins.Plugin{ @@ -1304,10 +1330,9 @@ func Test_setPathsBasedOnApp(t *testing.T) { } func newLoader(cfg *config.Cfg, cbs ...func(loader *Loader)) *Loader { - cdn := pluginscdn.ProvideService(cfg) l := New(cfg, &fakes.FakeLicensingService{}, signature.NewUnsignedAuthorizer(cfg), fakes.NewFakePluginRegistry(), fakes.NewFakeBackendProcessProvider(), fakes.NewFakeProcessManager(), fakes.NewFakePluginStorage(), - fakes.NewFakeRoleRegistry(), cdn, assetpath.ProvideService(cdn), finder.NewLocalFinder()) + fakes.NewFakeRoleRegistry(), assetpath.ProvideService(pluginscdn.ProvideService(cfg)), finder.NewLocalFinder()) for _, cb := range cbs { cb(l) diff --git a/pkg/plugins/manager/manager_integration_test.go b/pkg/plugins/manager/manager_integration_test.go index 2e8c9c56cec..60d65a5d18c 100644 --- a/pkg/plugins/manager/manager_integration_test.go +++ b/pkg/plugins/manager/manager_integration_test.go @@ -114,12 +114,10 @@ func TestIntegrationPluginManager(t *testing.T) { pCfg, err := config.ProvideConfig(setting.ProvideProvider(cfg), cfg) require.NoError(t, err) reg := registry.ProvideService() - cdn := pluginscdn.ProvideService(pCfg) - lic := plicensing.ProvideLicensing(cfg, &licensing.OSSLicensingService{Cfg: cfg}) l := loader.ProvideService(pCfg, lic, signature.NewUnsignedAuthorizer(pCfg), reg, provider.ProvideService(coreRegistry), finder.NewLocalFinder(), fakes.NewFakeRoleRegistry(), - cdn, assetpath.ProvideService(cdn)) + assetpath.ProvideService(pluginscdn.ProvideService(pCfg))) srcs := sources.ProvideService(cfg, pCfg) ps, err := store.ProvideService(reg, srcs, l) require.NoError(t, err) From e9d356010d5d5e7f4baa3e0527be124fc76232b2 Mon Sep 17 00:00:00 2001 From: Eric Leijonmarck Date: Tue, 4 Apr 2023 16:27:40 +0100 Subject: [PATCH 19/80] Service accounts: Fix service account role picker on reload of profile page (#65911) * working but unsure if best strategy * removal of roleoptions to pass into the profile component * remove the dispatch of ac * added comment * added one more comment tro trigger pipeline --- .../ServiceAccountPage.test.tsx | 1 - .../serviceaccounts/ServiceAccountPage.tsx | 12 ++-------- .../components/ServiceAccountProfile.tsx | 23 ++++++++++++++++--- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/public/app/features/serviceaccounts/ServiceAccountPage.test.tsx b/public/app/features/serviceaccounts/ServiceAccountPage.test.tsx index 47483c46dd0..66ab605e509 100644 --- a/public/app/features/serviceaccounts/ServiceAccountPage.test.tsx +++ b/public/app/features/serviceaccounts/ServiceAccountPage.test.tsx @@ -30,7 +30,6 @@ const setup = (propOverrides: Partial) => { serviceAccount: {} as ServiceAccountDTO, tokens: [], isLoading: false, - roleOptions: [], match: { params: { id: '1' }, isExact: true, diff --git a/public/app/features/serviceaccounts/ServiceAccountPage.tsx b/public/app/features/serviceaccounts/ServiceAccountPage.tsx index dc4b00f6f2c..936dc4e8c06 100644 --- a/public/app/features/serviceaccounts/ServiceAccountPage.tsx +++ b/public/app/features/serviceaccounts/ServiceAccountPage.tsx @@ -6,7 +6,7 @@ import { Button, ConfirmModal, HorizontalGroup } from '@grafana/ui'; import { Page } from 'app/core/components/Page/Page'; import { contextSrv } from 'app/core/core'; import { GrafanaRouteComponentProps } from 'app/core/navigation/types'; -import { AccessControlAction, ApiKey, Role, ServiceAccountDTO, StoreState } from 'app/types'; +import { AccessControlAction, ApiKey, ServiceAccountDTO, StoreState } from 'app/types'; import { ServiceAccountPermissions } from './ServiceAccountPermissions'; import { CreateTokenModal, ServiceAccountToken } from './components/CreateTokenModal'; @@ -26,7 +26,6 @@ interface OwnProps extends GrafanaRouteComponentProps<{ id: string }> { serviceAccount?: ServiceAccountDTO; tokens: ApiKey[]; isLoading: boolean; - roleOptions: Role[]; } function mapStateToProps(state: StoreState) { @@ -34,7 +33,6 @@ function mapStateToProps(state: StoreState) { serviceAccount: state.serviceAccountProfile.serviceAccount, tokens: state.serviceAccountProfile.tokens, isLoading: state.serviceAccountProfile.isLoading, - roleOptions: state.serviceAccounts.roleOptions, timezone: getTimeZone(state.user), }; } @@ -58,7 +56,6 @@ export const ServiceAccountPageUnconnected = ({ tokens, timezone, isLoading, - roleOptions, createServiceAccountToken, deleteServiceAccount, deleteServiceAccountToken, @@ -171,12 +168,7 @@ export const ServiceAccountPageUnconnected = ({ )} {serviceAccount && ( - + )}

Tokens

diff --git a/public/app/features/serviceaccounts/components/ServiceAccountProfile.tsx b/public/app/features/serviceaccounts/components/ServiceAccountProfile.tsx index a426b656383..a6d83cc5b38 100644 --- a/public/app/features/serviceaccounts/components/ServiceAccountProfile.tsx +++ b/public/app/features/serviceaccounts/components/ServiceAccountProfile.tsx @@ -3,6 +3,7 @@ import React from 'react'; import { dateTimeFormat, GrafanaTheme2, OrgRole, TimeZone } from '@grafana/data'; import { useStyles2 } from '@grafana/ui'; +import { fetchRoleOptions } from 'app/core/components/RolePicker/api'; import { contextSrv } from 'app/core/core'; import { AccessControlAction, Role, ServiceAccountDTO } from 'app/types'; @@ -12,13 +13,13 @@ import { ServiceAccountRoleRow } from './ServiceAccountRoleRow'; interface Props { serviceAccount: ServiceAccountDTO; timeZone: TimeZone; - roleOptions: Role[]; onChange: (serviceAccount: ServiceAccountDTO) => void; } -export function ServiceAccountProfile({ serviceAccount, timeZone, roleOptions, onChange }: Props): JSX.Element { +export function ServiceAccountProfile({ serviceAccount, timeZone, onChange }: Props): JSX.Element { const styles = useStyles2(getStyles); const ableToWrite = contextSrv.hasPermission(AccessControlAction.ServiceAccountsWrite); + const [roles, setRoles] = React.useState([]); const onRoleChange = (role: OrgRole) => { onChange({ ...serviceAccount, role: role }); @@ -27,6 +28,22 @@ export function ServiceAccountProfile({ serviceAccount, timeZone, roleOptions, o const onNameChange = (newValue: string) => { onChange({ ...serviceAccount, name: newValue }); }; + // TODO: this is a temporary solution to fetch roles for service accounts + // until we make use of the state from the serviceaccountspage + // and pass it down to the serviceaccountprofile + React.useEffect(() => { + if (contextSrv.licensedAccessControlEnabled()) { + if (contextSrv.hasPermission(AccessControlAction.ActionRolesList)) { + fetchRoleOptions(serviceAccount.orgId) + .then((roles) => { + setRoles(roles); + }) + .catch((err) => { + console.log('fetchRoleOptions error: ', err); + }); + } + } + }, [serviceAccount.orgId]); return (
@@ -44,7 +61,7 @@ export function ServiceAccountProfile({ serviceAccount, timeZone, roleOptions, o label="Roles" serviceAccount={serviceAccount} onRoleChange={onRoleChange} - roleOptions={roleOptions} + roleOptions={roles} /> Date: Tue, 4 Apr 2023 17:54:09 +0200 Subject: [PATCH 20/80] chore: automatically add relevant items to dataviz / bi projects (#65882) Implement automation to include relevant items in both BI and DataViz projects --- .github/commands.json | 152 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) diff --git a/.github/commands.json b/.github/commands.json index 9aacbac983d..f2e9cc2223c 100644 --- a/.github/commands.json +++ b/.github/commands.json @@ -322,5 +322,157 @@ "addToProject": { "url": "https://github.com/orgs/grafana/projects/78" } + }, + { + "type": "label", + "name": "area/panel/candlestick", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/56" + } + }, + { + "type": "label", + "name": "area/panel/canvas", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/56" + } + }, + { + "type": "label", + "name": "area/panel/barchart", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/56" + } + }, + { + "type": "label", + "name": "area/panel/bargauge", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/72" + } + }, + { + "type": "label", + "name": "area/panel/gauge", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/72" + } + }, + { + "type": "label", + "name": "area/panel/geomap", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/56" + } + }, + { + "type": "label", + "name": "area/panel/graph", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/56" + } + }, + { + "type": "label", + "name": "area/panel/heatmap", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/56" + } + }, + { + "type": "label", + "name": "area/panel/histogram", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/56" + } + }, + { + "type": "label", + "name": "area/panel/icon", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/56" + } + }, + { + "type": "label", + "name": "area/panel/piechart", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/72" + } + }, + { + "type": "label", + "name": "area/panel/stat", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/72" + } + }, + { + "type": "label", + "name": "area/panel/state-timeline", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/56" + } + }, + { + "type": "label", + "name": "area/panel/status-history", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/56" + } + }, + { + "type": "label", + "name": "area/panel/timeseries", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/56" + } + }, + { + "type": "label", + "name": "area/panel/xychart", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/56" + } + }, + { + "type": "label", + "name": "area/panel/oss-dataviz", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/56" + } + }, + { + "type": "label", + "name": "area/panel/oss-bi", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/72" + } + }, + { + "type": "label", + "name": "area/panel/table", + "action": "addToProject", + "addToProject": { + "url": "https://github.com/orgs/grafana/projects/72" + } } ] From c7d3c5a622f7b1db1a3c49e3f6f7371c90a7353e Mon Sep 17 00:00:00 2001 From: Ricky Whitaker Date: Tue, 4 Apr 2023 11:17:12 -0500 Subject: [PATCH 21/80] Rickywhitaker/verify repos update (#65739) * initial commit of verify repo update * consolidated duplicate verify-repos.sh commands into 1 with env vars * fixing rpm versioned install --- scripts/verify-repo-update/verify-repos.sh | 59 ++++++++++++---------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/scripts/verify-repo-update/verify-repos.sh b/scripts/verify-repo-update/verify-repos.sh index d4196b0e803..22ada0ed938 100755 --- a/scripts/verify-repo-update/verify-repos.sh +++ b/scripts/verify-repo-update/verify-repos.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash +# Usage: ./verify-repos.sh [argument] +# argument is optional, but can be "beta" or a valid tag (ex: 9.4.7) set -o pipefail _basedir=$(dirname "$0") @@ -20,37 +22,38 @@ docker_build () { retval=$(docker run --rm "$tag" cat /usr/share/grafana/VERSION) } -CHECK_BETA=$1 -if [[ $CHECK_BETA == "beta" ]]; then - # Testing deb repos - docker_build "Dockerfile.deb" "deb-oss-beta.list" "grafana" "gf-oss-deb-repo-test" - _oss_deb_v="$retval" +_stable_or_beta="stable" +_grafana_deb_tag="grafana" +_grafana_rpm_tag="grafana" +_grafana_enterprise_deb_tag="grafana-enterprise" +_grafana_enterprise_rpm_tag="grafana-enterprise" - docker_build "Dockerfile.deb" "deb-ee-beta.list" "grafana-enterprise" "gf-ee-deb-repo-test" - _ee_deb_v="$retval" - - # Testing rpm repos - docker_build "Dockerfile.rpm" "rpm-oss-beta.list" "grafana" "gf-oss-rpm-repo-test" - _oss_rpm_v="$retval" - - docker_build "Dockerfile.rpm" "rpm-ee-beta.list" "grafana-enterprise" "gf-ee-rpm-repo-test" - _ee_rpm_v="$retval" -else - # Testing deb repos - docker_build "Dockerfile.deb" "deb-oss-stable.list" "grafana" "gf-oss-deb-repo-test" - _oss_deb_v="$retval" - - docker_build "Dockerfile.deb" "deb-ee-stable.list" "grafana-enterprise" "gf-ee-deb-repo-test" - _ee_deb_v="$retval" - - # Testing rpm repos - docker_build "Dockerfile.rpm" "rpm-oss-stable.list" "grafana" "gf-oss-rpm-repo-test" - _oss_rpm_v="$retval" - - docker_build "Dockerfile.rpm" "rpm-ee-stable.list" "grafana-enterprise" "gf-ee-rpm-repo-test" - _ee_rpm_v="$retval" +# CHECK_BETA=$1 +if [[ $1 == "beta" ]]; then + _stable_or_beta="beta" +elif [[ $1 != "" ]]; then + # Assume user is passing in version + _version="$1" + _grafana_deb_tag="grafana=$_version" + _grafana_rpm_tag="grafana-$_version" + _grafana_enterprise_deb_tag="grafana-enterprise=$_version" + _grafana_enterprise_rpm_tag="grafana-enterprise-$_version" fi +# Testing deb repos +docker_build "Dockerfile.deb" "deb-oss-$_stable_or_beta.list" "$_grafana_deb_tag" "gf-oss-deb-repo-test" +_oss_deb_v="$retval" + +docker_build "Dockerfile.deb" "deb-ee-$_stable_or_beta.list" "$_grafana_enterprise_deb_tag" "gf-ee-deb-repo-test" +_ee_deb_v="$retval" + +# Testing rpm repos +docker_build "Dockerfile.rpm" "rpm-oss-$_stable_or_beta.list" "$_grafana_rpm_tag" "gf-oss-rpm-repo-test" +_oss_rpm_v="$retval" + +docker_build "Dockerfile.rpm" "rpm-ee-$_stable_or_beta.list" "$_grafana_enterprise_rpm_tag" "gf-ee-rpm-repo-test" +_ee_rpm_v="$retval" + echo Versions: echo OSS deb = "${_oss_deb_v}" echo OSS rpm = "${_oss_rpm_v}" From 445734888b8e6340aef65c3141fcecdb4b9d2ac9 Mon Sep 17 00:00:00 2001 From: melGL <81323402+melgl@users.noreply.github.com> Date: Tue, 4 Apr 2023 13:38:18 -0500 Subject: [PATCH 22/80] Docs: Added note to contact Support (#65235) * Added note to contact Support * Update docs/sources/setup-grafana/configure-security/configure-authentication/enhanced-ldap/index.md * Update docs/sources/setup-grafana/configure-security/configure-authentication/enhanced-ldap/index.md * makes prettier * Apply suggestions from code review --------- Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com> Co-authored-by: Chris Moyer --- .../configure-authentication/enhanced-ldap/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/setup-grafana/configure-security/configure-authentication/enhanced-ldap/index.md b/docs/sources/setup-grafana/configure-security/configure-authentication/enhanced-ldap/index.md index 1bc215476a8..e03a7457b41 100644 --- a/docs/sources/setup-grafana/configure-security/configure-authentication/enhanced-ldap/index.md +++ b/docs/sources/setup-grafana/configure-security/configure-authentication/enhanced-ldap/index.md @@ -18,7 +18,7 @@ weight: 900 The enhanced LDAP integration adds additional functionality on top of the [LDAP integration]({{< relref "ldap/" >}}) available in the open source edition of Grafana. -> **Note:** Available in [Grafana Enterprise]({{< relref "../../../../introduction/grafana-enterprise/" >}}) and [Grafana Cloud Advanced](/docs/grafana-cloud). +> **Note:** Available in [Grafana Enterprise]({{< relref "../../../../introduction/grafana-enterprise/" >}}) and [Grafana Cloud Advanced](/docs/grafana-cloud). If you are a Grafana Cloud customer, please [open a support ticket in the Cloud Portal](https://grafana.com/orgs/$org/tickets) to request this feature. > To control user access with role-based permissions, refer to [role-based access control]({{< relref "../../../../administration/roles-and-permissions/access-control/" >}}). From f932952c68f19b853bb81bd55db03827a90aed67 Mon Sep 17 00:00:00 2001 From: kay delaney <45561153+kaydelaney@users.noreply.github.com> Date: Tue, 4 Apr 2023 19:56:47 +0100 Subject: [PATCH 23/80] Row-repeats: Fix disappearing panel when viewed panel is refreshed (#58392) * Row-repeats: Fix disappearing panel when viewed panel is refreshed Close #57159 --- .betterer.results | 3 +- .../state/DashboardModel.repeat.test.ts | 60 ------------------- .../dashboard/state/DashboardModel.ts | 2 +- 3 files changed, 2 insertions(+), 63 deletions(-) diff --git a/.betterer.results b/.betterer.results index 3a94de50eb6..50a78b99fb8 100644 --- a/.betterer.results +++ b/.betterer.results @@ -2523,8 +2523,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "3"], [0, 0, 0, "Unexpected any. Specify a different type.", "4"], [0, 0, 0, "Unexpected any. Specify a different type.", "5"], - [0, 0, 0, "Unexpected any. Specify a different type.", "6"], - [0, 0, 0, "Unexpected any. Specify a different type.", "7"] + [0, 0, 0, "Unexpected any. Specify a different type.", "6"] ], "public/app/features/dashboard/state/DashboardModel.test.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] diff --git a/public/app/features/dashboard/state/DashboardModel.repeat.test.ts b/public/app/features/dashboard/state/DashboardModel.repeat.test.ts index e95bc66d36d..1c6e8719856 100644 --- a/public/app/features/dashboard/state/DashboardModel.repeat.test.ts +++ b/public/app/features/dashboard/state/DashboardModel.repeat.test.ts @@ -5,8 +5,6 @@ import { DashboardPanelsChangedEvent } from 'app/types/events'; import { getDashboardModel } from '../../../../test/helpers/getDashboardModel'; import { DashboardModel } from '../state/DashboardModel'; -import { PanelModel } from './PanelModel'; - jest.mock('app/core/services/context_srv', () => ({})); describe('given dashboard with panel repeat', () => { @@ -802,61 +800,3 @@ describe('given dashboard with row and repeats on same row', () => { expect(dashboard.panels[17].gridPos).toEqual({ x: x2, y: 31, w: w2, h: h2 }); }); }); - -describe('given panel is in view mode', () => { - let dashboard: any; - - beforeEach(() => { - const dashboardJSON = { - panels: [ - { - id: 1, - repeat: 'apps', - repeatDirection: 'h', - gridPos: { x: 0, y: 0, h: 2, w: 24 }, - }, - ], - templating: { - list: [ - { - name: 'apps', - type: 'custom', - current: { - text: 'se1, se2, se3', - value: ['se1', 'se2', 'se3'], - }, - options: [ - { text: 'se1', value: 'se1', selected: true }, - { text: 'se2', value: 'se2', selected: true }, - { text: 'se3', value: 'se3', selected: true }, - { text: 'se4', value: 'se4', selected: false }, - ], - }, - ], - }, - }; - - dashboard = getDashboardModel(dashboardJSON); - dashboard.initViewPanel( - new PanelModel({ - id: 2, - repeat: undefined, - repeatDirection: 'h', - panels: [ - { - id: 2, - repeat: 'apps', - repeatDirection: 'h', - gridPos: { x: 0, y: 0, h: 2, w: 24 }, - }, - ], - repeatPanelId: 2, - }) - ); - dashboard.processRepeats(); - }); - - it('should set correct repeated panel to be in view', () => { - expect(dashboard.panels[1].isViewing).toBeTruthy(); - }); -}); diff --git a/public/app/features/dashboard/state/DashboardModel.ts b/public/app/features/dashboard/state/DashboardModel.ts index ebca913d348..b4cb4fbc8fc 100644 --- a/public/app/features/dashboard/state/DashboardModel.ts +++ b/public/app/features/dashboard/state/DashboardModel.ts @@ -576,7 +576,7 @@ export class DashboardModel implements TimeModel { } processRepeats() { - if (this.isSnapshotTruthy() || !this.hasVariables()) { + if (this.isSnapshotTruthy() || !this.hasVariables() || this.panelInView) { return; } From f1eddbad0633d3ddad2422303b62d3990bd1c906 Mon Sep 17 00:00:00 2001 From: Giuseppe Guerra Date: Tue, 4 Apr 2023 23:16:57 +0200 Subject: [PATCH 24/80] Plugins: Tracing: Add test for composite propagation (#65917) --- .../loader/initializer/initializer_test.go | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pkg/plugins/manager/loader/initializer/initializer_test.go b/pkg/plugins/manager/loader/initializer/initializer_test.go index d9d7a49692a..00f7c80e42a 100644 --- a/pkg/plugins/manager/loader/initializer/initializer_test.go +++ b/pkg/plugins/manager/loader/initializer/initializer_test.go @@ -304,6 +304,27 @@ func TestInitializer_tracingEnvironmentVariables(t *testing.T) { assert.Equal(t, "GF_INSTANCE_OTLP_PROPAGATION=w3c", envVars[4]) }, }, + { + name: "otlp enabled composite propagation", + cfg: &config.Cfg{ + Opentelemetry: config.OpentelemetryCfg{ + Address: "127.0.0.1:4317", + Propagation: "w3c,jaeger", + }, + PluginSettings: map[string]map[string]string{ + pluginID: {"tracing": "true"}, + }, + }, + plugin: defaultPlugin, + exp: func(t *testing.T, envVars []string) { + assert.Len(t, envVars, 5) + assert.Equal(t, "GF_PLUGIN_TRACING=true", envVars[0]) + assert.Equal(t, "GF_VERSION=", envVars[1]) + assert.Equal(t, "GF_PLUGIN_VERSION=1.0.0", envVars[2]) + assert.Equal(t, "GF_INSTANCE_OTLP_ADDRESS=127.0.0.1:4317", envVars[3]) + assert.Equal(t, "GF_INSTANCE_OTLP_PROPAGATION=w3c,jaeger", envVars[4]) + }, + }, { name: "otlp no propagation disabled by default", cfg: &config.Cfg{ From fb520edd72624794ab257ddb039a28675e65f1fe Mon Sep 17 00:00:00 2001 From: Alexander Weaver Date: Tue, 4 Apr 2023 16:41:46 -0500 Subject: [PATCH 25/80] Alerting: Use a completely isolated context for state history writes (#64989) * Add fresh context with timeout and same log properties, re-derive logger * Unify timeout constants * Move ctx after shortcut that got added through rebasing * Unify timeouts * Port opentracing's SpanFromContext and ContextFromSpan to the grafana tracing package * Support both opentracing and otel variants * Better document why we're creating a new ctx * Add new func to FakeSpan which was added after rebase * Support grafana-specific traceID key in both tracer implementations --- pkg/infra/tracing/opentelemetry_tracing.go | 12 ++++++ pkg/infra/tracing/test_helper.go | 4 ++ pkg/infra/tracing/tracing.go | 39 +++++++++++++++++++ .../ngalert/state/historian/annotation.go | 18 ++++++++- pkg/services/ngalert/state/historian/core.go | 3 ++ pkg/services/ngalert/state/historian/loki.go | 17 +++++++- .../ngalert/state/historian/loki_http.go | 6 +-- .../ngalert/state/historian/model/rule.go | 5 +++ 8 files changed, 95 insertions(+), 9 deletions(-) diff --git a/pkg/infra/tracing/opentelemetry_tracing.go b/pkg/infra/tracing/opentelemetry_tracing.go index 17620b922a4..52e4d0c14f9 100644 --- a/pkg/infra/tracing/opentelemetry_tracing.go +++ b/pkg/infra/tracing/opentelemetry_tracing.go @@ -320,3 +320,15 @@ func (s OpentelemetrySpan) AddEvents(keys []string, values []EventValue) { } } } + +func (s OpentelemetrySpan) contextWithSpan(ctx context.Context) context.Context { + if s.span != nil { + ctx = trace.ContextWithSpan(ctx, s.span) + // Grafana also manages its own separate traceID in the context in addition to what opentracing handles. + // It's derived from the span. Ensure that we propagate this too. + if traceID := s.span.SpanContext().TraceID(); traceID.IsValid() { + ctx = context.WithValue(ctx, traceKey{}, traceValue{traceID.String(), s.span.SpanContext().IsSampled()}) + } + } + return ctx +} diff --git a/pkg/infra/tracing/test_helper.go b/pkg/infra/tracing/test_helper.go index c8e4a646409..19894f2adce 100644 --- a/pkg/infra/tracing/test_helper.go +++ b/pkg/infra/tracing/test_helper.go @@ -92,6 +92,10 @@ func (t *FakeSpan) AddEvents(keys []string, values []EventValue) { } } +func (t *FakeSpan) contextWithSpan(ctx context.Context) context.Context { + return ctx +} + type FakeTracer struct { Spans []*FakeSpan } diff --git a/pkg/infra/tracing/tracing.go b/pkg/infra/tracing/tracing.go index 7463931847e..145f540b1a4 100644 --- a/pkg/infra/tracing/tracing.go +++ b/pkg/infra/tracing/tracing.go @@ -76,6 +76,10 @@ type Span interface { // // Panics if the length of keys is shorter than the length of values. AddEvents(keys []string, values []EventValue) + + // contextWithSpan returns a context.Context that holds the parent + // context plus a reference to this span. + contextWithSpan(ctx context.Context) context.Context } func ProvideService(cfg *setting.Cfg) (Tracer, error) { @@ -146,6 +150,29 @@ func TraceIDFromContext(c context.Context, requireSampled bool) string { return "" } +// SpanFromContext returns the Span previously associated with ctx, or nil, if no such span could be found. +// It is the equivalent of opentracing.SpanFromContext and trace.SpanFromContext. +func SpanFromContext(ctx context.Context) Span { + // Look for both opentracing and opentelemetry spans. + if span := opentracing.SpanFromContext(ctx); span != nil { + return OpentracingSpan{span: span} + } + if span := trace.SpanFromContext(ctx); span != nil { + return OpentelemetrySpan{span: span} + } + return nil +} + +// ContextWithSpan returns a new context.Context that holds a reference to the given span. +// If span is nil, a new context without an active span is returned. +// It is the equivalent of opentracing.ContextWithSpan and trace.ContextWithSpan. +func ContextWithSpan(ctx context.Context, span Span) context.Context { + if span != nil { + return span.contextWithSpan(ctx) + } + return ctx +} + type Opentracing struct { enabled bool address string @@ -324,6 +351,18 @@ func (s OpentracingSpan) AddEvents(keys []string, values []EventValue) { s.span.LogFields(fields...) } +func (s OpentracingSpan) contextWithSpan(ctx context.Context) context.Context { + if s.span != nil { + ctx = opentracing.ContextWithSpan(ctx, s.span) + // Grafana also manages its own separate traceID in the context in addition to what opentracing handles. + // It's derived from the span. Ensure that we propagate this too. + if sctx, ok := s.span.Context().(jaeger.SpanContext); ok { + ctx = context.WithValue(ctx, traceKey{}, traceValue{sctx.TraceID().String(), sctx.IsSampled()}) + } + } + return ctx +} + func splitTagSettings(input string) map[string]string { res := map[string]string{} diff --git a/pkg/services/ngalert/state/historian/annotation.go b/pkg/services/ngalert/state/historian/annotation.go index d4c45ca7418..12a3a15ea03 100644 --- a/pkg/services/ngalert/state/historian/annotation.go +++ b/pkg/services/ngalert/state/historian/annotation.go @@ -14,6 +14,7 @@ import ( "github.com/grafana/grafana/pkg/components/simplejson" "github.com/grafana/grafana/pkg/infra/log" + "github.com/grafana/grafana/pkg/infra/tracing" "github.com/grafana/grafana/pkg/services/annotations" "github.com/grafana/grafana/pkg/services/dashboards" "github.com/grafana/grafana/pkg/services/ngalert/eval" @@ -67,10 +68,23 @@ func (h *AnnotationBackend) Record(ctx context.Context, rule history_model.RuleM return errCh } - go func() { + // This is a new background job, so let's create a brand new context for it. + // We want it to be isolated, i.e. we don't want grafana shutdowns to interrupt this work + // immediately but rather try to flush writes. + // This also prevents timeouts or other lingering objects (like transactions) from being + // incorrectly propagated here from other areas. + writeCtx := context.Background() + writeCtx, cancel := context.WithTimeout(writeCtx, StateHistoryWriteTimeout) + writeCtx = history_model.WithRuleData(writeCtx, rule) + writeCtx = tracing.ContextWithSpan(writeCtx, tracing.SpanFromContext(ctx)) + + go func(ctx context.Context) { + defer cancel() defer close(errCh) + logger := h.log.FromContext(ctx) + errCh <- h.recordAnnotations(ctx, panel, annotations, rule.OrgID, logger) - }() + }(writeCtx) return errCh } diff --git a/pkg/services/ngalert/state/historian/core.go b/pkg/services/ngalert/state/historian/core.go index 35b9e3ba40a..5fff26fdfd8 100644 --- a/pkg/services/ngalert/state/historian/core.go +++ b/pkg/services/ngalert/state/historian/core.go @@ -2,6 +2,7 @@ package historian import ( "strings" + "time" "github.com/grafana/grafana-plugin-sdk-go/data" @@ -12,6 +13,8 @@ import ( history_model "github.com/grafana/grafana/pkg/services/ngalert/state/historian/model" ) +const StateHistoryWriteTimeout = time.Minute + func shouldRecord(transition state.StateTransition) bool { if !transition.Changed() { return false diff --git a/pkg/services/ngalert/state/historian/loki.go b/pkg/services/ngalert/state/historian/loki.go index 0223010475b..99364a788ad 100644 --- a/pkg/services/ngalert/state/historian/loki.go +++ b/pkg/services/ngalert/state/historian/loki.go @@ -14,6 +14,7 @@ import ( "github.com/grafana/grafana/pkg/components/simplejson" "github.com/grafana/grafana/pkg/infra/log" + "github.com/grafana/grafana/pkg/infra/tracing" "github.com/grafana/grafana/pkg/services/ngalert/eval" "github.com/grafana/grafana/pkg/services/ngalert/metrics" "github.com/grafana/grafana/pkg/services/ngalert/models" @@ -80,8 +81,20 @@ func (h *RemoteLokiBackend) Record(ctx context.Context, rule history_model.RuleM return errCh } - go func() { + // This is a new background job, so let's create a brand new context for it. + // We want it to be isolated, i.e. we don't want grafana shutdowns to interrupt this work + // immediately but rather try to flush writes. + // This also prevents timeouts or other lingering objects (like transactions) from being + // incorrectly propagated here from other areas. + writeCtx := context.Background() + writeCtx, cancel := context.WithTimeout(writeCtx, StateHistoryWriteTimeout) + writeCtx = history_model.WithRuleData(writeCtx, rule) + writeCtx = tracing.ContextWithSpan(writeCtx, tracing.SpanFromContext(ctx)) + + go func(ctx context.Context) { + defer cancel() defer close(errCh) + logger := h.log.FromContext(ctx) org := fmt.Sprint(rule.OrgID) h.metrics.WritesTotal.WithLabelValues(org, "loki").Inc() @@ -93,7 +106,7 @@ func (h *RemoteLokiBackend) Record(ctx context.Context, rule history_model.RuleM h.metrics.TransitionsFailed.WithLabelValues(org).Add(float64(len(logStream.Values))) errCh <- fmt.Errorf("failed to save alert state history batch: %w", err) } - }() + }(writeCtx) return errCh } diff --git a/pkg/services/ngalert/state/historian/loki_http.go b/pkg/services/ngalert/state/historian/loki_http.go index 67ecdca2477..ff482397154 100644 --- a/pkg/services/ngalert/state/historian/loki_http.go +++ b/pkg/services/ngalert/state/historian/loki_http.go @@ -17,12 +17,8 @@ import ( "github.com/weaveworks/common/http/client" ) -const defaultClientTimeout = 30 * time.Second - func NewRequester() client.Requester { - return &http.Client{ - Timeout: defaultClientTimeout, - } + return &http.Client{} } // encoder serializes log streams to some byte format. diff --git a/pkg/services/ngalert/state/historian/model/rule.go b/pkg/services/ngalert/state/historian/model/rule.go index a63656c7560..5a76d60c9ce 100644 --- a/pkg/services/ngalert/state/historian/model/rule.go +++ b/pkg/services/ngalert/state/historian/model/rule.go @@ -1,6 +1,7 @@ package model import ( + "context" "strconv" "github.com/grafana/grafana/pkg/cmd/grafana-cli/logger" @@ -44,3 +45,7 @@ func NewRuleMeta(r *models.AlertRule, log log.Logger) RuleMeta { PanelID: panelID, } } + +func WithRuleData(ctx context.Context, rule RuleMeta) context.Context { + return models.WithRuleKey(ctx, models.AlertRuleKey{OrgID: rule.OrgID, UID: rule.UID}) +} From 313b3dd2af8cfd7a3d03839387471387308defde Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Tue, 4 Apr 2023 16:54:38 -0700 Subject: [PATCH 26/80] Chore: Reuse findFieldIndex from findField (#65973) --- public/app/features/dimensions/utils.ts | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/public/app/features/dimensions/utils.ts b/public/app/features/dimensions/utils.ts index 983356ab430..139386dc914 100644 --- a/public/app/features/dimensions/utils.ts +++ b/public/app/features/dimensions/utils.ts @@ -91,20 +91,8 @@ export function getTextDimensionFromData( } export function findField(frame?: DataFrame, name?: string): Field | undefined { - if (!frame || !name?.length) { - return undefined; - } - - for (const field of frame.fields) { - if (name === field.name) { - return field; - } - const disp = getFieldDisplayName(field, frame); - if (name === disp) { - return field; - } - } - return undefined; + const idx = findFieldIndex(frame, name); + return idx == null ? undefined : frame!.fields[idx]; } export function findFieldIndex(frame?: DataFrame, name?: string): number | undefined { From d974e5f25a0f1fcbde565d38c530d25bcfea441b Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Tue, 4 Apr 2023 20:52:20 -0700 Subject: [PATCH 27/80] TrendPanel: Add new trend panel (Alpha) (#65740) --- .betterer.results | 4 + .github/CODEOWNERS | 1 + .../uPlot/config/UPlotScaleBuilder.ts | 5 + .../manager/manager_integration_test.go | 1 + pkg/plugins/pfs/corelist/corelist_load_gen.go | 1 + pkg/plugins/plugindef/plugindef.cue | 2 +- .../app/features/plugins/built_in_plugins.ts | 2 + .../app/plugins/panel/timeseries/module.tsx | 5 +- public/app/plugins/panel/timeseries/utils.ts | 47 ++++-- public/app/plugins/panel/trend/TrendPanel.tsx | 137 ++++++++++++++++++ public/app/plugins/panel/trend/img/trend.svg | 9 ++ public/app/plugins/panel/trend/module.tsx | 30 ++++ public/app/plugins/panel/trend/panelcfg.cue | 42 ++++++ .../app/plugins/panel/trend/panelcfg.gen.ts | 27 ++++ public/app/plugins/panel/trend/plugin.json | 19 +++ public/app/plugins/panel/trend/suggestions.ts | 40 +++++ 16 files changed, 354 insertions(+), 18 deletions(-) create mode 100644 public/app/plugins/panel/trend/TrendPanel.tsx create mode 100644 public/app/plugins/panel/trend/img/trend.svg create mode 100644 public/app/plugins/panel/trend/module.tsx create mode 100644 public/app/plugins/panel/trend/panelcfg.cue create mode 100644 public/app/plugins/panel/trend/panelcfg.gen.ts create mode 100644 public/app/plugins/panel/trend/plugin.json create mode 100644 public/app/plugins/panel/trend/suggestions.ts diff --git a/.betterer.results b/.betterer.results index 50a78b99fb8..91f06e90952 100644 --- a/.betterer.results +++ b/.betterer.results @@ -6009,6 +6009,10 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], + "public/app/plugins/panel/trend/suggestions.ts:5381": [ + [0, 0, 0, "Do not use any type assertions.", "0"], + [0, 0, 0, "Unexpected any. Specify a different type.", "1"] + ], "public/app/plugins/panel/xychart/AutoEditor.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 11503dd8765..59d3c75414e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -407,6 +407,7 @@ lerna.json @grafana/frontend-ops /public/app/plugins/panel/table/ @grafana/grafana-bi-squad /public/app/plugins/panel/table-old/ @grafana/grafana-bi-squad /public/app/plugins/panel/timeseries/ @grafana/dataviz-squad +/public/app/plugins/panel/trend/ @grafana/dataviz-squad /public/app/plugins/panel/geomap/ @grafana/dataviz-squad /public/app/plugins/panel/canvas/ @grafana/dataviz-squad /public/app/plugins/panel/candlestick/ @grafana/dataviz-squad diff --git a/packages/grafana-ui/src/components/uPlot/config/UPlotScaleBuilder.ts b/packages/grafana-ui/src/components/uPlot/config/UPlotScaleBuilder.ts index dd7bb67e13c..f07a9c8c0cd 100644 --- a/packages/grafana-ui/src/components/uPlot/config/UPlotScaleBuilder.ts +++ b/packages/grafana-ui/src/components/uPlot/config/UPlotScaleBuilder.ts @@ -156,6 +156,11 @@ export class UPlotScaleBuilder extends PlotConfigBuilder { let minMax: uPlot.Range.MinMax = [dataMin, dataMax]; + // don't pad numeric x scales + if (scaleKey === 'x' && !isTime) { + return minMax; + } + // happens when all series on a scale are `show: false`, re-returning nulls will auto-disable axis if (!hasFixedRange && dataMin == null && dataMax == null) { return minMax; diff --git a/pkg/plugins/manager/manager_integration_test.go b/pkg/plugins/manager/manager_integration_test.go index 60d65a5d18c..2b987205375 100644 --- a/pkg/plugins/manager/manager_integration_test.go +++ b/pkg/plugins/manager/manager_integration_test.go @@ -189,6 +189,7 @@ func verifyCorePluginCatalogue(t *testing.T, ctx context.Context, ps *store.Serv "table-old": {}, "text": {}, "timeseries": {}, + "trend": {}, "welcome": {}, "xychart": {}, } diff --git a/pkg/plugins/pfs/corelist/corelist_load_gen.go b/pkg/plugins/pfs/corelist/corelist_load_gen.go index e9f631cec22..6215b3177b1 100644 --- a/pkg/plugins/pfs/corelist/corelist_load_gen.go +++ b/pkg/plugins/pfs/corelist/corelist_load_gen.go @@ -79,6 +79,7 @@ func corePlugins(rt *thema.Runtime) []pfs.ParsedPlugin { parsePluginOrPanic("public/app/plugins/panel/text", "text", rt), parsePluginOrPanic("public/app/plugins/panel/timeseries", "timeseries", rt), parsePluginOrPanic("public/app/plugins/panel/traces", "traces", rt), + parsePluginOrPanic("public/app/plugins/panel/trend", "trend", rt), parsePluginOrPanic("public/app/plugins/panel/welcome", "welcome", rt), parsePluginOrPanic("public/app/plugins/panel/xychart", "xychart", rt), } diff --git a/pkg/plugins/plugindef/plugindef.cue b/pkg/plugins/plugindef/plugindef.cue index 69c53b9a1c2..75f75f5d94d 100644 --- a/pkg/plugins/plugindef/plugindef.cue +++ b/pkg/plugins/plugindef/plugindef.cue @@ -17,7 +17,7 @@ seqs: [ // grafana.com, then the plugin `id` has to follow the naming // conventions. id: string & strings.MinRunes(1) - id: =~"^([0-9a-z]+\\-([0-9a-z]+\\-)?(\(strings.Join([ for t in _types {t}], "|"))))|(alertGroups|alertlist|annolist|barchart|bargauge|candlestick|canvas|dashlist|debug|gauge|geomap|gettingstarted|graph|heatmap|histogram|icon|live|logs|news|nodeGraph|piechart|pluginlist|stat|state-timeline|status-history|table|table-old|text|timeseries|traces|welcome|xychart|alertmanager|cloudwatch|dashboard|elasticsearch|grafana|grafana-azure-monitor-datasource|graphite|influxdb|jaeger|loki|mixed|mssql|mysql|opentsdb|postgres|prometheus|stackdriver|tempo|testdata|zipkin|phlare|parca)$" + id: =~"^([0-9a-z]+\\-([0-9a-z]+\\-)?(\(strings.Join([ for t in _types {t}], "|"))))|(alertGroups|alertlist|annolist|barchart|bargauge|candlestick|canvas|dashlist|debug|gauge|geomap|gettingstarted|graph|heatmap|histogram|icon|live|logs|news|nodeGraph|piechart|pluginlist|stat|state-timeline|status-history|table|table-old|text|timeseries|trend|traces|welcome|xychart|alertmanager|cloudwatch|dashboard|elasticsearch|grafana|grafana-azure-monitor-datasource|graphite|influxdb|jaeger|loki|mixed|mssql|mysql|opentsdb|postgres|prometheus|stackdriver|tempo|testdata|zipkin|phlare|parca)$" // Human-readable name of the plugin that is shown to the user in // the UI. diff --git a/public/app/features/plugins/built_in_plugins.ts b/public/app/features/plugins/built_in_plugins.ts index 6fa3d13ef45..b1acdb9214e 100644 --- a/public/app/features/plugins/built_in_plugins.ts +++ b/public/app/features/plugins/built_in_plugins.ts @@ -66,6 +66,7 @@ import * as tablePanel from 'app/plugins/panel/table/module'; import * as textPanel from 'app/plugins/panel/text/module'; import * as timeseriesPanel from 'app/plugins/panel/timeseries/module'; import * as tracesPanel from 'app/plugins/panel/traces/module'; +import * as trendPanel from 'app/plugins/panel/trend/module'; import * as welcomeBanner from 'app/plugins/panel/welcome/module'; import * as xyChartPanel from 'app/plugins/panel/xychart/module'; @@ -106,6 +107,7 @@ const builtInPlugins: any = { 'app/plugins/panel/text/module': textPanel, 'app/plugins/panel/timeseries/module': timeseriesPanel, + 'app/plugins/panel/trend/module': trendPanel, 'app/plugins/panel/state-timeline/module': stateTimelinePanel, 'app/plugins/panel/status-history/module': statusHistoryPanel, 'app/plugins/panel/candlestick/module': candlestickPanel, diff --git a/public/app/plugins/panel/timeseries/module.tsx b/public/app/plugins/panel/timeseries/module.tsx index da9a6ba6ed0..fc8e5802fa7 100644 --- a/public/app/plugins/panel/timeseries/module.tsx +++ b/public/app/plugins/panel/timeseries/module.tsx @@ -1,15 +1,14 @@ import { PanelPlugin } from '@grafana/data'; -import { GraphFieldConfig } from '@grafana/schema'; import { commonOptionsBuilder } from '@grafana/ui'; import { TimeSeriesPanel } from './TimeSeriesPanel'; import { TimezonesEditor } from './TimezonesEditor'; import { defaultGraphConfig, getGraphFieldConfig } from './config'; import { graphPanelChangedHandler } from './migrations'; -import { PanelOptions } from './panelcfg.gen'; +import { PanelFieldConfig, PanelOptions } from './panelcfg.gen'; import { TimeSeriesSuggestionsSupplier } from './suggestions'; -export const plugin = new PanelPlugin(TimeSeriesPanel) +export const plugin = new PanelPlugin(TimeSeriesPanel) .setPanelChangeHandler(graphPanelChangedHandler) .useFieldConfig(getGraphFieldConfig(defaultGraphConfig)) .setPanelOptions((builder) => { diff --git a/public/app/plugins/panel/timeseries/utils.ts b/public/app/plugins/panel/timeseries/utils.ts index 74720cc1890..e2257c6abfc 100644 --- a/public/app/plugins/panel/timeseries/utils.ts +++ b/public/app/plugins/panel/timeseries/utils.ts @@ -22,12 +22,26 @@ import { nullToValue } from '@grafana/ui/src/components/GraphNG/nullToValue'; export function prepareGraphableFields( series: DataFrame[], theme: GrafanaTheme2, - timeRange?: TimeRange + timeRange?: TimeRange, + // numeric X requires a single frame where the first field is numeric + xNumFieldIdx?: number ): DataFrame[] | null { if (!series?.length) { return null; } + let useNumericX = xNumFieldIdx != null; + + // Make sure the numeric x field is first in the frame + if (xNumFieldIdx != null && xNumFieldIdx > 0) { + series = [ + { + ...series[0], + fields: [series[0].fields[xNumFieldIdx], ...series[0].fields.filter((f, i) => i !== xNumFieldIdx)], + }, + ]; + } + // some datasources simply tag the field as time, but don't convert to milli epochs // so we're stuck with doing the parsing here to avoid Moment slowness everywhere later // this mutates (once) @@ -49,20 +63,26 @@ export function prepareGraphableFields( let hasTimeField = false; let hasValueField = false; - let nulledFrame = applyNullInsertThreshold({ - frame, - refFieldPseudoMin: timeRange?.from.valueOf(), - refFieldPseudoMax: timeRange?.to.valueOf(), - }); + let nulledFrame = useNumericX + ? frame + : applyNullInsertThreshold({ + frame, + refFieldPseudoMin: timeRange?.from.valueOf(), + refFieldPseudoMax: timeRange?.to.valueOf(), + }); + + const frameFields = nullToValue(nulledFrame).fields; + + for (let fieldIdx = 0; fieldIdx < frameFields?.length ?? 0; fieldIdx++) { + const field = frameFields[fieldIdx]; - for (const field of nullToValue(nulledFrame).fields) { switch (field.type) { case FieldType.time: hasTimeField = true; fields.push(field); break; case FieldType.number: - hasValueField = true; + hasValueField = useNumericX ? fieldIdx > 0 : true; copy = { ...field, values: new ArrayVector( @@ -124,7 +144,7 @@ export function prepareGraphableFields( } } - if (hasTimeField && hasValueField) { + if ((useNumericX || hasTimeField) && hasValueField) { frames.push({ ...frame, length: nulledFrame.length, @@ -134,20 +154,19 @@ export function prepareGraphableFields( } if (frames.length) { - setClassicPaletteIdxs(frames, theme); + setClassicPaletteIdxs(frames, theme, 0); return frames; } return null; } -const setClassicPaletteIdxs = (frames: DataFrame[], theme: GrafanaTheme2) => { +const setClassicPaletteIdxs = (frames: DataFrame[], theme: GrafanaTheme2, skipFieldIdx?: number) => { let seriesIndex = 0; - frames.forEach((frame) => { - frame.fields.forEach((field) => { + frame.fields.forEach((field, fieldIdx) => { // TODO: also add FieldType.enum type here after https://github.com/grafana/grafana/pull/60491 - if (field.type === FieldType.number || field.type === FieldType.boolean) { + if (fieldIdx !== skipFieldIdx && (field.type === FieldType.number || field.type === FieldType.boolean)) { field.state = { ...field.state, seriesIndex: seriesIndex++, // TODO: skip this for fields with custom renderers (e.g. Candlestick)? diff --git a/public/app/plugins/panel/trend/TrendPanel.tsx b/public/app/plugins/panel/trend/TrendPanel.tsx new file mode 100644 index 00000000000..f899555ff06 --- /dev/null +++ b/public/app/plugins/panel/trend/TrendPanel.tsx @@ -0,0 +1,137 @@ +import React, { useMemo } from 'react'; + +import { FieldType, PanelProps } from '@grafana/data'; +import { config, PanelDataErrorView } from '@grafana/runtime'; +import { KeyboardPlugin, TimeSeries, TooltipDisplayMode, TooltipPlugin, usePanelContext } from '@grafana/ui'; +import { findFieldIndex } from 'app/features/dimensions'; + +import { ContextMenuPlugin } from '../timeseries/plugins/ContextMenuPlugin'; +import { prepareGraphableFields, regenerateLinksSupplier } from '../timeseries/utils'; + +import { PanelOptions } from './panelcfg.gen'; + +export const TrendPanel = ({ + data, + timeRange, + timeZone, + width, + height, + options, + fieldConfig, + replaceVariables, + id, +}: PanelProps) => { + const { sync } = usePanelContext(); + + const info = useMemo(() => { + if (data.series.length > 1) { + return { + warning: 'Only one frame is supported, consider adding a join transformation', + frames: data.series, + }; + } + + let frames = data.series; + let xFieldIdx: number | undefined; + if (options.xField) { + xFieldIdx = findFieldIndex(frames[0], options.xField); + if (xFieldIdx == null) { + return { + warning: 'Unable to find field: ' + options.xField, + frames: data.series, + }; + } + } else { + // first number field + // Perhaps we can/should support any ordinal rather than an error here + xFieldIdx = frames[0].fields.findIndex((f) => f.type === FieldType.number); + if (xFieldIdx === -1) { + return { + warning: 'No numeric fields found for X axis', + frames, + }; + } + } + + // Make sure values are ascending + if (xFieldIdx != null) { + const field = frames[0].fields[xFieldIdx]; + if (field.type === FieldType.number) { + // we may support ordinal soon + let last = Number.NEGATIVE_INFINITY; + const values = field.values.toArray(); + for (let i = 0; i < values.length; i++) { + const v = values[i]; + if (last > v) { + return { + warning: `Values must be in ascending order (index: ${i}, ${last} > ${v})`, + frames, + }; + } + last = v; + } + } + } + + return { frames: prepareGraphableFields(frames, config.theme2, undefined, xFieldIdx) }; + }, [data, options.xField]); + + if (info.warning || !info.frames) { + return ( + + ); + } + + return ( + + {(config, alignedDataFrame) => { + if ( + alignedDataFrame.fields.filter((f) => f.config.links !== undefined && f.config.links.length > 0).length > 0 + ) { + alignedDataFrame = regenerateLinksSupplier(alignedDataFrame, info.frames!, replaceVariables, timeZone); + } + + return ( + <> + + {options.tooltip.mode === TooltipDisplayMode.None || ( + + )} + + + + ); + }} + + ); +}; diff --git a/public/app/plugins/panel/trend/img/trend.svg b/public/app/plugins/panel/trend/img/trend.svg new file mode 100644 index 00000000000..f8f286dca06 --- /dev/null +++ b/public/app/plugins/panel/trend/img/trend.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/public/app/plugins/panel/trend/module.tsx b/public/app/plugins/panel/trend/module.tsx new file mode 100644 index 00000000000..177dcb04b1d --- /dev/null +++ b/public/app/plugins/panel/trend/module.tsx @@ -0,0 +1,30 @@ +import { PanelPlugin } from '@grafana/data'; +import { commonOptionsBuilder } from '@grafana/ui'; + +import { defaultGraphConfig, getGraphFieldConfig } from '../timeseries/config'; + +import { TrendPanel } from './TrendPanel'; +import { PanelFieldConfig, PanelOptions } from './panelcfg.gen'; +import { TrendSuggestionsSupplier } from './suggestions'; + +export const plugin = new PanelPlugin(TrendPanel) + .useFieldConfig(getGraphFieldConfig(defaultGraphConfig)) + .setPanelOptions((builder) => { + const category = ['X Axis']; + builder.addFieldNamePicker({ + path: 'xField', + name: 'X Field', + description: 'An increasing numeric value', + category, + defaultValue: undefined, + settings: { + isClearable: true, + placeholderText: 'First numeric value', + }, + }); + + commonOptionsBuilder.addTooltipOptions(builder); + commonOptionsBuilder.addLegendOptions(builder); + }) + .setSuggestionsSupplier(new TrendSuggestionsSupplier()); +//.setDataSupport({ annotations: true, alertStates: true }); diff --git a/public/app/plugins/panel/trend/panelcfg.cue b/public/app/plugins/panel/trend/panelcfg.cue new file mode 100644 index 00000000000..a56352c17fe --- /dev/null +++ b/public/app/plugins/panel/trend/panelcfg.cue @@ -0,0 +1,42 @@ +// Copyright 2021 Grafana Labs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package grafanaplugin + +import ( + "github.com/grafana/grafana/packages/grafana-schema/src/common" +) + +composableKinds: PanelCfg: { + lineage: { + seqs: [ + { + schemas: [ + { + // Identical to timeseries... except it does not have timezone settings + PanelOptions: { + legend: common.VizLegendOptions + tooltip: common.VizTooltipOptions + + // Name of the x field to use (defaults to first number) + xField?: string + } @cuetsy(kind="interface") + + PanelFieldConfig: common.GraphFieldConfig & {} @cuetsy(kind="interface") + }, + ] + }, + ] + } +} diff --git a/public/app/plugins/panel/trend/panelcfg.gen.ts b/public/app/plugins/panel/trend/panelcfg.gen.ts new file mode 100644 index 00000000000..d72f0b5a583 --- /dev/null +++ b/public/app/plugins/panel/trend/panelcfg.gen.ts @@ -0,0 +1,27 @@ +// Code generated - EDITING IS FUTILE. DO NOT EDIT. +// +// Generated by: +// public/app/plugins/gen.go +// Using jennies: +// TSTypesJenny +// PluginTSTypesJenny +// +// Run 'make gen-cue' from repository root to regenerate. + +import * as common from '@grafana/schema'; + +export const PanelCfgModelVersion = Object.freeze([0, 0]); + +/** + * Identical to timeseries... except it does not have timezone settings + */ +export interface PanelOptions { + legend: common.VizLegendOptions; + tooltip: common.VizTooltipOptions; + /** + * Name of the x field to use (defaults to first number) + */ + xField?: string; +} + +export interface PanelFieldConfig extends common.GraphFieldConfig {} diff --git a/public/app/plugins/panel/trend/plugin.json b/public/app/plugins/panel/trend/plugin.json new file mode 100644 index 00000000000..91717e503bd --- /dev/null +++ b/public/app/plugins/panel/trend/plugin.json @@ -0,0 +1,19 @@ +{ + "type": "panel", + "name": "Trend", + "id": "trend", + + "state": "alpha", + + "info": { + "description": "Like timeseries, but when x != time", + "author": { + "name": "Grafana Labs", + "url": "https://grafana.com" + }, + "logos": { + "small": "img/trend.svg", + "large": "img/trend.svg" + } + } +} diff --git a/public/app/plugins/panel/trend/suggestions.ts b/public/app/plugins/panel/trend/suggestions.ts new file mode 100644 index 00000000000..4306d46b18b --- /dev/null +++ b/public/app/plugins/panel/trend/suggestions.ts @@ -0,0 +1,40 @@ +import { VisualizationSuggestionsBuilder } from '@grafana/data'; +import { GraphDrawStyle, GraphFieldConfig } from '@grafana/schema'; +import { SuggestionName } from 'app/types/suggestions'; + +import { PanelOptions } from './panelcfg.gen'; + +export class TrendSuggestionsSupplier { + getSuggestionsForData(builder: VisualizationSuggestionsBuilder) { + const { dataSummary } = builder; + + if (dataSummary.numberFieldCount < 2 || dataSummary.rowCountTotal < 2 || dataSummary.rowCountTotal < 2) { + return; + } + + // Super basic + const list = builder.getListAppender({ + name: SuggestionName.LineChart, + pluginId: 'trend', + options: { + legend: {} as any, + }, + fieldConfig: { + defaults: { + custom: {}, + }, + overrides: [], + }, + cardOptions: { + previewModifier: (s) => { + s.options!.legend.showLegend = false; + + if (s.fieldConfig?.defaults.custom?.drawStyle !== GraphDrawStyle.Bars) { + s.fieldConfig!.defaults.custom!.lineWidth = Math.max(s.fieldConfig!.defaults.custom!.lineWidth ?? 1, 2); + } + }, + }, + }); + return list; + } +} From 9719ee9bd30cd3750fa86558c6ba78dea9b7552e Mon Sep 17 00:00:00 2001 From: Marcus Andersson Date: Wed, 5 Apr 2023 07:55:44 +0200 Subject: [PATCH 28/80] PluginExtensions: Fixed issue in typings for the onClick link callback (#65978) * Fixed bug with event being forced. * Made onClick undefinable in the config as well. * Fixed some more type issues. --- packages/grafana-data/src/types/pluginExtensions.ts | 4 ++-- public/app/features/plugins/extensions/getPluginExtensions.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/grafana-data/src/types/pluginExtensions.ts b/packages/grafana-data/src/types/pluginExtensions.ts index 0d1fc7ff143..dcc312a9c9c 100644 --- a/packages/grafana-data/src/types/pluginExtensions.ts +++ b/packages/grafana-data/src/types/pluginExtensions.ts @@ -20,7 +20,7 @@ export type PluginExtension = { export type PluginExtensionLink = PluginExtension & { type: PluginExtensionTypes.link; path?: string; - onClick?: (event: React.MouseEvent) => void; + onClick?: (event?: React.MouseEvent) => void; }; // Objects used for registering extensions (in app plugins) @@ -45,7 +45,7 @@ export type PluginExtensionLinkConfig = PluginE Context, Pick & { type: PluginExtensionTypes.link; - onClick?: (event: React.MouseEvent, helpers: PluginExtensionEventHelpers) => void; + onClick?: (event: React.MouseEvent | undefined, helpers: PluginExtensionEventHelpers) => void; } >; diff --git a/public/app/features/plugins/extensions/getPluginExtensions.ts b/public/app/features/plugins/extensions/getPluginExtensions.ts index 0a46015036c..7440528c4bc 100644 --- a/public/app/features/plugins/extensions/getPluginExtensions.ts +++ b/public/app/features/plugins/extensions/getPluginExtensions.ts @@ -108,14 +108,14 @@ function getLinkExtensionOverrides(pluginId: string, config: PluginExtensionLink function getLinkExtensionOnClick( config: PluginExtensionLinkConfig, context?: object -): ((event: React.MouseEvent) => void) | undefined { +): ((event?: React.MouseEvent) => void) | undefined { const { onClick } = config; if (!onClick) { return; } - return function onClickExtensionLink(event: React.MouseEvent) { + return function onClickExtensionLink(event?: React.MouseEvent) { try { const result = onClick(event, getEventHelpers(context)); From 4ded937c79a38087576b3224bf6f2ba59345571e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Farkas?= Date: Wed, 5 Apr 2023 09:13:24 +0200 Subject: [PATCH 29/80] Show traceids for failing and successful requests (#64903) * tracing: show backend trace ids in frontend * better trace id naming Co-authored-by: Sven Grossmann * better trace id naming Co-authored-by: Sven Grossmann * better trace id naming Co-authored-by: Sven Grossmann * added feature flag * bind functionality to the feature flag * use non-generic name for traceid header * fixed tests * loki: do not create empty fields * do not add empty fields * fixed graphite test mock data * added unit-tests to queryResponse * added unit-tests for backend_srv * more typescript-friendly check * added unit-tests for runRequest --------- Co-authored-by: Sven Grossmann --- .../feature-toggles/index.md | 1 + packages/grafana-data/src/types/datasource.ts | 6 ++ .../src/types/featureToggles.gen.ts | 1 + packages/grafana-data/src/types/panel.ts | 3 + .../src/services/backendSrv.ts | 2 + .../src/utils/queryResponse.test.ts | 76 +++++++++++++++++++ .../src/utils/queryResponse.ts | 25 ++++-- pkg/middleware/middleware.go | 7 ++ pkg/services/featuremgmt/registry.go | 6 ++ pkg/services/featuremgmt/toggles_gen.csv | 1 + pkg/services/featuremgmt/toggles_gen.go | 4 + public/app/core/services/backend_srv.ts | 11 ++- public/app/core/specs/backend_srv.test.ts | 63 ++++++++++++++- .../features/inspector/InspectErrorTab.tsx | 7 ++ .../features/inspector/InspectStatsTab.tsx | 6 ++ .../inspector/InspectStatsTraceIdsTable.tsx | 47 ++++++++++++ .../query/components/QueryErrorAlert.tsx | 10 ++- .../features/query/state/runRequest.test.ts | 43 +++++++++++ public/app/features/query/state/runRequest.ts | 7 ++ .../graphite/datasource_integration.test.ts | 4 +- .../plugins/datasource/loki/responseUtils.ts | 10 ++- 21 files changed, 327 insertions(+), 13 deletions(-) create mode 100644 public/app/features/inspector/InspectStatsTraceIdsTable.tsx 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 1da4beab3fd..3559bb4464e 100644 --- a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md +++ b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md @@ -84,6 +84,7 @@ Alpha features might be changed or removed without prior notice. | `showDashboardValidationWarnings` | Show warnings when dashboards do not validate against the schema | | `mysqlAnsiQuotes` | Use double quotes to escape keyword in a MySQL query | | `elasticsearchBackendMigration` | Use Elasticsearch as backend data source | +| `showTraceId` | Show trace ids for requests | | `datasourceOnboarding` | Enable data source onboarding page | | `secureSocksDatasourceProxy` | Enable secure socks tunneling for supported core datasources | | `authnService` | Use new auth service to perform authentication | diff --git a/packages/grafana-data/src/types/datasource.ts b/packages/grafana-data/src/types/datasource.ts index 3fe8cf36a09..02a196f0240 100644 --- a/packages/grafana-data/src/types/datasource.ts +++ b/packages/grafana-data/src/types/datasource.ts @@ -465,6 +465,11 @@ export interface DataQueryResponse { * Defaults to LoadingState.Done if state is not defined */ state?: LoadingState; + + /** + * traceIds related to the response, if available + */ + traceIds?: string[]; } export enum DataQueryErrorType { @@ -488,6 +493,7 @@ export interface DataQueryError { status?: number; statusText?: string; refId?: string; + traceId?: string; type?: DataQueryErrorType; } diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts index d889e89e2f1..0c84cb2fb0b 100644 --- a/packages/grafana-data/src/types/featureToggles.gen.ts +++ b/packages/grafana-data/src/types/featureToggles.gen.ts @@ -65,6 +65,7 @@ export interface FeatureToggles { nestedFolders?: boolean; accessTokenExpirationCheck?: boolean; elasticsearchBackendMigration?: boolean; + showTraceId?: boolean; datasourceOnboarding?: boolean; emptyDashboardPage?: boolean; secureSocksDatasourceProxy?: boolean; diff --git a/packages/grafana-data/src/types/panel.ts b/packages/grafana-data/src/types/panel.ts index 7e72b7680a7..99c580deeac 100644 --- a/packages/grafana-data/src/types/panel.ts +++ b/packages/grafana-data/src/types/panel.ts @@ -66,6 +66,9 @@ export interface PanelData { /** Contains the range from the request or a shifted time range if a request uses relative time */ timeRange: TimeRange; + + /** traceIds collected during the processing of the requests */ + traceIds?: string[]; } export interface PanelProps { diff --git a/packages/grafana-runtime/src/services/backendSrv.ts b/packages/grafana-runtime/src/services/backendSrv.ts index 15671891069..341794835b9 100644 --- a/packages/grafana-runtime/src/services/backendSrv.ts +++ b/packages/grafana-runtime/src/services/backendSrv.ts @@ -96,6 +96,7 @@ export interface FetchResponse { readonly type: ResponseType; readonly url: string; readonly config: BackendSrvRequest; + readonly traceId?: string; } /** @@ -122,6 +123,7 @@ export interface FetchError { cancelled?: boolean; isHandled?: boolean; config: BackendSrvRequest; + traceId?: string; } export function isFetchError(e: unknown): e is FetchError { diff --git a/packages/grafana-runtime/src/utils/queryResponse.test.ts b/packages/grafana-runtime/src/utils/queryResponse.test.ts index 56be442fd27..adec09b9f9d 100644 --- a/packages/grafana-runtime/src/utils/queryResponse.test.ts +++ b/packages/grafana-runtime/src/utils/queryResponse.test.ts @@ -280,6 +280,82 @@ describe('Query Response parser', () => { expect(ids).toEqual(['A', 'B']); }); + test('should handle a success-response without traceIds', () => { + const input = { + data: { + results: { + A: { + frames: [], + }, + }, + }, + } as unknown as FetchResponse; + const res = toDataQueryResponse(input); + expect(res.traceIds).toBeUndefined(); + }); + + test('should handle a success-response with traceIds', () => { + const input = { + data: { + results: { + A: { + frames: [], + }, + }, + }, + traceId: 'traceId1', + } as unknown as FetchResponse; + const res = toDataQueryResponse(input); + expect(res.traceIds).toStrictEqual(['traceId1']); + }); + + test('should handle an error-response without traceIds', () => { + const input = { + data: { + results: { + A: { + error: 'error from A', + status: 400, + }, + B: { + error: 'error from B', + status: 400, + }, + }, + }, + } as unknown as FetchResponse; + const res = toDataQueryResponse(input); + expect(res.traceIds).toBeUndefined(); + expect(res.error?.traceId).toBeUndefined(); + expect(res.errors).toHaveLength(2); + expect(res.errors?.[0].traceId).toBeUndefined(); + expect(res.errors?.[1].traceId).toBeUndefined(); + }); + + test('should handle an error-response with traceIds', () => { + const input = { + data: { + results: { + A: { + error: 'error from A', + status: 400, + }, + B: { + error: 'error from B', + status: 400, + }, + }, + }, + traceId: 'traceId1', + } as unknown as FetchResponse; + const res = toDataQueryResponse(input); + expect(res.traceIds).toStrictEqual(['traceId1']); + expect(res.error?.traceId).toBe('traceId1'); + expect(res.errors).toHaveLength(2); + expect(res.errors?.[0].traceId).toBe('traceId1'); + expect(res.errors?.[1].traceId).toBe('traceId1'); + }); + describe('Cache notice', () => { let resp: FetchResponse; diff --git a/packages/grafana-runtime/src/utils/queryResponse.ts b/packages/grafana-runtime/src/utils/queryResponse.ts index 919c003ef03..707550f9909 100644 --- a/packages/grafana-runtime/src/utils/queryResponse.ts +++ b/packages/grafana-runtime/src/utils/queryResponse.ts @@ -65,6 +65,13 @@ export function toDataQueryResponse( queries?: DataQuery[] ): DataQueryResponse { const rsp: DataQueryResponse = { data: [], state: LoadingState.Done }; + + const traceId = 'traceId' in res ? res.traceId : undefined; + + if (traceId != null) { + rsp.traceIds = [traceId]; + } + // If the response isn't in a correct shape we just ignore the data and pass empty DataQueryResponse. if ((res as FetchResponse).data?.results) { const results = (res as FetchResponse).data.results; @@ -83,17 +90,21 @@ export function toDataQueryResponse( for (const dr of data) { if (dr.error) { + const errorObj: DataQueryError = { + refId: dr.refId, + message: dr.error, + status: dr.status, + }; + if (traceId != null) { + errorObj.traceId = traceId; + } if (!rsp.error) { - rsp.error = { - refId: dr.refId, - message: dr.error, - status: dr.status, - }; + rsp.error = { ...errorObj }; } if (rsp.errors) { - rsp.errors.push({ refId: dr.refId, message: dr.error, status: dr.status }); + rsp.errors.push({ ...errorObj }); } else { - rsp.errors = [{ refId: dr.refId, message: dr.error, status: dr.status }]; + rsp.errors = [{ ...errorObj }]; } rsp.state = LoadingState.Error; } diff --git a/pkg/middleware/middleware.go b/pkg/middleware/middleware.go index 4980d7cb2a4..eb4861dbbeb 100644 --- a/pkg/middleware/middleware.go +++ b/pkg/middleware/middleware.go @@ -4,6 +4,7 @@ import ( "fmt" "strings" + "github.com/grafana/grafana/pkg/infra/tracing" contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model" "github.com/grafana/grafana/pkg/services/org" "github.com/grafana/grafana/pkg/setting" @@ -29,12 +30,18 @@ func AddDefaultResponseHeaders(cfg *setting.Cfg) web.Handler { t := web.NewTree() t.Add("/api/datasources/uid/:uid/resources/*", nil) t.Add("/api/datasources/:id/resources/*", nil) + return func(c *web.Context) { c.Resp.Before(func(w web.ResponseWriter) { // if response has already been written, skip. if w.Written() { return } + traceId := tracing.TraceIDFromContext(c.Req.Context(), false) + if traceId != "" { + w.Header().Set("grafana-trace-id", traceId) + } + _, _, resourceURLMatch := t.Match(c.Req.URL.Path) resourceCachable := resourceURLMatch && allowCacheControl(c.Resp) if !strings.HasPrefix(c.Req.URL.Path, "/public/plugins/") && diff --git a/pkg/services/featuremgmt/registry.go b/pkg/services/featuremgmt/registry.go index c3f84f0dee1..11bf3812990 100644 --- a/pkg/services/featuremgmt/registry.go +++ b/pkg/services/featuremgmt/registry.go @@ -315,6 +315,12 @@ var ( State: FeatureStateAlpha, Owner: grafanaObservabilityLogsSquad, }, + { + Name: "showTraceId", + Description: "Show trace ids for requests", + State: FeatureStateAlpha, + Owner: grafanaObservabilityLogsSquad, + }, { Name: "datasourceOnboarding", Description: "Enable data source onboarding page", diff --git a/pkg/services/featuremgmt/toggles_gen.csv b/pkg/services/featuremgmt/toggles_gen.csv index ee34a99f725..d7bbe3f1e55 100644 --- a/pkg/services/featuremgmt/toggles_gen.csv +++ b/pkg/services/featuremgmt/toggles_gen.csv @@ -46,6 +46,7 @@ accessControlOnCall,beta,@grafana/grafana-authnz-team,false,false,false,false nestedFolders,alpha,@grafana/backend-platform,true,false,false,false accessTokenExpirationCheck,stable,@grafana/grafana-authnz-team,false,false,false,false elasticsearchBackendMigration,alpha,@grafana/observability-logs,false,false,false,false +showTraceId,alpha,@grafana/observability-logs,false,false,false,false datasourceOnboarding,alpha,@grafana/dashboards-squad,false,false,false,false emptyDashboardPage,stable,@grafana/dashboards-squad,false,false,false,true secureSocksDatasourceProxy,alpha,@grafana/hosted-grafana-team,false,false,false,false diff --git a/pkg/services/featuremgmt/toggles_gen.go b/pkg/services/featuremgmt/toggles_gen.go index e7c96cbe473..4595ec528e1 100644 --- a/pkg/services/featuremgmt/toggles_gen.go +++ b/pkg/services/featuremgmt/toggles_gen.go @@ -195,6 +195,10 @@ const ( // Use Elasticsearch as backend data source FlagElasticsearchBackendMigration = "elasticsearchBackendMigration" + // FlagShowTraceId + // Show trace ids for requests + FlagShowTraceId = "showTraceId" + // FlagDatasourceOnboarding // Enable data source onboarding page FlagDatasourceOnboarding = "datasourceOnboarding" diff --git a/public/app/core/services/backend_srv.ts b/public/app/core/services/backend_srv.ts index d2e9b6c42f0..16acfd7c110 100644 --- a/public/app/core/services/backend_srv.ts +++ b/public/app/core/services/backend_srv.ts @@ -50,6 +50,8 @@ export interface FolderRequestOptions { withAccessControl?: boolean; } +const GRAFANA_TRACEID_HEADER = 'grafana-trace-id'; + export class BackendSrv implements BackendService { private inFlightRequests: Subject = new Subject(); private HTTP_REQUEST_CANCELED = -1; @@ -223,6 +225,7 @@ export class BackendSrv implements BackendService { type, redirected, config: options, + traceId: response.headers.get(GRAFANA_TRACEID_HEADER) ?? undefined, }; return fetchResponse; }), @@ -238,7 +241,13 @@ export class BackendSrv implements BackendService { filter((response) => response.ok === false), mergeMap((response) => { const { status, statusText, data } = response; - const fetchErrorResponse: FetchError = { status, statusText, data, config: options }; + const fetchErrorResponse: FetchError = { + status, + statusText, + data, + config: options, + traceId: response.headers.get(GRAFANA_TRACEID_HEADER) ?? undefined, + }; return throwError(fetchErrorResponse); }), retryWhen((attempts: Observable) => diff --git a/public/app/core/specs/backend_srv.test.ts b/public/app/core/specs/backend_srv.test.ts index a0fe3067587..ffa46ae60db 100644 --- a/public/app/core/specs/backend_srv.test.ts +++ b/public/app/core/specs/backend_srv.test.ts @@ -1,5 +1,5 @@ import 'whatwg-fetch'; // fetch polyfill needed for PhantomJs rendering -import { Observable, of } from 'rxjs'; +import { Observable, of, lastValueFrom } from 'rxjs'; import { delay } from 'rxjs/operators'; import { AppEvents, DataQueryErrorType, EventBusExtended } from '@grafana/data'; @@ -21,6 +21,7 @@ const getTestContext = (overides?: object) => { redirected: false, type: 'basic', url: 'http://localhost:3000/api/some-mock', + headers: new Map(), }; const props = { ...defaults, ...overides }; const textMock = jest.fn().mockResolvedValue(JSON.stringify(props.data)); @@ -29,6 +30,7 @@ const getTestContext = (overides?: object) => { ok: props.ok, status: props.status, statusText: props.statusText, + headers: props.headers, text: textMock, redirected: false, type: 'basic', @@ -355,6 +357,63 @@ describe('backendSrv', () => { }); }); }); + + describe('traceId handling', () => { + const opts = { url: '/something', method: 'GET' }; + it('should handle a success-response without traceId', async () => { + const ctx = getTestContext({ status: 200, statusText: 'OK', headers: new Headers() }); + const res = await lastValueFrom(ctx.backendSrv.fetch(opts)); + expect(res.traceId).toBeUndefined(); + }); + + it('should handle a success-response with traceId', async () => { + const ctx = getTestContext({ + status: 200, + statusText: 'OK', + headers: new Headers({ + 'grafana-trace-id': 'traceId1', + }), + }); + const res = await lastValueFrom(ctx.backendSrv.fetch(opts)); + expect(res.traceId).toBe('traceId1'); + }); + + it('should handle an error-response without traceId', () => { + const ctx = getTestContext({ + ok: false, + status: 500, + statusText: 'INTERNAL SERVER ERROR', + headers: new Headers(), + }); + return lastValueFrom(ctx.backendSrv.fetch(opts)).then( + (data) => { + throw new Error('must not get here'); + }, + (error) => { + expect(error.traceId).toBeUndefined(); + } + ); + }); + + it('should handle an error-response with traceId', () => { + const ctx = getTestContext({ + ok: false, + status: 500, + statusText: 'INTERNAL SERVER ERROR', + headers: new Headers({ + 'grafana-trace-id': 'traceId1', + }), + }); + return lastValueFrom(ctx.backendSrv.fetch(opts)).then( + (data) => { + throw new Error('must not get here'); + }, + (error) => { + expect(error.traceId).toBe('traceId1'); + } + ); + }); + }); }); describe('datasourceRequest', () => { @@ -369,6 +428,7 @@ describe('backendSrv', () => { ok: true, status: 200, statusText: 'Ok', + headers: new Map(), text: () => Promise.resolve(JSON.stringify(slowData)), redirected: false, type: 'basic', @@ -382,6 +442,7 @@ describe('backendSrv', () => { ok: true, status: 200, statusText: 'Ok', + headers: new Map(), text: () => Promise.resolve(JSON.stringify(fastData)), redirected: false, type: 'basic', diff --git a/public/app/features/inspector/InspectErrorTab.tsx b/public/app/features/inspector/InspectErrorTab.tsx index 9c9b4b71aa1..a93d1338b62 100644 --- a/public/app/features/inspector/InspectErrorTab.tsx +++ b/public/app/features/inspector/InspectErrorTab.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { DataQueryError } from '@grafana/data'; +import { config } from '@grafana/runtime'; import { Alert, JSONFormatter } from '@grafana/ui'; interface InspectErrorTabProps { @@ -36,6 +37,12 @@ function renderError(error: DataQueryError) { <> {error.status && <>Status: {error.status}. Message: } {msg} + {config.featureToggles.showTraceId && error.traceId != null && ( + <> +
+ (Trace ID: {error.traceId}) + + )} ); } else { diff --git a/public/app/features/inspector/InspectStatsTab.tsx b/public/app/features/inspector/InspectStatsTab.tsx index 541a3bd0da5..3977cffcb2b 100644 --- a/public/app/features/inspector/InspectStatsTab.tsx +++ b/public/app/features/inspector/InspectStatsTab.tsx @@ -2,9 +2,11 @@ import React from 'react'; import { PanelData, QueryResultMetaStat, TimeZone } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; +import { config } from '@grafana/runtime'; import { t } from 'app/core/internationalization'; import { InspectStatsTable } from './InspectStatsTable'; +import { InspectStatsTraceIdsTable } from './InspectStatsTraceIdsTable'; interface InspectStatsTabProps { data: PanelData; @@ -59,11 +61,15 @@ export const InspectStatsTab = ({ data, timeZone }: InspectStatsTabProps) => { const statsTableName = t('dashboard.inspect-stats.table-title', 'Stats'); const dataStatsTableName = t('dashboard.inspect-stats.data-title', 'Data source stats'); + const traceIdsStatsTableName = t('dashboard.inspect-stats.data-traceids', 'Trace IDs'); return (
+ {config.featureToggles.showTraceId && ( + + )}
); }; diff --git a/public/app/features/inspector/InspectStatsTraceIdsTable.tsx b/public/app/features/inspector/InspectStatsTraceIdsTable.tsx new file mode 100644 index 00000000000..ab958f9bf66 --- /dev/null +++ b/public/app/features/inspector/InspectStatsTraceIdsTable.tsx @@ -0,0 +1,47 @@ +import { css } from '@emotion/css'; +import React from 'react'; + +import { GrafanaTheme2 } from '@grafana/data'; +import { stylesFactory, useTheme2 } from '@grafana/ui'; + +type Props = { + name: string; + traceIds: string[]; +}; + +export const InspectStatsTraceIdsTable = ({ name, traceIds }: Props) => { + const theme = useTheme2(); + const styles = getStyles(theme); + + if (traceIds.length === 0) { + return null; + } + + return ( +
+
{name}
+ + + {traceIds.map((traceId, index) => { + return ( + + + + ); + })} + +
{traceId}
+
+ ); +}; + +const getStyles = stylesFactory((theme: GrafanaTheme2) => { + return { + wrapper: css` + padding-bottom: ${theme.spacing(2)}; + `, + cell: css` + text-align: right; + `, + }; +}); diff --git a/public/app/features/query/components/QueryErrorAlert.tsx b/public/app/features/query/components/QueryErrorAlert.tsx index 3a31cdadadf..efe60c58312 100644 --- a/public/app/features/query/components/QueryErrorAlert.tsx +++ b/public/app/features/query/components/QueryErrorAlert.tsx @@ -2,6 +2,7 @@ import { css } from '@emotion/css'; import React from 'react'; import { DataQueryError, GrafanaTheme2 } from '@grafana/data'; +import { config } from '@grafana/runtime'; import { Icon, useStyles2 } from '@grafana/ui'; export interface Props { @@ -18,7 +19,14 @@ export function QueryErrorAlert({ error }: Props) {
-
{message}
+
+ {message} + {config.featureToggles.showTraceId && error.traceId != null && ( + <> +
(Trace ID: {error.traceId}) + + )} +
); } diff --git a/public/app/features/query/state/runRequest.test.ts b/public/app/features/query/state/runRequest.test.ts index d52bdfdee42..03334ea7dbf 100644 --- a/public/app/features/query/state/runRequest.test.ts +++ b/public/app/features/query/state/runRequest.test.ts @@ -223,6 +223,49 @@ describe('runRequest', () => { }); }); + runRequestScenario('When the response contains traceIds', (ctx) => { + ctx.setup(() => { + ctx.start(); + ctx.emitPacket({ + data: [{ name: 'data-a', refId: 'A' } as DataFrame], + }); + ctx.emitPacket({ + data: [{ name: 'data-b', refId: 'B' } as DataFrame], + }); + ctx.emitPacket({ + data: [{ name: 'data-c', refId: 'C' } as DataFrame], + traceIds: ['t1', 't2'], + }); + ctx.emitPacket({ + data: [{ name: 'data-d', refId: 'D' } as DataFrame], + }); + ctx.emitPacket({ + data: [{ name: 'data-e', refId: 'E' } as DataFrame], + traceIds: ['t3', 't4'], + }); + ctx.emitPacket({ + data: [{ name: 'data-e', refId: 'E' } as DataFrame], + traceIds: ['t4', 't4'], + }); + }); + it('should collect traceIds correctly', () => { + const { results } = ctx; + expect(results).toHaveLength(6); + expect(results[0].traceIds).toBeUndefined(); + + // this is the result of adding no-traces data to no-traces state + expect(results[1].traceIds).toBeUndefined(); + // this is the result of adding with-traces data to no-traces state + expect(results[2].traceIds).toStrictEqual(['t1', 't2']); + // this is the result of adding no-traces data to with-traces state + expect(results[3].traceIds).toStrictEqual(['t1', 't2']); + // this is the result of adding with-traces data to with-traces state + expect(results[4].traceIds).toStrictEqual(['t1', 't2', 't3', 't4']); + // this is the result of adding with-traces data to with-traces state with duplicate traceIds + expect(results[5].traceIds).toStrictEqual(['t1', 't2', 't3', 't4']); + }); + }); + runRequestScenario('After response with state Streaming', (ctx) => { ctx.setup(() => { ctx.start(); diff --git a/public/app/features/query/state/runRequest.ts b/public/app/features/query/state/runRequest.ts index d7480fdaef9..1c4ace55276 100644 --- a/public/app/features/query/state/runRequest.ts +++ b/public/app/features/query/state/runRequest.ts @@ -88,6 +88,13 @@ export function processResponsePacket(packet: DataQueryResponse, state: RunningQ timeRange, }; + // we use a Set to deduplicate the traceIds + const traceIdSet = new Set([...(state.panelData.traceIds ?? []), ...(packet.traceIds ?? [])]); + + if (traceIdSet.size > 0) { + panelData.traceIds = Array.from(traceIdSet); + } + return { packets, panelData }; } diff --git a/public/app/plugins/datasource/graphite/datasource_integration.test.ts b/public/app/plugins/datasource/graphite/datasource_integration.test.ts index 5c853d496a5..fe9b3ab4859 100644 --- a/public/app/plugins/datasource/graphite/datasource_integration.test.ts +++ b/public/app/plugins/datasource/graphite/datasource_integration.test.ts @@ -116,12 +116,12 @@ function mockBackendSrv(data: string) { redirected: false, type: 'basic', url: 'http://localhost:3000/api/some-mock', - headers: { + headers: new Headers({ method: 'GET', url: '/functions', // to work around Graphite returning invalid JSON responseType: 'text', - }, + }), }; return of(mockedResponse); }); diff --git a/public/app/plugins/datasource/loki/responseUtils.ts b/public/app/plugins/datasource/loki/responseUtils.ts index f961eb95acf..306c3b387f8 100644 --- a/public/app/plugins/datasource/loki/responseUtils.ts +++ b/public/app/plugins/datasource/loki/responseUtils.ts @@ -154,7 +154,15 @@ export function combineResponses(currentResult: DataQueryResponse | null, newRes // some grafana parts do not behave well. // we just choose the old error, if it exists, // otherwise the new error, if it exists. - currentResult.error = currentResult.error ?? newResult.error; + const mergedError = currentResult.error ?? newResult.error; + if (mergedError != null) { + currentResult.error = mergedError; + } + + const mergedTraceIds = [...(currentResult.traceIds ?? []), ...(newResult.traceIds ?? [])]; + if (mergedTraceIds.length > 0) { + currentResult.traceIds = mergedTraceIds; + } return currentResult; } From 3af8f3246a316793fa1666d1dc897ef438242445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 5 Apr 2023 10:19:54 +0200 Subject: [PATCH 30/80] Scenes: Add support for shared query results of other panel (#65413) * Scene: Add support for shared query results of other panel * Update * Fixing dashboard --- .../panel-common/shared_queries.json | 494 +++++++++++------- .../scenes/dashboard/DashboardsLoader.test.ts | 18 + .../scenes/dashboard/DashboardsLoader.ts | 44 +- .../dashboard/ShareQueryDataProvider.test.ts | 54 ++ .../dashboard/ShareQueryDataProvider.ts | 103 ++++ public/app/features/scenes/dashboard/utils.ts | 26 + .../app/plugins/datasource/dashboard/types.ts | 1 + yarn.lock | 4 +- 8 files changed, 551 insertions(+), 193 deletions(-) create mode 100644 public/app/features/scenes/dashboard/ShareQueryDataProvider.test.ts create mode 100644 public/app/features/scenes/dashboard/ShareQueryDataProvider.ts create mode 100644 public/app/features/scenes/dashboard/utils.ts diff --git a/devenv/dev-dashboards/panel-common/shared_queries.json b/devenv/dev-dashboards/panel-common/shared_queries.json index b29485f4c3f..a4804559089 100644 --- a/devenv/dev-dashboards/panel-common/shared_queries.json +++ b/devenv/dev-dashboards/panel-common/shared_queries.json @@ -3,7 +3,10 @@ "list": [ { "builtIn": 1, - "datasource": "-- Grafana --", + "datasource": { + "type": "datasource", + "uid": "grafana" + }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", @@ -13,17 +16,69 @@ ] }, "editable": true, - "gnetId": null, + "fiscalYearStartMonth": 0, "graphTooltip": 0, "links": [], + "liveNow": false, "panels": [ { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "fill": 0, - "fillGradient": 6, + "datasource": { + "type": "testdata", + "uid": "PD8C576611E62080A" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 60, + "gradientMode": "opacity", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 6, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "always", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "links": [], + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, "gridPos": { "h": 15, "w": 12, @@ -31,89 +86,79 @@ "y": 0 }, "id": 2, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", "options": { - "dataLinks": [] + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } }, - "percentage": false, - "pointradius": 2, - "points": true, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, + "pluginVersion": "9.5.0-pre", "targets": [ { + "datasource": { + "type": "testdata", + "uid": "PD8C576611E62080A" + }, "refId": "A", "scenarioId": "csv_metric_values", "stringInput": "1,20,90,30,5,0,100" }, { + "datasource": { + "type": "testdata", + "uid": "PD8C576611E62080A" + }, "refId": "B", "scenarioId": "csv_metric_values", "stringInput": "1,20,90,30,5,-100,200" }, { + "datasource": { + "type": "testdata", + "uid": "PD8C576611E62080A" + }, "refId": "C", "scenarioId": "csv_metric_values", "stringInput": "2.5,3.5,4.5,10.5,20.5,21.5,19.5" } ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, "title": "Raw Data Graph", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ], - "yaxis": { - "align": false, - "alignLevel": null - } + "type": "timeseries" }, { - "datasource": "-- Dashboard --", + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "max": 100, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, "gridPos": { "h": 5, "w": 12, @@ -122,44 +167,59 @@ }, "id": 4, "options": { - "fieldOptions": { - "calcs": ["lastNotNull"], - "defaults": { - "mappings": [], - "max": 100, - "min": 0, - "thresholds": [ + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showThresholdLabels": false, + "showThresholdMarkers": true + }, + "pluginVersion": "9.5.0-pre", + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, + "panelId": 2, + "refId": "A" + } + ], + "title": "Last non-null", + "type": "gauge" + }, + { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "max": 100, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "override": {}, - "values": false + } }, - "orientation": "auto", - "showThresholdLabels": false, - "showThresholdMarkers": true + "overrides": [] }, - "pluginVersion": "6.4.0-pre", - "targets": [ - { - "panelId": 2, - "refId": "A" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "Last non-null", - "type": "gauge" - }, - { - "datasource": "-- Dashboard --", "gridPos": { "h": 5, "w": 12, @@ -168,63 +228,49 @@ }, "id": 6, "options": { - "fieldOptions": { - "calcs": ["min"], - "defaults": { - "mappings": [], - "max": 100, - "min": 0, - "thresholds": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "override": {}, + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "min" + ], + "fields": "", "values": false }, - "orientation": "auto", "showThresholdLabels": false, "showThresholdMarkers": true }, - "pluginVersion": "6.4.0-pre", + "pluginVersion": "9.5.0-pre", "targets": [ { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, "panelId": 2, "refId": "A" } ], - "timeFrom": null, - "timeShift": null, "title": "min", "type": "gauge" }, { - "datasource": "-- Dashboard --", - "gridPos": { - "h": 5, - "w": 12, - "x": 12, - "y": 10 + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" }, - "id": 5, - "options": { - "displayMode": "basic", - "fieldOptions": { - "calcs": ["max"], - "defaults": { - "mappings": [], - "max": 200, - "min": 0, - "thresholds": [ + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "max": 200, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "blue", @@ -235,28 +281,102 @@ "value": 120 } ] - }, - "override": {}, + } + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 12, + "x": 12, + "y": 10 + }, + "id": 5, + "options": { + "displayMode": "basic", + "minVizHeight": 10, + "minVizWidth": 0, + "orientation": "vertical", + "reduceOptions": { + "calcs": [ + "max" + ], + "fields": "", "values": false }, - "orientation": "vertical" + "showUnfilled": true, + "valueMode": "color" }, - "pluginVersion": "6.4.0-pre", + "pluginVersion": "9.5.0-pre", "targets": [ { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, "panelId": 2, "refId": "A" } ], - "timeFrom": null, - "timeShift": null, "title": "Max", "type": "bargauge" }, { - "columns": [], - "datasource": "-- Dashboard --", - "fontSize": "100%", + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "decimals": 2, + "displayName": "", + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Time" + }, + "properties": [ + { + "id": "displayName", + "value": "Time" + }, + { + "id": "unit", + "value": "time: YYYY-MM-DD HH:mm:ss" + }, + { + "id": "custom.align" + } + ] + } + ] + }, "gridPos": { "h": 10, "w": 24, @@ -264,47 +384,49 @@ "y": 15 }, "id": 8, - "options": {}, - "pageSize": null, - "showHeader": true, - "sort": { - "col": 0, - "desc": true - }, - "styles": [ - { - "alias": "Time", - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "pattern": "Time", - "type": "date" + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false }, - { - "alias": "", - "colorMode": null, - "colors": ["rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)"], - "decimals": 2, - "pattern": "/.*/", - "thresholds": [], - "type": "number", - "unit": "short" - } - ], + "showHeader": true, + "showRowNums": false + }, + "pluginVersion": "9.5.0-pre", "targets": [ { + "datasource": { + "type": "datasource", + "uid": "-- Dashboard --" + }, "panelId": 2, "refId": "A" } ], - "timeFrom": null, - "timeShift": null, - "title": "Panel Title", - "transform": "timeseries_to_columns", + "title": "The data from graph above with seriesToColumns transform", + "transformations": [ + { + "id": "seriesToColumns", + "options": { + "reducers": [] + } + } + ], "type": "table" } ], - "schemaVersion": 19, + "refresh": "", + "schemaVersion": 38, "style": "dark", - "tags": ["gdev", "datasource-test"], + "tags": [ + "gdev", + "datasource-test" + ], "templating": { "list": [] }, @@ -313,10 +435,22 @@ "to": "now" }, "timepicker": { - "refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"] + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ] }, "timezone": "", "title": "Datasource tests - Shared Queries", "uid": "ZqZnVvFZz", - "version": 10 -} + "version": 8, + "weekStart": "" +} \ No newline at end of file diff --git a/public/app/features/scenes/dashboard/DashboardsLoader.test.ts b/public/app/features/scenes/dashboard/DashboardsLoader.test.ts index 9daacdd517c..8d758d979c2 100644 --- a/public/app/features/scenes/dashboard/DashboardsLoader.test.ts +++ b/public/app/features/scenes/dashboard/DashboardsLoader.test.ts @@ -13,6 +13,8 @@ import { defaultDashboard, LoadingState, Panel, RowPanel, VariableType } from '@ import { DashboardLoaderSrv, setDashboardLoaderSrv } from 'app/features/dashboard/services/DashboardLoaderSrv'; import { DashboardModel, PanelModel } from 'app/features/dashboard/state'; import { createPanelJSONFixture } from 'app/features/dashboard/state/__fixtures__/dashboardFixtures'; +import { SHARED_DASHBOARD_QUERY } from 'app/plugins/datasource/dashboard'; +import { DASHBOARD_DATASOURCE_PLUGIN_ID } from 'app/plugins/datasource/dashboard/types'; import { DashboardScene } from './DashboardScene'; import { @@ -21,6 +23,7 @@ import { createSceneVariableFromVariableModel, DashboardLoader, } from './DashboardsLoader'; +import { ShareQueryDataProvider } from './ShareQueryDataProvider'; describe('DashboardLoader', () => { describe('when fetching/loading a dashboard', () => { @@ -328,6 +331,21 @@ describe('DashboardLoader', () => { expect((vizPanelSceneObject.state.body as VizPanel)?.state.displayMode).toEqual('transparent'); expect((vizPanelSceneObject.state.body as VizPanel)?.state.hoverHeader).toEqual(true); }); + + it('should handle a dashboard query data source', () => { + const panel = { + title: '', + type: 'test-plugin', + datasource: { uid: SHARED_DASHBOARD_QUERY, type: DASHBOARD_DATASOURCE_PLUGIN_ID }, + gridPos: { x: 0, y: 0, w: 12, h: 8 }, + transparent: true, + targets: [{ refId: 'A', panelId: 10 }], + }; + + const vizPanel = createVizPanelFromPanelModel(new PanelModel(panel)).state.body as VizPanel; + + expect(vizPanel.state.$data).toBeInstanceOf(ShareQueryDataProvider); + }); }); describe('when creating variables objects', () => { diff --git a/public/app/features/scenes/dashboard/DashboardsLoader.ts b/public/app/features/scenes/dashboard/DashboardsLoader.ts index 18632e11682..0d3c537e1dd 100644 --- a/public/app/features/scenes/dashboard/DashboardsLoader.ts +++ b/public/app/features/scenes/dashboard/DashboardsLoader.ts @@ -22,13 +22,17 @@ import { SceneRefreshPicker, SceneDataTransformer, SceneGridItem, + SceneDataProvider, } from '@grafana/scenes'; import { StateManagerBase } from 'app/core/services/StateManagerBase'; import { dashboardLoaderSrv } from 'app/features/dashboard/services/DashboardLoaderSrv'; import { DashboardModel, PanelModel } from 'app/features/dashboard/state'; +import { SHARED_DASHBOARD_QUERY } from 'app/plugins/datasource/dashboard/types'; import { DashboardDTO } from 'app/types'; import { DashboardScene } from './DashboardScene'; +import { ShareQueryDataProvider } from './ShareQueryDataProvider'; +import { getVizPanelKeyForPanelId } from './utils'; export interface DashboardLoaderState { dashboard?: DashboardScene; @@ -259,11 +263,6 @@ export function createSceneVariableFromVariableModel(variable: VariableModel): S } export function createVizPanelFromPanelModel(panel: PanelModel) { - const queryRunner = new SceneQueryRunner({ - queries: panel.targets, - maxDataPoints: panel.maxDataPoints ?? undefined, - }); - return new SceneGridItem({ x: panel.gridPos.x, y: panel.gridPos.y, @@ -272,6 +271,7 @@ export function createVizPanelFromPanelModel(panel: PanelModel) { isDraggable: true, isResizable: true, body: new VizPanel({ + key: getVizPanelKeyForPanelId(panel.id), title: panel.title, pluginId: panel.type, options: panel.options ?? {}, @@ -280,16 +280,38 @@ export function createVizPanelFromPanelModel(panel: PanelModel) { displayMode: panel.transparent ? 'transparent' : undefined, // To be replaced with it's own option persited option instead derived hoverHeader: !panel.title && !panel.timeFrom && !panel.timeShift, - $data: panel.transformations?.length - ? new SceneDataTransformer({ - $data: queryRunner, - transformations: panel.transformations, - }) - : queryRunner, + $data: createPanelDataProvider(panel), }), }); } +export function createPanelDataProvider(panel: PanelModel): SceneDataProvider | undefined { + if (!panel.targets?.length) { + return undefined; + } + + let dataProvider: SceneDataProvider | undefined = undefined; + + if (panel.datasource?.uid === SHARED_DASHBOARD_QUERY) { + dataProvider = new ShareQueryDataProvider({ query: panel.targets[0] }); + } else { + dataProvider = new SceneQueryRunner({ + queries: panel.targets, + maxDataPoints: panel.maxDataPoints ?? undefined, + }); + } + + // Wrap inner data provider in a data transformer + if (panel.transformations?.length) { + dataProvider = new SceneDataTransformer({ + $data: dataProvider, + transformations: panel.transformations, + }); + } + + return dataProvider; +} + let loader: DashboardLoader | null = null; export function getDashboardLoader(): DashboardLoader { diff --git a/public/app/features/scenes/dashboard/ShareQueryDataProvider.test.ts b/public/app/features/scenes/dashboard/ShareQueryDataProvider.test.ts new file mode 100644 index 00000000000..04eb9fc3b17 --- /dev/null +++ b/public/app/features/scenes/dashboard/ShareQueryDataProvider.test.ts @@ -0,0 +1,54 @@ +import { getDefaultTimeRange, LoadingState } from '@grafana/data'; +import { + SceneDataNode, + SceneFlexItem, + SceneFlexLayout, + sceneGraph, + SceneObjectBase, + SceneObjectState, +} from '@grafana/scenes'; + +import { ShareQueryDataProvider } from './ShareQueryDataProvider'; +import { activateFullSceneTree, getVizPanelKeyForPanelId } from './utils'; + +export class SceneDummyPanel extends SceneObjectBase {} + +describe('ShareQueryDataProvider', () => { + it('Should find and subscribe to another VizPanels data provider', () => { + const panel = new SceneDummyPanel({ + key: getVizPanelKeyForPanelId(2), + $data: new ShareQueryDataProvider({ + query: { refId: 'A', panelId: 1 }, + }), + }); + + const sourceData = new SceneDataNode({ + data: { + series: [], + state: LoadingState.Done, + timeRange: getDefaultTimeRange(), + structureRev: 11, + }, + }); + + const scene = new SceneFlexLayout({ + children: [ + new SceneFlexItem({ + body: new SceneDummyPanel({ + key: getVizPanelKeyForPanelId(1), + $data: sourceData, + }), + }), + new SceneFlexItem({ body: panel }), + ], + }); + + activateFullSceneTree(scene); + + expect(sceneGraph.getData(panel).state.data?.structureRev).toBe(11); + + sourceData.setState({ data: { ...sourceData.state.data!, structureRev: 12 } }); + + expect(sceneGraph.getData(panel).state.data?.structureRev).toBe(12); + }); +}); diff --git a/public/app/features/scenes/dashboard/ShareQueryDataProvider.ts b/public/app/features/scenes/dashboard/ShareQueryDataProvider.ts new file mode 100644 index 00000000000..83d512617ee --- /dev/null +++ b/public/app/features/scenes/dashboard/ShareQueryDataProvider.ts @@ -0,0 +1,103 @@ +import { Unsubscribable } from 'rxjs'; + +import { + SceneDataProvider, + SceneDataState, + SceneDataTransformer, + SceneDeactivationHandler, + SceneObject, + SceneObjectBase, +} from '@grafana/scenes'; +import { DashboardQuery } from 'app/plugins/datasource/dashboard/types'; + +import { getVizPanelKeyForPanelId } from './utils'; + +export interface ShareQueryDataProviderState extends SceneDataState { + query: DashboardQuery; +} + +export class ShareQueryDataProvider extends SceneObjectBase implements SceneDataProvider { + private _querySub: Unsubscribable | undefined; + private _sourceDataDeactivationHandler?: SceneDeactivationHandler; + + public constructor(state: ShareQueryDataProviderState) { + super(state); + + this.addActivationHandler(() => { + // TODO handle changes to query model (changed panelId / withTransforms) + //this.subscribeToState(this._onStateChanged); + + this._subscribeToSource(); + + return () => { + if (this._querySub) { + this._querySub.unsubscribe(); + } + if (this._sourceDataDeactivationHandler) { + this._sourceDataDeactivationHandler(); + } + }; + }); + } + + private _subscribeToSource() { + const { query } = this.state; + + if (this._querySub) { + this._querySub.unsubscribe(); + } + + if (!query.panelId) { + return; + } + + const keyToFind = getVizPanelKeyForPanelId(query.panelId); + const source = findObjectInScene(this.getRoot(), (scene: SceneObject) => scene.state.key === keyToFind); + + if (!source) { + console.log('Shared dashboard query refers to a panel that does not exist in the scene'); + return; + } + + let sourceData = source.state.$data; + if (!sourceData) { + console.log('No source data found for shared dashboard query'); + return; + } + + // This will activate if sourceData is part of hidden panel + // Also make sure the sourceData is not deactivated if hidden later + this._sourceDataDeactivationHandler = sourceData.activate(); + + if (sourceData instanceof SceneDataTransformer) { + if (!query.withTransforms) { + if (!sourceData.state.$data) { + throw new Error('No source inner query runner found in data transformer'); + } + sourceData = sourceData.state.$data; + } + } + + this._querySub = sourceData.subscribeToState((state) => this.setState({ data: state.data })); + + // Copy the initial state + this.setState({ data: sourceData.state.data }); + } +} + +export function findObjectInScene(scene: SceneObject, check: (scene: SceneObject) => boolean): SceneObject | null { + if (check(scene)) { + return scene; + } + + let found: SceneObject | null = null; + + scene.forEachChild((child) => { + let maybe = findObjectInScene(child, check); + if (maybe) { + found = maybe; + } + }); + + return found; +} diff --git a/public/app/features/scenes/dashboard/utils.ts b/public/app/features/scenes/dashboard/utils.ts new file mode 100644 index 00000000000..418c793a3b0 --- /dev/null +++ b/public/app/features/scenes/dashboard/utils.ts @@ -0,0 +1,26 @@ +import { SceneDeactivationHandler, SceneObject } from '@grafana/scenes'; + +export function getVizPanelKeyForPanelId(panelId: number) { + return `panel-${panelId}`; +} + +/** + * Useful from tests to simulate mounting a full scene. Children are activated before parents to simulate the real order + * of React mount order and useEffect ordering. + * + */ +export function activateFullSceneTree(scene: SceneObject): SceneDeactivationHandler { + const deactivationHandlers: SceneDeactivationHandler[] = []; + + scene.forEachChild((child) => { + deactivationHandlers.push(activateFullSceneTree(child)); + }); + + deactivationHandlers.push(scene.activate()); + + return () => { + for (const handler of deactivationHandlers) { + handler(); + } + }; +} diff --git a/public/app/plugins/datasource/dashboard/types.ts b/public/app/plugins/datasource/dashboard/types.ts index 983c79260fc..c1d1d7b579c 100644 --- a/public/app/plugins/datasource/dashboard/types.ts +++ b/public/app/plugins/datasource/dashboard/types.ts @@ -1,6 +1,7 @@ import { DataFrame, DataQuery, DataQueryError, DataTopic } from '@grafana/data'; export const SHARED_DASHBOARD_QUERY = '-- Dashboard --'; +export const DASHBOARD_DATASOURCE_PLUGIN_ID = 'dashboard'; export interface DashboardQuery extends DataQuery { panelId?: number; diff --git a/yarn.lock b/yarn.lock index 3fe57d32bba..ace327afbb0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3327,7 +3327,7 @@ __metadata: linkType: soft "@grafana/scenes@npm:^0.3.0": - version: 0.3.0 + version: 0.0.0-use.local resolution: "@grafana/scenes@npm:0.3.0" dependencies: "@grafana/e2e-selectors": canary @@ -3338,7 +3338,7 @@ __metadata: uuid: ^9.0.0 checksum: 3610cedcc150b9d6e3d6948056bb1bbbfe58d7fa0ff6e762eec6619bb0940504db867ea87e56160f27e4d93772f6203493bf87d353a1b18d2664e74a03f03a05 languageName: node - linkType: hard + linkType: soft "@grafana/schema@10.0.0-pre, @grafana/schema@workspace:*, @grafana/schema@workspace:packages/grafana-schema": version: 0.0.0-use.local From eec7462bc3b103c04e47a25125a0a134017c9aa5 Mon Sep 17 00:00:00 2001 From: mikkancso Date: Wed, 5 Apr 2023 10:23:25 +0200 Subject: [PATCH 31/80] Admin/Plugins: Change alert about Connections to subtitle (#65913) * change ConnectionRedirectNotice to a subtitle on Admin/Plugins * cleanup ConnectionsRedirectNotice a bit --- .../ConnectionsRedirectNotice.tsx | 15 ++----------- .../datasources/pages/DataSourcesListPage.tsx | 9 ++------ .../features/plugins/admin/pages/Browse.tsx | 22 ++++++++++--------- 3 files changed, 16 insertions(+), 30 deletions(-) diff --git a/public/app/features/connections/components/ConnectionsRedirectNotice/ConnectionsRedirectNotice.tsx b/public/app/features/connections/components/ConnectionsRedirectNotice/ConnectionsRedirectNotice.tsx index 8a14aadebb8..c473107d804 100644 --- a/public/app/features/connections/components/ConnectionsRedirectNotice/ConnectionsRedirectNotice.tsx +++ b/public/app/features/connections/components/ConnectionsRedirectNotice/ConnectionsRedirectNotice.tsx @@ -21,18 +21,7 @@ const getStyles = (theme: GrafanaTheme2) => ({ `, }); -export enum DestinationPage { - dataSources = 'dataSources', - connectData = 'connectData', -} - -const destinationLinks = { - [DestinationPage.dataSources]: ROUTES.DataSources, - // Set category filter for the cloud version of ConnectData page - [DestinationPage.connectData]: `${ROUTES.ConnectData}?cat=data-source`, -}; - -export function ConnectionsRedirectNotice({ destinationPage }: { destinationPage: DestinationPage }) { +export function ConnectionsRedirectNotice() { const styles = useStyles2(getStyles); return ( @@ -42,7 +31,7 @@ export function ConnectionsRedirectNotice({ destinationPage }: { destinationPage Data sources have a new home! You can discover new data sources or manage existing ones in the new Connections page, accessible from the lefthand nav.

- + See data sources in Connections diff --git a/public/app/features/datasources/pages/DataSourcesListPage.tsx b/public/app/features/datasources/pages/DataSourcesListPage.tsx index 27a8afef8b4..05c43b663ff 100644 --- a/public/app/features/datasources/pages/DataSourcesListPage.tsx +++ b/public/app/features/datasources/pages/DataSourcesListPage.tsx @@ -2,10 +2,7 @@ import React from 'react'; import { config } from '@grafana/runtime'; import { Page } from 'app/core/components/Page/Page'; -import { - ConnectionsRedirectNotice, - DestinationPage, -} from 'app/features/connections/components/ConnectionsRedirectNotice'; +import { ConnectionsRedirectNotice } from 'app/features/connections/components/ConnectionsRedirectNotice'; import { StoreState, useSelector } from 'app/types'; import { DataSourceAddButton } from '../components/DataSourceAddButton'; @@ -19,9 +16,7 @@ export function DataSourcesListPage() { return ( - {config.featureToggles.dataConnectionsConsole && ( - - )} + {config.featureToggles.dataConnectionsConsole && } diff --git a/public/app/features/plugins/admin/pages/Browse.tsx b/public/app/features/plugins/admin/pages/Browse.tsx index 37596ad8c95..62cb83ba6dc 100644 --- a/public/app/features/plugins/admin/pages/Browse.tsx +++ b/public/app/features/plugins/admin/pages/Browse.tsx @@ -8,10 +8,7 @@ import { LoadingPlaceholder, Select, RadioButtonGroup, useStyles2, Tooltip, Fiel import { Page } from 'app/core/components/Page/Page'; import { GrafanaRouteComponentProps } from 'app/core/navigation/types'; import { getNavModel } from 'app/core/selectors/navModel'; -import { - ConnectionsRedirectNotice, - DestinationPage, -} from 'app/features/connections/components/ConnectionsRedirectNotice'; +import { ROUTES as CONNECTIONS_ROUTES } from 'app/features/connections/constants'; import { useSelector } from 'app/types'; import { HorizontalGroup } from '../components/HorizontalGroup'; @@ -67,13 +64,18 @@ export default function Browse({ route }: GrafanaRouteComponentProps): ReactElem return null; } - return ( - - - {config.featureToggles.dataConnectionsConsole && (filterByType === 'all' || filterByType === 'datasource') && ( - - )} + const subTitle = config.featureToggles.dataConnectionsConsole ? ( +

+ Extend the Grafana experience with panel plugins and apps. To find more data sources go to{' '} + Connections. +

+ ) : ( +

Extend the Grafana experience with panel plugins and apps.

+ ); + return ( + + From 91a61f1e0d150359c3487f94478c76170c82cdaa Mon Sep 17 00:00:00 2001 From: Victor Marin <36818606+mdvictor@users.noreply.github.com> Date: Wed, 5 Apr 2023 11:28:03 +0300 Subject: [PATCH 32/80] PieChart: Show long labels properly (#65699) Fix label hidden when overflowing --- public/app/plugins/panel/piechart/PieChart.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/panel/piechart/PieChart.tsx b/public/app/plugins/panel/piechart/PieChart.tsx index 13eb48e4ac4..d12f5456667 100644 --- a/public/app/plugins/panel/piechart/PieChart.tsx +++ b/public/app/plugins/panel/piechart/PieChart.tsx @@ -84,7 +84,7 @@ export const PieChart = ({ return (
- + {colors.map((color) => { return ( From f69304fd50ac956d68f6fd9340197a51e2ed1f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 5 Apr 2023 10:37:30 +0200 Subject: [PATCH 33/80] Badge: Fix alignment and simplify markup and styles (#65980) --- .../grafana-ui/src/components/Badge/Badge.tsx | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/packages/grafana-ui/src/components/Badge/Badge.tsx b/packages/grafana-ui/src/components/Badge/Badge.tsx index d754a14b37e..e97bcd10526 100644 --- a/packages/grafana-ui/src/components/Badge/Badge.tsx +++ b/packages/grafana-ui/src/components/Badge/Badge.tsx @@ -7,7 +7,6 @@ import { GrafanaTheme2 } from '@grafana/data'; import { useStyles2 } from '../../themes/ThemeContext'; import { IconName } from '../../types'; import { Icon } from '../Icon/Icon'; -import { HorizontalGroup } from '../Layout/Layout'; import { Tooltip } from '../Tooltip/Tooltip'; export type BadgeColor = 'blue' | 'red' | 'green' | 'orange' | 'purple'; @@ -23,10 +22,8 @@ export const Badge = React.memo(({ icon, color, text, tooltip, class const styles = useStyles2(useCallback((theme) => getStyles(theme, color), [color])); const badge = (
- - {icon && } - {text} - + {icon && } + {text}
); @@ -59,7 +56,6 @@ const getStyles = (theme: GrafanaTheme2, color: BadgeColor) => { return { wrapper: css` - font-size: ${theme.typography.size.sm}; display: inline-flex; padding: 1px 4px; border-radius: ${theme.shape.radius.default}; @@ -67,12 +63,10 @@ const getStyles = (theme: GrafanaTheme2, color: BadgeColor) => { border: 1px solid ${borderColor}; color: ${textColor}; font-weight: ${theme.typography.fontWeightRegular}; - - > span { - position: relative; - top: 1px; - margin-left: 2px; - } + gap: 2px; + font-size: ${theme.typography.bodySmall.fontSize}; + line-height: ${theme.typography.bodySmall.lineHeight}; + align-items: center; `, }; }; From caac9838d8554fa61bad1645d8128190040699da Mon Sep 17 00:00:00 2001 From: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com> Date: Wed, 5 Apr 2023 11:55:55 +0300 Subject: [PATCH 34/80] Build: Fix Redis/Memcached integration tests (#64298) * Build: Fix integration cache tests * Allow REDIS_URL with scheme * Reduce cache integration tests timeout to 5m * Apply suggestion from code review * Run redis/memcached integration tests in OSS pipelines * Change redis image --- .drone.yml | 122 ++++++++++++++++-- Makefile | 12 ++ .../memcached_storage_integration_test.go | 17 ++- .../redis_storage_integration_test.go | 33 ++++- pkg/infra/remotecache/remotecache_test.go | 6 +- .../live/managedstream/cache_redis_test.go | 26 +++- scripts/drone/events/release.star | 18 +-- .../drone/pipelines/integration_tests.star | 6 +- scripts/drone/services/services.star | 28 ++-- scripts/drone/steps/lib.star | 4 +- 10 files changed, 215 insertions(+), 57 deletions(-) diff --git a/.drone.yml b/.drone.yml index cc144f74868..9c5f364a85e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -797,6 +797,12 @@ services: volumes: - name: mysql path: /var/lib/mysql +- environment: {} + image: redis:6.2.11-alpine + name: redis +- environment: {} + image: memcached:1.6.9-alpine + name: memcached steps: - commands: - is_fork=$(curl "https://$GITHUB_TOKEN@api.github.com/repos/grafana/grafana/pulls/$DRONE_PULL_REQUEST" @@ -892,6 +898,26 @@ steps: MYSQL_HOST: mysql image: grafana/build-container:1.7.2 name: mysql-integration-tests +- commands: + - dockerize -wait tcp://redis:6379/0 -timeout 120s + - go clean -testcache + - go test -run IntegrationRedis -covermode=atomic -timeout=2m ./pkg/... + depends_on: + - wire-install + environment: + REDIS_URL: redis://redis:6379/0 + image: grafana/build-container:1.7.2 + name: redis-integration-tests +- commands: + - dockerize -wait tcp://memcached:11211 -timeout 120s + - go clean -testcache + - go test -run IntegrationMemcached -covermode=atomic -timeout=2m ./pkg/... + depends_on: + - wire-install + environment: + MEMCACHED_HOSTS: memcached:11211 + image: grafana/build-container:1.7.2 + name: memcached-integration-tests trigger: event: - pull_request @@ -1797,6 +1823,12 @@ services: volumes: - name: mysql path: /var/lib/mysql +- environment: {} + image: redis:6.2.11-alpine + name: redis +- environment: {} + image: memcached:1.6.9-alpine + name: memcached steps: - commands: - mkdir -p bin @@ -1870,6 +1902,26 @@ steps: MYSQL_HOST: mysql image: grafana/build-container:1.7.2 name: mysql-integration-tests +- commands: + - dockerize -wait tcp://redis:6379/0 -timeout 120s + - go clean -testcache + - go test -run IntegrationRedis -covermode=atomic -timeout=2m ./pkg/... + depends_on: + - wire-install + environment: + REDIS_URL: redis://redis:6379/0 + image: grafana/build-container:1.7.2 + name: redis-integration-tests +- commands: + - dockerize -wait tcp://memcached:11211 -timeout 120s + - go clean -testcache + - go test -run IntegrationMemcached -covermode=atomic -timeout=2m ./pkg/... + depends_on: + - wire-install + environment: + MEMCACHED_HOSTS: memcached:11211 + image: grafana/build-container:1.7.2 + name: memcached-integration-tests trigger: branch: main event: @@ -4956,6 +5008,12 @@ services: volumes: - name: mysql path: /var/lib/mysql +- environment: {} + image: redis:6.2.11-alpine + name: redis +- environment: {} + image: memcached:1.6.9-alpine + name: memcached steps: - commands: - mkdir -p bin @@ -5022,6 +5080,26 @@ steps: MYSQL_HOST: mysql image: grafana/build-container:1.7.2 name: mysql-integration-tests +- commands: + - dockerize -wait tcp://redis:6379/0 -timeout 120s + - go clean -testcache + - go test -run IntegrationRedis -covermode=atomic -timeout=2m ./pkg/... + depends_on: + - wire-install + environment: + REDIS_URL: redis://redis:6379/0 + image: grafana/build-container:1.7.2 + name: redis-integration-tests +- commands: + - dockerize -wait tcp://memcached:11211 -timeout 120s + - go clean -testcache + - go test -run IntegrationMemcached -covermode=atomic -timeout=2m ./pkg/... + depends_on: + - wire-install + environment: + MEMCACHED_HOSTS: memcached:11211 + image: grafana/build-container:1.7.2 + name: memcached-integration-tests trigger: ref: - refs/heads/v[0-9]* @@ -5617,7 +5695,7 @@ services: - name: mysql path: /var/lib/mysql - environment: {} - image: redis:6.2.1-alpine + image: redis:6.2.11-alpine name: redis - environment: {} image: memcached:1.6.9-alpine @@ -5718,8 +5796,7 @@ steps: - commands: - dockerize -wait tcp://redis:6379/0 -timeout 120s - go clean -testcache - - go list './pkg/...' | xargs -I {} sh -c 'go test -run Integration -covermode=atomic - -timeout=5m {}' + - go test -run IntegrationRedis -covermode=atomic -timeout=2m ./pkg/... depends_on: - wire-install environment: @@ -5729,8 +5806,7 @@ steps: - commands: - dockerize -wait tcp://memcached:11211 -timeout 120s - go clean -testcache - - go list './pkg/...' | xargs -I {} sh -c 'go test -run Integration -covermode=atomic - -timeout=5m {}' + - go test -run IntegrationMemcached -covermode=atomic -timeout=2m ./pkg/... depends_on: - wire-install environment: @@ -6112,6 +6188,12 @@ services: volumes: - name: mysql path: /var/lib/mysql +- environment: {} + image: redis:6.2.11-alpine + name: redis +- environment: {} + image: memcached:1.6.9-alpine + name: memcached steps: - commands: - mkdir -p bin @@ -6178,6 +6260,26 @@ steps: MYSQL_HOST: mysql image: grafana/build-container:1.7.2 name: mysql-integration-tests +- commands: + - dockerize -wait tcp://redis:6379/0 -timeout 120s + - go clean -testcache + - go test -run IntegrationRedis -covermode=atomic -timeout=2m ./pkg/... + depends_on: + - wire-install + environment: + REDIS_URL: redis://redis:6379/0 + image: grafana/build-container:1.7.2 + name: redis-integration-tests +- commands: + - dockerize -wait tcp://memcached:11211 -timeout 120s + - go clean -testcache + - go test -run IntegrationMemcached -covermode=atomic -timeout=2m ./pkg/... + depends_on: + - wire-install + environment: + MEMCACHED_HOSTS: memcached:11211 + image: grafana/build-container:1.7.2 + name: memcached-integration-tests trigger: event: - promote @@ -6230,7 +6332,7 @@ services: - name: mysql path: /var/lib/mysql - environment: {} - image: redis:6.2.1-alpine + image: redis:6.2.11-alpine name: redis - environment: {} image: memcached:1.6.9-alpine @@ -6332,8 +6434,7 @@ steps: - commands: - dockerize -wait tcp://redis:6379/0 -timeout 120s - go clean -testcache - - go list './pkg/...' | xargs -I {} sh -c 'go test -run Integration -covermode=atomic - -timeout=5m {}' + - go test -run IntegrationRedis -covermode=atomic -timeout=2m ./pkg/... depends_on: - wire-install environment: @@ -6343,8 +6444,7 @@ steps: - commands: - dockerize -wait tcp://memcached:11211 -timeout 120s - go clean -testcache - - go list './pkg/...' | xargs -I {} sh -c 'go test -run Integration -covermode=atomic - -timeout=5m {}' + - go test -run IntegrationMemcached -covermode=atomic -timeout=2m ./pkg/... depends_on: - wire-install environment: @@ -6653,6 +6753,6 @@ kind: secret name: enterprise2_security_prefix --- kind: signature -hmac: 675c90070f9b68e15f349d079fbafa5288c3e5c30c345a4c9678d69afd1cc5a7 +hmac: 54bded4dc7c3ffbbf3859a4f8f6364f59f3b6e0696152a0b835211eca7119e50 ... diff --git a/Makefile b/Makefile index 5d5d9f4387b..ad161a619d8 100644 --- a/Makefile +++ b/Makefile @@ -143,6 +143,18 @@ test-go-integration-mysql: devenv-mysql ## Run integration tests for mysql backe $(GO) clean -testcache $(GO) list './pkg/...' | xargs -I {} sh -c 'GRAFANA_TEST_DB=mysql go test -run Integration -covermode=atomic -timeout=2m {}' +.PHONY: test-go-integration-redis +test-go-integration-redis: ## Run integration tests for redis cache. + @echo "test backend integration redis tests" + $(GO) clean -testcache + REDIS_URL=localhost:6379 $(GO) test -run IntegrationRedis -covermode=atomic -timeout=2m ./pkg/... + +.PHONY: test-go-integration-memcached +test-go-integration-memcached: ## Run integration tests for memcached cache. + @echo "test backend integration memcached tests" + $(GO) clean -testcache + MEMCACHED_HOSTS=localhost:11211 $(GO) test -run IntegrationMemcached -covermode=atomic -timeout=2m ./pkg/... + test-js: ## Run tests for frontend. @echo "test frontend" yarn test diff --git a/pkg/infra/remotecache/memcached_storage_integration_test.go b/pkg/infra/remotecache/memcached_storage_integration_test.go index 87fffe182eb..38bf6fc12ea 100644 --- a/pkg/infra/remotecache/memcached_storage_integration_test.go +++ b/pkg/infra/remotecache/memcached_storage_integration_test.go @@ -1,16 +1,23 @@ -//go:build memcached -// +build memcached - package remotecache import ( + "os" "testing" "github.com/grafana/grafana/pkg/setting" ) -func TestMemcachedCacheStorage(t *testing.T) { - opts := &setting.RemoteCacheOptions{Name: memcachedCacheType, ConnStr: "localhost:11211"} +func TestIntegrationMemcachedCacheStorage(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } + + u, ok := os.LookupEnv("MEMCACHED_HOSTS") + if !ok || u == "" { + t.Skip("No Memcached hosts provided") + } + + opts := &setting.RemoteCacheOptions{Name: memcachedCacheType, ConnStr: u} client := createTestClient(t, opts, nil) runTestsForClient(t, client) runCountTestsForClient(t, opts, nil) diff --git a/pkg/infra/remotecache/redis_storage_integration_test.go b/pkg/infra/remotecache/redis_storage_integration_test.go index d360feb3ce8..392d3bb8b44 100644 --- a/pkg/infra/remotecache/redis_storage_integration_test.go +++ b/pkg/infra/remotecache/redis_storage_integration_test.go @@ -1,17 +1,40 @@ -//go:build redis -// +build redis - package remotecache import ( + "fmt" + "os" + "strings" "testing" + "github.com/go-redis/redis/v8" "github.com/grafana/grafana/pkg/setting" ) -func TestRedisCacheStorage(t *testing.T) { +func TestIntegrationRedisCacheStorage(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } - opts := &setting.RemoteCacheOptions{Name: redisCacheType, ConnStr: "addr=localhost:6379"} + u, ok := os.LookupEnv("REDIS_URL") + if !ok || u == "" { + t.Skip("No redis URL supplied") + } + + addr := u + db := 0 + parsed, err := redis.ParseURL(u) + if err == nil { + addr = parsed.Addr + db = parsed.DB + } + + b := strings.Builder{} + b.WriteString(fmt.Sprintf("addr=%s", addr)) + if db != 0 { + b.WriteString(fmt.Sprintf(",db=%d", db)) + } + + opts := &setting.RemoteCacheOptions{Name: redisCacheType, ConnStr: b.String()} client := createTestClient(t, opts, nil) runTestsForClient(t, client) runCountTestsForClient(t, opts, nil) diff --git a/pkg/infra/remotecache/remotecache_test.go b/pkg/infra/remotecache/remotecache_test.go index 9ad5acbe7a8..9732e8474cd 100644 --- a/pkg/infra/remotecache/remotecache_test.go +++ b/pkg/infra/remotecache/remotecache_test.go @@ -95,7 +95,8 @@ func canPutGetAndDeleteCachedObjects(t *testing.T, client CacheStorage) { assert.Equal(t, err, nil) _, err = client.Get(context.Background(), "key1") - assert.Equal(t, err, ErrCacheItemNotFound) + // redis client returns redis.Nil error when key does not exist. + assert.Error(t, err) } func canNotFetchExpiredItems(t *testing.T, client CacheStorage) { @@ -109,7 +110,8 @@ func canNotFetchExpiredItems(t *testing.T, client CacheStorage) { // should not be able to read that value since its expired _, err = client.Get(context.Background(), "key1") - assert.Equal(t, err, ErrCacheItemNotFound) + // redis client returns redis.Nil error when key does not exist. + assert.Error(t, err) } func TestCollectUsageStats(t *testing.T) { diff --git a/pkg/services/live/managedstream/cache_redis_test.go b/pkg/services/live/managedstream/cache_redis_test.go index df650ded044..d7c3f9fddbb 100644 --- a/pkg/services/live/managedstream/cache_redis_test.go +++ b/pkg/services/live/managedstream/cache_redis_test.go @@ -1,18 +1,34 @@ -//go:build redis -// +build redis - package managedstream import ( + "os" "testing" "github.com/go-redis/redis/v8" "github.com/stretchr/testify/require" ) -func TestRedisCacheStorage(t *testing.T) { +func TestIntegrationRedisCacheStorage(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } + + u, ok := os.LookupEnv("REDIS_URL") + if !ok || u == "" { + t.Skip("No redis URL supplied") + } + + addr := u + db := 0 + parsed, err := redis.ParseURL(u) + if err == nil { + addr = parsed.Addr + db = parsed.DB + } + redisClient := redis.NewClient(&redis.Options{ - Addr: "localhost:6379", + Addr: addr, + DB: db, }) c := NewRedisFrameCache(redisClient) require.NotNil(t, c) diff --git a/scripts/drone/events/release.star b/scripts/drone/events/release.star index 8c079d33bb7..a163927b045 100644 --- a/scripts/drone/events/release.star +++ b/scripts/drone/events/release.star @@ -141,7 +141,7 @@ def oss_pipelines(ver_mode = ver_mode, trigger = release_trigger): environment = {"EDITION": "oss"} - services = integration_test_services(edition = "oss") + services = integration_test_services() volumes = integration_test_services_volumes() init_steps = [ @@ -203,6 +203,8 @@ def oss_pipelines(ver_mode = ver_mode, trigger = release_trigger): integration_test_steps = [ postgres_integration_tests_step(), mysql_integration_tests_step(), + redis_integration_tests_step(), + memcached_integration_tests_step(), ] # We don't need to run integration tests at release time since they have @@ -282,7 +284,7 @@ def enterprise_pipelines(ver_mode = ver_mode, trigger = release_trigger): environment = {"EDITION": "enterprise"} - services = integration_test_services(edition = "enterprise") + services = integration_test_services() volumes = integration_test_services_volumes() init_steps = [ @@ -694,11 +696,9 @@ def integration_test_pipelines(): } pipelines = [] volumes = integration_test_services_volumes() - oss_integration_test_steps = [ + integration_test_steps = [ postgres_integration_tests_step(), mysql_integration_tests_step(), - ] - enterprise_integration_test_steps = oss_integration_test_steps + [ redis_integration_tests_step(), memcached_integration_tests_step(), ] @@ -708,7 +708,7 @@ def integration_test_pipelines(): name = "integration-tests-oss", edition = "oss", trigger = trigger, - services = integration_test_services(edition = "oss"), + services = integration_test_services(), steps = [ download_grabpl_step(), identify_runner_step(), @@ -716,7 +716,7 @@ def integration_test_pipelines(): verify_gen_jsonnet_step(), wire_install_step(), ] + - oss_integration_test_steps, + integration_test_steps, environment = {"EDITION": "oss"}, volumes = volumes, )) @@ -725,7 +725,7 @@ def integration_test_pipelines(): name = "integration-tests-enterprise", edition = "enterprise", trigger = trigger, - services = integration_test_services(edition = "enterprise"), + services = integration_test_services(), steps = [ download_grabpl_step(), identify_runner_step(), @@ -744,7 +744,7 @@ def integration_test_pipelines(): [ wire_install_step(), ] + - enterprise_integration_test_steps, + integration_test_steps, environment = {"EDITION": "enterprise"}, volumes = volumes, )) diff --git a/scripts/drone/pipelines/integration_tests.star b/scripts/drone/pipelines/integration_tests.star index 7e8bc47fbd9..87276500809 100644 --- a/scripts/drone/pipelines/integration_tests.star +++ b/scripts/drone/pipelines/integration_tests.star @@ -8,8 +8,10 @@ load( "download_grabpl_step", "enterprise_setup_step", "identify_runner_step", + "memcached_integration_tests_step", "mysql_integration_tests_step", "postgres_integration_tests_step", + "redis_integration_tests_step", "verify_gen_cue_step", "verify_gen_jsonnet_step", "wire_install_step", @@ -37,7 +39,7 @@ def integration_tests(trigger, prefix, ver_mode = "pr"): """ environment = {"EDITION": "oss"} - services = integration_test_services(edition = "oss") + services = integration_test_services() volumes = integration_test_services_volumes() init_steps = [] @@ -66,6 +68,8 @@ def integration_tests(trigger, prefix, ver_mode = "pr"): test_steps = [ postgres_integration_tests_step(), mysql_integration_tests_step(), + redis_integration_tests_step(), + memcached_integration_tests_step(), ] return pipeline( diff --git a/scripts/drone/services/services.star b/scripts/drone/services/services.star index 9d7d04a2ded..d5310032f30 100644 --- a/scripts/drone/services/services.star +++ b/scripts/drone/services/services.star @@ -8,7 +8,7 @@ def integration_test_services_volumes(): {"name": "mysql", "temp": {"medium": "memory"}}, ] -def integration_test_services(edition): +def integration_test_services(): services = [ { "name": "postgres", @@ -34,24 +34,18 @@ def integration_test_services(edition): }, "volumes": [{"name": "mysql", "path": "/var/lib/mysql"}], }, + { + "name": "redis", + "image": "redis:6.2.11-alpine", + "environment": {}, + }, + { + "name": "memcached", + "image": "memcached:1.6.9-alpine", + "environment": {}, + }, ] - if edition in ("enterprise", "enterprise2"): - services.extend( - [ - { - "name": "redis", - "image": "redis:6.2.1-alpine", - "environment": {}, - }, - { - "name": "memcached", - "image": "memcached:1.6.9-alpine", - "environment": {}, - }, - ], - ) - return services def ldap_service(): diff --git a/scripts/drone/steps/lib.star b/scripts/drone/steps/lib.star index 82d61f390fd..749250171a6 100644 --- a/scripts/drone/steps/lib.star +++ b/scripts/drone/steps/lib.star @@ -1144,7 +1144,7 @@ def redis_integration_tests_step(): "commands": [ "dockerize -wait tcp://redis:6379/0 -timeout 120s", "go clean -testcache", - "go list './pkg/...' | xargs -I {} sh -c 'go test -run Integration -covermode=atomic -timeout=5m {}'", + "go test -run IntegrationRedis -covermode=atomic -timeout=2m ./pkg/...", ], } @@ -1159,7 +1159,7 @@ def memcached_integration_tests_step(): "commands": [ "dockerize -wait tcp://memcached:11211 -timeout 120s", "go clean -testcache", - "go list './pkg/...' | xargs -I {} sh -c 'go test -run Integration -covermode=atomic -timeout=5m {}'", + "go test -run IntegrationMemcached -covermode=atomic -timeout=2m ./pkg/...", ], } From 507c6e7d97e8a9396fdbb26298269eababfc84e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 5 Apr 2023 11:10:33 +0200 Subject: [PATCH 35/80] Templating: Replace __data , __field and __cell_n with macros (#65324) * Templating: __data __field and __series macros * filter out datacontext from json serialization * Fix condition * Update * Added test cases for formatting data, and field macros --- .betterer.results | 15 +-- .../src/field/fieldDisplay.test.ts | 10 +- .../grafana-data/src/field/fieldDisplay.ts | 72 ++++++++------ .../src/field/fieldOverrides.test.ts | 32 +----- .../grafana-data/src/field/fieldOverrides.ts | 73 ++++++-------- packages/grafana-data/src/types/ScopedVars.ts | 2 + .../app/features/inspector/InspectJSONTab.tsx | 20 +++- .../features/templating/dataMacros.test.ts | 78 ++++++++++++++- public/app/features/templating/dataMacros.ts | 97 ++++++++++++++++++- .../features/templating/fieldAccessorCache.ts | 16 +++ .../app/features/templating/macroRegistry.ts | 5 +- .../templating}/templateProxies.test.ts | 2 +- .../features/templating}/templateProxies.ts | 5 +- .../app/features/templating/template_srv.ts | 24 ++--- 14 files changed, 315 insertions(+), 136 deletions(-) create mode 100644 public/app/features/templating/fieldAccessorCache.ts rename {packages/grafana-data/src/field => public/app/features/templating}/templateProxies.test.ts (94%) rename {packages/grafana-data/src/field => public/app/features/templating}/templateProxies.ts (87%) diff --git a/.betterer.results b/.betterer.results index 91f06e90952..265b61e70ac 100644 --- a/.betterer.results +++ b/.betterer.results @@ -200,9 +200,6 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "6"], [0, 0, 0, "Unexpected any. Specify a different type.", "7"] ], - "packages/grafana-data/src/field/templateProxies.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "packages/grafana-data/src/geo/layer.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], @@ -3352,6 +3349,9 @@ exports[`better eslint`] = { "public/app/features/teams/state/selectors.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], + "public/app/features/templating/fieldAccessorCache.ts:5381": [ + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] + ], "public/app/features/templating/formatVariableValue.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], @@ -3360,6 +3360,9 @@ exports[`better eslint`] = { "public/app/features/templating/macroRegistry.test.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], + "public/app/features/templating/templateProxies.ts:5381": [ + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] + ], "public/app/features/templating/template_srv.mock.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], @@ -3376,11 +3379,9 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "9"], [0, 0, 0, "Unexpected any. Specify a different type.", "10"], [0, 0, 0, "Unexpected any. Specify a different type.", "11"], - [0, 0, 0, "Unexpected any. Specify a different type.", "12"], + [0, 0, 0, "Do not use any type assertions.", "12"], [0, 0, 0, "Unexpected any. Specify a different type.", "13"], - [0, 0, 0, "Do not use any type assertions.", "14"], - [0, 0, 0, "Unexpected any. Specify a different type.", "15"], - [0, 0, 0, "Do not use any type assertions.", "16"] + [0, 0, 0, "Do not use any type assertions.", "14"] ], "public/app/features/transformers/FilterByValueTransformer/ValueMatchers/BasicMatcherEditor.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], diff --git a/packages/grafana-data/src/field/fieldDisplay.test.ts b/packages/grafana-data/src/field/fieldDisplay.test.ts index f7e293987c1..ebea46752bd 100644 --- a/packages/grafana-data/src/field/fieldDisplay.test.ts +++ b/packages/grafana-data/src/field/fieldDisplay.test.ts @@ -6,7 +6,7 @@ import { ReducerID } from '../transformations/fieldReducer'; import { FieldConfigPropertyItem, MappingType, SpecialValueMatch, ValueMapping } from '../types'; import { getDisplayProcessor } from './displayProcessor'; -import { getFieldDisplayValues, GetFieldDisplayValuesOptions } from './fieldDisplay'; +import { fixCellTemplateExpressions, getFieldDisplayValues, GetFieldDisplayValuesOptions } from './fieldDisplay'; import { standardFieldConfigEditorRegistry } from './standardFieldConfigEditorRegistry'; describe('FieldDisplay', () => { @@ -534,3 +534,11 @@ function createDisplayOptions(extend: Partial = {} return merge(options, extend); } + +describe('fixCellTemplateExpressions', () => { + it('Should replace __cell_x correctly', () => { + expect(fixCellTemplateExpressions('$__cell_10 asd ${__cell_15} asd [[__cell_20]]')).toEqual( + '${__data.fields[10]} asd ${__data.fields[15]} asd ${__data.fields[20]}' + ); + }); +}); diff --git a/packages/grafana-data/src/field/fieldDisplay.ts b/packages/grafana-data/src/field/fieldDisplay.ts index f21393f21d0..6bd10b415fb 100644 --- a/packages/grafana-data/src/field/fieldDisplay.ts +++ b/packages/grafana-data/src/field/fieldDisplay.ts @@ -1,4 +1,4 @@ -import { toString, isEmpty } from 'lodash'; +import { isEmpty } from 'lodash'; import { DataFrameView } from '../dataframe/DataFrameView'; import { getTimeField } from '../dataframe/processDataFrame'; @@ -96,7 +96,6 @@ export const getFieldDisplayValues = (options: GetFieldDisplayValuesOptions): Fi const data = options.data ?? []; const limit = reduceOptions.limit ? reduceOptions.limit : DEFAULT_FIELD_DISPLAY_VALUES_LIMIT; - const scopedVars: ScopedVars = {}; let hitLimit = false; @@ -125,7 +124,7 @@ export const getFieldDisplayValues = (options: GetFieldDisplayValuesOptions): Fi }; } - const displayName = field.config.displayName ?? ''; + let displayName = field.config.displayName ?? ''; const display = field.display ?? @@ -137,23 +136,10 @@ export const getFieldDisplayValues = (options: GetFieldDisplayValuesOptions): Fi // Show all rows if (reduceOptions.values) { - const usesCellValues = displayName.indexOf(VAR_CELL_PREFIX) >= 0; - for (let j = 0; j < field.values.length; j++) { - // Add all the row variables - if (usesCellValues) { - for (let k = 0; k < dataFrame.fields.length; k++) { - const f = dataFrame.fields[k]; - const v = f.values.get(j); - scopedVars[VAR_CELL_PREFIX + k] = { - value: v, - text: toString(v), - }; - } - } - field.state = setIndexForPaletteColor(field, values.length); + const scopedVars = getFieldScopedVarsWithDataContexAndRowIndex(field, j); const displayValue = display(field.values.get(j)); const rowName = getSmartDisplayNameForRow(dataFrame, field, j, replaceVariables, scopedVars); const overrideColor = lookupRowColorFromOverride(rowName, options.fieldConfig, theme); @@ -190,14 +176,13 @@ export const getFieldDisplayValues = (options: GetFieldDisplayValuesOptions): Fi }); for (const calc of calcs) { + const scopedVars = field.state?.scopedVars ?? {}; scopedVars[VAR_CALC] = { value: calc, text: calc }; + const displayValue = display(results[calc]); if (displayName !== '') { - displayValue.title = replaceVariables(displayName, { - ...field.state?.scopedVars, // series and field scoped vars - ...scopedVars, - }); + displayValue.title = replaceVariables(displayName, scopedVars); } else { displayValue.title = getFieldDisplayName(field, dataFrame, data); } @@ -247,18 +232,22 @@ function getSmartDisplayNameForRow( field: Field, rowIndex: number, replaceVariables: InterpolateFunction, - scopedVars: ScopedVars + scopedVars: ScopedVars | undefined ): string { + const displayName = field.config.displayName; + + if (displayName) { + // Handle old __cell_n syntax + if (displayName.indexOf(VAR_CELL_PREFIX)) { + return replaceVariables(fixCellTemplateExpressions(displayName), scopedVars); + } + + return replaceVariables(displayName, scopedVars); + } + let parts: string[] = []; let otherNumericFields = 0; - if (field.config.displayName) { - return replaceVariables(field.config.displayName, { - ...field.state?.scopedVars, // series and field scoped vars - ...scopedVars, - }); - } - for (const otherField of frame.fields) { if (otherField === field) { continue; @@ -382,3 +371,28 @@ function getDisplayText(display: DisplayValue, fallback: string): string { } return display.text; } + +export function fixCellTemplateExpressions(str: string) { + return str.replace(/\${__cell_(\d+)}|\[\[__cell_(\d+)\]\]|\$__cell_(\d+)/g, (match, fmt1, fmt2, fmt3) => { + return `\${__data.fields[${fmt1 ?? fmt2 ?? fmt3}]}`; + }); +} + +/** + * Clones the existing dataContext and adds rowIndex to it + */ +function getFieldScopedVarsWithDataContexAndRowIndex(field: Field, rowIndex: number): ScopedVars | undefined { + if (field.state?.scopedVars?.__dataContext) { + return { + ...field.state?.scopedVars, + __dataContext: { + value: { + ...field.state?.scopedVars?.__dataContext.value, + rowIndex, + }, + }, + }; + } + + return field.state?.scopedVars; +} diff --git a/packages/grafana-data/src/field/fieldOverrides.test.ts b/packages/grafana-data/src/field/fieldOverrides.test.ts index 59abb84e52f..1199f8118ff 100644 --- a/packages/grafana-data/src/field/fieldOverrides.test.ts +++ b/packages/grafana-data/src/field/fieldOverrides.test.ts @@ -199,35 +199,9 @@ describe('applyFieldOverrides', () => { fieldConfigRegistry: new FieldConfigOptionsRegistry(), }); - expect(withOverrides[0].fields[0].state!.scopedVars).toMatchInlineSnapshot(` - { - "__field": { - "text": "Field", - "value": {}, - }, - "__series": { - "text": "Series", - "value": { - "name": "A", - }, - }, - } - `); - - expect(withOverrides[1].fields[0].state!.scopedVars).toMatchInlineSnapshot(` - { - "__field": { - "text": "Field", - "value": {}, - }, - "__series": { - "text": "Series", - "value": { - "name": "B", - }, - }, - } - `); + expect(withOverrides[0].fields[0].state!.scopedVars?.__dataContext?.value.frame).toBe(withOverrides[0]); + expect(withOverrides[0].fields[0].state!.scopedVars?.__dataContext?.value.frameIndex).toBe(0); + expect(withOverrides[0].fields[0].state!.scopedVars?.__dataContext?.value.field).toBe(withOverrides[0].fields[0]); }); }); diff --git a/packages/grafana-data/src/field/fieldOverrides.ts b/packages/grafana-data/src/field/fieldOverrides.ts index ceceb40952d..08bc0c63d43 100644 --- a/packages/grafana-data/src/field/fieldOverrides.ts +++ b/packages/grafana-data/src/field/fieldOverrides.ts @@ -39,10 +39,7 @@ import { mapInternalLinkToExplore } from '../utils/dataLinks'; import { FieldConfigOptionsRegistry } from './FieldConfigOptionsRegistry'; import { getDisplayProcessor, getRawDisplayProcessor } from './displayProcessor'; -import { getFrameDisplayName } from './fieldState'; -import { getFieldDisplayValuesProxy } from './getFieldDisplayValuesProxy'; import { standardFieldConfigEditorRegistry } from './standardFieldConfigEditorRegistry'; -import { getTemplateProxyForField } from './templateProxies'; interface OverrideProps { match: FieldMatcher; @@ -122,18 +119,17 @@ export function applyFieldOverrides(options: ApplyFieldOverrideOptions): DataFra }; }); - const scopedVars: ScopedVars = { - __series: { text: 'Series', value: { name: getFrameDisplayName(newFrame, index) } }, // might be missing - }; - for (const field of newFrame.fields) { const config = field.config; field.state!.scopedVars = { - ...scopedVars, - __field: { - text: 'Field', - value: getTemplateProxyForField(field, newFrame, options.data), + __dataContext: { + value: { + data: options.data!, + frame: newFrame, + frameIndex: index, + field: field, + }, }, }; @@ -371,49 +367,29 @@ export const getLinksSupplier = } return field.config.links.map((link: DataLink) => { - let dataFrameVars = {}; - let dataContext: DataContextScopedVar = { value: { frame, field } }; + const dataContext: DataContextScopedVar = getFieldDataContextClone(frame, field, fieldScopedVars); + const dataLinkScopedVars = { + ...fieldScopedVars, + __dataContext: dataContext, + }; // We are not displaying reduction result if (config.valueRowIndex !== undefined && !isNaN(config.valueRowIndex)) { dataContext.value.rowIndex = config.valueRowIndex; - - const fieldsProxy = getFieldDisplayValuesProxy({ - frame, - rowIndex: config.valueRowIndex, - timeZone: timeZone, - }); - - dataFrameVars = { - __data: { - value: { - name: frame.name, - refId: frame.refId, - fields: fieldsProxy, - }, - text: 'Data', - }, - }; } else { dataContext.value.calculatedValue = config.calculatedValue; } - const variables: ScopedVars = { - ...fieldScopedVars, - ...dataFrameVars, - __dataContext: dataContext, - }; - if (link.onClick) { return { href: link.url, - title: replaceVariables(link.title || '', variables), + title: replaceVariables(link.title || '', dataLinkScopedVars), target: link.targetBlank ? '_blank' : undefined, onClick: (evt, origin) => { link.onClick!({ origin: origin ?? field, e: evt, - replaceVariables: (v) => replaceVariables(v, variables), + replaceVariables: (v) => replaceVariables(v, dataLinkScopedVars), }); }, origin: field, @@ -425,7 +401,7 @@ export const getLinksSupplier = return mapInternalLinkToExplore({ link, internalLink: link.internal, - scopedVars: variables, + scopedVars: dataLinkScopedVars, field, range: link.internal.range ?? ({} as any), replaceVariables, @@ -440,13 +416,13 @@ export const getLinksSupplier = if (href) { href = locationUtil.assureBaseUrl(href.replace(/\n/g, '')); - href = replaceVariables(href, variables, VariableFormatID.PercentEncode); + href = replaceVariables(href, dataLinkScopedVars, VariableFormatID.PercentEncode); href = locationUtil.processUrl(href); } const info: LinkModel = { href, - title: replaceVariables(link.title || '', variables), + title: replaceVariables(link.title || '', dataLinkScopedVars), target: link.targetBlank ? '_blank' : undefined, origin: field, }; @@ -530,3 +506,18 @@ export function useFieldOverrides( }; }, [fieldConfigRegistry, fieldConfig, data, prevSeries, timeZone, theme, replace]); } + +/** + * Clones the existing dataContext or creates a new one + */ +function getFieldDataContextClone(frame: DataFrame, field: Field, fieldScopedVars: ScopedVars) { + if (fieldScopedVars?.__dataContext) { + return { + value: { + ...fieldScopedVars.__dataContext.value, + }, + }; + } + + return { value: { frame, field, data: [frame] } }; +} diff --git a/packages/grafana-data/src/types/ScopedVars.ts b/packages/grafana-data/src/types/ScopedVars.ts index b5e6b9e0ed7..725dd051a8d 100644 --- a/packages/grafana-data/src/types/ScopedVars.ts +++ b/packages/grafana-data/src/types/ScopedVars.ts @@ -16,9 +16,11 @@ export interface ScopedVars { */ export interface DataContextScopedVar { value: { + data: DataFrame[]; frame: DataFrame; field: Field; rowIndex?: number; + frameIndex?: number; calculatedValue?: DisplayValue; }; } diff --git a/public/app/features/inspector/InspectJSONTab.tsx b/public/app/features/inspector/InspectJSONTab.tsx index ff78fe81898..b59b46840d9 100644 --- a/public/app/features/inspector/InspectJSONTab.tsx +++ b/public/app/features/inspector/InspectJSONTab.tsx @@ -191,7 +191,7 @@ async function getJSONObject(show: ShowContent, panel?: PanelModel, data?: Panel function getPrettyJSON(obj: any): string { let r = ''; try { - r = JSON.stringify(obj, null, 2); + r = JSON.stringify(obj, getCircularReplacer(), 2); } catch (e) { if ( e instanceof Error && @@ -204,3 +204,21 @@ function getPrettyJSON(obj: any): string { } return r; } + +function getCircularReplacer() { + const seen = new WeakSet(); + + return (key: string, value: unknown) => { + if (key === '__dataContext') { + return 'Filtered out in JSON serialization'; + } + + if (typeof value === 'object' && value !== null) { + if (seen.has(value)) { + return; + } + seen.add(value); + } + return value; + }; +} diff --git a/public/app/features/templating/dataMacros.test.ts b/public/app/features/templating/dataMacros.test.ts index 164a5c8b345..493643c2361 100644 --- a/public/app/features/templating/dataMacros.test.ts +++ b/public/app/features/templating/dataMacros.test.ts @@ -3,7 +3,7 @@ import { initTemplateSrv } from 'test/helpers/initTemplateSrv'; import { DataContextScopedVar, FieldType, toDataFrame } from '@grafana/data'; import { TemplateSrv } from '@grafana/runtime'; -describe('templateSrv', () => { +describe('dataMacros', () => { let _templateSrv: TemplateSrv; beforeEach(() => { @@ -11,12 +11,14 @@ describe('templateSrv', () => { }); const data = toDataFrame({ - name: 'A', + name: 'frameName', + refId: 'refIdA', fields: [ { - name: 'number', + name: 'CoolNumber', type: FieldType.number, values: [5, 10], + labels: { cluster: 'US', region: 'west=1' }, display: (value: number) => { return { text: value.toString(), numeric: value, suffix: '%' }; }, @@ -32,6 +34,7 @@ describe('templateSrv', () => { it('Should interpolate __value.* expressions with dataContext in scopedVars', () => { const dataContext: DataContextScopedVar = { value: { + data: [data], frame: data, field: data.fields[0], rowIndex: 1, @@ -52,6 +55,7 @@ describe('templateSrv', () => { it('Should interpolate __value.* with calculatedValue', () => { const dataContext: DataContextScopedVar = { value: { + data: [data], frame: data, field: data.fields[0], calculatedValue: { @@ -74,6 +78,7 @@ describe('templateSrv', () => { it('Should return match when ${__value.*} is used and no dataContext or rowIndex is found', () => { const dataContext: DataContextScopedVar = { value: { + data: [data], frame: data, field: data.fields[0], }, @@ -83,4 +88,71 @@ describe('templateSrv', () => { expect(_templateSrv.replace('${__value.raw}', scopedVars)).toBe('${__value.raw}'); }); + + it('Should interpolate __data.* correctly', () => { + const dataContext: DataContextScopedVar = { + value: { + data: [data], + frame: data, + field: data.fields[0], + rowIndex: 1, + }, + }; + + const scopedVars = { __dataContext: dataContext }; + + expect(_templateSrv.replace('${__data.fields[1]}', scopedVars)).toBe('10000'); + expect(_templateSrv.replace('${__data.fields[0]}', scopedVars)).toBe('10%'); + expect(_templateSrv.replace('${__data.fields[0].text}', scopedVars)).toBe('10'); + expect(_templateSrv.replace('${__data.fields["CoolNumber"].text}', scopedVars)).toBe('10'); + expect(_templateSrv.replace('${__data.name}', scopedVars)).toBe('frameName'); + expect(_templateSrv.replace('${__data.refId}', scopedVars)).toBe('refIdA'); + expect(_templateSrv.replace('${__data.fields[0]:percentencode}', scopedVars)).toBe('10%25'); + }); + + it('${__data.*} should return match when the rowIndex is missing dataContext is not there', () => { + const dataContext: DataContextScopedVar = { + value: { + data: [data], + frame: data, + field: data.fields[0], + }, + }; + + const scopedVars = { __dataContext: dataContext }; + + expect(_templateSrv.replace('${__data.name}', scopedVars)).toBe('${__data.name}'); + }); + + it('Should interpolate ${__series} to frame display name', () => { + const dataContext: DataContextScopedVar = { + value: { + data: [data], + frame: data, + field: data.fields[0], + frameIndex: 0, + }, + }; + + const scopedVars = { __dataContext: dataContext }; + + expect(_templateSrv.replace('${__series.name}', scopedVars)).toBe('frameName'); + }); + + it('Should interpolate ${__field.*} correctly', () => { + const dataContext: DataContextScopedVar = { + value: { + data: [data], + frame: data, + field: data.fields[0], + frameIndex: 0, + }, + }; + + const scopedVars = { __dataContext: dataContext }; + + expect(_templateSrv.replace('${__field.name}', scopedVars)).toBe('CoolNumber'); + expect(_templateSrv.replace('${__field.labels.cluster}', scopedVars)).toBe('US'); + expect(_templateSrv.replace('${__field.labels.region:percentencode}', scopedVars)).toBe('west%3D1'); + }); }); diff --git a/public/app/features/templating/dataMacros.ts b/public/app/features/templating/dataMacros.ts index 354c1b58f42..5eac406a39f 100644 --- a/public/app/features/templating/dataMacros.ts +++ b/public/app/features/templating/dataMacros.ts @@ -1,7 +1,17 @@ -import { DisplayProcessor, FieldType, formattedValueToString, getDisplayProcessor, ScopedVars } from '@grafana/data'; +import { + DisplayProcessor, + FieldType, + formattedValueToString, + getDisplayProcessor, + getFieldDisplayValuesProxy, + getFrameDisplayName, + ScopedVars, +} from '@grafana/data'; import { VariableCustomFormatterFn } from '@grafana/scenes'; +import { getFieldAccessor } from './fieldAccessorCache'; import { formatVariableValue } from './formatVariableValue'; +import { getTemplateProxyForField } from './templateProxies'; /** * ${__value.raw/nummeric/text/time} macro @@ -65,6 +75,41 @@ function getValueForValueMacro(match: string, fieldPath?: string, scopedVars?: S } } +/** + * Macro support doing things like. + * ${__data.name} + * ${__data.fields[0].name} + * ${__data.fields["Value"].labels.cluster} + * + * Requires rowIndex on dataContext + */ +export function dataMacro( + match: string, + fieldPath?: string, + scopedVars?: ScopedVars, + format?: string | VariableCustomFormatterFn +) { + const dataContext = scopedVars?.__dataContext; + if (!dataContext || !fieldPath) { + return match; + } + + const { frame, rowIndex } = dataContext.value; + + if (rowIndex === undefined || fieldPath === undefined) { + return match; + } + + const obj = { + name: frame.name, + refId: frame.refId, + fields: getFieldDisplayValuesProxy({ frame, rowIndex }), + }; + + const value = getFieldAccessor(fieldPath)(obj) ?? ''; + return formatVariableValue(value, format); +} + let fallbackDisplayProcessor: DisplayProcessor | undefined; function getFallbackDisplayProcessor() { @@ -74,3 +119,53 @@ function getFallbackDisplayProcessor() { return fallbackDisplayProcessor; } + +/** + * ${__series} = frame display name + */ +export function seriesNameMacro( + match: string, + fieldPath?: string, + scopedVars?: ScopedVars, + format?: string | VariableCustomFormatterFn +) { + const dataContext = scopedVars?.__dataContext; + if (!dataContext) { + return match; + } + + if (fieldPath !== 'name') { + return match; + } + + const { frame, frameIndex } = dataContext.value; + const value = getFrameDisplayName(frame, frameIndex); + return formatVariableValue(value, format); +} + +/** + * Handles expressions like + * ${__field.name} + * ${__field.labels.cluster} + */ +export function fieldMacro( + match: string, + fieldPath?: string, + scopedVars?: ScopedVars, + format?: string | VariableCustomFormatterFn +) { + const dataContext = scopedVars?.__dataContext; + if (!dataContext) { + return match; + } + + if (fieldPath === undefined || fieldPath === '') { + return match; + } + + const { frame, field, data } = dataContext.value; + const obj = getTemplateProxyForField(field, frame, data); + + const value = getFieldAccessor(fieldPath)(obj) ?? ''; + return formatVariableValue(value, format); +} diff --git a/public/app/features/templating/fieldAccessorCache.ts b/public/app/features/templating/fieldAccessorCache.ts new file mode 100644 index 00000000000..a14b281e6be --- /dev/null +++ b/public/app/features/templating/fieldAccessorCache.ts @@ -0,0 +1,16 @@ +import { property } from 'lodash'; + +interface FieldAccessorCache { + [key: string]: (obj: object) => any; +} + +let fieldAccessorCache: FieldAccessorCache = {}; + +export function getFieldAccessor(fieldPath: string) { + const accessor = fieldAccessorCache[fieldPath]; + if (accessor) { + return accessor; + } + + return (fieldAccessorCache[fieldPath] = property(fieldPath)); +} diff --git a/public/app/features/templating/macroRegistry.ts b/public/app/features/templating/macroRegistry.ts index 8431ef6c154..65ede4f22b6 100644 --- a/public/app/features/templating/macroRegistry.ts +++ b/public/app/features/templating/macroRegistry.ts @@ -3,11 +3,14 @@ import { DataLinkBuiltInVars, ScopedVars, urlUtil } from '@grafana/data'; import { getTimeSrv } from '../dashboard/services/TimeSrv'; import { getVariablesUrlParams } from '../variables/getAllVariableValuesForUrl'; -import { valueMacro } from './dataMacros'; +import { dataMacro, fieldMacro, seriesNameMacro, valueMacro } from './dataMacros'; import { MacroHandler } from './types'; export const macroRegistry: Record = { ['__value']: valueMacro, + ['__data']: dataMacro, + ['__series']: seriesNameMacro, + ['__field']: fieldMacro, [DataLinkBuiltInVars.includeVars]: includeVarsMacro, [DataLinkBuiltInVars.keepTime]: urlTimeRangeMacro, }; diff --git a/packages/grafana-data/src/field/templateProxies.test.ts b/public/app/features/templating/templateProxies.test.ts similarity index 94% rename from packages/grafana-data/src/field/templateProxies.test.ts rename to public/app/features/templating/templateProxies.test.ts index 154bd77628d..95f48388fe6 100644 --- a/packages/grafana-data/src/field/templateProxies.test.ts +++ b/public/app/features/templating/templateProxies.test.ts @@ -1,4 +1,4 @@ -import { toDataFrame } from '../dataframe'; +import { toDataFrame } from '@grafana/data'; import { getTemplateProxyForField } from './templateProxies'; diff --git a/packages/grafana-data/src/field/templateProxies.ts b/public/app/features/templating/templateProxies.ts similarity index 87% rename from packages/grafana-data/src/field/templateProxies.ts rename to public/app/features/templating/templateProxies.ts index e547f1b689e..634ecfe5c23 100644 --- a/packages/grafana-data/src/field/templateProxies.ts +++ b/public/app/features/templating/templateProxies.ts @@ -1,7 +1,4 @@ -import { DataFrame, Field } from '../types'; -import { formatLabels } from '../utils/labels'; - -import { getFieldDisplayName } from './fieldState'; +import { Field, DataFrame, getFieldDisplayName, formatLabels } from '@grafana/data'; /** * This object is created often, and only used when tmplates exist. Using a proxy lets us delay diff --git a/public/app/features/templating/template_srv.ts b/public/app/features/templating/template_srv.ts index 2b1445def8b..359a7c5af43 100644 --- a/public/app/features/templating/template_srv.ts +++ b/public/app/features/templating/template_srv.ts @@ -1,4 +1,4 @@ -import { escape, isString, property } from 'lodash'; +import { escape, isString } from 'lodash'; import { deprecationWarning, @@ -24,13 +24,10 @@ import { isAdHoc } from '../variables/guard'; import { getFilteredVariables, getVariables, getVariableWithName } from '../variables/state/selectors'; import { variableRegex } from '../variables/utils'; +import { getFieldAccessor } from './fieldAccessorCache'; import { formatVariableValue } from './formatVariableValue'; import { macroRegistry } from './macroRegistry'; -interface FieldAccessorCache { - [key: string]: (obj: any) => any; -} - /** * Internal regex replace function */ @@ -54,7 +51,6 @@ export class TemplateSrv implements BaseTemplateSrv { private index: any = {}; private grafanaVariables = new Map(); private timeRange?: TimeRange | null = null; - private fieldAccessorCache: FieldAccessorCache = {}; constructor(private dependencies: TemplateSrvDependencies = runtimeDependencies) { this._variables = []; @@ -206,18 +202,9 @@ export class TemplateSrv implements BaseTemplateSrv { return values; } - private getFieldAccessor(fieldPath: string) { - const accessor = this.fieldAccessorCache[fieldPath]; - if (accessor) { - return accessor; - } - - return (this.fieldAccessorCache[fieldPath] = property(fieldPath)); - } - private getVariableValue(scopedVar: ScopedVar, fieldPath: string | undefined) { if (fieldPath) { - return this.getFieldAccessor(fieldPath)(scopedVar.value); + return getFieldAccessor(fieldPath)(scopedVar.value); } return scopedVar.value; @@ -284,8 +271,9 @@ export class TemplateSrv implements BaseTemplateSrv { } if (!variable) { - if (macroRegistry[variableName]) { - return macroRegistry[variableName](match, fieldPath, scopedVars, format); + const macro = macroRegistry[variableName]; + if (macro) { + return macro(match, fieldPath, scopedVars, format); } return match; From 2f495e10585068571482b0c59d5bed7ffe6be0a7 Mon Sep 17 00:00:00 2001 From: Victor Colomb <51762123+VictorColomb@users.noreply.github.com> Date: Wed, 5 Apr 2023 11:25:00 +0200 Subject: [PATCH 36/80] DashlistPanel: Add options to include time range and variable values (#65757) --- .../visualizations/dashboard-list/index.md | 2 + .../app/plugins/panel/dashlist/DashList.tsx | 72 +++++++++++++------ public/app/plugins/panel/dashlist/module.tsx | 10 +++ .../app/plugins/panel/dashlist/panelcfg.cue | 2 + .../plugins/panel/dashlist/panelcfg.gen.ts | 4 ++ 5 files changed, 70 insertions(+), 20 deletions(-) diff --git a/docs/sources/panels-visualizations/visualizations/dashboard-list/index.md b/docs/sources/panels-visualizations/visualizations/dashboard-list/index.md index 662475f6b33..94b579778f2 100644 --- a/docs/sources/panels-visualizations/visualizations/dashboard-list/index.md +++ b/docs/sources/panels-visualizations/visualizations/dashboard-list/index.md @@ -26,6 +26,8 @@ On each dashboard load, this panel queries the dashboard list, always providing Use these options to refine your visualization. +- **Include current time range -** Select this option to propagate the time range of the current dashboard to the dashboard links. When the user clicks a link, the linked dashboard opens with the indicated time range already set. +- **Include current template variable values -** Select this option to include template variables currently used as query parameters in a link. When the user clicks the link, any matching templates in the linked dashboard are set to the values from the link. Learn more about [Dashboard URL variables]({{< relref "../../../dashboards/build-dashboards/create-dashboard-url-variables/" >}}). - **Starred -** Display starred dashboards in alphabetical order. - **Recently viewed -** Display recently viewed dashboards in alphabetical order. - **Search -** Display dashboards by search query or tags. You must enter at least one value in **Query** or **Tags**. For the **Query** and **Tags** fields. Variable interpolation is supported, for example,`$my_var` or `${my_var}`. diff --git a/public/app/plugins/panel/dashlist/DashList.tsx b/public/app/plugins/panel/dashlist/DashList.tsx index c291c9a29d9..102b0cc1f6b 100644 --- a/public/app/plugins/panel/dashlist/DashList.tsx +++ b/public/app/plugins/panel/dashlist/DashList.tsx @@ -2,16 +2,27 @@ import { css, cx } from '@emotion/css'; import { take } from 'lodash'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; -import { GrafanaTheme2, InterpolateFunction, PanelProps } from '@grafana/data'; +import { + DateTime, + GrafanaTheme2, + InterpolateFunction, + PanelProps, + textUtil, + UrlQueryValue, + urlUtil, +} from '@grafana/data'; import { CustomScrollbar, stylesFactory, useStyles2 } from '@grafana/ui'; import { Icon, IconProps } from '@grafana/ui/src/components/Icon/Icon'; import { getFocusStyles } from '@grafana/ui/src/themes/mixins'; +import { getConfig } from 'app/core/config'; import { setStarred } from 'app/core/reducers/navBarTree'; import { getBackendSrv } from 'app/core/services/backend_srv'; import impressionSrv from 'app/core/services/impression_srv'; import { getDashboardSrv } from 'app/features/dashboard/services/DashboardSrv'; +import { getTimeSrv } from 'app/features/dashboard/services/TimeSrv'; import { SearchCard } from 'app/features/search/components/SearchCard'; import { DashboardSearchItem } from 'app/features/search/types'; +import { getVariablesUrlParams } from 'app/features/variables/getAllVariableValuesForUrl'; import { useDispatch } from 'app/types'; import { PanelLayout, PanelOptions } from './panelcfg.gen'; @@ -143,26 +154,47 @@ export function DashList(props: PanelProps) { const renderList = (dashboards: Dashboard[]) => (
    - {dashboards.map((dash) => ( -
  • -
    -
    - - {dash.title} - - {dash.folderTitle &&
    {dash.folderTitle}
    } + {dashboards.map((dash) => { + let url = dash.url; + let params: { [key: string]: string | DateTime | UrlQueryValue } = {}; + + if (props.options.keepTime) { + const range = getTimeSrv().timeRangeForUrl(); + params['from'] = range.from; + params['to'] = range.to; + } + + if (props.options.includeVars) { + params = { + ...params, + ...getVariablesUrlParams(), + }; + } + + url = urlUtil.appendQueryToUrl(url, urlUtil.toUrlParams(params)); + url = getConfig().disableSanitizeHtml ? url : textUtil.sanitizeUrl(url); + + return ( +
  • +
    +
    + + {dash.title} + + {dash.folderTitle &&
    {dash.folderTitle}
    } +
    + toggleDashboardStar(e, dash)} + />
    - toggleDashboardStar(e, dash)} - /> -
- - ))} + + ); + })} ); diff --git a/public/app/plugins/panel/dashlist/module.tsx b/public/app/plugins/panel/dashlist/module.tsx index fe6e735a284..d22c00e5094 100644 --- a/public/app/plugins/panel/dashlist/module.tsx +++ b/public/app/plugins/panel/dashlist/module.tsx @@ -30,6 +30,16 @@ export const plugin = new PanelPlugin(DashList) } builder + .addBooleanSwitch({ + path: 'keepTime', + name: 'Include current time range', + defaultValue: defaultPanelOptions.keepTime, + }) + .addBooleanSwitch({ + path: 'includeVars', + name: 'Include current template variable values', + defaultValue: defaultPanelOptions.includeVars, + }) .addBooleanSwitch({ path: 'showStarred', name: 'Starred', diff --git a/public/app/plugins/panel/dashlist/panelcfg.cue b/public/app/plugins/panel/dashlist/panelcfg.cue index 8d1c43adbdf..600563bbf27 100644 --- a/public/app/plugins/panel/dashlist/panelcfg.cue +++ b/public/app/plugins/panel/dashlist/panelcfg.cue @@ -25,6 +25,8 @@ composableKinds: PanelCfg: { PanelLayout: "list" | "previews" @cuetsy(kind="enum") PanelOptions: { layout?: PanelLayout | *"list" + keepTime: bool | *false + includeVars: bool | *false showStarred: bool | *true showRecentlyViewed: bool | *false showSearch: bool | *false diff --git a/public/app/plugins/panel/dashlist/panelcfg.gen.ts b/public/app/plugins/panel/dashlist/panelcfg.gen.ts index 0fdea561c83..19f89096fd7 100644 --- a/public/app/plugins/panel/dashlist/panelcfg.gen.ts +++ b/public/app/plugins/panel/dashlist/panelcfg.gen.ts @@ -17,6 +17,8 @@ export enum PanelLayout { export interface PanelOptions { folderId?: number; + includeVars: boolean; + keepTime: boolean; layout?: PanelLayout; maxItems: number; query: string; @@ -28,6 +30,8 @@ export interface PanelOptions { } export const defaultPanelOptions: Partial = { + includeVars: false, + keepTime: false, layout: PanelLayout.List, maxItems: 10, query: '', From 6108701aed7cb25456420711c705ebdee394dbdf Mon Sep 17 00:00:00 2001 From: Joao Silva <100691367+JoaoSilvaGrafana@users.noreply.github.com> Date: Wed, 5 Apr 2023 11:30:29 +0200 Subject: [PATCH 37/80] VizLegend: Change border radius from default to pill (#65946) --- packages/grafana-ui/src/components/VizLegend/SeriesIcon.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/grafana-ui/src/components/VizLegend/SeriesIcon.tsx b/packages/grafana-ui/src/components/VizLegend/SeriesIcon.tsx index e65e8885687..937f61bf836 100644 --- a/packages/grafana-ui/src/components/VizLegend/SeriesIcon.tsx +++ b/packages/grafana-ui/src/components/VizLegend/SeriesIcon.tsx @@ -30,7 +30,7 @@ export const SeriesIcon = React.memo( background: cssColor, width: '14px', height: '4px', - borderRadius: theme.shape.radius.default, + borderRadius: theme.shape.radius.pill, display: 'inline-block', marginRight: '8px', }; From c96d5d6c7e7c1cbb007d8c503c4fb016f0741472 Mon Sep 17 00:00:00 2001 From: Jack Westbrook Date: Wed, 5 Apr 2023 11:47:37 +0200 Subject: [PATCH 38/80] Grafana UI: Ignore internal stories when compiling (#65983) Grafana UI: Ignore internal stories when compiling --- packages/grafana-ui/tsconfig.build.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/grafana-ui/tsconfig.build.json b/packages/grafana-ui/tsconfig.build.json index 2ce1fd65c43..291f5a514af 100644 --- a/packages/grafana-ui/tsconfig.build.json +++ b/packages/grafana-ui/tsconfig.build.json @@ -5,6 +5,14 @@ "@grafana/ui": ["."] } }, - "exclude": ["**/*.story.tsx", "**/*.test.ts*", "**/*.tmpl.ts", "dist", "node_modules", "src/utils/storybook"], + "exclude": [ + "**/*.story.tsx", + "**/*.story.internal.tsx", + "**/*.test.ts*", + "**/*.tmpl.ts", + "dist", + "node_modules", + "src/utils/storybook" + ], "extends": "./tsconfig.json" } From c9288868f44cf520ef144967ca3674225a8f6a3f Mon Sep 17 00:00:00 2001 From: Matias Chomicki Date: Wed, 5 Apr 2023 13:05:06 +0200 Subject: [PATCH 39/80] Supplementary Query Error: Align buttons to the right / Update timeout message (#65738) * Update timeout message * Align buttons to the right * Remove test code * Update test * Add min width to error container --- .../explore/LogsVolumePanelList.test.tsx | 2 +- .../features/explore/LogsVolumePanelList.tsx | 2 +- .../explore/SupplementaryResultError.tsx | 71 +++++++++++++------ 3 files changed, 51 insertions(+), 24 deletions(-) diff --git a/public/app/features/explore/LogsVolumePanelList.test.tsx b/public/app/features/explore/LogsVolumePanelList.test.tsx index d9a0473747a..160628c8271 100644 --- a/public/app/features/explore/LogsVolumePanelList.test.tsx +++ b/public/app/features/explore/LogsVolumePanelList.test.tsx @@ -63,7 +63,7 @@ describe('LogsVolumePanelList', () => { }, onLoadCallback ); - expect(screen.getByText('The logs volume query is taking too long and has timed out')).toBeInTheDocument(); + expect(screen.getByText('The logs volume query has timed out')).toBeInTheDocument(); await userEvent.click(screen.getByRole('button', { name: 'Retry' })); expect(onLoadCallback).toHaveBeenCalled(); }); diff --git a/public/app/features/explore/LogsVolumePanelList.tsx b/public/app/features/explore/LogsVolumePanelList.tsx index c3295896ef6..f530336822d 100644 --- a/public/app/features/explore/LogsVolumePanelList.tsx +++ b/public/app/features/explore/LogsVolumePanelList.tsx @@ -69,7 +69,7 @@ export const LogsVolumePanelList = ({ } else if (timeoutError) { return ( SHORT_ERROR_MESSAGE_LIMIT; + const theme = useTheme2(); + const styles = getStyles(theme); return ( - - {showButton ? ( - - ) : ( - message - )} - {suggestedAction && onSuggestedAction && ( - - )} - +
+ +
+ {showButton ? ( + + ) : ( + message + )} + {suggestedAction && onSuggestedAction && ( +
+ +
+ )} +
+
+
); } + +const getStyles = (theme: GrafanaTheme2) => { + return { + supplementaryErrorContainer: css` + width: 50%; + min-width: ${theme.breakpoints.values.sm}px; + margin: 0 auto; + `, + suggestedActionWrapper: css` + height: ${theme.spacing(6)}; + button { + position: absolute; + right: ${theme.spacing(2)}; + top: ${theme.spacing(7)}; + } + `, + }; +}; From bff9f4c890aedf6379d7999808062c9bf6ffd13e Mon Sep 17 00:00:00 2001 From: Will Browne Date: Wed, 5 Apr 2023 13:40:08 +0100 Subject: [PATCH 40/80] Plugins: Move config factory to pluginsintegration package (#65716) * move config to pluginsintegration package * change to all plugin toggle * fixes * fixes * fix lerna * fix test --- pkg/api/plugin_resource_test.go | 5 +- pkg/infra/tracing/opentelemetry_tracing.go | 4 + pkg/plugins/config/config.go | 74 ++++--------------- pkg/plugins/config/tracing.go | 37 ++-------- .../manager/loader/initializer/initializer.go | 6 +- .../loader/initializer/initializer_test.go | 62 +++++++++++----- .../manager/manager_integration_test.go | 2 +- .../pluginsintegration/config/config.go | 59 +++++++++++++++ .../pluginsintegration}/config/config_test.go | 0 .../pluginsintegration/config/tracing.go | 27 +++++++ .../config/tracing_test.go | 18 ++--- .../pluginsintegration/pluginsintegration.go | 7 +- 12 files changed, 175 insertions(+), 126 deletions(-) create mode 100644 pkg/services/pluginsintegration/config/config.go rename pkg/{plugins => services/pluginsintegration}/config/config_test.go (100%) create mode 100644 pkg/services/pluginsintegration/config/tracing.go rename pkg/{plugins => services/pluginsintegration}/config/tracing_test.go (61%) diff --git a/pkg/api/plugin_resource_test.go b/pkg/api/plugin_resource_test.go index 5abd7ed97e3..7c990f8a7e7 100644 --- a/pkg/api/plugin_resource_test.go +++ b/pkg/api/plugin_resource_test.go @@ -18,7 +18,6 @@ import ( "github.com/grafana/grafana/pkg/infra/tracing" "github.com/grafana/grafana/pkg/plugins/backendplugin/coreplugin" "github.com/grafana/grafana/pkg/plugins/backendplugin/provider" - "github.com/grafana/grafana/pkg/plugins/config" pluginClient "github.com/grafana/grafana/pkg/plugins/manager/client" "github.com/grafana/grafana/pkg/plugins/manager/fakes" "github.com/grafana/grafana/pkg/plugins/manager/loader" @@ -34,6 +33,7 @@ import ( "github.com/grafana/grafana/pkg/services/featuremgmt" "github.com/grafana/grafana/pkg/services/oauthtoken/oauthtokentest" "github.com/grafana/grafana/pkg/services/pluginsintegration" + "github.com/grafana/grafana/pkg/services/pluginsintegration/config" "github.com/grafana/grafana/pkg/services/pluginsintegration/pluginaccesscontrol" "github.com/grafana/grafana/pkg/services/pluginsintegration/plugincontext" pluginSettings "github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsettings/service" @@ -59,8 +59,7 @@ func TestCallResource(t *testing.T) { coreRegistry := coreplugin.ProvideCoreRegistry(nil, &cloudwatch.CloudWatchService{}, nil, nil, nil, nil, nil, nil, nil, nil, testdatasource.ProvideService(cfg, featuremgmt.WithFeatures()), nil, nil, nil, nil, nil, nil) - var pCfg *config.Cfg - pCfg, err = config.ProvideConfig(setting.ProvideProvider(cfg), cfg) + pCfg, err := config.ProvideConfig(setting.ProvideProvider(cfg), cfg) require.NoError(t, err) reg := registry.ProvideService() l := loader.ProvideService(pCfg, fakes.NewFakeLicensingService(), signature.NewUnsignedAuthorizer(pCfg), diff --git a/pkg/infra/tracing/opentelemetry_tracing.go b/pkg/infra/tracing/opentelemetry_tracing.go index 52e4d0c14f9..8535233b8eb 100644 --- a/pkg/infra/tracing/opentelemetry_tracing.go +++ b/pkg/infra/tracing/opentelemetry_tracing.go @@ -105,6 +105,10 @@ func (ots *Opentelemetry) parseSettingsOpentelemetry() error { return nil } +func (ots *Opentelemetry) OTelExporterEnabled() bool { + return ots.Enabled == otlpExporter +} + func splitCustomAttribs(s string) ([]attribute.KeyValue, error) { res := []attribute.KeyValue{} diff --git a/pkg/plugins/config/config.go b/pkg/plugins/config/config.go index e2797f79e93..c1509453d47 100644 --- a/pkg/plugins/config/config.go +++ b/pkg/plugins/config/config.go @@ -1,9 +1,6 @@ package config import ( - "fmt" - "strings" - "github.com/grafana/grafana-azure-sdk-go/azsettings" "github.com/grafana/grafana/pkg/plugins/log" @@ -33,63 +30,24 @@ type Cfg struct { PluginsCDNURLTemplate string - Opentelemetry OpentelemetryCfg + Tracing Tracing } -func ProvideConfig(settingProvider setting.Provider, grafanaCfg *setting.Cfg) (*Cfg, error) { - return NewCfg(settingProvider, grafanaCfg) -} - -func NewCfg(settingProvider setting.Provider, grafanaCfg *setting.Cfg) (*Cfg, error) { - logger := log.New("plugin.cfg") - - aws := settingProvider.Section("aws") - plugins := settingProvider.Section("plugins") - - allowedUnsigned := grafanaCfg.PluginsAllowUnsigned - if len(plugins.KeyValue("allow_loading_unsigned_plugins").Value()) > 0 { - allowedUnsigned = strings.Split(plugins.KeyValue("allow_loading_unsigned_plugins").Value(), ",") - } - - allowedAuth := grafanaCfg.AWSAllowedAuthProviders - if len(aws.KeyValue("allowed_auth_providers").Value()) > 0 { - allowedUnsigned = strings.Split(settingProvider.KeyValue("plugins", "allow_loading_unsigned_plugins").Value(), ",") - } - - otelCfg, err := NewOpentelemetryCfg(grafanaCfg) - if err != nil { - return nil, fmt.Errorf("new opentelemetry cfg: %w", err) - } +func NewCfg(devMode bool, pluginsPath string, pluginSettings setting.PluginSettings, pluginsAllowUnsigned []string, + awsAllowedAuthProviders []string, awsAssumeRoleEnabled bool, azure *azsettings.AzureSettings, grafanaVersion string, + logDatasourceRequests bool, pluginsCDNURLTemplate string, tracing Tracing) *Cfg { return &Cfg{ - log: logger, - PluginsPath: grafanaCfg.PluginsPath, - BuildVersion: grafanaCfg.BuildVersion, - DevMode: settingProvider.KeyValue("", "app_mode").MustBool(grafanaCfg.Env == setting.Dev), - PluginSettings: extractPluginSettings(settingProvider), - PluginsAllowUnsigned: allowedUnsigned, - AWSAllowedAuthProviders: allowedAuth, - AWSAssumeRoleEnabled: aws.KeyValue("assume_role_enabled").MustBool(grafanaCfg.AWSAssumeRoleEnabled), - Azure: grafanaCfg.Azure, - LogDatasourceRequests: grafanaCfg.PluginLogBackendRequests, - PluginsCDNURLTemplate: grafanaCfg.PluginsCDNURLTemplate, - Opentelemetry: otelCfg, - }, nil -} - -func extractPluginSettings(settingProvider setting.Provider) setting.PluginSettings { - ps := setting.PluginSettings{} - for sectionName, sectionCopy := range settingProvider.Current() { - if !strings.HasPrefix(sectionName, "plugin.") { - continue - } - // Calling Current() returns a redacted version of section. We need to replace the map values with the unredacted values. - section := settingProvider.Section(sectionName) - for k := range sectionCopy { - sectionCopy[k] = section.KeyValue(k).MustString("") - } - pluginID := strings.Replace(sectionName, "plugin.", "", 1) - ps[pluginID] = sectionCopy + log: log.New("plugin.cfg"), + PluginsPath: pluginsPath, + BuildVersion: grafanaVersion, + DevMode: devMode, + PluginSettings: pluginSettings, + PluginsAllowUnsigned: pluginsAllowUnsigned, + AWSAllowedAuthProviders: awsAllowedAuthProviders, + AWSAssumeRoleEnabled: awsAssumeRoleEnabled, + Azure: azure, + LogDatasourceRequests: logDatasourceRequests, + PluginsCDNURLTemplate: pluginsCDNURLTemplate, + Tracing: tracing, } - - return ps } diff --git a/pkg/plugins/config/tracing.go b/pkg/plugins/config/tracing.go index 704ff0b6927..8ea7615d332 100644 --- a/pkg/plugins/config/tracing.go +++ b/pkg/plugins/config/tracing.go @@ -1,38 +1,17 @@ package config -import ( - "fmt" +type Tracing struct { + OpenTelemetry OpenTelemetryCfg +} - "github.com/grafana/grafana/pkg/infra/tracing" - "github.com/grafana/grafana/pkg/setting" -) - -const otlpExporter string = "otlp" - -// OpentelemetryCfg contains the Opentelemetry address and propagation config values. -// This is used to export the Opentelemetry (OTLP) config without exposing the whole *setting.Cfg. -type OpentelemetryCfg struct { +// OpenTelemetryCfg contains the OpenTelemetry address and propagation config values. +// This is used to export the OpenTelemetry (OTLP) config without exposing the whole *setting.Cfg. +type OpenTelemetryCfg struct { Address string Propagation string } // IsEnabled returns true if OTLP tracing is enabled (address set) -func (c OpentelemetryCfg) IsEnabled() bool { - return c.Address != "" -} - -// NewOpentelemetryCfg creates a new OpentelemetryCfg based on the provided Grafana config. -// If Opentelemetry (OTLP) is disabled, a zero-value OpentelemetryCfg is returned. -func NewOpentelemetryCfg(grafanaCfg *setting.Cfg) (OpentelemetryCfg, error) { - ots, err := tracing.ParseSettingsOpentelemetry(grafanaCfg) - if err != nil { - return OpentelemetryCfg{}, fmt.Errorf("parse settings: %w", err) - } - if ots.Enabled != otlpExporter { - return OpentelemetryCfg{}, nil - } - return OpentelemetryCfg{ - Address: ots.Address, - Propagation: ots.Propagation, - }, nil +func (t Tracing) IsEnabled() bool { + return t.OpenTelemetry.Address != "" } diff --git a/pkg/plugins/manager/loader/initializer/initializer.go b/pkg/plugins/manager/loader/initializer/initializer.go index 1b7c8b7c795..39afb5be578 100644 --- a/pkg/plugins/manager/loader/initializer/initializer.go +++ b/pkg/plugins/manager/loader/initializer/initializer.go @@ -70,14 +70,14 @@ func (i *Initializer) envVars(plugin *plugins.Plugin) []string { if v, exists := i.cfg.PluginSettings[plugin.ID]["tracing"]; exists { pluginTracingEnabled = v == "true" } - if i.cfg.Opentelemetry.IsEnabled() && pluginTracingEnabled { + if i.cfg.Tracing.IsEnabled() && pluginTracingEnabled { if plugin.Info.Version != "" { hostEnv = append(hostEnv, fmt.Sprintf("GF_PLUGIN_VERSION=%s", plugin.Info.Version)) } hostEnv = append( hostEnv, - fmt.Sprintf("GF_INSTANCE_OTLP_ADDRESS=%s", i.cfg.Opentelemetry.Address), - fmt.Sprintf("GF_INSTANCE_OTLP_PROPAGATION=%s", i.cfg.Opentelemetry.Propagation), + fmt.Sprintf("GF_INSTANCE_OTLP_ADDRESS=%s", i.cfg.Tracing.OpenTelemetry.Address), + fmt.Sprintf("GF_INSTANCE_OTLP_PROPAGATION=%s", i.cfg.Tracing.OpenTelemetry.Propagation), ) } diff --git a/pkg/plugins/manager/loader/initializer/initializer_test.go b/pkg/plugins/manager/loader/initializer/initializer_test.go index 00f7c80e42a..010998da890 100644 --- a/pkg/plugins/manager/loader/initializer/initializer_test.go +++ b/pkg/plugins/manager/loader/initializer/initializer_test.go @@ -185,7 +185,7 @@ func TestInitializer_tracingEnvironmentVariables(t *testing.T) { JSONData: plugins.JSONData{ID: pluginID}, } - defaultOtelCfg := config.OpentelemetryCfg{ + defaultOTelCfg := config.OpenTelemetryCfg{ Address: "127.0.0.1:4317", Propagation: "", } @@ -250,7 +250,7 @@ func TestInitializer_tracingEnvironmentVariables(t *testing.T) { { name: "otel not configured", cfg: &config.Cfg{ - Opentelemetry: config.OpentelemetryCfg{}, + Tracing: config.Tracing{}, }, plugin: defaultPlugin, exp: expNoTracing, @@ -258,7 +258,7 @@ func TestInitializer_tracingEnvironmentVariables(t *testing.T) { { name: "otel not configured but plugin-tracing enabled", cfg: &config.Cfg{ - Opentelemetry: config.OpentelemetryCfg{}, + Tracing: config.Tracing{}, PluginSettings: map[string]map[string]string{pluginID: {"tracing": "true"}}, }, plugin: defaultPlugin, @@ -267,7 +267,9 @@ func TestInitializer_tracingEnvironmentVariables(t *testing.T) { { name: "otlp no propagation plugin enabled", cfg: &config.Cfg{ - Opentelemetry: defaultOtelCfg, + Tracing: config.Tracing{ + OpenTelemetry: defaultOTelCfg, + }, PluginSettings: map[string]map[string]string{ pluginID: {"tracing": "true"}, }, @@ -278,7 +280,9 @@ func TestInitializer_tracingEnvironmentVariables(t *testing.T) { { name: "otlp no propagation disabled by default", cfg: &config.Cfg{ - Opentelemetry: defaultOtelCfg, + Tracing: config.Tracing{ + OpenTelemetry: defaultOTelCfg, + }, }, plugin: defaultPlugin, exp: expNoTracing, @@ -286,9 +290,11 @@ func TestInitializer_tracingEnvironmentVariables(t *testing.T) { { name: "otlp propagation plugin enabled", cfg: &config.Cfg{ - Opentelemetry: config.OpentelemetryCfg{ - Address: "127.0.0.1:4317", - Propagation: "w3c", + Tracing: config.Tracing{ + OpenTelemetry: config.OpenTelemetryCfg{ + Address: "127.0.0.1:4317", + Propagation: "w3c", + }, }, PluginSettings: map[string]map[string]string{ pluginID: {"tracing": "true"}, @@ -307,9 +313,11 @@ func TestInitializer_tracingEnvironmentVariables(t *testing.T) { { name: "otlp enabled composite propagation", cfg: &config.Cfg{ - Opentelemetry: config.OpentelemetryCfg{ - Address: "127.0.0.1:4317", - Propagation: "w3c,jaeger", + Tracing: config.Tracing{ + OpenTelemetry: config.OpenTelemetryCfg{ + Address: "127.0.0.1:4317", + Propagation: "w3c,jaeger", + }, }, PluginSettings: map[string]map[string]string{ pluginID: {"tracing": "true"}, @@ -328,9 +336,11 @@ func TestInitializer_tracingEnvironmentVariables(t *testing.T) { { name: "otlp no propagation disabled by default", cfg: &config.Cfg{ - Opentelemetry: config.OpentelemetryCfg{ - Address: "127.0.0.1:4317", - Propagation: "w3c", + Tracing: config.Tracing{ + OpenTelemetry: config.OpenTelemetryCfg{ + Address: "127.0.0.1:4317", + Propagation: "w3c", + }, }, }, plugin: defaultPlugin, @@ -339,7 +349,9 @@ func TestInitializer_tracingEnvironmentVariables(t *testing.T) { { name: "disabled on plugin", cfg: &config.Cfg{ - Opentelemetry: defaultOtelCfg, + Tracing: config.Tracing{ + OpenTelemetry: defaultOTelCfg, + }, PluginSettings: setting.PluginSettings{ pluginID: map[string]string{"tracing": "false"}, }, @@ -350,7 +362,9 @@ func TestInitializer_tracingEnvironmentVariables(t *testing.T) { { name: "disabled on plugin with other plugin settings", cfg: &config.Cfg{ - Opentelemetry: defaultOtelCfg, + Tracing: config.Tracing{ + OpenTelemetry: defaultOTelCfg, + }, PluginSettings: map[string]map[string]string{ pluginID: {"some_other_option": "true"}, }, @@ -361,7 +375,9 @@ func TestInitializer_tracingEnvironmentVariables(t *testing.T) { { name: "enabled on plugin with other plugin settings", cfg: &config.Cfg{ - Opentelemetry: defaultOtelCfg, + Tracing: config.Tracing{ + OpenTelemetry: defaultOTelCfg, + }, PluginSettings: map[string]map[string]string{ pluginID: {"some_other_option": "true", "tracing": "true"}, }, @@ -372,7 +388,9 @@ func TestInitializer_tracingEnvironmentVariables(t *testing.T) { { name: "GF_PLUGIN_VERSION is not present if tracing is disabled", cfg: &config.Cfg{ - Opentelemetry: config.OpentelemetryCfg{}, // no OTEL config + Tracing: config.Tracing{ + OpenTelemetry: config.OpenTelemetryCfg{}, + }, PluginSettings: map[string]map[string]string{pluginID: {"tracing": "true"}}, }, plugin: defaultPlugin, @@ -381,7 +399,9 @@ func TestInitializer_tracingEnvironmentVariables(t *testing.T) { { name: "GF_PLUGIN_VERSION is present if tracing is enabled and plugin has version", cfg: &config.Cfg{ - Opentelemetry: defaultOtelCfg, + Tracing: config.Tracing{ + OpenTelemetry: defaultOTelCfg, + }, PluginSettings: map[string]map[string]string{pluginID: {"tracing": "true"}}, }, plugin: defaultPlugin, @@ -390,7 +410,9 @@ func TestInitializer_tracingEnvironmentVariables(t *testing.T) { { name: "GF_PLUGIN_VERSION is not present if tracing is enabled but plugin doesn't have a version", cfg: &config.Cfg{ - Opentelemetry: config.OpentelemetryCfg{}, + Tracing: config.Tracing{ + OpenTelemetry: config.OpenTelemetryCfg{}, + }, PluginSettings: map[string]map[string]string{pluginID: {"tracing": "true"}}, }, plugin: pluginWithoutVersion, diff --git a/pkg/plugins/manager/manager_integration_test.go b/pkg/plugins/manager/manager_integration_test.go index 2b987205375..56899d80ec4 100644 --- a/pkg/plugins/manager/manager_integration_test.go +++ b/pkg/plugins/manager/manager_integration_test.go @@ -18,7 +18,6 @@ import ( "github.com/grafana/grafana/pkg/plugins" "github.com/grafana/grafana/pkg/plugins/backendplugin/coreplugin" "github.com/grafana/grafana/pkg/plugins/backendplugin/provider" - "github.com/grafana/grafana/pkg/plugins/config" "github.com/grafana/grafana/pkg/plugins/manager/client" "github.com/grafana/grafana/pkg/plugins/manager/fakes" "github.com/grafana/grafana/pkg/plugins/manager/loader" @@ -31,6 +30,7 @@ import ( "github.com/grafana/grafana/pkg/plugins/pluginscdn" "github.com/grafana/grafana/pkg/services/featuremgmt" "github.com/grafana/grafana/pkg/services/licensing" + "github.com/grafana/grafana/pkg/services/pluginsintegration/config" plicensing "github.com/grafana/grafana/pkg/services/pluginsintegration/licensing" "github.com/grafana/grafana/pkg/services/searchV2" "github.com/grafana/grafana/pkg/setting" diff --git a/pkg/services/pluginsintegration/config/config.go b/pkg/services/pluginsintegration/config/config.go new file mode 100644 index 00000000000..24d1e5c2f03 --- /dev/null +++ b/pkg/services/pluginsintegration/config/config.go @@ -0,0 +1,59 @@ +package config + +import ( + "fmt" + "strings" + + pCfg "github.com/grafana/grafana/pkg/plugins/config" + "github.com/grafana/grafana/pkg/setting" +) + +func ProvideConfig(settingProvider setting.Provider, grafanaCfg *setting.Cfg) (*pCfg.Cfg, error) { + plugins := settingProvider.Section("plugins") + allowedUnsigned := grafanaCfg.PluginsAllowUnsigned + if len(plugins.KeyValue("allow_loading_unsigned_plugins").Value()) > 0 { + allowedUnsigned = strings.Split(plugins.KeyValue("allow_loading_unsigned_plugins").Value(), ",") + } + + aws := settingProvider.Section("aws") + allowedAuth := grafanaCfg.AWSAllowedAuthProviders + if len(aws.KeyValue("allowed_auth_providers").Value()) > 0 { + allowedUnsigned = strings.Split(settingProvider.KeyValue("plugins", "allow_loading_unsigned_plugins").Value(), ",") + } + + tracingCfg, err := newTracingCfg(grafanaCfg) + if err != nil { + return nil, fmt.Errorf("new opentelemetry cfg: %w", err) + } + return pCfg.NewCfg( + settingProvider.KeyValue("", "app_mode").MustBool(grafanaCfg.Env == setting.Dev), + grafanaCfg.PluginsPath, + extractPluginSettings(settingProvider), + allowedUnsigned, + allowedAuth, + aws.KeyValue("assume_role_enabled").MustBool(grafanaCfg.AWSAssumeRoleEnabled), + grafanaCfg.Azure, + grafanaCfg.BuildVersion, + grafanaCfg.PluginLogBackendRequests, + grafanaCfg.PluginsCDNURLTemplate, + tracingCfg, + ), nil +} + +func extractPluginSettings(settingProvider setting.Provider) setting.PluginSettings { + ps := setting.PluginSettings{} + for sectionName, sectionCopy := range settingProvider.Current() { + if !strings.HasPrefix(sectionName, "plugin.") { + continue + } + // Calling Current() returns a redacted version of section. We need to replace the map values with the unredacted values. + section := settingProvider.Section(sectionName) + for k := range sectionCopy { + sectionCopy[k] = section.KeyValue(k).MustString("") + } + pluginID := strings.Replace(sectionName, "plugin.", "", 1) + ps[pluginID] = sectionCopy + } + + return ps +} diff --git a/pkg/plugins/config/config_test.go b/pkg/services/pluginsintegration/config/config_test.go similarity index 100% rename from pkg/plugins/config/config_test.go rename to pkg/services/pluginsintegration/config/config_test.go diff --git a/pkg/services/pluginsintegration/config/tracing.go b/pkg/services/pluginsintegration/config/tracing.go new file mode 100644 index 00000000000..1f5ad963a83 --- /dev/null +++ b/pkg/services/pluginsintegration/config/tracing.go @@ -0,0 +1,27 @@ +package config + +import ( + "fmt" + + "github.com/grafana/grafana/pkg/infra/tracing" + pCfg "github.com/grafana/grafana/pkg/plugins/config" + "github.com/grafana/grafana/pkg/setting" +) + +// newTracingCfg creates a plugins tracing configuration based on the provided Grafana tracing config. +// If OpenTelemetry (OTLP) is disabled, a zero-value OpenTelemetryCfg is returned. +func newTracingCfg(grafanaCfg *setting.Cfg) (pCfg.Tracing, error) { + ots, err := tracing.ParseSettingsOpentelemetry(grafanaCfg) + if err != nil { + return pCfg.Tracing{}, fmt.Errorf("parse settings: %w", err) + } + if !ots.OTelExporterEnabled() { + return pCfg.Tracing{}, nil + } + return pCfg.Tracing{ + OpenTelemetry: pCfg.OpenTelemetryCfg{ + Address: ots.Address, + Propagation: ots.Propagation, + }, + }, nil +} diff --git a/pkg/plugins/config/tracing_test.go b/pkg/services/pluginsintegration/config/tracing_test.go similarity index 61% rename from pkg/plugins/config/tracing_test.go rename to pkg/services/pluginsintegration/config/tracing_test.go index cc24b7162a7..6f5367da02c 100644 --- a/pkg/plugins/config/tracing_test.go +++ b/pkg/services/pluginsintegration/config/tracing_test.go @@ -8,15 +8,15 @@ import ( "github.com/stretchr/testify/require" ) -func TestNewOpentelemetryCfg(t *testing.T) { +func TestNewTracingCfg(t *testing.T) { t.Run("empty", func(t *testing.T) { cfg := setting.NewCfg() - otelCfg, err := NewOpentelemetryCfg(cfg) + tracingCfg, err := newTracingCfg(cfg) require.NoError(t, err) - assert.False(t, otelCfg.IsEnabled(), "otel should be disabled") - assert.Empty(t, otelCfg.Address) - assert.Empty(t, otelCfg.Propagation) + assert.False(t, tracingCfg.IsEnabled(), "tracing should be disabled") + assert.Empty(t, tracingCfg.OpenTelemetry.Address) + assert.Empty(t, tracingCfg.OpenTelemetry.Propagation) }) t.Run("enabled", func(t *testing.T) { @@ -39,11 +39,11 @@ func TestNewOpentelemetryCfg(t *testing.T) { otlpSect.Key("propagation").SetValue(tc.propagation) } - otelCfg, err := NewOpentelemetryCfg(cfg) + tracingCfg, err := newTracingCfg(cfg) require.NoError(t, err) - assert.True(t, otelCfg.IsEnabled(), "otel should be enabled") - assert.Equal(t, address, otelCfg.Address) - assert.Equal(t, tc.propagation, otelCfg.Propagation) + assert.True(t, tracingCfg.IsEnabled(), "tracing should be enabled") + assert.Equal(t, address, tracingCfg.OpenTelemetry.Address) + assert.Equal(t, tc.propagation, tracingCfg.OpenTelemetry.Propagation) }) } }) diff --git a/pkg/services/pluginsintegration/pluginsintegration.go b/pkg/services/pluginsintegration/pluginsintegration.go index 535c5e41913..1434b9a2dbb 100644 --- a/pkg/services/pluginsintegration/pluginsintegration.go +++ b/pkg/services/pluginsintegration/pluginsintegration.go @@ -7,7 +7,7 @@ import ( "github.com/grafana/grafana/pkg/plugins" "github.com/grafana/grafana/pkg/plugins/backendplugin/coreplugin" "github.com/grafana/grafana/pkg/plugins/backendplugin/provider" - "github.com/grafana/grafana/pkg/plugins/config" + pCfg "github.com/grafana/grafana/pkg/plugins/config" "github.com/grafana/grafana/pkg/plugins/manager" "github.com/grafana/grafana/pkg/plugins/manager/client" "github.com/grafana/grafana/pkg/plugins/manager/filestore" @@ -23,6 +23,7 @@ import ( "github.com/grafana/grafana/pkg/plugins/repo" "github.com/grafana/grafana/pkg/services/oauthtoken" "github.com/grafana/grafana/pkg/services/pluginsintegration/clientmiddleware" + "github.com/grafana/grafana/pkg/services/pluginsintegration/config" "github.com/grafana/grafana/pkg/services/pluginsintegration/licensing" "github.com/grafana/grafana/pkg/services/pluginsintegration/plugincontext" "github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsettings" @@ -76,14 +77,14 @@ var WireExtensionSet = wire.NewSet( finder.NewLocalFinder, ) -func ProvideClientDecorator(cfg *setting.Cfg, pCfg *config.Cfg, +func ProvideClientDecorator(cfg *setting.Cfg, pCfg *pCfg.Cfg, pluginRegistry registry.Service, oAuthTokenService oauthtoken.OAuthTokenService, tracer tracing.Tracer) (*client.Decorator, error) { return NewClientDecorator(cfg, pCfg, pluginRegistry, oAuthTokenService, tracer) } -func NewClientDecorator(cfg *setting.Cfg, pCfg *config.Cfg, +func NewClientDecorator(cfg *setting.Cfg, pCfg *pCfg.Cfg, pluginRegistry registry.Service, oAuthTokenService oauthtoken.OAuthTokenService, tracer tracing.Tracer) (*client.Decorator, error) { From 65deff49b4f9d661f1155219d29e84837644b813 Mon Sep 17 00:00:00 2001 From: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> Date: Wed, 5 Apr 2023 14:43:19 +0200 Subject: [PATCH 41/80] Devenv: Create new Elasticsearch dashboards for data in data source (#65930) * Devenv: Create new Elasticsearch dashboards for data in data source * Update dashboards * Fix name in es migration * Fix tresholds from null to 0 --- devenv/datasources.yaml | 1 + .../elasticsearch_compare.json | 10995 ---------------- .../elasticsearch_complex.json | 5300 ++++++++ .../elasticsearch_migration.json | 10352 +++++++++++++++ .../elasticsearch_simple.json | 1128 ++ .../elasticsearch_v7.json | 736 -- .../elasticsearch_v7_filebeat.json | 241 - devenv/docker/blocks/elastic/data/data.js | 16 + devenv/jsonnet/dev-dashboards.libsonnet | 6 +- 9 files changed, 16800 insertions(+), 11975 deletions(-) delete mode 100644 devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_compare.json create mode 100644 devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_complex.json create mode 100644 devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_migration.json create mode 100644 devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_simple.json delete mode 100644 devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_v7.json delete mode 100644 devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_v7_filebeat.json diff --git a/devenv/datasources.yaml b/devenv/datasources.yaml index 4be1fe4b35f..9f2fad5e059 100644 --- a/devenv/datasources.yaml +++ b/devenv/datasources.yaml @@ -124,6 +124,7 @@ datasources: - name: gdev-elasticsearch type: elasticsearch + uid: gdev-elasticsearch access: proxy database: "[logs-]YYYY.MM.DD" url: http://localhost:9200 diff --git a/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_compare.json b/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_compare.json deleted file mode 100644 index 2ab0785563b..00000000000 --- a/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_compare.json +++ /dev/null @@ -1,10995 +0,0 @@ -{ - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": "-- Grafana --", - "enable": false, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "limit": 100, - "name": "Annotations & Alerts", - "showIn": 0, - "type": "dashboard" - } - ] - }, - "editable": true, - "graphTooltip": 0, - "iteration": 1620904436360, - "links": [ - { - "asDropdown": true, - "icon": "external link", - "tags": [ - "gdev", - "elasticsearch", - "datasource-test" - ], - "title": "Dashboards", - "type": "dashboards" - } - ], - "panels": [ - { - "collapsed": true, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 0 - }, - "id": 5, - "panels": [ - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 1 - }, - "hiddenSeries": false, - "id": 2, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "select field", - "id": "1", - "type": "count" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Basic (version one) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 1 - }, - "hiddenSeries": false, - "id": 3, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "select field", - "id": "1", - "type": "count" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Basic (version two) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 10 - }, - "hiddenSeries": false, - "id": 8, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "1m", - "min_doc_count": 50 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "select field", - "id": "1", - "type": "count" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Basic (version one) - interval 1m + min doc count 50", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 10 - }, - "hiddenSeries": false, - "id": 9, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "1m", - "min_doc_count": 50 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "select field", - "id": "1", - "type": "count" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Basic (version two) - interval 1m + min doc count 50", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 19 - }, - "hiddenSeries": false, - "id": 6, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 10 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "select field", - "id": "1", - "type": "count" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Basic (version one) - interval 5m + trim edges=10", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 19 - }, - "hiddenSeries": false, - "id": 7, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 10 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "select field", - "id": "1", - "type": "count" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Basic (version two) - interval 5m + trim edges=10", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - } - ], - "title": "Basic date histogram with count", - "type": "row" - }, - { - "collapsed": true, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 1 - }, - "id": 11, - "panels": [ - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 2 - }, - "hiddenSeries": false, - "id": 12, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": {}, - "settings": {}, - "type": "avg" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "avg (version one) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 2 - }, - "hiddenSeries": false, - "id": 13, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": {}, - "settings": {}, - "type": "avg" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "avg (version two) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 11 - }, - "hiddenSeries": false, - "id": 14, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": {}, - "settings": {}, - "type": "sum" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "sum (version one) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 11 - }, - "hiddenSeries": false, - "id": 15, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": {}, - "settings": {}, - "type": "sum" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "sum (version two) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "decimals": 3, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 20 - }, - "hiddenSeries": false, - "id": 16, - "legend": { - "alignAsTable": true, - "avg": true, - "current": true, - "max": true, - "min": true, - "show": true, - "total": true, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": {}, - "settings": {}, - "type": "max" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "max (version one) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "decimals": 3, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 20 - }, - "hiddenSeries": false, - "id": 21, - "legend": { - "alignAsTable": true, - "avg": true, - "current": true, - "max": true, - "min": true, - "show": true, - "total": true, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": {}, - "settings": {}, - "type": "max" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "max (version two) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "decimals": 3, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 29 - }, - "hiddenSeries": false, - "id": 17, - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "show": true, - "total": true, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": {}, - "settings": {}, - "type": "min" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "min (version one) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "decimals": 3, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 29 - }, - "hiddenSeries": false, - "id": 22, - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "show": true, - "total": true, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": {}, - "settings": {}, - "type": "min" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "min (version two) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "decimals": 3, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 38 - }, - "hiddenSeries": false, - "id": 18, - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "rightSide": true, - "show": true, - "sort": "min", - "sortDesc": true, - "total": true, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "avg": true, - "count": true, - "max": true, - "min": true, - "std_deviation": true, - "std_deviation_bounds_lower": true, - "std_deviation_bounds_upper": true, - "sum": true - }, - "settings": {}, - "type": "extended_stats" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "extended stats (version one) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "decimals": 3, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 38 - }, - "hiddenSeries": false, - "id": 23, - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "rightSide": true, - "show": true, - "sort": "min", - "sortDesc": true, - "total": true, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "avg": true, - "count": true, - "max": true, - "min": true, - "std_deviation": true, - "std_deviation_bounds_lower": true, - "std_deviation_bounds_upper": true, - "sum": true - }, - "settings": {}, - "type": "extended_stats" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "extended stats (version two) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "decimals": 3, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 47 - }, - "hiddenSeries": false, - "id": 19, - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "rightSide": true, - "show": true, - "total": true, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": {}, - "settings": { - "percents": [ - 25, - 50, - 75, - 95, - 99 - ] - }, - "type": "percentiles" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "percentiles (version one) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "decimals": 3, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 47 - }, - "hiddenSeries": false, - "id": 24, - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "rightSide": true, - "show": true, - "total": true, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": {}, - "settings": { - "percents": [ - 25, - 50, - 75, - 95, - 99 - ] - }, - "type": "percentiles" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "percentiles (version two) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "decimals": 3, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 56 - }, - "hiddenSeries": false, - "id": 20, - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "rightSide": false, - "show": true, - "total": true, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": {}, - "settings": {}, - "type": "cardinality" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "unique count (version one) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "decimals": 3, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 56 - }, - "hiddenSeries": false, - "id": 25, - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": true, - "min": true, - "rightSide": false, - "show": true, - "total": true, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": {}, - "settings": {}, - "type": "cardinality" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "unique count (version two) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - } - ], - "title": "Basic date histogram with metric aggregation", - "type": "row" - }, - { - "collapsed": true, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 2 - }, - "id": 27, - "panels": [ - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 3 - }, - "hiddenSeries": false, - "id": 55, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "count" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": { - "minimize": false, - "model": "simple", - "window": 5 - }, - "type": "moving_avg" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "count (version one) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 3 - }, - "hiddenSeries": false, - "id": 34, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "count" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": { - "minimize": false, - "model": "simple", - "window": 5 - }, - "type": "moving_avg" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "count (version two) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 12 - }, - "hiddenSeries": false, - "id": 29, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "avg" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": { - "minimize": false, - "model": "simple", - "window": 5 - }, - "type": "moving_avg" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "avg (version one) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 12 - }, - "hiddenSeries": false, - "id": 56, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "avg" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": { - "minimize": false, - "model": "simple", - "window": 5 - }, - "type": "moving_avg" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "avg (version two) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 21 - }, - "hiddenSeries": false, - "id": 30, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "sum" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": { - "minimize": false, - "model": "simple", - "window": 5 - }, - "type": "moving_avg" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "sum (version one) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 21 - }, - "hiddenSeries": false, - "id": 35, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "sum" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": { - "minimize": false, - "model": "simple", - "window": 5 - }, - "type": "moving_avg" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "sum (version two) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 30 - }, - "hiddenSeries": false, - "id": 31, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "max" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": { - "minimize": false, - "model": "simple", - "window": 5 - }, - "type": "moving_avg" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "max (version one) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 30 - }, - "hiddenSeries": false, - "id": 36, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "max" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": { - "minimize": false, - "model": "simple", - "window": 5 - }, - "type": "moving_avg" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "max (version two) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 39 - }, - "hiddenSeries": false, - "id": 32, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "min" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": { - "minimize": false, - "model": "simple", - "window": 5 - }, - "type": "moving_avg" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "min (version one) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 39 - }, - "hiddenSeries": false, - "id": 37, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "min" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": { - "minimize": false, - "model": "simple", - "window": 5 - }, - "type": "moving_avg" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "min (version two) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 48 - }, - "hiddenSeries": false, - "id": 33, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "cardinality" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": { - "minimize": false, - "model": "simple", - "window": 5 - }, - "type": "moving_avg" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "unique count (version one) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 48 - }, - "hiddenSeries": false, - "id": 38, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "cardinality" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": { - "minimize": false, - "model": "simple", - "window": 5 - }, - "type": "moving_avg" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "unique count (version two) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - } - ], - "title": "Basic date histogram with moving average aggregation", - "type": "row" - }, - { - "collapsed": true, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 3 - }, - "id": 39, - "panels": [ - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 4 - }, - "hiddenSeries": false, - "id": 57, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "count" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "derivative" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "count (version one) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 4 - }, - "hiddenSeries": false, - "id": 41, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "count" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "derivative" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "count (version two) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 13 - }, - "hiddenSeries": false, - "id": 40, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "avg" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "derivative" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "avg (version one) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 13 - }, - "hiddenSeries": false, - "id": 58, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "avg" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "derivative" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "avg (version two) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 22 - }, - "hiddenSeries": false, - "id": 42, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "sum" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "derivative" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "sum (version one) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 22 - }, - "hiddenSeries": false, - "id": 43, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "sum" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "derivative" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "sum (version two) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 31 - }, - "hiddenSeries": false, - "id": 44, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "max" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "derivative" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "max (version one) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 31 - }, - "hiddenSeries": false, - "id": 45, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "max" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "derivative" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "max (version two) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 40 - }, - "hiddenSeries": false, - "id": 46, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "min" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "derivative" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "min (version one) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 40 - }, - "hiddenSeries": false, - "id": 47, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "min" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "derivative" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "min (version two) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 49 - }, - "hiddenSeries": false, - "id": 48, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "cardinality" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "derivative" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "unique count (version one) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 49 - }, - "hiddenSeries": false, - "id": 49, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "cardinality" - }, - { - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "derivative" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "unique count (version two) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - } - ], - "title": "Basic date histogram with derivative aggregation", - "type": "row" - }, - { - "collapsed": true, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 4 - }, - "id": 70, - "panels": [ - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 5 - }, - "hiddenSeries": false, - "id": 71, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "$$hashKey": "object:344", - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "$$hashKey": "object:340", - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "count" - }, - { - "$$hashKey": "object:341", - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "cumulative_sum" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "count (version one) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 5 - }, - "hiddenSeries": false, - "id": 77, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "$$hashKey": "object:344", - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "$$hashKey": "object:340", - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "count" - }, - { - "$$hashKey": "object:341", - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "cumulative_sum" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "count (version two) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 14 - }, - "hiddenSeries": false, - "id": 72, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "$$hashKey": "object:546", - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "$$hashKey": "object:542", - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "avg" - }, - { - "$$hashKey": "object:543", - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "cumulative_sum" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "avg (version one) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 14 - }, - "hiddenSeries": false, - "id": 78, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "$$hashKey": "object:546", - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "$$hashKey": "object:542", - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "avg" - }, - { - "$$hashKey": "object:543", - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "cumulative_sum" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "avg (version two) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 23 - }, - "hiddenSeries": false, - "id": 73, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "$$hashKey": "object:731", - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "$$hashKey": "object:727", - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "sum" - }, - { - "$$hashKey": "object:728", - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "cumulative_sum" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "sum (version one) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 23 - }, - "hiddenSeries": false, - "id": 79, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "$$hashKey": "object:731", - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "$$hashKey": "object:727", - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "sum" - }, - { - "$$hashKey": "object:728", - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "cumulative_sum" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "sum (version two) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 32 - }, - "hiddenSeries": false, - "id": 74, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "$$hashKey": "object:885", - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "$$hashKey": "object:881", - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "max" - }, - { - "$$hashKey": "object:882", - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "cumulative_sum" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "max (version one) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 32 - }, - "hiddenSeries": false, - "id": 80, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "$$hashKey": "object:885", - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "$$hashKey": "object:881", - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "max" - }, - { - "$$hashKey": "object:882", - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "cumulative_sum" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "max (version two) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 41 - }, - "hiddenSeries": false, - "id": 75, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "$$hashKey": "object:1039", - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "$$hashKey": "object:1035", - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "min" - }, - { - "$$hashKey": "object:1036", - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "cumulative_sum" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "min (version one) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 41 - }, - "hiddenSeries": false, - "id": 81, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "$$hashKey": "object:1039", - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "$$hashKey": "object:1035", - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "min" - }, - { - "$$hashKey": "object:1036", - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "cumulative_sum" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "min (version two) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 50 - }, - "hiddenSeries": false, - "id": 76, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "$$hashKey": "object:1193", - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "$$hashKey": "object:1189", - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "cardinality" - }, - { - "$$hashKey": "object:1190", - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "cumulative_sum" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "unique count (version one) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {}, - "links": [] - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 50 - }, - "hiddenSeries": false, - "id": 82, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "$$hashKey": "object:1193", - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "$$hashKey": "object:1189", - "field": "@value", - "hide": true, - "id": "1", - "meta": {}, - "settings": {}, - "type": "cardinality" - }, - { - "$$hashKey": "object:1190", - "field": "1", - "id": "3", - "meta": {}, - "pipelineAgg": "1", - "settings": {}, - "type": "cumulative_sum" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "unique count (version two) - interval 5m", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - } - ], - "title": "Basic date histogram with cumulative sum aggregation", - "type": "row" - }, - { - "collapsed": true, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 5 - }, - "id": 60, - "panels": [ - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 6 - }, - "hiddenSeries": false, - "id": 63, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "select field", - "hide": true, - "id": "1", - "type": "count" - }, - { - "field": "select field", - "id": "3", - "meta": {}, - "pipelineVariables": [ - { - "name": "var1", - "pipelineAgg": "1" - } - ], - "settings": { - "script": "params.var1 * 1000" - }, - "type": "bucket_script" - } - ], - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "count * 1000 (version one) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 6 - }, - "hiddenSeries": false, - "id": 64, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "select field", - "hide": true, - "id": "1", - "type": "count" - }, - { - "field": "select field", - "id": "3", - "meta": {}, - "pipelineVariables": [ - { - "name": "var1", - "pipelineAgg": "1" - } - ], - "settings": { - "script": "params.var1 * 1000" - }, - "type": "bucket_script" - } - ], - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "count * 1000 (version two) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 14 - }, - "hiddenSeries": false, - "id": 65, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "select field", - "hide": true, - "id": "1", - "type": "count" - }, - { - "field": "@value", - "hide": true, - "id": "3", - "meta": {}, - "settings": {}, - "type": "avg" - }, - { - "field": "select field", - "id": "4", - "meta": {}, - "pipelineVariables": [ - { - "name": "var1", - "pipelineAgg": "1" - }, - { - "name": "var2", - "pipelineAgg": "3" - } - ], - "settings": { - "script": "params.var1 * params.var2" - }, - "type": "bucket_script" - } - ], - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "count * avg (version one) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 14 - }, - "hiddenSeries": false, - "id": 66, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "select field", - "hide": true, - "id": "1", - "type": "count" - }, - { - "field": "@value", - "hide": true, - "id": "3", - "meta": {}, - "settings": {}, - "type": "avg" - }, - { - "field": "select field", - "id": "4", - "meta": {}, - "pipelineVariables": [ - { - "name": "var1", - "pipelineAgg": "1" - }, - { - "name": "var2", - "pipelineAgg": "3" - } - ], - "settings": { - "script": "params.var1 * params.var2" - }, - "type": "bucket_script" - } - ], - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "count * avg (version two) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - } - ], - "title": "Basic date histogram with bucket script aggregation", - "type": "row" - }, - { - "collapsed": true, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 6 - }, - "id": 54, - "panels": [ - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_one" - }, - "decimals": 3, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 7 - }, - "hiddenSeries": false, - "id": 51, - "legend": { - "alignAsTable": true, - "avg": true, - "current": true, - "max": true, - "min": true, - "rightSide": true, - "show": true, - "sort": "min", - "sortDesc": true, - "total": true, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": true, - "steppedLine": false, - "targets": [ - { - "alias": "{{@source}} - {{@hostname}} - {{@metric}} {{metric}}", - "bucketAggs": [ - { - "fake": true, - "field": "@source", - "id": "4", - "settings": { - "min_doc_count": 1, - "order": "desc", - "orderBy": "_count", - "size": "10" - }, - "type": "terms" - }, - { - "fake": true, - "field": "@metric", - "id": "5", - "settings": { - "min_doc_count": 1, - "order": "desc", - "orderBy": "_term", - "size": "10" - }, - "type": "terms" - }, - { - "fake": true, - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": 1, - "order": "desc", - "orderBy": "_term", - "size": "5" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "select field", - "id": "1", - "type": "count" - }, - { - "field": "@value", - "id": "6", - "meta": {}, - "settings": {}, - "type": "avg" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "count/average with triple terms agg (version one) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "$version_two" - }, - "decimals": 3, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 7 - }, - "hiddenSeries": false, - "id": 52, - "legend": { - "alignAsTable": true, - "avg": true, - "current": true, - "max": true, - "min": true, - "rightSide": true, - "show": true, - "sort": "min", - "sortDesc": true, - "total": true, - "values": true - }, - "lines": true, - "linewidth": 1, - "links": [], - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "paceLength": 10, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": true, - "steppedLine": false, - "targets": [ - { - "alias": "{{@source}} - {{@hostname}} - {{@metric}} {{metric}}", - "bucketAggs": [ - { - "fake": true, - "field": "@source", - "id": "4", - "settings": { - "min_doc_count": 1, - "order": "desc", - "orderBy": "_count", - "size": "10" - }, - "type": "terms" - }, - { - "fake": true, - "field": "@metric", - "id": "5", - "settings": { - "min_doc_count": 1, - "order": "desc", - "orderBy": "_term", - "size": "10" - }, - "type": "terms" - }, - { - "fake": true, - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": 1, - "order": "desc", - "orderBy": "_term", - "size": "5" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "select field", - "id": "1", - "type": "count" - }, - { - "field": "@value", - "id": "6", - "meta": {}, - "settings": {}, - "type": "avg" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "count/average with triple terms agg (version two) - interval auto", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - } - ], - "title": "Multiple metrics and aggregations", - "type": "row" - }, - { - "collapsed": true, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 7 - }, - "id": 103, - "panels": [ - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_one}" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 8 - }, - "hiddenSeries": false, - "id": 104, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "desc", - "orderBy": "_count", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "id": "1", - "type": "count" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by Doc Count", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_two}" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 8 - }, - "hiddenSeries": false, - "id": 107, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "desc", - "orderBy": "_count", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "id": "1", - "type": "count" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by Doc Count", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_one}" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 16 - }, - "hiddenSeries": false, - "id": 116, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "desc", - "orderBy": "_term", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "id": "1", - "type": "count" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by Term value", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_two}" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 16 - }, - "hiddenSeries": false, - "id": 117, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "desc", - "orderBy": "_term", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "id": "1", - "type": "count" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by Term value", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_one}" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 24 - }, - "hiddenSeries": false, - "id": 105, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "desc", - "orderBy": "1", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "type": "avg" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by avg", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_two}" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 24 - }, - "hiddenSeries": false, - "id": 108, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "desc", - "orderBy": "1", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "type": "avg" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by avg", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_one}" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 32 - }, - "hiddenSeries": false, - "id": 106, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "desc", - "orderBy": "1", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "type": "cardinality" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by unique count", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_two}" - }, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 32 - }, - "hiddenSeries": false, - "id": 109, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.4.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "desc", - "orderBy": "1", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "type": "cardinality" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by unique count", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - } - ], - "title": "Terms order by simple aggregation", - "type": "row" - }, - { - "collapsed": true, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 8 - }, - "id": 84, - "panels": [ - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_one}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 9 - }, - "hiddenSeries": false, - "id": 86, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "desc", - "orderBy": "1[avg]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "avg": true, - "count": false, - "max": false, - "min": false, - "std_deviation": false, - "std_deviation_bounds_lower": false, - "std_deviation_bounds_upper": false, - "sum": false - }, - "type": "extended_stats" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by extended stats (avg)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_two}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 9 - }, - "hiddenSeries": false, - "id": 94, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "desc", - "orderBy": "1[avg]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "avg": true, - "count": false, - "max": false, - "min": false, - "std_deviation": false, - "std_deviation_bounds_lower": false, - "std_deviation_bounds_upper": false, - "sum": false - }, - "type": "extended_stats" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by extended stats (avg)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_one}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 17 - }, - "hiddenSeries": false, - "id": 87, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "desc", - "orderBy": "1[min]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "avg": false, - "count": false, - "max": false, - "min": true, - "std_deviation": false, - "std_deviation_bounds_lower": false, - "std_deviation_bounds_upper": false, - "sum": false - }, - "type": "extended_stats" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by extended stats (min)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_two}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 17 - }, - "hiddenSeries": false, - "id": 95, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "desc", - "orderBy": "1[min]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "avg": false, - "count": false, - "max": false, - "min": true, - "std_deviation": false, - "std_deviation_bounds_lower": false, - "std_deviation_bounds_upper": false, - "sum": false - }, - "type": "extended_stats" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by extended stats (min)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_one}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 25 - }, - "hiddenSeries": false, - "id": 88, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "desc", - "orderBy": "1[max]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "avg": false, - "count": false, - "max": true, - "min": false, - "std_deviation": false, - "std_deviation_bounds_lower": false, - "std_deviation_bounds_upper": false, - "sum": false - }, - "type": "extended_stats" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by extended stats (max)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_two}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 25 - }, - "hiddenSeries": false, - "id": 96, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "desc", - "orderBy": "1[max]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "avg": false, - "count": false, - "max": true, - "min": false, - "std_deviation": false, - "std_deviation_bounds_lower": false, - "std_deviation_bounds_upper": false, - "sum": false - }, - "type": "extended_stats" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by extended stats (max)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_one}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 33 - }, - "hiddenSeries": false, - "id": 89, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "desc", - "orderBy": "1[sum]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "avg": false, - "count": false, - "max": false, - "min": false, - "std_deviation": false, - "std_deviation_bounds_lower": false, - "std_deviation_bounds_upper": false, - "sum": true - }, - "type": "extended_stats" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by extended stats (sum)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_two}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 33 - }, - "hiddenSeries": false, - "id": 97, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "desc", - "orderBy": "1[sum]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "avg": false, - "count": false, - "max": false, - "min": false, - "std_deviation": false, - "std_deviation_bounds_lower": false, - "std_deviation_bounds_upper": false, - "sum": true - }, - "type": "extended_stats" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by extended stats (sum)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_one}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 41 - }, - "hiddenSeries": false, - "id": 90, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "asc", - "orderBy": "1[count]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "avg": false, - "count": true, - "max": false, - "min": false, - "std_deviation": false, - "std_deviation_bounds_lower": false, - "std_deviation_bounds_upper": false, - "sum": false - }, - "type": "extended_stats" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by extended stats (count)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_two}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 41 - }, - "hiddenSeries": false, - "id": 98, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "asc", - "orderBy": "1[count]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "avg": false, - "count": true, - "max": false, - "min": false, - "std_deviation": false, - "std_deviation_bounds_lower": false, - "std_deviation_bounds_upper": false, - "sum": false - }, - "type": "extended_stats" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by extended stats (count)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_one}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 49 - }, - "hiddenSeries": false, - "id": 91, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "asc", - "orderBy": "1[std_deviation]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "avg": false, - "count": false, - "max": false, - "min": false, - "std_deviation": true, - "std_deviation_bounds_lower": false, - "std_deviation_bounds_upper": false, - "sum": false - }, - "type": "extended_stats" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by extended stats (std dev)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_two}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 49 - }, - "hiddenSeries": false, - "id": 99, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "asc", - "orderBy": "1[std_deviation]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "avg": false, - "count": false, - "max": false, - "min": false, - "std_deviation": true, - "std_deviation_bounds_lower": false, - "std_deviation_bounds_upper": false, - "sum": false - }, - "type": "extended_stats" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by extended stats (std dev)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_one}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 57 - }, - "hiddenSeries": false, - "id": 92, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "asc", - "orderBy": "1[std_upper]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "avg": false, - "count": false, - "max": false, - "min": false, - "std_deviation": false, - "std_deviation_bounds_lower": false, - "std_deviation_bounds_upper": true, - "sum": false - }, - "type": "extended_stats" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by extended stats (std dev upper)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_two}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 57 - }, - "hiddenSeries": false, - "id": 100, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "asc", - "orderBy": "1[std_upper]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "avg": false, - "count": false, - "max": false, - "min": false, - "std_deviation": false, - "std_deviation_bounds_lower": false, - "std_deviation_bounds_upper": true, - "sum": false - }, - "type": "extended_stats" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by extended stats (std dev upper)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_one}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 65 - }, - "hiddenSeries": false, - "id": 93, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "asc", - "orderBy": "1[std_lower]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "avg": false, - "count": false, - "max": false, - "min": false, - "std_deviation": false, - "std_deviation_bounds_lower": true, - "std_deviation_bounds_upper": false, - "sum": false - }, - "type": "extended_stats" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by extended stats (std dev lower)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_two}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 65 - }, - "hiddenSeries": false, - "id": 101, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "asc", - "orderBy": "1[std_lower]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "avg": false, - "count": false, - "max": false, - "min": false, - "std_deviation": false, - "std_deviation_bounds_lower": true, - "std_deviation_bounds_upper": false, - "sum": false - }, - "type": "extended_stats" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by extended stats (std dev lower)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - } - ], - "title": "Terms order by extended stats", - "type": "row" - }, - { - "collapsed": true, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 9 - }, - "id": 111, - "panels": [ - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_one}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 10 - }, - "hiddenSeries": false, - "id": 112, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "desc", - "orderBy": "1[25.0]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "settings": { - "percents": [ - "25" - ] - }, - "type": "percentiles" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by percentile (25)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_two}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 10 - }, - "hiddenSeries": false, - "id": 114, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "desc", - "orderBy": "1[25.0]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "settings": { - "percents": [ - "25" - ] - }, - "type": "percentiles" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by percentile (25)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_one}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 18 - }, - "hiddenSeries": false, - "id": 113, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "asc", - "orderBy": "1[99.0]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "settings": { - "percents": [ - "99" - ] - }, - "type": "percentiles" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by percentile (99)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "uid": "${version_two}" - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 18 - }, - "hiddenSeries": false, - "id": 115, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "7.5.0-pre", - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "", - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": "0", - "order": "asc", - "orderBy": "1[99.0]", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "settings": { - "percents": [ - "99" - ] - }, - "type": "percentiles" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Terms order by percentile (99)", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - } - ], - "title": "Terms order by percentile", - "type": "row" - }, - { - "collapsed": true, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 10 - }, - "id": 119, - "panels": [], - "title": "Inline scripts", - "type": "row" - }, - { - "datasource": { - "uid": "${version_one}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "viz": false, - "legend": false, - "tooltip": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 11 - }, - "id": 121, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "alias": "New Script Format", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "settings": { - "script": "_value * 2" - }, - "type": "avg" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - }, - { - "alias": "Old Script Format", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "hide": false, - "metrics": [ - { - "field": "@value", - "id": "1", - "settings": { - "script": { - "inline": "_value * 1.5" - } - }, - "type": "avg" - } - ], - "query": "", - "refId": "B", - "timeField": "@timestamp" - } - ], - "title": "Old & new script format", - "type": "timeseries" - }, - { - "datasource": { - "uid": "${version_two}" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "viz": false, - "legend": false, - "tooltip": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 11 - }, - "id": 122, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "alias": "New Script Format", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "settings": { - "script": "_value * 2" - }, - "type": "avg" - } - ], - "query": "", - "refId": "A", - "timeField": "@timestamp" - }, - { - "alias": "Old Script Format", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto" - }, - "type": "date_histogram" - } - ], - "hide": false, - "metrics": [ - { - "field": "@value", - "id": "1", - "settings": { - "script": { - "inline": "_value * 1.5" - } - }, - "type": "avg" - } - ], - "query": "", - "refId": "B", - "timeField": "@timestamp" - } - ], - "title": "Old & new script format", - "type": "timeseries" - } - ], - "refresh": false, - "schemaVersion": 33, - "style": "dark", - "tags": [ - "elasticsearch", - "gdev", - "datasource-test" - ], - "templating": { - "list": [ - { - "current": { - "selected": false, - "text": "gdev-elasticsearch-v5-metrics", - "value": "gdev-elasticsearch-v5-metrics" - }, - "hide": 0, - "includeAll": false, - "label": "Version One", - "multi": false, - "name": "version_one", - "options": [], - "query": "elasticsearch", - "queryValue": "", - "refresh": 1, - "regex": "/^gdev.*metrics$/", - "skipUrlSync": false, - "type": "datasource" - }, - { - "current": { - "selected": false, - "text": "gdev-elasticsearch-v56-metrics", - "value": "gdev-elasticsearch-v56-metrics" - }, - "hide": 0, - "includeAll": false, - "label": "Version Two", - "multi": false, - "name": "version_two", - "options": [], - "query": "elasticsearch", - "queryValue": "", - "refresh": 1, - "regex": "/^gdev.*metrics$/", - "skipUrlSync": false, - "type": "datasource" - } - ] - }, - "time": { - "from": "now-6h", - "to": "now" - }, - "timepicker": { - "refresh_intervals": [ - "5s", - "10s", - "30s", - "1m", - "5m", - "15m", - "30m", - "1h", - "2h", - "1d" - ], - "time_options": [ - "5m", - "15m", - "1h", - "6h", - "12h", - "24h", - "2d", - "7d", - "30d" - ] - }, - "timezone": "", - "title": "Datasource tests - Elasticsearch comparison", - "uid": "fuFWehBmk", - "version": 4 -} diff --git a/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_complex.json b/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_complex.json new file mode 100644 index 00000000000..5c277b491f2 --- /dev/null +++ b/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_complex.json @@ -0,0 +1,5300 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "links": [], + "liveNow": false, + "panels": [ + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 8, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 1 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m", + "min_doc_count": 50 + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "select field", + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic - interval 1m + min doc count 50", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 1 + }, + "id": 10, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto", + "min_doc_count": 0, + "trimEdges": 0 + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "select field", + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "always", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 9 + }, + "id": 12, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "5m", + "min_doc_count": 0, + "trimEdges": 10 + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "select field", + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic - interval 5m + trim edges = 10", + "type": "timeseries" + } + ], + "title": "Date histogram with count", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 1 + }, + "id": 7, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 2 + }, + "id": 14, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "avg" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic with aggregation - avg - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 2 + }, + "id": 16, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "settings": { + "percents": [ + "25", + "50", + "75", + "95", + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic with aggregation - percentiles - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 10 + }, + "id": 18, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "min" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic with aggregation - min - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 10 + }, + "id": 19, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "sum" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic with aggregation - sum - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 18 + }, + "id": 21, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "max" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic with aggregation - max - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 18 + }, + "id": 27, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "meta": { + "avg": true, + "count": true, + "max": true, + "min": true, + "std_deviation": true, + "std_deviation_bounds_lower": true, + "std_deviation_bounds_upper": true, + "sum": true + }, + "type": "extended_stats" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic with aggregation - extended stats - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 26 + }, + "id": 23, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "cardinality" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic with aggregation - unique count - interval auto", + "type": "timeseries" + } + ], + "title": "Date histogram with metric aggregation", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 2 + }, + "id": 6, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 3 + }, + "id": 26, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "5m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "hide": false, + "id": "1", + "type": "count" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "settings": { + "script": "MovingFunctions.max(values)", + "window": "10" + }, + "type": "moving_fn" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "moving function - count - interval 5m", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 3 + }, + "id": 29, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "5m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "hide": false, + "id": "1", + "type": "cardinality" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "settings": { + "script": "MovingFunctions.max(values)", + "window": "10" + }, + "type": "moving_fn" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "moving function - unique count - interval 5m", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 11 + }, + "id": 31, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "max" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "settings": { + "script": "MovingFunctions.max(values)", + "window": "10" + }, + "type": "moving_fn" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "moving function - max - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 11 + }, + "id": 34, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "avg" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "settings": { + "script": "MovingFunctions.max(values)", + "window": "10" + }, + "type": "moving_fn" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "moving function - avg - interval 1m", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 19 + }, + "id": 35, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "float", + "id": "1", + "type": "sum" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "settings": { + "script": "MovingFunctions.max(values)", + "window": "10" + }, + "type": "moving_fn" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "moving function - sum - interval 1m", + "type": "timeseries" + } + ], + "title": "Date histogram with moving functions", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 3 + }, + "id": 5, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 4 + }, + "id": 37, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "settings": { + "precision_threshold": "10" + }, + "type": "cardinality" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "derivative" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "derivative - unique count - interval 1m", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 4 + }, + "id": 39, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "max" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "derivative" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "derivative - max - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 12 + }, + "id": 42, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "float", + "id": "1", + "type": "sum" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "derivative" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "derivative - sum - interval auto", + "type": "timeseries" + } + ], + "title": "Date histogram with derivative", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 4 + }, + "id": 4, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 5 + }, + "id": 43, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "settings": { + "precision_threshold": "10" + }, + "type": "cardinality" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "cumulative_sum" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "cumulative sum - unique count - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 5 + }, + "id": 46, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "float", + "id": "1", + "settings": { + "script": "_value * 0.1" + }, + "type": "avg" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "cumulative_sum" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "cumulative sum - avg - interval 1m", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 13 + }, + "id": 48, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "10s" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "type": "count" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "cumulative_sum" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "cumulative sum - count - interval 10s", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 13 + }, + "id": 49, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m", + "trimEdges": "100" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "min" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "cumulative_sum" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "cumulative sum - min - interval 1m - trim edges 100", + "type": "timeseries" + } + ], + "title": "Date histogram with cumulative sum aggregation", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 5 + }, + "id": 3, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 6 + }, + "id": 51, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "hide": true, + "id": "1", + "type": "count" + }, + { + "field": "value", + "hide": true, + "id": "4", + "type": "avg" + }, + { + "id": "5", + "pipelineVariables": [ + { + "name": "var1", + "pipelineAgg": "1" + }, + { + "name": "var2", + "pipelineAgg": "4" + } + ], + "settings": { + "script": "params.var1 * params.var2" + }, + "type": "bucket_script" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "count * avg - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 6 + }, + "id": 54, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "hide": true, + "id": "1", + "type": "count" + }, + { + "id": "3", + "pipelineVariables": [ + { + "name": "var1", + "pipelineAgg": "1" + } + ], + "settings": { + "script": "params.var1 * 1000" + }, + "type": "bucket_script" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "count * 1000 - interval 1m", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 14 + }, + "id": 57, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "Alias", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "hide": true, + "id": "1", + "type": "count" + }, + { + "id": "3", + "pipelineVariables": [ + { + "name": "var1", + "pipelineAgg": "1" + } + ], + "settings": { + "script": "params.var1 * 1000" + }, + "type": "bucket_script" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "count * 1000 - interval 1m", + "type": "timeseries" + } + ], + "title": "Date histogram with bucket script aggregation", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 6 + }, + "id": 2, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 7 + }, + "id": 55, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "4", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_count", + "size": "10" + }, + "type": "terms" + }, + { + "field": "metric", + "id": "5", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + }, + { + "field": "level", + "id": "6", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "hide": false, + "id": "1", + "type": "count" + }, + { + "field": "value", + "id": "3", + "type": "avg" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "count/average with triple terms agg - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 7 + }, + "id": 60, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "{{hostname}} - {{metric}} - {{level}}", + "bucketAggs": [ + { + "field": "hostname", + "id": "4", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_count", + "size": "10" + }, + "type": "terms" + }, + { + "field": "metric", + "id": "5", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + }, + { + "field": "level", + "id": "6", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "hide": false, + "id": "1", + "type": "count" + }, + { + "field": "value", + "id": "3", + "type": "avg" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "count/average with triple terms agg - interval auto", + "transformations": [], + "type": "timeseries" + } + ], + "title": "Multiple metrics and aggregations", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 7 + }, + "id": 62, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 61, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "0", + "order": "desc", + "orderBy": "1", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "cardinality" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by unique count", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 8 + }, + "id": 70, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "0", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by Term value", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 16 + }, + "id": 71, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by Doc Count", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 16 + }, + "id": 73, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "avg" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by avg", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 24 + }, + "id": 76, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "hostname: {{hostname}}", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "avg" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by avg with alias", + "type": "timeseries" + } + ], + "title": "Terms order by simple aggregation", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 8 + }, + "id": 63, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 9 + }, + "id": 78, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[std_lower]", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "meta": { + "std_deviation_bounds_lower": true, + "std_deviation_bounds_upper": false + }, + "type": "extended_stats" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by extended stats (std dev lower)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 9 + }, + "id": 80, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[std_lower]", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "meta": { + "std_deviation": true, + "std_deviation_bounds_lower": false, + "std_deviation_bounds_upper": false + }, + "settings": { + "script": "_value * 4", + "sigma": "3" + }, + "type": "extended_stats" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by extended stats (std dev)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 17 + }, + "id": 82, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[sum]", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1h" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "float", + "id": "1", + "meta": { + "std_deviation": false, + "std_deviation_bounds_lower": false, + "std_deviation_bounds_upper": false, + "sum": true + }, + "settings": { + "script": "_value * 4", + "sigma": "3" + }, + "type": "extended_stats" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by extended stats (sum)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 17 + }, + "id": 83, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[count]", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "10m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "float", + "id": "1", + "meta": { + "avg": true, + "count": true, + "std_deviation": false, + "std_deviation_bounds_lower": false, + "std_deviation_bounds_upper": false, + "sum": false + }, + "settings": { + "script": "_value * 4", + "sigma": "3" + }, + "type": "extended_stats" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by extended stats (count,avg)", + "type": "timeseries" + } + ], + "title": "Terms order by extended stats", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 9 + }, + "id": 64, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 10 + }, + "id": 85, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[25.0]", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "float", + "id": "1", + "settings": { + "percents": [ + "25", + "50", + "75", + "95", + "99" + ], + "script": "_value * 2" + }, + "type": "percentiles" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by percentile", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 10 + }, + "id": 88, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[99.0]", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "settings": { + "percents": [ + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by percentile (99)", + "type": "timeseries" + } + ], + "title": "Terms order by percentile", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 10 + }, + "id": 65, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 11 + }, + "id": 89, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "New script format", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "settings": { + "script": "_value * 2" + }, + "type": "avg" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "alias": "Old script format", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "hide": false, + "metrics": [ + { + "field": "value", + "id": "1", + "settings": { + "script": "_value * 1.5" + }, + "type": "avg" + } + ], + "query": "", + "refId": "B", + "timeField": "@timestamp" + } + ], + "title": "Old & new script format", + "type": "timeseries" + } + ], + "title": "Inline scripts", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 11 + }, + "id": 66, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 28 + }, + "id": 92, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "9.5.0-pre", + "targets": [ + { + "alias": "", + "bucketAggs": [], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "settings": { + "size": "500" + }, + "type": "raw_document" + } + ], + "query": "", + "refId": "A", + "timeField": "@timestamp" + } + ], + "title": "Raw documents in table", + "transformations": [ + { + "id": "extractFields", + "options": { + "format": "json", + "replace": true, + "source": "A" + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 36 + }, + "id": 93, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "9.5.0-pre", + "targets": [ + { + "alias": "", + "bucketAggs": [], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "settings": { + "size": "10" + }, + "type": "raw_data" + } + ], + "query": "", + "refId": "A", + "timeField": "@timestamp" + } + ], + "title": "Raw data", + "transformations": [], + "type": "table" + } + ], + "title": "Raw data and documents", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 12 + }, + "id": 67, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 13 + }, + "id": 95, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "settings": { + "limit": "10" + }, + "type": "logs" + } + ], + "query": "", + "refId": "A", + "timeField": "@timestamp" + } + ], + "title": "Logs", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 21 + }, + "id": 94, + "options": { + "dedupStrategy": "none", + "enableLogDetails": true, + "prettifyLogMessage": false, + "showCommonLabels": false, + "showLabels": false, + "showTime": false, + "sortOrder": "Descending", + "wrapLogMessage": false + }, + "targets": [ + { + "alias": "", + "bucketAggs": [], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "settings": { + "limit": "10" + }, + "type": "logs" + } + ], + "query": "", + "refId": "A", + "timeField": "@timestamp" + } + ], + "title": "Logs", + "type": "logs" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 29 + }, + "id": 96, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "9.5.0-pre", + "targets": [ + { + "alias": "", + "bucketAggs": [], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "settings": { + "limit": "10" + }, + "type": "logs" + } + ], + "query": "", + "refId": "A", + "timeField": "@timestamp" + } + ], + "title": "Logs", + "type": "table" + } + ], + "title": "Logs", + "type": "row" + } + ], + "refresh": "", + "schemaVersion": 38, + "style": "dark", + "tags": [ + "gdev", + "elasticsearch", + "datasource-test" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Datasource tests - Elasticsearch complex", + "uid": "es_complex", + "version": 1, + "weekStart": "" +} diff --git a/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_migration.json b/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_migration.json new file mode 100644 index 00000000000..d0790a5c3e2 --- /dev/null +++ b/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_migration.json @@ -0,0 +1,10352 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "links": [], + "liveNow": false, + "panels": [ + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 8, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 17 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m", + "min_doc_count": 50 + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "select field", + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic - interval 1m + min doc count 50", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 17 + }, + "id": 9, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m", + "min_doc_count": 50 + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "select field", + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Basic - interval 1m + min doc count 50 (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 25 + }, + "id": 10, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto", + "min_doc_count": 0, + "trimEdges": 0 + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "select field", + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 25 + }, + "id": 11, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto", + "min_doc_count": 0, + "trimEdges": 0 + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "select field", + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Basic - interval auto (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "always", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 33 + }, + "id": 12, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "5m", + "min_doc_count": 0, + "trimEdges": 10 + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "select field", + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic - interval 5m + trim edges = 10", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "always", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 33 + }, + "id": 13, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "5m", + "min_doc_count": 0, + "trimEdges": 10 + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "select field", + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Basic - interval 5m + trim edges = 10 (backend)", + "type": "timeseries" + } + ], + "title": "Date histogram with count", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 1 + }, + "id": 7, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 18 + }, + "id": 14, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "avg" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic with aggregation - avg - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 18 + }, + "id": 15, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "avg" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Basic with aggregation - avg - interval auto (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 26 + }, + "id": 16, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "settings": { + "percents": [ + "25", + "50", + "75", + "95", + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic with aggregation - percentiles - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 26 + }, + "id": 17, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "settings": { + "percents": [ + "25", + "50", + "75", + "95", + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Basic with aggregation - percentiles - interval auto (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 34 + }, + "id": 18, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "min" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic with aggregation - min - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 34 + }, + "id": 20, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "min" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Basic with aggregation - min - interval auto (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 42 + }, + "id": 19, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "sum" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic with aggregation - sum - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 42 + }, + "id": 22, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "sum" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Basic with aggregation - sum - interval auto (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 50 + }, + "id": 21, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "max" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic with aggregation - max - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 50 + }, + "id": 24, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "max" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Basic with aggregation - max - interval auto (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 58 + }, + "id": 27, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "meta": { + "avg": true, + "count": true, + "max": true, + "min": true, + "std_deviation": true, + "std_deviation_bounds_lower": true, + "std_deviation_bounds_upper": true, + "sum": true + }, + "type": "extended_stats" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic with aggregation - extended stats - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 58 + }, + "id": 28, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "meta": { + "avg": true, + "count": true, + "max": true, + "min": true, + "std_deviation": true, + "std_deviation_bounds_lower": true, + "std_deviation_bounds_upper": true, + "sum": true + }, + "type": "extended_stats" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Basic with aggregation - extended stats - interval auto (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 66 + }, + "id": 23, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "cardinality" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Basic with aggregation - unique count - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 66 + }, + "id": 25, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "cardinality" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Basic with aggregation - unique count - interval auto (backend)", + "type": "timeseries" + } + ], + "title": "Date histogram with metric aggregation", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 2 + }, + "id": 6, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 19 + }, + "id": 26, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "5m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "hide": false, + "id": "1", + "type": "count" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "settings": { + "script": "MovingFunctions.max(values)", + "window": "10" + }, + "type": "moving_fn" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "moving function - count - interval 5m", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 19 + }, + "id": 30, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "5m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "hide": false, + "id": "1", + "type": "count" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "settings": { + "script": "MovingFunctions.max(values)", + "window": "10" + }, + "type": "moving_fn" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "moving function - count - interval 5m (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 27 + }, + "id": 29, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "5m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "hide": false, + "id": "1", + "type": "cardinality" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "settings": { + "script": "MovingFunctions.max(values)", + "window": "10" + }, + "type": "moving_fn" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "moving function - unique count - interval 5m", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 27 + }, + "id": 32, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "5m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "hide": false, + "id": "1", + "type": "cardinality" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "settings": { + "script": "MovingFunctions.max(values)", + "window": "10" + }, + "type": "moving_fn" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "moving function - unique count - interval 5m (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 35 + }, + "id": 31, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "max" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "settings": { + "script": "MovingFunctions.max(values)", + "window": "10" + }, + "type": "moving_fn" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "moving function - max - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 35 + }, + "id": 33, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "max" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "settings": { + "script": "MovingFunctions.max(values)", + "window": "10" + }, + "type": "moving_fn" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "moving function - max - interval auto (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 43 + }, + "id": 34, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "avg" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "settings": { + "script": "MovingFunctions.max(values)", + "window": "10" + }, + "type": "moving_fn" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "moving function - avg - interval 1m", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 43 + }, + "id": 36, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "avg" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "settings": { + "script": "MovingFunctions.max(values)", + "window": "10" + }, + "type": "moving_fn" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "moving function - avg - interval 1m (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 51 + }, + "id": 35, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "float", + "id": "1", + "type": "sum" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "settings": { + "script": "MovingFunctions.max(values)", + "window": "10" + }, + "type": "moving_fn" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "moving function - sum - interval 1m", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 51 + }, + "id": 38, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "float", + "id": "1", + "type": "sum" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "settings": { + "script": "MovingFunctions.max(values)", + "window": "10" + }, + "type": "moving_fn" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "moving function - sum - interval 1m (backend)", + "type": "timeseries" + } + ], + "title": "Date histogram with moving functions", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 3 + }, + "id": 5, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 20 + }, + "id": 37, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "settings": { + "precision_threshold": "10" + }, + "type": "cardinality" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "derivative" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "derivative - unique count - interval 1m", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 20 + }, + "id": 40, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "settings": { + "precision_threshold": "10" + }, + "type": "cardinality" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "derivative" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "derivative - unique count - interval 1m (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 28 + }, + "id": 39, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "max" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "derivative" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "derivative - max - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 28 + }, + "id": 41, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "max" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "derivative" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "derivative - max - interval auto (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 36 + }, + "id": 42, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "float", + "id": "1", + "type": "sum" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "derivative" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "derivative - sum - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 36 + }, + "id": 44, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "float", + "id": "1", + "type": "sum" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "derivative" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "derivative - sum - interval auto (backend)", + "type": "timeseries" + } + ], + "title": "Date histogram with derivative", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 4 + }, + "id": 4, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 21 + }, + "id": 43, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "settings": { + "precision_threshold": "10" + }, + "type": "cardinality" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "cumulative_sum" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "cumulative sum - unique count - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 21 + }, + "id": 45, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "settings": { + "precision_threshold": "10" + }, + "type": "cardinality" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "cumulative_sum" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "cumulative sum - unique count - interval auto (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 29 + }, + "id": 46, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "float", + "id": "1", + "settings": { + "script": "_value * 0.1" + }, + "type": "avg" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "cumulative_sum" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "cumulative sum - avg - interval 1m", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 29 + }, + "id": 47, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "float", + "id": "1", + "settings": { + "script": "_value * 0.1" + }, + "type": "avg" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "cumulative_sum" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "cumulative sum - avg - interval 1m (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 37 + }, + "id": 48, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "10s" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "type": "count" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "cumulative_sum" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "cumulative sum - count - interval 10s", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 37 + }, + "id": 50, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "10s" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "type": "count" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "cumulative_sum" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "cumulative sum - count - interval 10s (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 45 + }, + "id": 49, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m", + "trimEdges": "100" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "min" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "cumulative_sum" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "cumulative sum - min - interval 1m - trim edges 100", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 45 + }, + "id": 52, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m", + "trimEdges": "100" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "min" + }, + { + "field": "1", + "id": "4", + "pipelineAgg": "1", + "type": "cumulative_sum" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "cumulative sum - min - interval 1m - trim edges 100 (backend)", + "type": "timeseries" + } + ], + "title": "Date histogram with cumulative sum aggregation", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 5 + }, + "id": 3, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 22 + }, + "id": 51, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "hide": true, + "id": "1", + "type": "count" + }, + { + "field": "value", + "hide": true, + "id": "4", + "type": "avg" + }, + { + "id": "5", + "pipelineVariables": [ + { + "name": "var1", + "pipelineAgg": "1" + }, + { + "name": "var2", + "pipelineAgg": "4" + } + ], + "settings": { + "script": "params.var1 * params.var2" + }, + "type": "bucket_script" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "count * avg - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 22 + }, + "id": 53, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "hide": true, + "id": "1", + "type": "count" + }, + { + "field": "value", + "hide": true, + "id": "4", + "type": "avg" + }, + { + "id": "5", + "pipelineVariables": [ + { + "name": "var1", + "pipelineAgg": "1" + }, + { + "name": "var2", + "pipelineAgg": "4" + } + ], + "settings": { + "script": "params.var1 * params.var2" + }, + "type": "bucket_script" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "count * avg - interval auto (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 30 + }, + "id": 54, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "hide": true, + "id": "1", + "type": "count" + }, + { + "id": "3", + "pipelineVariables": [ + { + "name": "var1", + "pipelineAgg": "1" + } + ], + "settings": { + "script": "params.var1 * 1000" + }, + "type": "bucket_script" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "count * 1000 - interval 1m", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 30 + }, + "id": 56, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "hide": true, + "id": "1", + "type": "count" + }, + { + "id": "3", + "pipelineVariables": [ + { + "name": "var1", + "pipelineAgg": "1" + } + ], + "settings": { + "script": "params.var1 * 1000" + }, + "type": "bucket_script" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "count * 1000 - interval 1m (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 38 + }, + "id": 57, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "Alias", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "hide": true, + "id": "1", + "type": "count" + }, + { + "id": "3", + "pipelineVariables": [ + { + "name": "var1", + "pipelineAgg": "1" + } + ], + "settings": { + "script": "params.var1 * 1000" + }, + "type": "bucket_script" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "count * 1000 - interval 1m", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 38 + }, + "id": 58, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "Alias", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "hide": true, + "id": "1", + "type": "count" + }, + { + "id": "3", + "pipelineVariables": [ + { + "name": "var1", + "pipelineAgg": "1" + } + ], + "settings": { + "script": "params.var1 * 1000" + }, + "type": "bucket_script" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "count * 1000 - interval 1m (backend)", + "type": "timeseries" + } + ], + "title": "Date histogram with bucket script aggregation", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 6 + }, + "id": 2, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 23 + }, + "id": 55, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "4", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_count", + "size": "10" + }, + "type": "terms" + }, + { + "field": "metric", + "id": "5", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + }, + { + "field": "level", + "id": "6", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "hide": false, + "id": "1", + "type": "count" + }, + { + "field": "value", + "id": "3", + "type": "avg" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "count/average with triple terms agg - interval auto", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 23 + }, + "id": 59, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "4", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_count", + "size": "10" + }, + "type": "terms" + }, + { + "field": "metric", + "id": "5", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + }, + { + "field": "level", + "id": "6", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "hide": false, + "id": "1", + "type": "count" + }, + { + "field": "value", + "id": "3", + "type": "avg" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "count/average with triple terms agg - interval auto (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 31 + }, + "id": 60, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "{{hostname}} - {{metric}} - {{level}}", + "bucketAggs": [ + { + "field": "hostname", + "id": "4", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_count", + "size": "10" + }, + "type": "terms" + }, + { + "field": "metric", + "id": "5", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + }, + { + "field": "level", + "id": "6", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "hide": false, + "id": "1", + "type": "count" + }, + { + "field": "value", + "id": "3", + "type": "avg" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "count/average with triple terms agg - interval auto", + "transformations": [], + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 31 + }, + "id": 68, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "{{hostname}} - {{metric}} - {{level}}", + "bucketAggs": [ + { + "field": "hostname", + "id": "4", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_count", + "size": "10" + }, + "type": "terms" + }, + { + "field": "metric", + "id": "5", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + }, + { + "field": "level", + "id": "6", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "hide": false, + "id": "1", + "type": "count" + }, + { + "field": "value", + "id": "3", + "type": "avg" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "count/average with triple terms agg - interval auto (backend)", + "type": "timeseries" + } + ], + "title": "Multiple metrics and aggregations", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 7 + }, + "id": 62, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 40 + }, + "id": 61, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "0", + "order": "desc", + "orderBy": "1", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "cardinality" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by unique count", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 40 + }, + "id": 69, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "0", + "order": "desc", + "orderBy": "1", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "cardinality" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Terms order by unique count (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 48 + }, + "id": 70, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "0", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by Term value", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 48 + }, + "id": 72, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "0", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Terms order by Term value (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 56 + }, + "id": 71, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by Doc Count", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 56 + }, + "id": 74, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Terms order by Doc Count (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 64 + }, + "id": 73, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "avg" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by avg", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 64 + }, + "id": 75, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "avg" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Terms order by avg (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 72 + }, + "id": 76, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "hostname: {{hostname}}", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "avg" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by avg with alias", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 72 + }, + "id": 77, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "hostname: {{hostname}}", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "avg" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Terms order by avg with alias (backend)", + "type": "timeseries" + } + ], + "title": "Terms order by simple aggregation", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 8 + }, + "id": 63, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 41 + }, + "id": 78, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[std_lower]", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "meta": { + "std_deviation_bounds_lower": true, + "std_deviation_bounds_upper": false + }, + "type": "extended_stats" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by extended stats (std dev lower)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 41 + }, + "id": 79, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[std_lower]", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "meta": { + "std_deviation_bounds_lower": true, + "std_deviation_bounds_upper": false + }, + "type": "extended_stats" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Terms order by extended stats (std dev lower) (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 49 + }, + "id": 80, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[std_lower]", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "meta": { + "std_deviation": true, + "std_deviation_bounds_lower": false, + "std_deviation_bounds_upper": false + }, + "settings": { + "script": "_value * 4", + "sigma": "3" + }, + "type": "extended_stats" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by extended stats (std dev)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 49 + }, + "id": 81, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[std_lower]", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "meta": { + "std_deviation": true, + "std_deviation_bounds_lower": false, + "std_deviation_bounds_upper": false + }, + "settings": { + "script": "_value * 4", + "sigma": "3" + }, + "type": "extended_stats" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Terms order by extended stats (std dev) (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 57 + }, + "id": 82, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[sum]", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1h" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "float", + "id": "1", + "meta": { + "std_deviation": false, + "std_deviation_bounds_lower": false, + "std_deviation_bounds_upper": false, + "sum": true + }, + "settings": { + "script": "_value * 4", + "sigma": "3" + }, + "type": "extended_stats" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by extended stats (sum)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 57 + }, + "id": 84, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[sum]", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "1h" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "float", + "id": "1", + "meta": { + "std_deviation": false, + "std_deviation_bounds_lower": false, + "std_deviation_bounds_upper": false, + "sum": true + }, + "settings": { + "script": "_value * 4", + "sigma": "3" + }, + "type": "extended_stats" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Terms order by extended stats (sum) (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 65 + }, + "id": 83, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[count]", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "10m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "float", + "id": "1", + "meta": { + "avg": true, + "count": true, + "std_deviation": false, + "std_deviation_bounds_lower": false, + "std_deviation_bounds_upper": false, + "sum": false + }, + "settings": { + "script": "_value * 4", + "sigma": "3" + }, + "type": "extended_stats" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by extended stats (count,avg)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 65 + }, + "id": 86, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[count]", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "10m" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "float", + "id": "1", + "meta": { + "avg": true, + "count": true, + "std_deviation": false, + "std_deviation_bounds_lower": false, + "std_deviation_bounds_upper": false, + "sum": false + }, + "settings": { + "script": "_value * 4", + "sigma": "3" + }, + "type": "extended_stats" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Terms order by extended stats (count,avg) (backend)", + "type": "timeseries" + } + ], + "title": "Terms order by extended stats", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 9 + }, + "id": 64, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 26 + }, + "id": 85, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[25.0]", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "float", + "id": "1", + "settings": { + "percents": [ + "25", + "50", + "75", + "95", + "99" + ], + "script": "_value * 2" + }, + "type": "percentiles" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by percentile", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 26 + }, + "id": 87, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[25.0]", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "float", + "id": "1", + "settings": { + "percents": [ + "25", + "50", + "75", + "95", + "99" + ], + "script": "_value * 2" + }, + "type": "percentiles" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Terms order by percentile (backend)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 34 + }, + "id": 88, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[99.0]", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "settings": { + "percents": [ + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Terms order by percentile (99)", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 34 + }, + "id": 90, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[99.0]", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "settings": { + "percents": [ + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "B", + "type": "math" + } + ], + "title": "Terms order by percentile (99) (backend)", + "type": "timeseries" + } + ], + "title": "Terms order by percentile", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 10 + }, + "id": 65, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 11 + }, + "id": 89, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "New script format", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "settings": { + "script": "_value * 2" + }, + "type": "avg" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "alias": "Old script format", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "hide": false, + "metrics": [ + { + "field": "value", + "id": "1", + "settings": { + "script": "_value * 1.5" + }, + "type": "avg" + } + ], + "query": "", + "refId": "B", + "timeField": "@timestamp" + } + ], + "title": "Old & new script format", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 11 + }, + "id": 91, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "New script format", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "settings": { + "script": "_value * 2" + }, + "type": "avg" + } + ], + "query": "", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "alias": "Old script format", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "hide": false, + "metrics": [ + { + "field": "value", + "id": "1", + "settings": { + "script": "_value * 1.5" + }, + "type": "avg" + } + ], + "query": "", + "refId": "B", + "timeField": "@timestamp" + }, + { + "datasource": { + "name": "Expression", + "type": "__expr__", + "uid": "__expr__" + }, + "expression": "0", + "hide": false, + "refId": "C", + "type": "math" + } + ], + "title": "Old & new script format (backend)", + "type": "timeseries" + } + ], + "title": "Inline scripts", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 11 + }, + "id": 66, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 28 + }, + "id": 92, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "9.5.0-pre", + "targets": [ + { + "alias": "", + "bucketAggs": [], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "settings": { + "size": "500" + }, + "type": "raw_document" + } + ], + "query": "", + "refId": "A", + "timeField": "@timestamp" + } + ], + "title": "Raw documents in table", + "transformations": [ + { + "id": "extractFields", + "options": { + "format": "json", + "replace": true, + "source": "A" + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 36 + }, + "id": 93, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "9.5.0-pre", + "targets": [ + { + "alias": "", + "bucketAggs": [], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "settings": { + "size": "10" + }, + "type": "raw_data" + } + ], + "query": "", + "refId": "A", + "timeField": "@timestamp" + } + ], + "title": "Raw data", + "transformations": [], + "type": "table" + } + ], + "title": "Raw data and documents", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 12 + }, + "id": 67, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 21 + }, + "id": 95, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "settings": { + "limit": "10" + }, + "type": "logs" + } + ], + "query": "", + "refId": "A", + "timeField": "@timestamp" + } + ], + "title": "Logs", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 29 + }, + "id": 94, + "options": { + "dedupStrategy": "none", + "enableLogDetails": true, + "prettifyLogMessage": false, + "showCommonLabels": false, + "showLabels": false, + "showTime": false, + "sortOrder": "Descending", + "wrapLogMessage": false + }, + "targets": [ + { + "alias": "", + "bucketAggs": [], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "settings": { + "limit": "10" + }, + "type": "logs" + } + ], + "query": "", + "refId": "A", + "timeField": "@timestamp" + } + ], + "title": "Logs", + "type": "logs" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 37 + }, + "id": 96, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "9.5.0-pre", + "targets": [ + { + "alias": "", + "bucketAggs": [], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "settings": { + "limit": "10" + }, + "type": "logs" + } + ], + "query": "", + "refId": "A", + "timeField": "@timestamp" + } + ], + "title": "Logs", + "type": "table" + } + ], + "title": "Logs", + "type": "row" + } + ], + "refresh": "", + "schemaVersion": 38, + "style": "dark", + "tags": [ + "gdev", + "elasticsearch", + "datasource-test" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Datasource tests - Elasticsearch migration", + "uid": "es_migration", + "version": 1, + "weekStart": "" +} diff --git a/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_simple.json b/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_simple.json new file mode 100644 index 00000000000..3a95e86e807 --- /dev/null +++ b/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_simple.json @@ -0,0 +1,1128 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "asc", + "orderBy": "1", + "size": "5" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "3", + "settings": { + "interval": "auto", + "min_doc_count": "0", + "timeZone": "utc", + "trimEdges": "0" + }, + "type": "date_histogram" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "field": "value", + "id": "1", + "type": "max" + } + ], + "query": "*", + "refId": "A", + "timeField": "@timestamp" + } + ], + "title": "Top 5 servers", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "bucketAggs": [ + { + "field": "metric", + "id": "3", + "settings": { + "min_doc_count": 1, + "order": "asc", + "orderBy": "1", + "size": "5" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto", + "min_doc_count": 0, + "trimEdges": 0 + }, + "type": "date_histogram" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "dsType": "elasticsearch", + "metrics": [ + { + "field": "value", + "id": "1", + "type": "avg" + } + ], + "query": "metric:cpu", + "refId": "A", + "target": "", + "timeField": "@timestamp" + }, + { + "alias": "", + "bucketAggs": [ + { + "field": "metric", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + }, + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto" + }, + "type": "date_histogram" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "hide": false, + "metrics": [ + { + "field": "float", + "id": "1", + "type": "avg" + } + ], + "query": "metric:latency", + "refId": "B", + "timeField": "@timestamp" + } + ], + "title": "Average metrics", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "{{metric}}", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "5m", + "min_doc_count": 0, + "trimEdges": 0 + }, + "type": "date_histogram" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "dsType": "elasticsearch", + "metrics": [ + { + "field": "value", + "id": "1", + "meta": {}, + "settings": { + "percents": [ + 25, + 50, + 75, + 95, + 99 + ] + }, + "type": "percentiles" + } + ], + "query": "metric:cpu", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Percentiles & metric filter", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 8 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "alias": "{{metric}}", + "bucketAggs": [ + { + "field": "@timestamp", + "id": "2", + "settings": { + "interval": "auto", + "min_doc_count": 0, + "trimEdges": 0 + }, + "type": "date_histogram" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "dsType": "elasticsearch", + "metrics": [ + { + "field": "value", + "id": "1", + "meta": { + "std_deviation_bounds_lower": true, + "std_deviation_bounds_upper": true + }, + "settings": {}, + "type": "extended_stats" + } + ], + "query": "metric:cpu", + "refId": "A", + "target": "", + "timeField": "@timestamp" + } + ], + "title": "Standard dev", + "type": "timeseries" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 16 + }, + "id": 5, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "9.5.0-pre", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "hostname", + "id": "2", + "settings": { + "min_doc_count": 1, + "order": "asc", + "orderBy": "_term", + "size": "0" + }, + "type": "terms" + }, + { + "field": "level", + "id": "5", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "dsType": "elasticsearch", + "metrics": [ + { + "field": "value", + "id": "1", + "meta": {}, + "settings": {}, + "type": "avg" + }, + { + "field": "value", + "id": "3", + "meta": {}, + "settings": {}, + "type": "max" + }, + { + "field": "value", + "id": "4", + "meta": {}, + "settings": {}, + "type": "sum" + } + ], + "query": "", + "refId": "B", + "timeField": "@timestamp" + } + ], + "title": "ES metrics", + "type": "table" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 24, + "x": 0, + "y": 23 + }, + "id": 10, + "options": { + "controls": { + "mouseWheelZoom": true, + "showAttribution": true, + "showDebug": false, + "showMeasure": false, + "showScale": false, + "showZoom": true + }, + "layers": [ + { + "config": { + "showLegend": true, + "style": { + "color": { + "fixed": "dark-green" + }, + "opacity": 0.4, + "rotation": { + "fixed": 0, + "max": 360, + "min": -360, + "mode": "mod" + }, + "size": { + "fixed": 5, + "max": 15, + "min": 2 + }, + "symbol": { + "fixed": "img/icons/marker/circle.svg", + "mode": "fixed" + }, + "textConfig": { + "fontSize": 12, + "offsetX": 0, + "offsetY": 0, + "textAlign": "center", + "textBaseline": "middle" + } + } + }, + "location": { + "mode": "auto" + }, + "name": "Layer 1", + "tooltip": true, + "type": "markers" + } + ], + "tooltip": { + "mode": "details" + }, + "view": { + "allLayers": true, + "id": "zero", + "lat": 0, + "lon": 0, + "zoom": 1 + } + }, + "pluginVersion": "9.5.0-pre", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "location", + "id": "2", + "settings": { + "precision": "3" + }, + "type": "geohash_grid" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "metrics": [ + { + "id": "1", + "type": "count" + } + ], + "query": "", + "refId": "A", + "timeField": "@timestamp" + } + ], + "title": "Location with count in Geomap", + "transformations": [ + { + "id": "organize", + "options": { + "excludeByName": {}, + "indexByName": {}, + "renameByName": { + "location": "geohash" + } + } + } + ], + "type": "geomap" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 0, + "y": 33 + }, + "id": 6, + "options": { + "dedupStrategy": "none", + "enableLogDetails": true, + "prettifyLogMessage": false, + "showCommonLabels": false, + "showLabels": false, + "showTime": false, + "sortOrder": "Descending", + "wrapLogMessage": false + }, + "pluginVersion": "9.5.0-pre", + "targets": [ + { + "alias": "", + "bucketAggs": [], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "dsType": "elasticsearch", + "metrics": [ + { + "id": "1", + "settings": { + "limit": "500" + }, + "type": "logs" + } + ], + "query": "", + "refId": "B", + "timeField": "@timestamp" + } + ], + "title": "Logs", + "transformations": [], + "type": "logs" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 12, + "y": 33 + }, + "id": 9, + "options": { + "dedupStrategy": "none", + "enableLogDetails": true, + "prettifyLogMessage": false, + "showCommonLabels": false, + "showLabels": false, + "showTime": false, + "sortOrder": "Descending", + "wrapLogMessage": false + }, + "pluginVersion": "9.5.0-pre", + "targets": [ + { + "alias": "", + "bucketAggs": [], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "dsType": "elasticsearch", + "metrics": [ + { + "id": "1", + "settings": { + "limit": "500" + }, + "type": "logs" + } + ], + "query": "", + "refId": "B", + "timeField": "@timestamp" + } + ], + "title": "Logs reordered", + "transformations": [ + { + "id": "organize", + "options": { + "excludeByName": {}, + "indexByName": { + "@timestamp": 0, + "_id": 3, + "_index": 4, + "_source": 5, + "_type": 6, + "counter": 7, + "description": 8, + "float": 9, + "highlight": 10, + "hostname": 11, + "label": 12, + "level": 1, + "line": 2, + "location": 13, + "metric": 14, + "shapes": 15, + "sort": 16, + "value": 17 + }, + "renameByName": {} + } + } + ], + "type": "logs" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 39 + }, + "id": 8, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "9.5.0-pre", + "targets": [ + { + "alias": "", + "bucketAggs": [], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "dsType": "elasticsearch", + "metrics": [ + { + "id": "1", + "settings": { + "size": "10" + }, + "type": "raw_data" + } + ], + "query": "", + "refId": "B", + "timeField": "@timestamp" + } + ], + "title": "Raw data in table", + "transformations": [], + "type": "table" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 46 + }, + "id": 7, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "9.5.0-pre", + "targets": [ + { + "alias": "", + "bucketAggs": [], + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "dsType": "elasticsearch", + "metrics": [ + { + "id": "1", + "settings": { + "size": "500" + }, + "type": "raw_document" + } + ], + "query": "", + "refId": "B", + "timeField": "@timestamp" + } + ], + "title": "Raw document with json transformation in table", + "transformations": [ + { + "id": "extractFields", + "options": { + "format": "json", + "replace": true, + "source": "B" + } + } + ], + "type": "table" + } + ], + "refresh": "", + "schemaVersion": 38, + "style": "dark", + "tags": [ + "gdev", + "elasticsearch", + "datasource-test" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Datasource tests - Elasticsearch simple", + "uid": "es_simple", + "version": 1, + "weekStart": "" +} diff --git a/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_v7.json b/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_v7.json deleted file mode 100644 index 02b3ced02f6..00000000000 --- a/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_v7.json +++ /dev/null @@ -1,736 +0,0 @@ -{ - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": "-- Grafana --", - "enable": false, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "limit": 100, - "name": "Annotations & Alerts", - "showIn": 0, - "type": "dashboard" - }, - { - "datasource": "gdev-elasticsearch-v7-logs", - "enable": false, - "iconColor": "rgba(255, 96, 96, 1)", - "limit": 100, - "name": "test", - "query": "", - "showIn": 0, - "textField": "description", - "type": "alert" - } - ] - }, - "editable": true, - "gnetId": null, - "graphTooltip": 0, - "iteration": 1591027717495, - "links": [ - { - "asDropdown": true, - "icon": "external link", - "tags": ["gdev", "elasticsearch", "datasource-test"], - "title": "Dashboards", - "type": "dashboards" - } - ], - "panels": [ - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "gdev-elasticsearch-v7-metrics", - "editable": true, - "error": false, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "grid": {}, - "gridPos": { - "h": 7, - "w": 24, - "x": 0, - "y": 0 - }, - "hiddenSeries": false, - "id": 1, - "legend": { - "alignAsTable": true, - "avg": false, - "current": false, - "max": true, - "min": false, - "rightSide": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 2, - "links": [], - "nullPointMode": "connected", - "options": { - "dataLinks": [] - }, - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "field": "@hostname", - "id": "3", - "settings": { - "min_doc_count": 1, - "order": "asc", - "orderBy": "1", - "size": "5" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "dsType": "elasticsearch", - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": {}, - "settings": {}, - "type": "max" - } - ], - "query": "*", - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, - "title": "Top 5 servers", - "tooltip": { - "msResolution": true, - "shared": true, - "sort": 0, - "value_type": "cumulative" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ], - "yaxis": { - "align": false, - "alignLevel": null - } - }, - { - "aliasColors": { - "Count": "#6ED0E0" - }, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "gdev-elasticsearch-v7-metrics", - "editable": true, - "error": false, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "grid": {}, - "gridPos": { - "h": 6, - "w": 12, - "x": 0, - "y": 7 - }, - "hiddenSeries": false, - "id": 2, - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": false, - "min": false, - "rightSide": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 2, - "links": [], - "nullPointMode": "connected", - "options": { - "dataLinks": [] - }, - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [ - { - "alias": "Count", - "lines": false, - "yaxis": 2, - "zindex": -1 - } - ], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "{{metric}}", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "dsType": "elasticsearch", - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": {}, - "settings": { - "percents": [25, 50, 75, 95, 99] - }, - "type": "percentiles" - } - ], - "query": "@metric:cpu", - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, - "title": "Percentiles & Metric filter", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "cumulative" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ], - "yaxis": { - "align": false, - "alignLevel": null - } - }, - { - "aliasColors": { - "Count": "#6ED0E0" - }, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": "gdev-elasticsearch-v7-metrics", - "editable": true, - "error": false, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "grid": {}, - "gridPos": { - "h": 6, - "w": 12, - "x": 12, - "y": 7 - }, - "hiddenSeries": false, - "id": 3, - "legend": { - "alignAsTable": true, - "avg": true, - "current": false, - "max": false, - "min": false, - "rightSide": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 2, - "links": [], - "nullPointMode": "connected", - "options": { - "dataLinks": [] - }, - "percentage": false, - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [ - { - "alias": "Count", - "lines": false, - "yaxis": 2, - "zindex": -1 - } - ], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "alias": "{{metric}}", - "bucketAggs": [ - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "dsType": "elasticsearch", - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": { - "std_deviation_bounds_lower": true, - "std_deviation_bounds_upper": true - }, - "settings": {}, - "type": "extended_stats" - } - ], - "query": "@metric:cpu", - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, - "title": "Standard dev", - "tooltip": { - "msResolution": true, - "shared": true, - "sort": 0, - "value_type": "cumulative" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ], - "yaxis": { - "align": false, - "alignLevel": null - } - }, - { - "columns": [ - { - "text": "@hostname", - "value": "@hostname" - }, - { - "text": "Average", - "value": "Average" - }, - { - "text": "Max", - "value": "Max" - }, - { - "text": "Sum", - "value": "Sum" - } - ], - "datasource": "gdev-elasticsearch-v7-metrics", - "editable": true, - "error": false, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fontSize": "100%", - "gridPos": { - "h": 7, - "w": 24, - "x": 0, - "y": 13 - }, - "id": 6, - "links": [], - "pageSize": null, - "scroll": true, - "showHeader": true, - "sort": { - "col": 0, - "desc": true - }, - "styles": [ - { - "align": "auto", - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "pattern": "@timestamp", - "type": "date" - }, - { - "align": "auto", - "colorMode": null, - "colors": ["rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)"], - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "decimals": 2, - "pattern": "/.*/", - "thresholds": [], - "type": "number", - "unit": "short" - } - ], - "targets": [ - { - "bucketAggs": [ - { - "field": "@hostname", - "id": "2", - "settings": { - "min_doc_count": 1, - "order": "asc", - "orderBy": "_term", - "size": "0" - }, - "type": "terms" - } - ], - "dsType": "elasticsearch", - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": {}, - "settings": {}, - "type": "avg" - }, - { - "field": "@value", - "id": "3", - "meta": {}, - "settings": {}, - "type": "max" - }, - { - "field": "@value", - "id": "4", - "meta": {}, - "settings": {}, - "type": "sum" - } - ], - "refId": "B", - "timeField": "@timestamp" - } - ], - "title": "ES Metrics", - "transform": "table", - "type": "table-old" - }, - { - "columns": [ - { - "text": "@timestamp", - "value": "@timestamp" - }, - { - "text": "@message", - "value": "@message" - }, - { - "text": "tags", - "value": "tags" - }, - { - "text": "description", - "value": "description" - } - ], - "datasource": "gdev-elasticsearch-v7-logs", - "editable": true, - "error": false, - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fontSize": "100%", - "gridPos": { - "h": 7, - "w": 24, - "x": 0, - "y": 20 - }, - "id": 5, - "links": [], - "pageSize": null, - "scroll": true, - "showHeader": true, - "sort": { - "col": 0, - "desc": true - }, - "styles": [ - { - "align": "auto", - "dateFormat": "YYYY-MM-DD HH:mm:ss", - "pattern": "@timestamp", - "type": "date" - } - ], - "targets": [ - { - "bucketAggs": [], - "dsType": "elasticsearch", - "metrics": [ - { - "field": "select field", - "id": "1", - "meta": {}, - "settings": { - "size": 500 - }, - "type": "raw_document" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "title": "ES Log query", - "transform": "json", - "type": "table-old" - }, - { - "circleMaxSize": 30, - "circleMinSize": 2, - "colors": ["rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)"], - "datasource": "gdev-elasticsearch-v7-metrics", - "decimals": 0, - "esGeoPoint": "@location", - "esMetric": "Average", - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "gridPos": { - "h": 12, - "w": 24, - "x": 0, - "y": 27 - }, - "hideEmpty": false, - "hideZero": false, - "id": 8, - "initialZoom": "1", - "links": [], - "locationData": "geohash", - "mapCenter": "(0°, 0°)", - "mapCenterLatitude": 0, - "mapCenterLongitude": 0, - "maxDataPoints": 1, - "mouseWheelZoom": false, - "showLegend": true, - "stickyLabels": false, - "tableQueryOptions": { - "geohashField": "geohash", - "latitudeField": "latitude", - "longitudeField": "longitude", - "metricField": "metric", - "queryType": "geohash" - }, - "targets": [ - { - "bucketAggs": [ - { - "fake": true, - "field": "@location", - "id": "3", - "settings": { - "precision": 2 - }, - "type": "geohash_grid" - } - ], - "metrics": [ - { - "field": "@value", - "id": "1", - "meta": {}, - "settings": {}, - "type": "avg" - } - ], - "refId": "A", - "target": "", - "timeField": "@timestamp" - } - ], - "thresholds": "0,10", - "title": "World map panel", - "type": "grafana-worldmap-panel", - "unitPlural": "", - "unitSingle": "", - "valueName": "total" - } - ], - "schemaVersion": 25, - "style": "dark", - "tags": ["elasticsearch", "gdev", "datasource-test"], - "templating": { - "list": [ - { - "datasource": "gdev-elasticsearch-v7-metrics", - "filters": [], - "hide": 0, - "label": "", - "name": "Filters", - "skipUrlSync": false, - "type": "adhoc" - } - ] - }, - "time": { - "from": "now-30m", - "to": "now" - }, - "timepicker": { - "collapse": false, - "enable": true, - "notice": false, - "now": true, - "refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"], - "status": "Stable", - "time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"], - "type": "timepicker" - }, - "timezone": "browser", - "title": "Datasource tests - Elasticsearch v7", - "uid": "Y-RvmuRWk", - "version": 1 -} diff --git a/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_v7_filebeat.json b/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_v7_filebeat.json deleted file mode 100644 index a5003193b11..00000000000 --- a/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_v7_filebeat.json +++ /dev/null @@ -1,241 +0,0 @@ -{ - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": "-- Grafana --", - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "type": "dashboard" - } - ] - }, - "editable": true, - "gnetId": null, - "graphTooltip": 0, - "iteration": 1591027736516, - "links": [ - { - "asDropdown": true, - "icon": "external link", - "tags": ["gdev", "elasticsearch", "datasource-test"], - "title": "Dashboards", - "type": "dashboards" - } - ], - "panels": [ - { - "aliasColors": { - "error": "red" - }, - "bars": true, - "dashLength": 10, - "dashes": false, - "datasource": "gdev-elasticsearch-v7-filebeat", - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "fill": 1, - "fillGradient": 0, - "gridPos": { - "h": 5, - "w": 24, - "x": 0, - "y": 0 - }, - "hiddenSeries": false, - "id": 4, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": false, - "linewidth": 1, - "nullPointMode": "null", - "options": { - "dataLinks": [] - }, - "percentage": false, - "pointradius": 2, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": true, - "steppedLine": false, - "targets": [ - { - "bucketAggs": [ - { - "fake": true, - "field": "fields.level", - "id": "3", - "settings": { - "min_doc_count": 1, - "order": "desc", - "orderBy": "_term", - "size": "10" - }, - "type": "terms" - }, - { - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "5m", - "min_doc_count": 1, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "field": "select field", - "id": "1", - "type": "count" - } - ], - "query": "fields.app:grafana", - "refId": "A", - "timeField": "@timestamp" - } - ], - "thresholds": [], - "timeFrom": null, - "timeRegions": [], - "timeShift": null, - "title": "Panel Title", - "tooltip": { - "shared": true, - "sort": 0, - "value_type": "individual" - }, - "type": "graph", - "xaxis": { - "buckets": null, - "mode": "time", - "name": null, - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - }, - { - "format": "short", - "label": null, - "logBase": 1, - "max": null, - "min": null, - "show": true - } - ], - "yaxis": { - "align": false, - "alignLevel": null - } - }, - { - "datasource": "gdev-elasticsearch-v7-filebeat", - "fieldConfig": { - "defaults": { - "custom": {} - }, - "overrides": [] - }, - "gridPos": { - "h": 22, - "w": 24, - "x": 0, - "y": 5 - }, - "id": 2, - "links": [], - "options": { - "showLabels": false, - "showTime": true, - "sortOrder": "Descending", - "wrapLogMessage": true - }, - "targets": [ - { - "bucketAggs": [ - { - "$$hashKey": "object:522", - "field": "@timestamp", - "id": "2", - "settings": { - "interval": "auto", - "min_doc_count": 0, - "trimEdges": 0 - }, - "type": "date_histogram" - } - ], - "metrics": [ - { - "$$hashKey": "object:484", - "field": "select field", - "id": "1", - "meta": {}, - "settings": {}, - "type": "logs" - } - ], - "query": "fields.app:grafana", - "refId": "A", - "timeField": "@timestamp" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "Panel Title", - "type": "logs" - } - ], - "schemaVersion": 25, - "style": "dark", - "tags": ["elasticsearch", "gdev", "datasource-test"], - "templating": { - "list": [ - { - "datasource": "gdev-elasticsearch-v7-filebeat", - "filters": [], - "hide": 0, - "label": "", - "name": "Filters", - "skipUrlSync": false, - "type": "adhoc" - } - ] - }, - "time": { - "from": "now-1h", - "to": "now" - }, - "timepicker": { - "refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"], - "time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"] - }, - "timezone": "", - "title": "Datasource tests - Elasticsearch v7 Filebeat", - "uid": "M94gguRWz", - "version": 1 -} diff --git a/devenv/docker/blocks/elastic/data/data.js b/devenv/docker/blocks/elastic/data/data.js index 50a9eea1488..efff9370005 100644 --- a/devenv/docker/blocks/elastic/data/data.js +++ b/devenv/docker/blocks/elastic/data/data.js @@ -81,6 +81,18 @@ async function elasticSetupIndexTemplate() { }, shapes: { type: 'nested', + }, + hostname: { + type: 'keyword', + }, + value: { + type: 'integer', + }, + metric: { + type: 'keyword', + }, + description: { + type: 'text', } }, }, @@ -119,6 +131,10 @@ function getRandomLogItem(counter, timestamp) { {"type": "triangle"}, {"type": "square"}, ], + hostname: chooseRandomElement(['hostname1', 'hostname2', 'hostname3', 'hostname4', 'hostname5', 'hostname6']), + value: counter, + metric: chooseRandomElement(['cpu', 'memory', 'latency']), + description: "this is description" }; } diff --git a/devenv/jsonnet/dev-dashboards.libsonnet b/devenv/jsonnet/dev-dashboards.libsonnet index ff4d81e4622..78eb25255c1 100644 --- a/devenv/jsonnet/dev-dashboards.libsonnet +++ b/devenv/jsonnet/dev-dashboards.libsonnet @@ -163,21 +163,21 @@ local dashboard = grafana.dashboard; id: 0, } }, - dashboard.new('elasticsearch_compare', import '../dev-dashboards/datasource-elasticsearch/elasticsearch_compare.json') + + dashboard.new('elasticsearch_complex', import '../dev-dashboards/datasource-elasticsearch/elasticsearch_complex.json') + resource.addMetadata('folder', 'dev-dashboards') + { spec+: { id: 0, } }, - dashboard.new('elasticsearch_v7', import '../dev-dashboards/datasource-elasticsearch/elasticsearch_v7.json') + + dashboard.new('elasticsearch_migration', import '../dev-dashboards/datasource-elasticsearch/elasticsearch_migration.json') + resource.addMetadata('folder', 'dev-dashboards') + { spec+: { id: 0, } }, - dashboard.new('elasticsearch_v7_filebeat', import '../dev-dashboards/datasource-elasticsearch/elasticsearch_v7_filebeat.json') + + dashboard.new('elasticsearch_simple', import '../dev-dashboards/datasource-elasticsearch/elasticsearch_simple.json') + resource.addMetadata('folder', 'dev-dashboards') + { spec+: { From a39190b6137ea61e194ef5a1fd7e96f83de19cf7 Mon Sep 17 00:00:00 2001 From: Simon Crute Date: Wed, 5 Apr 2023 13:49:57 +0100 Subject: [PATCH 42/80] Docs: Add the index function --- .../using-go-templating-language.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/sources/alerting/manage-notifications/template-notifications/using-go-templating-language.md b/docs/sources/alerting/manage-notifications/template-notifications/using-go-templating-language.md index b6529d4f7b2..a1b5267c338 100644 --- a/docs/sources/alerting/manage-notifications/template-notifications/using-go-templating-language.md +++ b/docs/sources/alerting/manage-notifications/template-notifications/using-go-templating-language.md @@ -71,6 +71,16 @@ The name of the annotation is {{ .Name }}, and the value is {{ .Value }} {{ end }} ``` +## The index function + +To print a specific annotation or label use the `index` function. + +``` +{{ range .Alerts }} +The name of the alert is {{ index .Labels "alertname" }} +{{ end }} +``` + ## If statements You can use if statements in templates. For example, to print `There are no alerts` if there are no alerts in `.Alerts` you would write the following: From 37eaf5019751aa76568574757830d63b764bbb1f Mon Sep 17 00:00:00 2001 From: Andrej Ocenas Date: Wed, 5 Apr 2023 14:57:24 +0200 Subject: [PATCH 43/80] FlameGraph: Use pyroscope/flamegraph (#65896) --- .betterer.results | 3 + .../feature-toggles/index.md | 1 + package.json | 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 + .../explore/FlameGraphExploreContainer.tsx | 5 +- .../components/FlameGraphTopWrapper.tsx | 126 ++++++++++++++++++ yarn.lock | 13 ++ 10 files changed, 158 insertions(+), 3 deletions(-) create mode 100644 public/app/plugins/panel/flamegraph/components/FlameGraphTopWrapper.tsx diff --git a/.betterer.results b/.betterer.results index 265b61e70ac..4db1152f170 100644 --- a/.betterer.results +++ b/.betterer.results @@ -5264,6 +5264,9 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "1"], [0, 0, 0, "Unexpected any. Specify a different type.", "2"] ], + "public/app/plugins/panel/flamegraph/components/FlameGraphTopWrapper.tsx:5381": [ + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] + ], "public/app/plugins/panel/gauge/GaugeMigrations.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], 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 3559bb4464e..9d7b628917a 100644 --- a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md +++ b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md @@ -107,6 +107,7 @@ Alpha features might be changed or removed without prior notice. | `alertStateHistoryLokiPrimary` | Enable a remote Loki instance as the primary source for state history reads. | | `alertStateHistoryLokiOnly` | Disable Grafana alerts from emitting annotations when a remote Loki instance is available. | | `unifiedRequestLog` | Writes error logs to the request logger | +| `pyroscopeFlameGraph` | Changes flame graph to pyroscope one | ## Development feature toggles diff --git a/package.json b/package.json index 44bfbb1211b..1e8cf53df28 100644 --- a/package.json +++ b/package.json @@ -279,6 +279,7 @@ "@opentelemetry/semantic-conventions": "1.9.1", "@popperjs/core": "2.11.6", "@prometheus-io/lezer-promql": "^0.37.0-rc.1", + "@pyroscope/flamegraph": "^0.35.5", "@react-aria/button": "3.6.1", "@react-aria/dialog": "3.3.1", "@react-aria/focus": "3.8.0", diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts index 0c84cb2fb0b..e62f5f0f32d 100644 --- a/packages/grafana-data/src/types/featureToggles.gen.ts +++ b/packages/grafana-data/src/types/featureToggles.gen.ts @@ -94,4 +94,5 @@ export interface FeatureToggles { alertStateHistoryLokiOnly?: boolean; unifiedRequestLog?: boolean; renderAuthJWT?: boolean; + pyroscopeFlameGraph?: boolean; } diff --git a/pkg/services/featuremgmt/registry.go b/pkg/services/featuremgmt/registry.go index 11bf3812990..2143c9d4ad3 100644 --- a/pkg/services/featuremgmt/registry.go +++ b/pkg/services/featuremgmt/registry.go @@ -505,5 +505,11 @@ var ( State: FeatureStateBeta, Owner: grafanaAsCodeSquad, }, + { + Name: "pyroscopeFlameGraph", + Description: "Changes flame graph to pyroscope one", + State: FeatureStateAlpha, + Owner: grafanaObservabilityTracesAndProfilingSquad, + }, } ) diff --git a/pkg/services/featuremgmt/toggles_gen.csv b/pkg/services/featuremgmt/toggles_gen.csv index d7bbe3f1e55..0286f61d16e 100644 --- a/pkg/services/featuremgmt/toggles_gen.csv +++ b/pkg/services/featuremgmt/toggles_gen.csv @@ -75,3 +75,4 @@ alertStateHistoryLokiPrimary,alpha,@grafana/alerting-squad,false,false,false,fal alertStateHistoryLokiOnly,alpha,@grafana/alerting-squad,false,false,false,false unifiedRequestLog,alpha,@grafana/backend-platform,false,false,false,false renderAuthJWT,beta,@grafana/grafana-as-code,false,false,false,false +pyroscopeFlameGraph,alpha,@grafana/observability-traces-and-profiling,false,false,false,false diff --git a/pkg/services/featuremgmt/toggles_gen.go b/pkg/services/featuremgmt/toggles_gen.go index 4595ec528e1..a648556ad6f 100644 --- a/pkg/services/featuremgmt/toggles_gen.go +++ b/pkg/services/featuremgmt/toggles_gen.go @@ -310,4 +310,8 @@ const ( // FlagRenderAuthJWT // Uses JWT-based auth for rendering instead of relying on remote cache FlagRenderAuthJWT = "renderAuthJWT" + + // FlagPyroscopeFlameGraph + // Changes flame graph to pyroscope one + FlagPyroscopeFlameGraph = "pyroscopeFlameGraph" ) diff --git a/public/app/features/explore/FlameGraphExploreContainer.tsx b/public/app/features/explore/FlameGraphExploreContainer.tsx index ed66d58b236..9e64f393c45 100644 --- a/public/app/features/explore/FlameGraphExploreContainer.tsx +++ b/public/app/features/explore/FlameGraphExploreContainer.tsx @@ -3,8 +3,7 @@ import React from 'react'; import { DataFrame, GrafanaTheme2, CoreApp } from '@grafana/data'; import { useStyles2 } from '@grafana/ui'; - -import FlameGraphContainer from '../../plugins/panel/flamegraph/components/FlameGraphContainer'; +import { FlameGraphTopWrapper } from 'app/plugins/panel/flamegraph/components/FlameGraphTopWrapper'; interface Props { dataFrames: DataFrame[]; @@ -15,7 +14,7 @@ export const FlameGraphExploreContainer = (props: Props) => { return (
- +
); }; diff --git a/public/app/plugins/panel/flamegraph/components/FlameGraphTopWrapper.tsx b/public/app/plugins/panel/flamegraph/components/FlameGraphTopWrapper.tsx new file mode 100644 index 00000000000..c52c882e704 --- /dev/null +++ b/public/app/plugins/panel/flamegraph/components/FlameGraphTopWrapper.tsx @@ -0,0 +1,126 @@ +import { FlamegraphRenderer } from '@pyroscope/flamegraph'; +import React from 'react'; +import '@pyroscope/flamegraph/dist/index.css'; + +import { CoreApp, DataFrame, DataFrameView } from '@grafana/data'; +import { config } from '@grafana/runtime'; + +import FlameGraphContainer from './FlameGraphContainer'; + +type Props = { + data?: DataFrame; + app: CoreApp; + // Height for flame graph when not used in explore. + // This needs to be different to explore flame graph height as we + // use panels with user adjustable heights in dashboards etc. + flameGraphHeight?: number; +}; + +export const FlameGraphTopWrapper = (props: Props) => { + if (config.featureToggles.pyroscopeFlameGraph) { + const profile = props.data ? dataFrameToFlameBearer(props.data) : undefined; + return ; + } + + return ; +}; + +type Row = { + level: number; + label: string; + value: number; + self: number; +}; + +/** + * Converts a nested set format from a DataFrame to a Flamebearer format needed by the pyroscope flamegraph. + * @param data + */ +function dataFrameToFlameBearer(data: DataFrame) { + // Unfortunately we cannot use @pyroscope/models for now as they publish ts files which then get type checked and + // they do not pass our with our tsconfig + const profile: any = { + version: 1, + flamebearer: { + names: [], + levels: [], + numTicks: 0, + maxSelf: 0, + }, + metadata: { + format: 'single' as const, + sampleRate: 100, + spyName: 'gospy' as const, + units: 'samples' as const, + }, + }; + const view = new DataFrameView(data); + const labelField = data.fields.find((f) => f.name === 'label'); + + if (labelField?.config?.type?.enum?.text) { + profile.flamebearer.names = labelField.config.type.enum.text; + } + + const labelMap: Record = {}; + + // Handle both cases where label is a string or a number pointing to enum config text array. + const getLabel = (label: string | number) => { + if (typeof label === 'number') { + return label; + } else { + if (labelMap[label] === undefined) { + labelMap[label] = profile.flamebearer.names.length; + profile.flamebearer.names.push(label); + } + + return labelMap[label]; + } + }; + + // Absolute offset where we are currently at. + let offset = 0; + + for (let i = 0; i < data.length; i++) { + // view.get() changes the underlying object, so we have to call this first get the value and then call get() for + // current row. + const prevLevel = i > 0 ? view.get(i - 1).level : undefined; + const row = view.get(i); + const currentLevel = row.level; + const level = profile.flamebearer.levels[currentLevel]; + + // First row is the root and always the total number of ticks. + if (i === 0) { + profile.flamebearer.numTicks = row.value; + } + profile.flamebearer.maxSelf = Math.max(profile.flamebearer.maxSelf, row.self); + + if (prevLevel && prevLevel >= currentLevel) { + // we are going back to the previous level and adding sibling we have to figure out new offset + offset = levelWidth(level); + } + + if (!level) { + // Starting a new level. Offset is what ever current absolute offset is as there are no siblings yet. + profile.flamebearer.levels[row.level] = [offset, row.value, row.self, getLabel(row.label)]; + } else { + // We actually need offset relative to sibling while offset variable contains absolute offset. + const width = levelWidth(level); + level.push(offset - width, row.value, row.self, getLabel(row.label)); + } + } + return profile; +} + +/** + * Get a width of a level. As offsets are relative to siblings we need to sum all the offsets and values in a level. + * @param level + */ +function levelWidth(level: number[]) { + let length = 0; + for (let i = 0; i < level.length; i += 4) { + const start = level[i]; + const value = level[i + 1]; + length += start + value; + } + return length; +} diff --git a/yarn.lock b/yarn.lock index ace327afbb0..405468006b1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6271,6 +6271,18 @@ __metadata: languageName: node linkType: hard +"@pyroscope/flamegraph@npm:^0.35.5": + version: 0.35.5 + resolution: "@pyroscope/flamegraph@npm:0.35.5" + peerDependencies: + graphviz-react: ^1.2.5 + react: ">=16.14.0" + react-dom: ">=16.14.0" + true-myth: ^5.1.2 + checksum: e63580683f5d2333202415b827ebe78986294d1fe49de978b62400e5cd070afd1f48d071ff7e5c22bc1ace6c52e9767e85650b34444c6ad0c9ecb23788d83ffd + languageName: node + linkType: hard + "@radix-ui/react-compose-refs@npm:1.0.0": version: 1.0.0 resolution: "@radix-ui/react-compose-refs@npm:1.0.0" @@ -20126,6 +20138,7 @@ __metadata: "@pmmmwh/react-refresh-webpack-plugin": 0.5.10 "@popperjs/core": 2.11.6 "@prometheus-io/lezer-promql": ^0.37.0-rc.1 + "@pyroscope/flamegraph": ^0.35.5 "@react-aria/button": 3.6.1 "@react-aria/dialog": 3.3.1 "@react-aria/focus": 3.8.0 From e8813916c9dc63b77a3942efc699e15ea76d0ac8 Mon Sep 17 00:00:00 2001 From: Alex Close Date: Wed, 5 Apr 2023 14:11:00 +0100 Subject: [PATCH 44/80] Docs: Updated Grafana OSS Introduction (#66004) * Added Phlare and added static data sources to intro instead of it just being TSDB sources * Update docs/sources/introduction/_index.md Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com> * Update docs/sources/introduction/_index.md Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com> --------- Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com> --- docs/sources/introduction/_index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/sources/introduction/_index.md b/docs/sources/introduction/_index.md index f74466dd5a0..511c3f788d6 100644 --- a/docs/sources/introduction/_index.md +++ b/docs/sources/introduction/_index.md @@ -8,7 +8,7 @@ weight: 5 # Grafana OSS -[Grafana open source software](https://grafana.com/oss/) enables you to query, visualize, alert on, and explore your metrics, logs, and traces wherever they are stored. Grafana OSS provides you with tools to turn your time-series database (TSDB) data into insightful graphs and visualizations. +[Grafana open source software](https://grafana.com/oss/) enables you to query, visualize, alert on, and explore your metrics, logs, and traces wherever they are stored. Grafana OSS provides you with tools to turn your time-series database (TSDB) data into insightful graphs and visualizations. The Grafana OSS plugin framework also enables you to connect other data sources like NoSQL/SQL databases, ticketing tools like Jira or ServiceNow, and CI/CD tooling like GitLab. After you have [installed Grafana]({{< relref "../setup-grafana/installation/" >}}) and set up your first dashboard using instructions in [Getting started with Grafana]({{< relref "../getting-started/build-first-dashboard.md" >}}), you will have many options to choose from depending on your requirements. For example, if you want to view weather data and statistics about your smart home, then you can create a [playlist]({{< relref "../dashboards/create-manage-playlists/" >}}). If you are the administrator for an enterprise and are managing Grafana for multiple teams, then you can set up [provisioning]({{< relref "../administration/provisioning/" >}}) and [authentication]({{< relref "../setup-grafana/configure-security/configure-authentication/" >}}). @@ -71,3 +71,5 @@ In addition to Grafana, Grafana Labs also provides the following open source pro **Grafana Tempo:** Grafana Tempo is an open source, easy-to-use and high-volume distributed tracing backend. For more information, refer to [Grafana Tempo documentation](https://grafana.com/docs/tempo/latest/?pg=oss-tempo&plcmt=hero-txt/). **Grafana Mimir:** Grafana Mimir is an open source software project that provides a scalable long-term storage for Prometheus. For more information about Grafana Mimir, refer to [Grafana Mimir documentation](https://grafana.com/docs/mimir/latest/). + +**Grafana Phlare:** Grafana Phlare is an open-source software project for aggregating continuous profiling data. Continuous profiling is an observability signal that enables you to understand your workload's resource (CPU, memory, etc.) usage to the exact line number. For more information about using Grafana Phlare, refer to [Grafana Phlare documentation](https://grafana.com/docs/phlare/latest/). From 232834f455ea7390efb9c75a98f97cd0ba95788f Mon Sep 17 00:00:00 2001 From: Ezequiel Victorero Date: Wed, 5 Apr 2023 10:35:00 -0300 Subject: [PATCH 45/80] PublicDashboards: fix collapsed rows queries (#66014) --- .../publicdashboards/service/query.go | 22 +- .../publicdashboards/service/query_test.go | 222 ++++++++++++++++++ 2 files changed, 243 insertions(+), 1 deletion(-) diff --git a/pkg/services/publicdashboards/service/query.go b/pkg/services/publicdashboards/service/query.go index 35180debcfb..22c6fd4f96c 100644 --- a/pkg/services/publicdashboards/service/query.go +++ b/pkg/services/publicdashboards/service/query.go @@ -213,7 +213,10 @@ func getUniqueDashboardDatasourceUids(dashboard *simplejson.Json) []string { var datasourceUids []string exists := map[string]bool{} - for _, panelObj := range dashboard.Get("panels").MustArray() { + // collapsed rows contain panels in a nested structure, so we need to flatten them before calculate unique uids + flattenedPanels := getFlattenedPanels(dashboard) + + for _, panelObj := range flattenedPanels { panel := simplejson.NewFromAny(panelObj) uid := getDataSourceUidFromJson(panel) @@ -238,6 +241,23 @@ func getUniqueDashboardDatasourceUids(dashboard *simplejson.Json) []string { return datasourceUids } +func getFlattenedPanels(dashboard *simplejson.Json) []interface{} { + var flatPanels []interface{} + for _, panelObj := range dashboard.Get("panels").MustArray() { + panel := simplejson.NewFromAny(panelObj) + // if the panel is a row and it is collapsed, get the queries from the panels inside the row + // if it is not collapsed, the row does not have any panels + if panel.Get("type").MustString() == "row" { + if panel.Get("collapsed").MustBool() { + flatPanels = append(flatPanels, panel.Get("panels").MustArray()...) + } + } else { + flatPanels = append(flatPanels, panelObj) + } + } + return flatPanels +} + func groupQueriesByPanelId(dashboard *simplejson.Json) map[int64][]*simplejson.Json { result := make(map[int64][]*simplejson.Json) diff --git a/pkg/services/publicdashboards/service/query_test.go b/pkg/services/publicdashboards/service/query_test.go index 1d8ccf2e8bd..2dbd20ec3a8 100644 --- a/pkg/services/publicdashboards/service/query_test.go +++ b/pkg/services/publicdashboards/service/query_test.go @@ -432,6 +432,218 @@ const ( ], "schemaVersion": 35 }` + + dashboardWithCollapsedRows = ` +{ +"panels": [ + { + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 12, + "title": "Row title", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "qCbTUC37k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 1 + }, + "id": 11, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "qCbTUC37k" + }, + "editorMode": "builder", + "expr": "access_evaluation_duration_bucket", + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "Panel Title", + "type": "timeseries" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 9 + }, + "id": 10, + "panels": [ + { + "datasource": { + "type": "influxdb", + "uid": "P49A45DF074423DFB" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 10 + }, + "id": 8, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "9.4.0-pre", + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "P49A45DF074423DFB" + }, + "query": "// v.bucket, v.timeRangeStart, and v.timeRange stop are all variables supported by the flux plugin and influxdb\nfrom(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_value\"] >= 10 and r[\"_value\"] <= 20)", + "refId": "A" + } + ], + "title": "Panel Title", + "type": "timeseries" + } + ], + "title": "Row title 1", + "type": "row" + } + ] +}` ) func TestGetQueryDataResponse(t *testing.T) { @@ -951,6 +1163,16 @@ func TestGetUniqueDashboardDatasourceUids(t *testing.T) { uids := getUniqueDashboardDatasourceUids(json) require.Len(t, uids, 0) }) + + t.Run("can get unique datasource ids from dashboard with rows", func(t *testing.T) { + json, err := simplejson.NewJson([]byte(dashboardWithCollapsedRows)) + require.NoError(t, err) + + uids := getUniqueDashboardDatasourceUids(json) + require.Len(t, uids, 2) + require.Equal(t, "qCbTUC37k", uids[0]) + require.Equal(t, "P49A45DF074423DFB", uids[1]) + }) } func TestBuildMetricRequest(t *testing.T) { From 9041e7dfa6c316c7db71f6fba1845b94ad07fb50 Mon Sep 17 00:00:00 2001 From: Alexa V <239999+axelavargas@users.noreply.github.com> Date: Wed, 5 Apr 2023 15:44:43 +0200 Subject: [PATCH 46/80] Fix: DataLinks from data sources override user defined data link (#65996) Co-authored-by: Dominik Prokop --- .../src/field/fieldOverrides.test.ts | 118 ++++++++++++++++++ .../grafana-data/src/field/fieldOverrides.ts | 5 + 2 files changed, 123 insertions(+) diff --git a/packages/grafana-data/src/field/fieldOverrides.test.ts b/packages/grafana-data/src/field/fieldOverrides.test.ts index 1199f8118ff..c0295144ab1 100644 --- a/packages/grafana-data/src/field/fieldOverrides.test.ts +++ b/packages/grafana-data/src/field/fieldOverrides.test.ts @@ -415,6 +415,124 @@ describe('setFieldConfigDefaults', () => { } `); }); + + it('applies field config defaults correctly when links property exist in field config and no links are defined in panel', () => { + const dsFieldConfig: FieldConfig = { + links: [ + { + title: 'Google link', + url: 'https://google.com', + }, + ], + }; + + const panelFieldConfig: FieldConfig = {}; + + const context: FieldOverrideEnv = { + data: [], + field: { type: FieldType.number } as Field, + dataFrameIndex: 0, + fieldConfigRegistry: customFieldRegistry, + }; + + // we mutate dsFieldConfig + // @ts-ignore + setFieldConfigDefaults(dsFieldConfig, panelFieldConfig, context); + + expect(dsFieldConfig).toMatchInlineSnapshot(` + { + "custom": {}, + "links": [ + { + "title": "Google link", + "url": "https://google.com", + }, + ], + } + `); + }); + + it('applies field config defaults correctly when links property exist in panel config and no links are defined in ds field config', () => { + const dsFieldConfig: FieldConfig = {}; + + const panelFieldConfig: FieldConfig = { + links: [ + { + title: 'Google link', + url: 'https://google.com', + }, + ], + }; + + const context: FieldOverrideEnv = { + data: [], + field: { type: FieldType.number } as Field, + dataFrameIndex: 0, + fieldConfigRegistry: customFieldRegistry, + }; + + // we mutate dsFieldConfig + // @ts-ignore + setFieldConfigDefaults(dsFieldConfig, panelFieldConfig, context); + + expect(dsFieldConfig).toMatchInlineSnapshot(` + { + "custom": {}, + "links": [ + { + "title": "Google link", + "url": "https://google.com", + }, + ], + } + `); + }); + + it('applies a merge strategy for links when they exist in ds config and panel', () => { + const dsFieldConfig: FieldConfig = { + links: [ + { + title: 'Google link', + url: 'https://google.com', + }, + ], + }; + + const panelFieldConfig: FieldConfig = { + links: [ + { + title: 'Grafana', + url: 'https://grafana.com', + }, + ], + }; + + const context: FieldOverrideEnv = { + data: [], + field: { type: FieldType.number } as Field, + dataFrameIndex: 0, + fieldConfigRegistry: customFieldRegistry, + }; + + // we mutate dsFieldConfig + setFieldConfigDefaults(dsFieldConfig, panelFieldConfig, context); + + expect(dsFieldConfig).toMatchInlineSnapshot(` + { + "custom": {}, + "links": [ + { + "title": "Google link", + "url": "https://google.com", + }, + { + "title": "Grafana", + "url": "https://grafana.com", + }, + ], + } + `); + }); }); describe('setDynamicConfigValue', () => { diff --git a/packages/grafana-data/src/field/fieldOverrides.ts b/packages/grafana-data/src/field/fieldOverrides.ts index 08bc0c63d43..f3b248a5000 100644 --- a/packages/grafana-data/src/field/fieldOverrides.ts +++ b/packages/grafana-data/src/field/fieldOverrides.ts @@ -289,6 +289,11 @@ export function setDynamicConfigValue(config: FieldConfig, value: DynamicConfigV // config -> from DS // defaults -> from Panel config export function setFieldConfigDefaults(config: FieldConfig, defaults: FieldConfig, context: FieldOverrideEnv) { + // For cases where we have links on the datasource config and the panel config, we need to merge them + if (config.links && defaults.links) { + // Combine the data source links and the panel default config links + config.links = [...config.links, ...defaults.links]; + } for (const fieldConfigProperty of context.fieldConfigRegistry.list()) { if (fieldConfigProperty.isCustom && !config.custom) { config.custom = {}; From 8dded022ecf672578fafb36ed809516bbaedfb25 Mon Sep 17 00:00:00 2001 From: Kristina Date: Wed, 5 Apr 2023 09:08:03 -0500 Subject: [PATCH 47/80] Explore: Run test datasource default selection when mounted (#65864) * Run test datasource query when mounted * Auto running test-datasource creates more query history entries * Make exemplar query intercept more robust * Delete unrelated query history queries * Revert "Run test datasource query when mounted" This reverts commit 28b37e4df9cb31774cc2c3db930fafc495fac61a. * Add default query to testdata and grafana datasources --- e2e/various-suite/exemplars.spec.ts | 10 +++++----- e2e/various-suite/explore.spec.ts | 8 ++++++++ public/app/plugins/datasource/grafana/datasource.ts | 6 ++++++ public/app/plugins/datasource/testdata/datasource.ts | 7 +++++++ 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/e2e/various-suite/exemplars.spec.ts b/e2e/various-suite/exemplars.spec.ts index fa07c4755d6..164296d70e0 100644 --- a/e2e/various-suite/exemplars.spec.ts +++ b/e2e/various-suite/exemplars.spec.ts @@ -32,14 +32,14 @@ describe('Exemplars', () => { }); it('should be able to navigate to configured data source', () => { - let intercept = 'prometheus'; e2e().intercept('/api/ds/query', (req) => { - if (intercept === 'prometheus') { - // For second intercept, we want to send tempo response - intercept = 'tempo'; + const datasourceType = req.body.queries[0].datasource.type; + if (datasourceType === 'prometheus') { req.reply({ fixture: 'exemplars-query-response.json' }); - } else { + } else if (datasourceType === 'tempo') { req.reply({ fixture: 'tempo-response.json' }); + } else { + req.reply({}); } }); diff --git a/e2e/various-suite/explore.spec.ts b/e2e/various-suite/explore.spec.ts index 8ba2fede78e..d81db71fce0 100644 --- a/e2e/various-suite/explore.spec.ts +++ b/e2e/various-suite/explore.spec.ts @@ -11,7 +11,15 @@ e2e.scenario({ e2e.pages.Explore.General.container().should('have.length', 1); e2e.components.RefreshPicker.runButtonV2().should('have.length', 1); + // delete query history queries that would be unrelated + e2e.components.QueryTab.queryHistoryButton().should('be.visible').click(); + cy.get('button[title="Delete query"]').each((button) => { + button.trigger('click'); + }); + e2e.components.QueryTab.queryHistoryButton().should('be.visible').click(); + e2e.components.DataSource.TestData.QueryTab.scenarioSelectContainer() + .scrollIntoView() .should('be.visible') .within(() => { e2e().get('input[id*="test-data-scenario-select-"]').should('be.visible').click(); diff --git a/public/app/plugins/datasource/grafana/datasource.ts b/public/app/plugins/datasource/grafana/datasource.ts index b2e4c76470f..7bf84b28cb1 100644 --- a/public/app/plugins/datasource/grafana/datasource.ts +++ b/public/app/plugins/datasource/grafana/datasource.ts @@ -66,6 +66,12 @@ export class GrafanaDatasource extends DataSourceWithBackend { }; } + getDefaultQuery(): Partial { + return { + queryType: GrafanaQueryType.RandomWalk, + }; + } + query(request: DataQueryRequest): Observable { const results: Array> = []; const targets: GrafanaQuery[] = []; diff --git a/public/app/plugins/datasource/testdata/datasource.ts b/public/app/plugins/datasource/testdata/datasource.ts index 4fa1f70ba87..c662332e9ee 100644 --- a/public/app/plugins/datasource/testdata/datasource.ts +++ b/public/app/plugins/datasource/testdata/datasource.ts @@ -37,6 +37,13 @@ export class TestDataDataSource extends DataSourceWithBackend { this.variables = new TestDataVariableSupport(); } + getDefaultQuery(): Partial { + return { + scenarioId: TestDataQueryType.RandomWalk, + seriesCount: 1, + }; + } + query(options: DataQueryRequest): Observable { const backendQueries: TestData[] = []; const streams: Array> = []; From 7cd601825349c0ed782acc21a53659dfd72c7eb0 Mon Sep 17 00:00:00 2001 From: Karl Persson Date: Wed, 5 Apr 2023 17:24:06 +0200 Subject: [PATCH 48/80] GenericOAuth: Set sub as auth id (#65902) * GenericOAuth: Set sud as auth id * GenericOAuth: Extract function to reduce complexity --- pkg/login/social/generic_oauth.go | 52 +++++++++++++++++++------------ 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/pkg/login/social/generic_oauth.go b/pkg/login/social/generic_oauth.go index 3eb9e76490e..637d0b6f765 100644 --- a/pkg/login/social/generic_oauth.go +++ b/pkg/login/social/generic_oauth.go @@ -76,6 +76,7 @@ func (s *SocialGenericOAuth) IsOrganizationMember(client *http.Client) bool { } type UserInfoJson struct { + Sub string `json:"sub"` Name string `json:"name"` DisplayName string `json:"display_name"` Login string `json:"login"` @@ -108,31 +109,16 @@ func (s *SocialGenericOAuth) UserInfo(client *http.Client, token *oauth2.Token) for _, data := range toCheck { s.log.Debug("Processing external user info", "source", data.source, "data", data) + if userInfo.Id == "" { + userInfo.Id = data.Sub + } + if userInfo.Name == "" { userInfo.Name = s.extractUserName(data) } if userInfo.Login == "" { - if data.Login != "" { - s.log.Debug("Setting user info login from login field", "login", data.Login) - userInfo.Login = data.Login - } else { - if s.loginAttributePath != "" { - s.log.Debug("Searching for login among JSON", "loginAttributePath", s.loginAttributePath) - login, err := s.searchJSONForStringAttr(s.loginAttributePath, data.rawJSON) - if err != nil { - s.log.Error("Failed to search JSON for login attribute", "error", err) - } else if login != "" { - userInfo.Login = login - s.log.Debug("Setting user info login from login field", "login", login) - } - } - - if userInfo.Login == "" && data.Username != "" { - s.log.Debug("Setting user info login from username field", "username", data.Username) - userInfo.Login = data.Username - } - } + userInfo.Login = s.extractLogin(data) } if userInfo.Email == "" { @@ -338,6 +324,32 @@ func (s *SocialGenericOAuth) extractEmail(data *UserInfoJson) string { return "" } +func (s *SocialGenericOAuth) extractLogin(data *UserInfoJson) string { + if data.Login != "" { + s.log.Debug("Setting user info login from login field", "login", data.Login) + return data.Login + } + + if s.loginAttributePath != "" { + s.log.Debug("Searching for login among JSON", "loginAttributePath", s.loginAttributePath) + login, err := s.searchJSONForStringAttr(s.loginAttributePath, data.rawJSON) + if err != nil { + s.log.Error("Failed to search JSON for login attribute", "error", err) + } + + if login != "" { + return login + } + } + + if data.Username != "" { + s.log.Debug("Setting user info login from username field", "username", data.Username) + return data.Username + } + + return "" +} + func (s *SocialGenericOAuth) extractUserName(data *UserInfoJson) string { if s.nameAttributePath != "" { name, err := s.searchJSONForStringAttr(s.nameAttributePath, data.rawJSON) From a378e3425049ce01954b60e7e06a62fed5bca25e Mon Sep 17 00:00:00 2001 From: Isabel <76437239+imatwawana@users.noreply.github.com> Date: Wed, 5 Apr 2023 11:41:47 -0400 Subject: [PATCH 49/80] fixe broken data source tables (#66042) fixed tables --- docs/sources/datasources/influxdb/_index.md | 13 ++--- docs/sources/datasources/prometheus/_index.md | 56 +++++++++---------- docs/sources/datasources/tempo/_index.md | 15 +++-- docs/sources/datasources/testdata/_index.md | 7 +-- docs/sources/datasources/zipkin/_index.md | 15 +++-- 5 files changed, 50 insertions(+), 56 deletions(-) diff --git a/docs/sources/datasources/influxdb/_index.md b/docs/sources/datasources/influxdb/_index.md index 95e7a04ebef..11a5fb064cc 100644 --- a/docs/sources/datasources/influxdb/_index.md +++ b/docs/sources/datasources/influxdb/_index.md @@ -41,14 +41,13 @@ To configure basic settings for the data source, complete the following steps: 1. Set the data source's basic configuration options carefully: - | Name | Description | - + | Name | Description | | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | - | **Name** | Sets the name you use to refer to the data source in panels and queries. We recommend something like `InfluxDB-InfluxQL`. | - | **Default** | Sets whether the data source is pre-selected for new panels. | - | **URL** | The HTTP protocol, IP address, and port of your InfluxDB API. InfluxDB's default API port is 8086. | - | **Min time interval** | _(Optional)_ Refer to [Min time interval]({{< relref "#configure-min-time-interval" >}}). | - | **Max series** | _(Optional)_ Limits the number of series and tables that Grafana processes. Lower this number to prevent abuse, and increase it if you have many small time series and not all are shown. Defaults to 1,000. | + | **Name** | Sets the name you use to refer to the data source in panels and queries. We recommend something like `InfluxDB-InfluxQL`. | + | **Default** | Sets whether the data source is pre-selected for new panels. | + | **URL** | The HTTP protocol, IP address, and port of your InfluxDB API. InfluxDB's default API port is 8086. | + | **Min time interval** | _(Optional)_ Refer to [Min time interval]({{< relref "#configure-min-time-interval" >}}). | + | **Max series** | _(Optional)_ Limits the number of series and tables that Grafana processes. Lower this number to prevent abuse, and increase it if you have many small time series and not all are shown. Defaults to 1,000. | You can also configure settings specific to the InfluxDB data source. These options are described in the sections below. diff --git a/docs/sources/datasources/prometheus/_index.md b/docs/sources/datasources/prometheus/_index.md index 4e51f5f0a0d..04a414ffd41 100644 --- a/docs/sources/datasources/prometheus/_index.md +++ b/docs/sources/datasources/prometheus/_index.md @@ -45,40 +45,38 @@ To configure basic settings for the data source, complete the following steps: 1. Set the data source's basic configuration options: - | Name | Description | - + | Name | Description | | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | `Name` | The data source name. This is how you refer to the data source in panels and queries. | - | `Default` | Default data source that is pre-selected for new panels. | - | `URL` | The URL of your Prometheus server, for example, `http://prometheus.example.org:9090`. | - | `Access` | Only Server access mode is functional. If Server mode is already selected this option is hidden. Otherwise change to Server mode to prevent errors. | - | `Basic Auth` | Enable basic authentication to the Prometheus data source. | - | `User` | User name for basic authentication. | - | `Password` | Password for basic authentication. | - | `Manage alerts via Alerting UI` | Toggle whether to enable Alertmanager integration for this data source. | - | `Scrape interval` | Set this to the typical scrape and evaluation interval configured in Prometheus. Defaults to 15s. | - | `HTTP method` | Use either POST or GET HTTP method to query your data source. POST is the recommended and pre-selected method as it allows bigger queries. Change this to GET if you have a Prometheus version older than 2.1 or if POST requests are restricted in your network. | - | `Type` | The type of your Prometheus server; `Prometheus`, `Cortex`, `Thanos`, `Mimir`. When selected, the **Version** field attempts to populate automatically using the Prometheus [buildinfo](https://semver.org/) API. Some Prometheus types, such as Cortex, don't support this API and must be manually populated. | - | `Version` | The version of your Prometheus server, note that this field is not visible until the Prometheus type is selected. | - | `Disable metrics lookup` | Checking this option will disable the metrics chooser and metric/label support in the query field's autocomplete. This helps if you have performance issues with bigger Prometheus instances. | - | `Custom query parameters` | Add custom parameters to the Prometheus query URL. For example `timeout`, `partial_response`, `dedup`, or `max_source_resolution`. Multiple parameters should be concatenated together with an '&'. | - | **Exemplars configuration** | | - | `Internal link` | Enable this option is you have an internal link. When you enable this option, you will see a data source selector. Select the backend tracing data store for your exemplar data. | - | `Data source` | You will see this option only if you enable `Internal link` option. Select the backend tracing data store for your exemplar data. | - | `URL` | You will see this option only if the `Internal link` option is disabled. Enter the full URL of the external link. You can interpolate the value from the field with `${__value.raw }` macro. | - | `URL Label` | (Optional) add a custom display label to override the value of the `Label name` field. | - | `Label name` | Add a name for the exemplar traceID property. | + | `Name` | The data source name. This is how you refer to the data source in panels and queries. | + | `Default` | Default data source that is pre-selected for new panels. | + | `URL` | The URL of your Prometheus server, for example, `http://prometheus.example.org:9090`. | + | `Access` | Only Server access mode is functional. If Server mode is already selected this option is hidden. Otherwise change to Server mode to prevent errors. | + | `Basic Auth` | Enable basic authentication to the Prometheus data source. | + | `User` | User name for basic authentication. | + | `Password` | Password for basic authentication. | + | `Manage alerts via Alerting UI` | Toggle whether to enable Alertmanager integration for this data source. | + | `Scrape interval` | Set this to the typical scrape and evaluation interval configured in Prometheus. Defaults to 15s. | + | `HTTP method` | Use either POST or GET HTTP method to query your data source. POST is the recommended and pre-selected method as it allows bigger queries. Change this to GET if you have a Prometheus version older than 2.1 or if POST requests are restricted in your network. | + | `Type` | The type of your Prometheus server; `Prometheus`, `Cortex`, `Thanos`, `Mimir`. When selected, the **Version** field attempts to populate automatically using the Prometheus [buildinfo](https://semver.org/) API. Some Prometheus types, such as Cortex, don't support this API and must be manually populated. | + | `Version` | The version of your Prometheus server, note that this field is not visible until the Prometheus type is selected. | + | `Disable metrics lookup` | Checking this option will disable the metrics chooser and metric/label support in the query field's autocomplete. This helps if you have performance issues with bigger Prometheus instances. | + | `Custom query parameters` | Add custom parameters to the Prometheus query URL. For example `timeout`, `partial_response`, `dedup`, or `max_source_resolution`. Multiple parameters should be concatenated together with an '&'. | + | **Exemplars configuration** | | + | `Internal link` | Enable this option is you have an internal link. When you enable this option, you will see a data source selector. Select the backend tracing data store for your exemplar data. | + | `Data source` | You will see this option only if you enable `Internal link` option. Select the backend tracing data store for your exemplar data. | + | `URL` | You will see this option only if the `Internal link` option is disabled. Enter the full URL of the external link. You can interpolate the value from the field with `${__value.raw }` macro. | + | `URL Label` | (Optional) add a custom display label to override the value of the `Label name` field. | + | `Label name` | Add a name for the exemplar traceID property. | **Exemplars configuration:** - | Name | Description | - + | Name | Description | | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | **Internal link** | Enable this option if you have an internal link. When enabled, this reveals the data source selector. Select the backend tracing data store for your exemplar data. | - | **Data source** | _(Visible only if you enable `Internal link`)_ Selects the backend tracing data store for your exemplar data. | - | **URL** | _(Visible only if you disable `Internal link`)_ Defines the external link's full URL. You can interpolate the value from the field by using the [`${__value.raw}` macro]({{< relref "../..//panels-visualizations/configure-data-links/#value-variables" >}}). | - | **URL label** | _(Optional)_ Adds a custom display label to override the value of the `Label name` field. | - | **Label name** | Adds a name for the exemplar traceID property. | + | **Internal link** | Enable this option if you have an internal link. When enabled, this reveals the data source selector. Select the backend tracing data store for your exemplar data. | + | **Data source** | _(Visible only if you enable `Internal link`)_ Selects the backend tracing data store for your exemplar data. | + | **URL** | _(Visible only if you disable `Internal link`)_ Defines the external link's full URL. You can interpolate the value from the field by using the [`${__value.raw}` macro]({{< relref "../..//panels-visualizations/configure-data-links/#value-variables" >}}). | + | **URL label** | _(Optional)_ Adds a custom display label to override the value of the `Label name` field. | + | **Label name** | Adds a name for the exemplar traceID property. | ### Provision the data source diff --git a/docs/sources/datasources/tempo/_index.md b/docs/sources/datasources/tempo/_index.md index be7cedffa78..04d88ac61da 100644 --- a/docs/sources/datasources/tempo/_index.md +++ b/docs/sources/datasources/tempo/_index.md @@ -38,15 +38,14 @@ To configure basic settings for the data source, complete the following steps: 1. Set the data source's basic configuration options: - | Name | Description | - + | Name | Description | | -------------- | ------------------------------------------------------------------------ | - | **Name** | Sets the name you use to refer to the data source in panels and queries. | - | **Default** | Sets the data source that's pre-selected for new panels. | - | **URL** | Sets the URL of the Tempo instance, such as `http://tempo`. | - | **Basic Auth** | Enables basic authentication to the Tempo data source. | - | **User** | Sets the user name for basic authentication. | - | **Password** | Sets the password for basic authentication. | + | **Name** | Sets the name you use to refer to the data source in panels and queries. | + | **Default** | Sets the data source that's pre-selected for new panels. | + | **URL** | Sets the URL of the Tempo instance, such as `http://tempo`. | + | **Basic Auth** | Enables basic authentication to the Tempo data source. | + | **User** | Sets the user name for basic authentication. | + | **Password** | Sets the password for basic authentication. | You can also configure settings specific to the Tempo data source. These options are described in the sections below. diff --git a/docs/sources/datasources/testdata/_index.md b/docs/sources/datasources/testdata/_index.md index 27b42124717..ad3c17bc64b 100644 --- a/docs/sources/datasources/testdata/_index.md +++ b/docs/sources/datasources/testdata/_index.md @@ -33,11 +33,10 @@ To configure basic settings for the data source, complete the following steps: The **Settings** tab of the data source is displayed. The data source doesn't provide any settings beyond the most basic options common to all data sources: - | Name | Description | - + | Name | Description | | ----------- | ------------------------------------------------------------------------ | - | **Name** | Sets the name you use to refer to the data source in panels and queries. | - | **Default** | Defines whether this data source is pre-selected for new panels. | + | **Name** | Sets the name you use to refer to the data source in panels and queries. | + | **Default** | Defines whether this data source is pre-selected for new panels. | ## Create mock data diff --git a/docs/sources/datasources/zipkin/_index.md b/docs/sources/datasources/zipkin/_index.md index 0a02fe196c8..c3cb2878c66 100644 --- a/docs/sources/datasources/zipkin/_index.md +++ b/docs/sources/datasources/zipkin/_index.md @@ -38,15 +38,14 @@ To configure basic settings for the data source, complete the following steps: 1. Set the data source's basic configuration options: - | Name | Description | - + | Name | Description | | -------------- | ------------------------------------------------------------------------ | - | **Name** | Sets the name you use to refer to the data source in panels and queries. | - | **Default** | Defines whether this data source is pre-selected for new panels. | - | **URL** | Sets the URL of the Zipkin instance, such as `http://localhost:9411`. | - | **Basic Auth** | Enables basic authentication for the Zipkin data source. | - | **User** | Defines the user name for basic authentication. | - | **Password** | Defines the password for basic authentication. | + | **Name** | Sets the name you use to refer to the data source in panels and queries. | + | **Default** | Defines whether this data source is pre-selected for new panels. | + | **URL** | Sets the URL of the Zipkin instance, such as `http://localhost:9411`. | + | **Basic Auth** | Enables basic authentication for the Zipkin data source. | + | **User** | Defines the user name for basic authentication. | + | **Password** | Defines the password for basic authentication. | ### Trace to logs From 7e312a6aa644dafd38bb323557ffc6fa06b1b122 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Wed, 5 Apr 2023 09:09:52 -0700 Subject: [PATCH 50/80] TrendPanel: use isLikelyAscendingVector rather than brute force (#65977) use likely frames --- public/app/plugins/panel/trend/TrendPanel.tsx | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/public/app/plugins/panel/trend/TrendPanel.tsx b/public/app/plugins/panel/trend/TrendPanel.tsx index f899555ff06..adafb81efa1 100644 --- a/public/app/plugins/panel/trend/TrendPanel.tsx +++ b/public/app/plugins/panel/trend/TrendPanel.tsx @@ -1,6 +1,7 @@ import React, { useMemo } from 'react'; import { FieldType, PanelProps } from '@grafana/data'; +import { isLikelyAscendingVector } from '@grafana/data/src/transformations/transformers/joinDataFrames'; import { config, PanelDataErrorView } from '@grafana/runtime'; import { KeyboardPlugin, TimeSeries, TooltipDisplayMode, TooltipPlugin, usePanelContext } from '@grafana/ui'; import { findFieldIndex } from 'app/features/dimensions'; @@ -56,20 +57,11 @@ export const TrendPanel = ({ // Make sure values are ascending if (xFieldIdx != null) { const field = frames[0].fields[xFieldIdx]; - if (field.type === FieldType.number) { - // we may support ordinal soon - let last = Number.NEGATIVE_INFINITY; - const values = field.values.toArray(); - for (let i = 0; i < values.length; i++) { - const v = values[i]; - if (last > v) { - return { - warning: `Values must be in ascending order (index: ${i}, ${last} > ${v})`, - frames, - }; - } - last = v; - } + if (field.type === FieldType.number && !isLikelyAscendingVector(field.values)) { + return { + warning: `Values must be in ascending order`, + frames, + }; } } From abc11d1dcf719b6a67f9f8f305554de234a878ce Mon Sep 17 00:00:00 2001 From: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> Date: Wed, 5 Apr 2023 18:32:02 +0200 Subject: [PATCH 51/80] Elasticsearch: Run log context queries through backend (#65805) * Elasticsearch: Run context queries trough backend * Fix typing * Update * Add possibility to run context query torugh backend and frontend * Correctly sort --- .../elasticsearch/client/search_request.go | 27 +- .../client/search_request_test.go | 2 +- pkg/tsdb/elasticsearch/data_query.go | 20 +- pkg/tsdb/elasticsearch/data_query_test.go | 19 ++ .../datasource/elasticsearch/IndexPattern.ts | 3 +- .../datasource/elasticsearch/datasource.ts | 263 ++++++++++++++---- .../plugins/datasource/elasticsearch/types.ts | 13 + 7 files changed, 281 insertions(+), 66 deletions(-) diff --git a/pkg/tsdb/elasticsearch/client/search_request.go b/pkg/tsdb/elasticsearch/client/search_request.go index dd7f8642d37..d267210f103 100644 --- a/pkg/tsdb/elasticsearch/client/search_request.go +++ b/pkg/tsdb/elasticsearch/client/search_request.go @@ -73,10 +73,21 @@ func (b *SearchRequestBuilder) Size(size int) *SearchRequestBuilder { return b } -// SortDesc adds a sort to the search request -func (b *SearchRequestBuilder) SortDesc(field, unmappedType string) *SearchRequestBuilder { +type SortOrder string + +const ( + SortOrderAsc SortOrder = "asc" + SortOrderDesc SortOrder = "desc" +) + +// Sort adds a "asc" | "desc" sort to the search request +func (b *SearchRequestBuilder) Sort(order SortOrder, field string, unmappedType string) *SearchRequestBuilder { + if order != SortOrderAsc && order != SortOrderDesc { + return b + } + props := map[string]string{ - "order": "desc", + "order": string(order), } if unmappedType != "" { @@ -110,6 +121,16 @@ func (b *SearchRequestBuilder) AddHighlight() *SearchRequestBuilder { return b } +func (b *SearchRequestBuilder) AddSearchAfter(value interface{}) *SearchRequestBuilder { + if b.customProps["search_after"] == nil { + b.customProps["search_after"] = []interface{}{value} + } else { + b.customProps["search_after"] = append(b.customProps["search_after"].([]interface{}), value) + } + + return b +} + // Query creates and return a query builder func (b *SearchRequestBuilder) Query() *QueryBuilder { if b.queryBuilder == nil { diff --git a/pkg/tsdb/elasticsearch/client/search_request_test.go b/pkg/tsdb/elasticsearch/client/search_request_test.go index f3f1601c9a1..f89b4ccd0ed 100644 --- a/pkg/tsdb/elasticsearch/client/search_request_test.go +++ b/pkg/tsdb/elasticsearch/client/search_request_test.go @@ -45,7 +45,7 @@ func TestSearchRequest(t *testing.T) { t.Run("When adding size, sort, filters", func(t *testing.T) { b := setup() b.Size(200) - b.SortDesc(timeField, "boolean") + b.Sort(SortOrderDesc, timeField, "boolean") filters := b.Query().Bool().Filter() filters.AddDateRangeFilter(timeField, 10, 5, DateFormatEpochMS) filters.AddQueryStringFilter("test", true) diff --git a/pkg/tsdb/elasticsearch/data_query.go b/pkg/tsdb/elasticsearch/data_query.go index 0d4653ab80a..f725ce441b6 100644 --- a/pkg/tsdb/elasticsearch/data_query.go +++ b/pkg/tsdb/elasticsearch/data_query.go @@ -317,12 +317,24 @@ func isRawDocumentQuery(query *Query) bool { func processLogsQuery(q *Query, b *es.SearchRequestBuilder, from, to int64, defaultTimeField string) { metric := q.Metrics[0] - b.SortDesc(defaultTimeField, "boolean") - b.SortDesc("_doc", "") + sort := es.SortOrderDesc + if metric.Settings.Get("sortDirection").MustString() == "asc" { + // This is currently used only for log context query + sort = es.SortOrderAsc + } + b.Sort(sort, defaultTimeField, "boolean") + b.Sort(sort, "_doc", "") b.AddDocValueField(defaultTimeField) b.Size(stringToIntWithDefaultValue(metric.Settings.Get("limit").MustString(), defaultSize)) b.AddHighlight() + // This is currently used only for log context query to get + // log lines before and after the selected log line + searchAfter := metric.Settings.Get("searchAfter").MustArray() + for _, value := range searchAfter { + b.AddSearchAfter(value) + } + // For log query, we add a date histogram aggregation aggBuilder := b.Agg() q.BucketAggs = append(q.BucketAggs, &BucketAgg{ @@ -342,8 +354,8 @@ func processLogsQuery(q *Query, b *es.SearchRequestBuilder, from, to int64, defa func processDocumentQuery(q *Query, b *es.SearchRequestBuilder, from, to int64, defaultTimeField string) { metric := q.Metrics[0] - b.SortDesc(defaultTimeField, "boolean") - b.SortDesc("_doc", "") + b.Sort(es.SortOrderDesc, defaultTimeField, "boolean") + b.Sort(es.SortOrderDesc, "_doc", "") b.AddDocValueField(defaultTimeField) b.Size(stringToIntWithDefaultValue(metric.Settings.Get("size").MustString(), defaultSize)) } diff --git a/pkg/tsdb/elasticsearch/data_query_test.go b/pkg/tsdb/elasticsearch/data_query_test.go index 478ae5feab2..f43f05d8430 100644 --- a/pkg/tsdb/elasticsearch/data_query_test.go +++ b/pkg/tsdb/elasticsearch/data_query_test.go @@ -1354,6 +1354,25 @@ func TestExecuteElasticsearchDataQuery(t *testing.T) { }) }) + t.Run("With log context query with sortDirection and searchAfter should return correct query", func(t *testing.T) { + c := newFakeClient() + _, err := executeElasticsearchDataQuery(c, `{ + "metrics": [{ "type": "logs", "id": "1", "settings": { "limit": "1000", "sortDirection": "asc", "searchAfter": [1, "2"] }}] + }`, from, to) + require.NoError(t, err) + sr := c.multisearchRequests[0].Requests[0] + require.Equal(t, sr.Sort["@timestamp"], map[string]string{"order": "asc", "unmapped_type": "boolean"}) + require.Equal(t, sr.Sort["_doc"], map[string]string{"order": "asc"}) + + searchAfter := sr.CustomProps["search_after"].([]interface{}) + firstSearchAfter, err := searchAfter[0].(json.Number).Int64() + require.NoError(t, err) + require.Equal(t, firstSearchAfter, int64(1)) + secondSearchAfter := searchAfter[1].(string) + require.NoError(t, err) + require.Equal(t, secondSearchAfter, "2") + }) + t.Run("With invalid query should return error", (func(t *testing.T) { c := newFakeClient() _, err := executeElasticsearchDataQuery(c, `{ diff --git a/public/app/plugins/datasource/elasticsearch/IndexPattern.ts b/public/app/plugins/datasource/elasticsearch/IndexPattern.ts index bc95849a9fa..4f8b1221c4d 100644 --- a/public/app/plugins/datasource/elasticsearch/IndexPattern.ts +++ b/public/app/plugins/datasource/elasticsearch/IndexPattern.ts @@ -10,7 +10,7 @@ type IntervalMap = Record< } >; -const intervalMap: IntervalMap = { +export const intervalMap: IntervalMap = { Hourly: { startOf: 'hour', amount: 'hours' }, Daily: { startOf: 'day', amount: 'days' }, Weekly: { startOf: 'isoWeek', amount: 'weeks' }, @@ -36,6 +36,7 @@ export class IndexPattern { // for the provided index pattern. // This is useful when requesting log context where the only time data we have is the log // timestamp. + // TODO: Remove when enableBackendMigration toggle is removed const indexOffset = 7; if (!this.interval) { return this.pattern; diff --git a/public/app/plugins/datasource/elasticsearch/datasource.ts b/public/app/plugins/datasource/elasticsearch/datasource.ts index 7743e324c1e..cfb9395df41 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.ts +++ b/public/app/plugins/datasource/elasticsearch/datasource.ts @@ -1,6 +1,6 @@ import { cloneDeep, find, first as _first, isNumber, isObject, isString, map as _map } from 'lodash'; import { generate, lastValueFrom, Observable, of, throwError } from 'rxjs'; -import { catchError, first, map, mergeMap, skipWhile, throwIfEmpty, tap } from 'rxjs/operators'; +import { catchError, first, map, mergeMap, skipWhile, throwIfEmpty, tap, switchMap } from 'rxjs/operators'; import { SemVer } from 'semver'; import { @@ -14,7 +14,6 @@ import { DataSourceWithSupplementaryQueriesSupport, DateTime, dateTime, - Field, getDefaultTimeRange, AbstractQuery, LogLevel, @@ -26,6 +25,12 @@ import { QueryFixAction, CoreApp, SupplementaryQueryType, + DataQueryError, + FieldCache, + FieldType, + rangeUtil, + Field, + sortDataFrame, } from '@grafana/data'; import { BackendSrvRequest, DataSourceWithBackend, getBackendSrv, getDataSourceSrv, config } from '@grafana/runtime'; import { queryLogsVolume } from 'app/core/logsModel'; @@ -36,7 +41,7 @@ import { RowContextOptions } from '../../../features/logs/components/LogRowConte import { getLogLevelFromKey } from '../../../features/logs/utils'; import { ElasticResponse } from './ElasticResponse'; -import { IndexPattern } from './IndexPattern'; +import { IndexPattern, intervalMap } from './IndexPattern'; import LanguageProvider from './LanguageProvider'; import { ElasticQueryBuilder } from './QueryBuilder'; import { ElasticsearchAnnotationsQueryEditor } from './components/QueryEditor/AnnotationQueryEditor'; @@ -49,7 +54,15 @@ import { import { metricAggregationConfig } from './components/QueryEditor/MetricAggregationsEditor/utils'; import { defaultBucketAgg, hasMetricOfType } from './queryDef'; import { trackQuery } from './tracking'; -import { Logs, BucketAggregation, DataLinkConfig, ElasticsearchOptions, ElasticsearchQuery, TermsQuery } from './types'; +import { + Logs, + BucketAggregation, + DataLinkConfig, + ElasticsearchOptions, + ElasticsearchQuery, + TermsQuery, + Interval, +} from './types'; import { getScriptValue, isSupportedVersion, unsupportedVersionMessage } from './utils'; export const REF_ID_STARTER_LOG_VOLUME = 'log-volume-'; @@ -85,6 +98,7 @@ export class ElasticDatasource maxConcurrentShardRequests?: number; queryBuilder: ElasticQueryBuilder; indexPattern: IndexPattern; + intervalPattern?: Interval; logMessageField?: string; logLevelField?: string; dataLinks: DataLinkConfig[]; @@ -110,6 +124,7 @@ export class ElasticDatasource this.timeField = settingsData.timeField; this.xpack = Boolean(settingsData.xpack); this.indexPattern = new IndexPattern(this.index, settingsData.interval); + this.intervalPattern = settingsData.interval; this.interval = settingsData.timeInterval; this.maxConcurrentShardRequests = settingsData.maxConcurrentShardRequests; this.queryBuilder = new ElasticQueryBuilder({ @@ -486,65 +501,86 @@ export class ElasticDatasource } getLogRowContext = async (row: LogRowModel, options?: RowContextOptions): Promise<{ data: DataFrame[] }> => { - const sortField = row.dataFrame.fields.find((f) => f.name === 'sort'); - const searchAfter = sortField?.values.get(row.rowIndex) || [row.timeEpochMs]; - const sort = options?.direction === 'FORWARD' ? 'asc' : 'desc'; + const { disableElasticsearchBackendExploreQuery, elasticsearchBackendMigration } = config.featureToggles; + if (!disableElasticsearchBackendExploreQuery || elasticsearchBackendMigration) { + const contextRequest = this.makeLogContextDataRequest(row, options); - const header = - options?.direction === 'FORWARD' - ? this.getQueryHeader('query_then_fetch', dateTime(row.timeEpochMs)) - : this.getQueryHeader('query_then_fetch', undefined, dateTime(row.timeEpochMs)); + return lastValueFrom( + this.query(contextRequest).pipe( + catchError((err) => { + const error: DataQueryError = { + message: 'Error during context query. Please check JS console logs.', + status: err.status, + statusText: err.statusText, + }; + throw error; + }), + switchMap((res) => { + return of(processToLogContextDataFrames(res)); + }) + ) + ); + } else { + const sortField = row.dataFrame.fields.find((f) => f.name === 'sort'); + const searchAfter = sortField?.values.get(row.rowIndex) || [row.timeEpochMs]; + const sort = options?.direction === 'FORWARD' ? 'asc' : 'desc'; - const limit = options?.limit ?? 10; - const esQuery = JSON.stringify({ - size: limit, - query: { - bool: { - filter: [ - { - range: { - [this.timeField]: { - [options?.direction === 'FORWARD' ? 'gte' : 'lte']: row.timeEpochMs, - format: 'epoch_millis', + const header = + options?.direction === 'FORWARD' + ? this.getQueryHeader('query_then_fetch', dateTime(row.timeEpochMs)) + : this.getQueryHeader('query_then_fetch', undefined, dateTime(row.timeEpochMs)); + + const limit = options?.limit ?? 10; + const esQuery = JSON.stringify({ + size: limit, + query: { + bool: { + filter: [ + { + range: { + [this.timeField]: { + [options?.direction === 'FORWARD' ? 'gte' : 'lte']: row.timeEpochMs, + format: 'epoch_millis', + }, }, }, + ], + }, + }, + sort: [{ [this.timeField]: sort }, { _doc: sort }], + search_after: searchAfter, + }); + const payload = [header, esQuery].join('\n') + '\n'; + const url = this.getMultiSearchUrl(); + const response = await lastValueFrom(this.post(url, payload)); + const targets: ElasticsearchQuery[] = [{ refId: `${row.dataFrame.refId}`, metrics: [{ type: 'logs', id: '1' }] }]; + const elasticResponse = new ElasticResponse(targets, transformHitsBasedOnDirection(response, sort)); + const logResponse = elasticResponse.getLogs(this.logMessageField, this.logLevelField); + const dataFrame = _first(logResponse.data); + if (!dataFrame) { + return { data: [] }; + } + /** + * The LogRowContextProvider requires there is a field in the dataFrame.fields + * named `ts` for timestamp and `line` for the actual log line to display. + * Unfortunatly these fields are hardcoded and are required for the lines to + * be properly displayed. This code just copies the fields based on this.timeField + * and this.logMessageField and recreates the dataFrame so it works. + */ + const timestampField = dataFrame.fields.find((f: Field) => f.name === this.timeField); + const lineField = dataFrame.fields.find((f: Field) => f.name === this.logMessageField); + if (timestampField && lineField) { + return { + data: [ + { + ...dataFrame, + fields: [...dataFrame.fields, { ...timestampField, name: 'ts' }, { ...lineField, name: 'line' }], }, ], - }, - }, - sort: [{ [this.timeField]: sort }, { _doc: sort }], - search_after: searchAfter, - }); - const payload = [header, esQuery].join('\n') + '\n'; - const url = this.getMultiSearchUrl(); - const response = await lastValueFrom(this.post(url, payload)); - const targets: ElasticsearchQuery[] = [{ refId: `${row.dataFrame.refId}`, metrics: [{ type: 'logs', id: '1' }] }]; - const elasticResponse = new ElasticResponse(targets, transformHitsBasedOnDirection(response, sort)); - const logResponse = elasticResponse.getLogs(this.logMessageField, this.logLevelField); - const dataFrame = _first(logResponse.data); - if (!dataFrame) { - return { data: [] }; + }; + } + return logResponse; } - /** - * The LogRowContextProvider requires there is a field in the dataFrame.fields - * named `ts` for timestamp and `line` for the actual log line to display. - * Unfortunatly these fields are hardcoded and are required for the lines to - * be properly displayed. This code just copies the fields based on this.timeField - * and this.logMessageField and recreates the dataFrame so it works. - */ - const timestampField = dataFrame.fields.find((f: Field) => f.name === this.timeField); - const lineField = dataFrame.fields.find((f: Field) => f.name === this.logMessageField); - if (timestampField && lineField) { - return { - data: [ - { - ...dataFrame, - fields: [...dataFrame.fields, { ...timestampField, name: 'ts' }, { ...lineField, name: 'line' }], - }, - ], - }; - } - return logResponse; }; getDataProvider( @@ -1077,6 +1113,50 @@ export class ElasticDatasource this.databaseVersion = freshDatabaseVersion; return freshDatabaseVersion; } + + private makeLogContextDataRequest = (row: LogRowModel, options?: RowContextOptions) => { + const direction = options?.direction || 'BACKWARD'; + const logQuery: Logs = { + type: 'logs', + id: '1', + settings: { + limit: options?.limit ? options?.limit.toString() : '10', + // Sorting of results in the context query + sortDirection: direction === 'BACKWARD' ? 'desc' : 'asc', + // Used to get the next log lines before/after the current log line using sort field of selected log line + searchAfter: row.dataFrame.fields.find((f) => f.name === 'sort')?.values.get(row.rowIndex) ?? [row.timeEpochMs], + }, + }; + + const query: ElasticsearchQuery = { + refId: `log-context-${row.dataFrame.refId}-${direction}`, + metrics: [logQuery], + query: '', + }; + + const timeRange = createContextTimeRange(row.timeEpochMs, direction, this.intervalPattern); + const range = { + from: timeRange.from, + to: timeRange.to, + raw: timeRange, + }; + + const interval = rangeUtil.calculateInterval(range, 1); + + const contextRequest: DataQueryRequest = { + requestId: `log-context-request-${row.dataFrame.refId}-${options?.direction}`, + targets: [query], + interval: interval.interval, + intervalMs: interval.intervalMs, + range, + scopedVars: {}, + timezone: 'UTC', + app: CoreApp.Explore, + startTime: Date.now(), + hideFromInspector: true, + }; + return contextRequest; + }; } /** @@ -1129,7 +1209,6 @@ function generateDataLink(linkConfig: DataLinkConfig): DataLink { }; } } - function transformHitsBasedOnDirection(response: any, direction: 'asc' | 'desc') { if (direction === 'desc') { return response; @@ -1148,3 +1227,73 @@ function transformHitsBasedOnDirection(response: any, direction: 'asc' | 'desc') ], }; } + +function processToLogContextDataFrames(result: DataQueryResponse): DataQueryResponse { + const frames = result.data.map((frame) => sortDataFrame(frame, 0, true)); + const processedFrames = frames.map((frame) => { + // log-row-context requires specific field-names to work, so we set them here: "ts", "line", "id" + const cache = new FieldCache(frame); + const timestampField = cache.getFirstFieldOfType(FieldType.time); + const lineField = cache.getFirstFieldOfType(FieldType.string); + const idField = cache.getFieldByName('_id'); + + if (!timestampField || !lineField || !idField) { + return { ...frame, fields: [] }; + } + + return { + ...frame, + fields: [ + { + ...timestampField, + name: 'ts', + }, + { + ...lineField, + name: 'line', + }, + { + ...idField, + name: 'id', + }, + ], + }; + }); + + return { + ...result, + data: processedFrames, + }; +} + +function createContextTimeRange(rowTimeEpochMs: number, direction: string, intervalPattern: Interval | undefined) { + const offset = 7; + // For log context, we want to request data from 7 subsequent/previous indices + if (intervalPattern) { + const intervalInfo = intervalMap[intervalPattern]; + if (direction === 'FORWARD') { + return { + from: dateTime(rowTimeEpochMs).utc(), + to: dateTime(rowTimeEpochMs).add(offset, intervalInfo.amount).utc().startOf(intervalInfo.startOf), + }; + } else { + return { + from: dateTime(rowTimeEpochMs).subtract(offset, intervalInfo.amount).utc().startOf(intervalInfo.startOf), + to: dateTime(rowTimeEpochMs).utc(), + }; + } + // If we don't have an interval pattern, we can't do this, so we just request data from 7h before/after + } else { + if (direction === 'FORWARD') { + return { + from: dateTime(rowTimeEpochMs).utc(), + to: dateTime(rowTimeEpochMs).add(offset, 'hours').utc(), + }; + } else { + return { + from: dateTime(rowTimeEpochMs).subtract(offset, 'hours').utc(), + to: dateTime(rowTimeEpochMs).utc(), + }; + } + } +} diff --git a/public/app/plugins/datasource/elasticsearch/types.ts b/public/app/plugins/datasource/elasticsearch/types.ts index 4db73644e3a..1226818adda 100644 --- a/public/app/plugins/datasource/elasticsearch/types.ts +++ b/public/app/plugins/datasource/elasticsearch/types.ts @@ -13,11 +13,24 @@ import { ExtendedStats, MovingAverage as SchemaMovingAverage, BucketAggregation, + Logs as SchemaLogs, } from './dataquery.gen'; export * from './dataquery.gen'; export { Elasticsearch as ElasticsearchQuery } from './dataquery.gen'; +// We want to extend the settings of the Logs query with additional properties that +// are not part of the schema. This is a workaround, because exporting LogsSettings +// from dataquery.gen.ts and extending that produces error in SettingKeyOf. +type ExtendedLogsSettings = SchemaLogs['settings'] & { + searchAfter?: unknown[]; + sortDirection?: 'asc' | 'desc'; +}; + +export interface Logs extends SchemaLogs { + settings?: ExtendedLogsSettings; +} + export type MetricAggregationWithMeta = ExtendedStats; export type MovingAverageModelSettings = Partial< From 58287c2df29ddc7e88290753d49cd60be5431af4 Mon Sep 17 00:00:00 2001 From: Matias Chomicki Date: Wed, 5 Apr 2023 18:46:44 +0200 Subject: [PATCH 52/80] Loki Query Editor: Increase autocomplete suggestions window with to 50% (#66041) Loki Monaco Editor: Increase autocomplete min width to 50% --- .../loki/components/monaco-query-field/MonacoQueryField.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/app/plugins/datasource/loki/components/monaco-query-field/MonacoQueryField.tsx b/public/app/plugins/datasource/loki/components/monaco-query-field/MonacoQueryField.tsx index 706d852b3a2..0cae11d26e3 100644 --- a/public/app/plugins/datasource/loki/components/monaco-query-field/MonacoQueryField.tsx +++ b/public/app/plugins/datasource/loki/components/monaco-query-field/MonacoQueryField.tsx @@ -79,6 +79,9 @@ const getStyles = (theme: GrafanaTheme2, placeholder: string) => { border-radius: ${theme.shape.borderRadius()}; border: 1px solid ${theme.components.input.borderColor}; width: 100%; + .monaco-editor .suggest-widget { + min-width: 50%; + } `, placeholder: css` ::after { From 2338c318893279db451d12a056cca10f98f89f20 Mon Sep 17 00:00:00 2001 From: Martin Disibio Date: Wed, 5 Apr 2023 13:12:48 -0400 Subject: [PATCH 53/80] Docs: Add traceQuery setting to Tempo provisioning example (#66050) Extend tempo provisioning example for TraceID Query settings --- docs/sources/datasources/tempo/_index.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/sources/datasources/tempo/_index.md b/docs/sources/datasources/tempo/_index.md index 04d88ac61da..0b10a4bada8 100644 --- a/docs/sources/datasources/tempo/_index.md +++ b/docs/sources/datasources/tempo/_index.md @@ -231,6 +231,10 @@ datasources: spanBar: type: 'Tag' tag: 'http.path' + traceQuery: + timeShiftEnabled: true + spanStartTimeShift: 15m + spanEndTimeShift: 20m ``` ## Query the data source From 6c6427e63f98913392e5b32ce117851ca361d78e Mon Sep 17 00:00:00 2001 From: Kyle Brandt Date: Wed, 5 Apr 2023 14:00:31 -0400 Subject: [PATCH 54/80] Chore: Use latest go-sdk (v0.158.0) (#66054) SDK release notes: * Logs contract: ignore remaining fields by @gabor in #659 * Logs contract: more robust field finding, explicit approach by @gabor in #660 * Tracing: Support multiple OTel propagators by @xnyo in #663 * Tracing: Add more details to HTTP Outgoing Request by @xnyo in #664 * Data: Encode Nanosecond into JSON by @kylebrandt in #647 * Data: cmp tests using FrameTestCompareOptions() will no longer ignore time differences beyond millisecond resolution --- go.mod | 2 +- go.sum | 49 +++++++++++++++++++ .../flux/testdata/grouping.golden.jsonc | 32 ++++++++++++ .../flux/testdata/multiple.golden.jsonc | 21 ++++++++ .../non_standard_time_column.golden.jsonc | 9 ++++ .../flux/testdata/simple.golden.jsonc | 7 +++ .../influxdb/flux/testdata/table.golden.jsonc | 6 +++ .../loki/testdata/streams_simple.golden.jsonc | 14 ++++++ 8 files changed, 139 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index aaf21363f5b..658b536798b 100644 --- a/go.mod +++ b/go.mod @@ -67,7 +67,7 @@ require ( github.com/grafana/cuetsy v0.1.6 github.com/grafana/grafana-aws-sdk v0.12.0 github.com/grafana/grafana-azure-sdk-go v1.6.0 - github.com/grafana/grafana-plugin-sdk-go v0.157.0 + github.com/grafana/grafana-plugin-sdk-go v0.158.0 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 github.com/hashicorp/go-hclog v1.2.0 github.com/hashicorp/go-plugin v1.4.3 diff --git a/go.sum b/go.sum index 589fa79a58b..ac7f880de80 100644 --- a/go.sum +++ b/go.sum @@ -117,6 +117,7 @@ github.com/Azure/azure-sdk-for-go v51.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9mo github.com/Azure/azure-sdk-for-go v55.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go v57.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go v59.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go v59.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go v65.0.0+incompatible h1:HzKLt3kIwMm4KeJYTdx9EbjRYTySD/t8i1Ee/W5EGXw= github.com/Azure/azure-sdk-for-go v65.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.2.0 h1:sVW/AFBTGyJxDaMYlq0ct3jUXTtj12tQ6zE2GZUgVQw= @@ -146,6 +147,7 @@ github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+B github.com/Azure/go-autorest/autorest v0.9.3/go.mod h1:GsRuLYvwzLjjjRoWEIyMUaYq8GNUx2nRB378IPt/1p0= github.com/Azure/go-autorest/autorest v0.10.0/go.mod h1:/FALq9T/kS7b5J5qsQ+RSTUdAmGFqi0vUdVNNx8q630= github.com/Azure/go-autorest/autorest v0.10.1/go.mod h1:/FALq9T/kS7b5J5qsQ+RSTUdAmGFqi0vUdVNNx8q630= +github.com/Azure/go-autorest/autorest v0.11.9/go.mod h1:eipySxLmqSyC5s5k1CLupqet0PSENBEDP93LQ9a8QYw= github.com/Azure/go-autorest/autorest v0.11.18/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA= github.com/Azure/go-autorest/autorest v0.11.19/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA= github.com/Azure/go-autorest/autorest v0.11.20/go.mod h1:o3tqFY+QR40VOlk+pV4d77mORO64jOXSgEnPQgLK6JY= @@ -168,6 +170,7 @@ github.com/Azure/go-autorest/autorest/adal v0.9.20/go.mod h1:XVVeme+LZwABT8K5Lc3 github.com/Azure/go-autorest/autorest/adal v0.9.21 h1:jjQnVFXPfekaqb8vIsv2G1lxshoW+oGv4MDlhRtnYZk= github.com/Azure/go-autorest/autorest/adal v0.9.21/go.mod h1:zua7mBUaCc5YnSLKYgGJR/w5ePdMDA6H56upLsHzA9U= github.com/Azure/go-autorest/autorest/azure/auth v0.4.2/go.mod h1:90gmfKdlmKgfjUpnCEpOJzsUEjrWDSLwHIG73tSXddM= +github.com/Azure/go-autorest/autorest/azure/auth v0.5.3/go.mod h1:4bJZhUhcq8LB20TruwHbAQsmUs2Xh+QR7utuJpLXX3A= github.com/Azure/go-autorest/autorest/azure/auth v0.5.9/go.mod h1:hg3/1yw0Bq87O3KvvnJoAh34/0zbP7SFizX/qN5JvjU= github.com/Azure/go-autorest/autorest/azure/cli v0.3.1/go.mod h1:ZG5p860J94/0kI9mNJVoIoLgXcirM2gF5i2kWloofxw= github.com/Azure/go-autorest/autorest/azure/cli v0.4.2/go.mod h1:7qkJkT+j6b+hIpzMOwPChJhTqS8VbsqqgULzMNRugoM= @@ -188,6 +191,7 @@ github.com/Azure/go-autorest/autorest/validation v0.2.0/go.mod h1:3EEqHnBxQGHXRY github.com/Azure/go-autorest/autorest/validation v0.3.1 h1:AgyqjAd94fwNAoTjl/WQXg4VvFeRFpO+UhNyRXqF1ac= github.com/Azure/go-autorest/autorest/validation v0.3.1/go.mod h1:yhLgjC0Wda5DYXl6JAsWyUe4KVNffhoDhG0zVzUMo3E= github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= +github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+ZtXWSmf4Tg= github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= @@ -245,6 +249,7 @@ github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2 github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00= github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600= github.com/Microsoft/hcsshim v0.8.18/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= +github.com/Microsoft/hcsshim v0.8.21/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU= github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= @@ -285,6 +290,7 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/alecthomas/units v0.0.0-20210912230133-d1bdfacee922/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= +github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= @@ -298,6 +304,7 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd github.com/antonmedv/expr v1.8.9/go.mod h1:5qsM3oLGDND7sDmQGDXHkYfkjYMUX14qsgqmHhwGEk8= github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ= github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= +github.com/apache/arrow/go/arrow v0.0.0-20200601151325-b2287a20f230/go.mod h1:QNYViu/X0HXDHw7m3KXzWSVXIbfUvJqBFe6Gj8/pYA0= github.com/apache/arrow/go/arrow v0.0.0-20200923215132-ac86123a3f01/go.mod h1:QNYViu/X0HXDHw7m3KXzWSVXIbfUvJqBFe6Gj8/pYA0= github.com/apache/arrow/go/arrow v0.0.0-20210223225224-5bea62493d91/go.mod h1:c9sxoIT3YgLxH4UhLOCKaBlEojuMhVYpk4Ntv3opUTQ= github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 h1:q4dksr6ICHXqG5hm0ZW5IHyeEJXoIJSOZeBLmWPNeIQ= @@ -342,6 +349,7 @@ github.com/aws/aws-sdk-go v1.38.35/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2z github.com/aws/aws-sdk-go v1.38.60/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go v1.38.68/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go v1.40.37/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= +github.com/aws/aws-sdk-go v1.42.16/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= github.com/aws/aws-sdk-go v1.43.31/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= github.com/aws/aws-sdk-go v1.44.171 h1:maREiPAmibvuONMOEZIkCH2OTosLRnDelceTtH3SYfo= github.com/aws/aws-sdk-go v1.44.171/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= @@ -471,6 +479,7 @@ github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw= +github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= github.com/cheekybits/genny v1.0.0 h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE= github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= github.com/chromedp/cdproto v0.0.0-20220208224320-6efb837e6bc2 h1:XCdvHbz3LhewBHN7+mQPx0sg/Hxil/1USnBmxkjHcmY= @@ -483,6 +492,7 @@ github.com/cilium/ebpf v0.0.0-20200110133405-4032b1d8aae3/go.mod h1:MA5e5Lr8slmE github.com/cilium/ebpf v0.0.0-20200702112145-1c8d4c9ef775/go.mod h1:7cR51M8ViRLIdUjrmSXlK9pkrsDlLHbO8jiB8X8JnOc= github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= +github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= @@ -490,6 +500,7 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20220314180256-7f1daf1720fc h1:PYXxkRUBGUMa5xgMVMDl62vEklZvKpVaxQeN9ie7Hfk= github.com/cncf/xds/go v0.0.0-20220314180256-7f1daf1720fc/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= @@ -534,6 +545,7 @@ github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09Zvgq github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s= github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= github.com/containerd/containerd v1.5.4/go.mod h1:sx18RgvW6ABJ4iYUw7Q5x7bgFOAB9B6G7+yO0XBc4zw= +github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c= github.com/containerd/containerd v1.6.8 h1:h4dOFDwzHmqFEP754PgfgTeVXFnLiRc6kiqC7tplDJs= github.com/containerd/containerd v1.6.8/go.mod h1:By6p5KqPK0/7/CgO/A6t/Gz+CUYUu2zf1hUaaymVXB0= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= @@ -671,6 +683,7 @@ github.com/dgryski/go-sip13 v0.0.0-20200911182023-62edffca9245/go.mod h1:vAd38F8 github.com/dhui/dktest v0.3.0/go.mod h1:cyzIUfGsBEbZ6BT7tnXqAShHSXCZhSNmFl70sZ7c1yc= github.com/digitalocean/godo v1.62.0/go.mod h1:p7dOjjtSBqCTUksqtA5Fd3uaKs9kyTq2xcz76ulEJRU= github.com/digitalocean/godo v1.65.0/go.mod h1:p7dOjjtSBqCTUksqtA5Fd3uaKs9kyTq2xcz76ulEJRU= +github.com/digitalocean/godo v1.72.0/go.mod h1:GBmu8MkjZmNARE7IXRPmkbbnocNN8+uBm0xbEVw2LCs= github.com/digitalocean/godo v1.88.0 h1:SAEdw63xOMmzlwCeCWjLH1GcyDPUjbSAR1Bh7VELxzc= github.com/digitalocean/godo v1.88.0/go.mod h1:NRpFznZFvhHjBoqZAaOD3khVzsJ3EibzKqFL4R60dmA= github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= @@ -739,10 +752,12 @@ github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/envoyproxy/go-control-plane v0.9.9/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= github.com/envoyproxy/go-control-plane v0.10.3 h1:xdCVXxEe0Y3FQith+0cj2irwZudqGYvecuLB1HtdexY= github.com/envoyproxy/go-control-plane v0.10.3/go.mod h1:fJJn/j26vwOu972OllsvAgJJM//w9BV6Fxbg2LuVd34= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.6.1/go.mod h1:txg5va2Qkip90uYoSKH+nkAAmXrb2j3iq4FLwdrCbXQ= +github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= github.com/envoyproxy/protoc-gen-validate v0.6.7/go.mod h1:dyJXwwfPK2VSqiB9Klm1J6romD608Ba7Hij42vrOBCo= github.com/envoyproxy/protoc-gen-validate v0.6.13 h1:TvDcILLkjuZV3ER58VkBmncKsLUBqBDxra/XctCzuMM= github.com/envoyproxy/protoc-gen-validate v0.6.13/go.mod h1:qEySVqXrEugbHKvmhI8ZqtQi75/RHSSRNpffvB4I6Bw= @@ -847,6 +862,7 @@ github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KE github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v1.0.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= @@ -1067,6 +1083,7 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/gogo/status v1.0.3/go.mod h1:SavQ51ycCLnc7dGyJxp8YAmudx8xqiVrRf+6IXRsugc= +github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= @@ -1197,6 +1214,7 @@ github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210827144239-02619b876842/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20211122183932-1daafda22083/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/subcommands v1.0.1/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= @@ -1233,6 +1251,7 @@ github.com/gophercloud/gophercloud v0.3.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEo github.com/gophercloud/gophercloud v0.10.0/go.mod h1:gmC5oQqMDOMO1t1gq5DquX/yAU808e/4mzjjDA76+Ss= github.com/gophercloud/gophercloud v0.18.0/go.mod h1:wRtmUelyIIv3CSSDI47aUwbs075O6i+LY+pXsKCBsb4= github.com/gophercloud/gophercloud v0.20.0/go.mod h1:wRtmUelyIIv3CSSDI47aUwbs075O6i+LY+pXsKCBsb4= +github.com/gophercloud/gophercloud v0.23.0/go.mod h1:MRw6uyLj8uCGbIvBlqL7QW67t0QtNZnzydUzewo1Ioc= github.com/gophercloud/gophercloud v1.0.0 h1:9nTGx0jizmHxDobe4mck89FyQHVyA3CaXLIUSGJjP9k= github.com/gophercloud/gophercloud v1.0.0/go.mod h1:Q8fZtyi5zZxPS/j9aj3sSxtvj41AdQMDwyo1myduD5c= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -1278,6 +1297,8 @@ github.com/grafana/grafana-plugin-sdk-go v0.94.0/go.mod h1:3VXz4nCv6wH5SfgB3mlW3 github.com/grafana/grafana-plugin-sdk-go v0.114.0/go.mod h1:D7x3ah+1d4phNXpbnOaxa/osSaZlwh9/ZUnGGzegRbk= github.com/grafana/grafana-plugin-sdk-go v0.157.0 h1:Qm0r5A4TsG+Tmy8Vagffqv21t3R/tzFUdYZZpd9COYE= github.com/grafana/grafana-plugin-sdk-go v0.157.0/go.mod h1:FwinU1fti54nWWsacIdL8D2WfYcKOWB2VRMtxnBbY+o= +github.com/grafana/grafana-plugin-sdk-go v0.158.0 h1:kucTwr4LEa6hoSunnRqkuEeJOgbBTFrhdGNkJrMV4Zg= +github.com/grafana/grafana-plugin-sdk-go v0.158.0/go.mod h1:7/F3lL/w3MGuZTwu0jam5oL/4zNOQmhs2k8WZ9VlzhI= github.com/grafana/kindsys v0.0.0-20230309200316-812b9884a375 h1:iWFjqAU5GjIV/HetIE/Me6VF3SRw29u5QviMVbJUVQo= github.com/grafana/kindsys v0.0.0-20230309200316-812b9884a375/go.mod h1:213a3clTiegHfheYcLPLeEyHv/azK/fAF67OEbzuLzw= github.com/grafana/phlare/api v0.1.3 h1:mYTaE9mLsAW/uzPXlW/PQSLsZ4ojBFA+oAMfR/PDdw8= @@ -1318,6 +1339,7 @@ github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoP github.com/hashicorp/consul/api v1.4.0/go.mod h1:xc8u05kyMa3Wjr9eEAsIAo3dg8+LywT5E/Cl7cNS5nU= github.com/hashicorp/consul/api v1.8.1/go.mod h1:sDjTOq0yUyv5G4h+BqSea7Fn6BU+XbolEz1952UB+mk= github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= +github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= github.com/hashicorp/consul/api v1.15.3 h1:WYONYL2rxTXtlekAqblR2SCdJsizMDIj/uXb5wNy9zU= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= @@ -1407,6 +1429,7 @@ github.com/hashicorp/yamux v0.0.0-20210826001029-26ff87cf9493 h1:brI5vBRUlAlM34V github.com/hashicorp/yamux v0.0.0-20210826001029-26ff87cf9493/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/hetznercloud/hcloud-go v1.26.2/go.mod h1:2C5uMtBiMoFr3m7lBFPf7wXTdh33CevmZpQIIDPGYJI= github.com/hetznercloud/hcloud-go v1.32.0/go.mod h1:XX/TQub3ge0yWR2yHWmnDVIrB+MQbda1pHxkUmDlUME= +github.com/hetznercloud/hcloud-go v1.33.1/go.mod h1:XX/TQub3ge0yWR2yHWmnDVIrB+MQbda1pHxkUmDlUME= github.com/hetznercloud/hcloud-go v1.35.3 h1:WCmFAhLRooih2QHAsbCbEdpIHnshQQmrPqsr3rHE1Ow= github.com/hetznercloud/hcloud-go v1.35.3/go.mod h1:mepQwR6va27S3UQthaEPGS86jtzSY9xWL1e9dyxXpgA= github.com/hmarr/codeowners v1.1.2 h1:CdmLJ0e2s2aaH21+3HW1HXJyJqz+OCEiMBfD9iZb3n8= @@ -1420,6 +1443,7 @@ github.com/iancoleman/strcase v0.0.0-20180726023541-3605ed457bf7/go.mod h1:SK73t github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= github.com/igm/sockjs-go/v3 v3.0.2 h1:2m0k53w0DBiGozeQUIEPR6snZFmpFpYvVsGnfLPNXbE= github.com/igm/sockjs-go/v3 v3.0.2/go.mod h1:UqchsOjeagIBFHvd+RZpLaVRbCwGilEC08EDHsD1jYE= github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -1433,12 +1457,14 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/influxdata/flux v0.65.0/go.mod h1:BwN2XG2lMszOoquQaFdPET8FRQfrXiZsWmcMO9rkaVY= github.com/influxdata/flux v0.113.0/go.mod h1:3TJtvbm/Kwuo5/PEo5P6HUzwVg4bXWkb2wPQHPtQdlU= github.com/influxdata/flux v0.120.1/go.mod h1:pGSAvyAA5d3et7SSzajaYShWYXmnRnJJq2qWi+WWZ2I= +github.com/influxdata/flux v0.131.0/go.mod h1:CKvnYe6FHpTj/E0YGI7TcOZdGiYHoToOPSnoa12RtKI= github.com/influxdata/httprouter v1.3.1-0.20191122104820-ee83e2772f69/go.mod h1:pwymjR6SrP3gD3pRj9RJwdl1j5s3doEEV8gS4X9qSzA= github.com/influxdata/influxdb v1.7.6/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= github.com/influxdata/influxdb v1.7.7/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= github.com/influxdata/influxdb v1.8.0/go.mod h1:SIzcnsjaHRFpmlxpJ4S3NT64qtEKYweNTUMb/vh0OMQ= github.com/influxdata/influxdb v1.9.2/go.mod h1:UEe3MeD9AaP5rlPIes102IhYua3FhIWZuOXNHxDjSrI= github.com/influxdata/influxdb v1.9.3/go.mod h1:xD4ZjAgEJQO9/bX3NhFrssKtdNPi+ki1kjrttJRDhGc= +github.com/influxdata/influxdb v1.9.5/go.mod h1:4uPVvcry9KWQVWLxyT9641qpkRXUBN+xa0MJFFNNLKo= github.com/influxdata/influxdb-client-go/v2 v2.3.1-0.20210518120617-5d1fff431040/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= github.com/influxdata/influxdb-client-go/v2 v2.6.0 h1:bIOaGTgvvv1Na2hG+nIvqyv7PK2UiU2WrJN1ck1ykyM= github.com/influxdata/influxdb-client-go/v2 v2.6.0/go.mod h1:Y/0W1+TZir7ypoQZYd2IrnVOKB3Tq6oegAQeSVN/+EU= @@ -1452,6 +1478,7 @@ github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 h1:vilfsD github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= github.com/influxdata/pkg-config v0.2.6/go.mod h1:EMS7Ll0S4qkzDk53XS3Z72/egBsPInt+BeRxb0WeSwk= github.com/influxdata/pkg-config v0.2.7/go.mod h1:EMS7Ll0S4qkzDk53XS3Z72/egBsPInt+BeRxb0WeSwk= +github.com/influxdata/pkg-config v0.2.8/go.mod h1:EMS7Ll0S4qkzDk53XS3Z72/egBsPInt+BeRxb0WeSwk= github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8= github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= @@ -1583,6 +1610,7 @@ github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM52 github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/knadh/koanf v1.2.0/go.mod h1:xpPTwMhsA/aaQLAilyCCqfpEiY1gpa160AiCuWHJUjY= +github.com/kolo/xmlrpc v0.0.0-20201022064351-38db28db192b/go.mod h1:pcaDhQK0/NJZEvtCO0qQPPropqV0sJOJ6YW7X+9kRwM= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -1633,11 +1661,13 @@ github.com/linkedin/goavro/v2 v2.10.0 h1:eTBIRoInBM88gITGXYtUSqqxLTFXfOsJBiX8ZMW github.com/linkedin/goavro/v2 v2.10.0/go.mod h1:UgQUb2N/pmueQYH9bfqFioWxzYCZXSfF8Jw03O5sjqA= github.com/linode/linodego v0.28.5/go.mod h1:BR0gVkCJffEdIGJSl6bHR80Ty+Uvg/2jkjmrWaFectM= github.com/linode/linodego v0.32.0/go.mod h1:BR0gVkCJffEdIGJSl6bHR80Ty+Uvg/2jkjmrWaFectM= +github.com/linode/linodego v1.2.1/go.mod h1:x/7+BoaKd4unViBmS2umdjYyVAmpFtBtEXZ0wou7FYQ= github.com/linode/linodego v1.9.3 h1:+lxNZw4avRxhCqGjwfPgQ2PvMT+vOL0OMsTdzixR7hQ= github.com/linode/linodego v1.9.3/go.mod h1:h6AuFR/JpqwwM/vkj7s8KV3iGN8/jxn+zc437F8SZ8w= github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s= github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/lyft/protoc-gen-star v0.5.1/go.mod h1:9toiA3cC7z5uVbODF7kEQ91Xn7XNFkVUl+SrEe+ZORU= +github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= github.com/lyft/protoc-gen-star v0.6.1/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= github.com/m3db/prometheus_remote_client_golang v0.4.4 h1:DsAIjVKoCp7Ym35tAOFL1OuMLIdIikAEHeNPHY+yyM8= @@ -1771,6 +1801,7 @@ github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2J github.com/moby/sys/symlink v0.1.0/go.mod h1:GGDODQmbFOjFsXvfLVn3+ZRxkch54RkSiGqsZeMYowQ= github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo= github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc= +github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -1876,14 +1907,17 @@ github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59P github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc93/go.mod h1:3NOsor4w32B2tC0Zbl8Knk4Wg84SM2ImC1fxBuqJ/H0= +github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.2-0.20190207185410-29686dbc5559/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.3-0.20200929063507-e6143ca7d51d/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqiriPsEqVhc+svHE= github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo= +github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8= github.com/opentracing-contrib/go-grpc v0.0.0-20180928155321-4b5a12d3ff02/go.mod h1:JNdpVEzCpXBgIiv4ds+TzhN1hrtxq6ClLrTlT9OQRSc= github.com/opentracing-contrib/go-grpc v0.0.0-20191001143057-db30781987df/go.mod h1:DYR5Eij8rJl8h7gblRrOZ8g0kW1umSpKqYIBTgeDtLo= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= @@ -2006,6 +2040,7 @@ github.com/prometheus/common/sigv4 v0.1.0 h1:qoVebwtwwEhS85Czm2dSROY5fTo2PAPEVdD github.com/prometheus/common/sigv4 v0.1.0/go.mod h1:2Jkxxk9yYvCkE5G1sQT7GuEXm57JrvHu9k5YwTjsNtI= github.com/prometheus/exporter-toolkit v0.5.1/go.mod h1:OCkM4805mmisBhLmVFw858QYi3v0wKdY6/UxrT0pZVg= github.com/prometheus/exporter-toolkit v0.6.1/go.mod h1:ZUBIj498ePooX9t/2xtDjeQYwvRpiPP2lh5u4iblj2g= +github.com/prometheus/exporter-toolkit v0.7.0/go.mod h1:ZUBIj498ePooX9t/2xtDjeQYwvRpiPP2lh5u4iblj2g= github.com/prometheus/exporter-toolkit v0.8.2 h1:sbJAfBXQFkG6sUkbwBun8MNdzW9+wd5YfPYofbmj0YM= github.com/prometheus/exporter-toolkit v0.8.2/go.mod h1:00shzmJL7KxcsabLWcONwpyNEuWhREOnFqZW7vadFS0= github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= @@ -2131,6 +2166,7 @@ github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:s github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/snowflakedb/gosnowflake v1.3.4/go.mod h1:NsRq2QeiMUuoNUJhp5Q6xGC4uBrsS9g6LwZVEkTWgsE= +github.com/snowflakedb/gosnowflake v1.3.13/go.mod h1:6nfka9aTXkUNha1p1cjeeyjDvcyh7jfjp0l8kGpDBok= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= @@ -2318,6 +2354,7 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= @@ -2437,6 +2474,7 @@ go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0 go.uber.org/automaxprocs v1.4.0/go.mod h1:/mTEdr7LvHhs0v7mjdxDreTz1OG5zdZGqgOnhWiR/+Q= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= @@ -2487,6 +2525,7 @@ golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200422194213-44a606286825/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -2647,11 +2686,13 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211020060615-d418f374d309/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220107192237-5cfca573fb4d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -2836,6 +2877,7 @@ golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210503080704-8803ae5d1324/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -2848,6 +2890,7 @@ golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -3019,6 +3062,7 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= @@ -3085,6 +3129,7 @@ google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqiv google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= google.golang.org/api v0.58.0/go.mod h1:cAbP2FsxoGVNwtgNAmmn3y5G1TWAiVYRmg4yku3lv+E= google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU= +google.golang.org/api v0.60.0/go.mod h1:d7rl65NZAkEQ90JFzqBjcRq1TVeG5ZoGV3sSpEnnVb4= google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= google.golang.org/api v0.64.0/go.mod h1:931CdxA8Rm4t6zqTFGSsgwbAEZ2+GMYurbndwSimebM= @@ -3211,6 +3256,7 @@ k8s.io/api v0.20.4/go.mod h1:++lNL1AJMkDymriNniQsWRkMDzRaX2Y/POTUi8yvqYQ= k8s.io/api v0.20.6/go.mod h1:X9e8Qag6JV/bL5G6bU8sdVRltWKmdHsFUGS3eVndqE8= k8s.io/api v0.21.1/go.mod h1:FstGROTmsSHBarKc8bylzXih8BLNYTiS3TZcsoEDg2s= k8s.io/api v0.22.1/go.mod h1:bh13rkTp3F1XEaLGykbyRD2QaTTzPm0e/BMd8ptFONY= +k8s.io/api v0.22.4/go.mod h1:Rgs+9gIGYC5laXQSZZ9JqT5NevNgoGiOdVWi1BAB3qk= k8s.io/api v0.25.3/go.mod h1:o42gKscFrEVjHdQnyRenACrMtbuJsVdP+WVjqejfzmI= k8s.io/api v0.26.2 h1:dM3cinp3PGB6asOySalOZxEG4CZ0IAdJsrYZXE/ovGQ= k8s.io/apiextensions-apiserver v0.26.2 h1:/yTG2B9jGY2Q70iGskMf41qTLhL9XeNN2KhI0uDgwko= @@ -3222,6 +3268,7 @@ k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRp k8s.io/apimachinery v0.20.6/go.mod h1:ejZXtW1Ra6V1O5H8xPBGz+T3+4gfkTCeExAHKU57MAc= k8s.io/apimachinery v0.21.1/go.mod h1:jbreFvJo3ov9rj7eWT7+sYiRx+qZuCYXwWT1bcDswPY= k8s.io/apimachinery v0.22.1/go.mod h1:O3oNtNadZdeOMxHFVxOreoznohCpy0z6mocxbZr7oJ0= +k8s.io/apimachinery v0.22.4/go.mod h1:yU6oA6Gnax9RrxGzVvPFFJ+mpnW6PBSqp0sx0I0HHW0= k8s.io/apimachinery v0.25.3/go.mod h1:jaF9C/iPNM1FuLl7Zuy5b9v+n35HGSh6AQ4HYRkCqwo= k8s.io/apimachinery v0.26.2 h1:da1u3D5wfR5u2RpLhE/ZtZS2P7QvDgLZTi9wrNZl/tQ= k8s.io/apimachinery v0.26.2/go.mod h1:ats7nN1LExKHvJ9TmwootT00Yz05MuYqPXEXaVeOy5I= @@ -3251,6 +3298,7 @@ k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= k8s.io/klog/v2 v2.9.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= k8s.io/klog/v2 v2.10.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= +k8s.io/klog/v2 v2.20.0/go.mod h1:Gm8eSIfQN6457haJuPaMxZw4wyP5k+ykPFlrhQDvhvw= k8s.io/klog/v2 v2.70.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4= k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= @@ -3260,6 +3308,7 @@ k8s.io/kube-openapi v0.0.0-20200316234421-82d701f24f9d/go.mod h1:F+5wygcW0wmRTnM k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7/go.mod h1:wXW5VT87nVfh/iLV8FpR2uDvrFyomxbtb1KivDbvPTE= k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw= +k8s.io/kube-openapi v0.0.0-20211109043538-20434351676c/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw= k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1/go.mod h1:C/N6wCaBHeBHkHUesQOQy2/MZqGgMAFPqGsGQLdbZBU= k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 h1:+70TFaan3hfJzs+7VK2o+OGxg8HsuBr/5f6tVAjDu6E= k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= diff --git a/pkg/tsdb/influxdb/flux/testdata/grouping.golden.jsonc b/pkg/tsdb/influxdb/flux/testdata/grouping.golden.jsonc index 1a6da1a668a..e69529d5b16 100644 --- a/pkg/tsdb/influxdb/flux/testdata/grouping.golden.jsonc +++ b/pkg/tsdb/influxdb/flux/testdata/grouping.golden.jsonc @@ -104,6 +104,14 @@ 3.56, null ] + ], + "nanos": [ + [ + 0, + 0, + 881833 + ], + null ] } }, @@ -146,6 +154,15 @@ 1.74, null ] + ], + "nanos": [ + [ + 0, + 0, + 0, + 881833 + ], + null ] } }, @@ -200,6 +217,21 @@ 1.71, null ] + ], + "nanos": [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 881833 + ], + null ] } } diff --git a/pkg/tsdb/influxdb/flux/testdata/multiple.golden.jsonc b/pkg/tsdb/influxdb/flux/testdata/multiple.golden.jsonc index ac09d56e348..444c50c4c9d 100644 --- a/pkg/tsdb/influxdb/flux/testdata/multiple.golden.jsonc +++ b/pkg/tsdb/influxdb/flux/testdata/multiple.golden.jsonc @@ -92,6 +92,13 @@ 1.4, 6.6 ] + ], + "nanos": [ + [ + 814545, + 214724 + ], + null ] } }, @@ -131,6 +138,13 @@ 4, -1 ] + ], + "nanos": [ + [ + 814545, + 214724 + ], + null ] } }, @@ -170,6 +184,13 @@ 0, 2 ] + ], + "nanos": [ + [ + 978640, + 100374 + ], + null ] } } diff --git a/pkg/tsdb/influxdb/flux/testdata/non_standard_time_column.golden.jsonc b/pkg/tsdb/influxdb/flux/testdata/non_standard_time_column.golden.jsonc index 0680c4f629e..b62a1c33f9f 100644 --- a/pkg/tsdb/influxdb/flux/testdata/non_standard_time_column.golden.jsonc +++ b/pkg/tsdb/influxdb/flux/testdata/non_standard_time_column.golden.jsonc @@ -76,6 +76,15 @@ [ 156.304 ] + ], + "nanos": [ + [ + 584046 + ], + [ + 584046 + ], + null ] } } diff --git a/pkg/tsdb/influxdb/flux/testdata/simple.golden.jsonc b/pkg/tsdb/influxdb/flux/testdata/simple.golden.jsonc index a5dd5329b50..8bf18138289 100644 --- a/pkg/tsdb/influxdb/flux/testdata/simple.golden.jsonc +++ b/pkg/tsdb/influxdb/flux/testdata/simple.golden.jsonc @@ -64,6 +64,13 @@ 1.4, 6.6 ] + ], + "nanos": [ + [ + 814545, + 214724 + ], + null ] } } diff --git a/pkg/tsdb/influxdb/flux/testdata/table.golden.jsonc b/pkg/tsdb/influxdb/flux/testdata/table.golden.jsonc index 144491e159f..786dbb1decb 100644 --- a/pkg/tsdb/influxdb/flux/testdata/table.golden.jsonc +++ b/pkg/tsdb/influxdb/flux/testdata/table.golden.jsonc @@ -59,6 +59,12 @@ [ 42 ] + ], + "nanos": [ + [ + 905100 + ], + null ] } } diff --git a/pkg/tsdb/loki/testdata/streams_simple.golden.jsonc b/pkg/tsdb/loki/testdata/streams_simple.golden.jsonc index 2bd8cc42b5c..1d83e77e033 100644 --- a/pkg/tsdb/loki/testdata/streams_simple.golden.jsonc +++ b/pkg/tsdb/loki/testdata/streams_simple.golden.jsonc @@ -356,6 +356,20 @@ "1645030245539423744_fd17f65c_sq", "1645030244091700992_62ae07f3_sq" ] + ], + "nanos": [ + null, + [ + 757120, + 735040, + 587968, + 587968, + 423744, + 700992 + ], + null, + null, + null ] } } From 85f738cdf96aa192fe4b57b53c27156e331c574b Mon Sep 17 00:00:00 2001 From: Matthew Jacobson Date: Wed, 5 Apr 2023 14:10:03 -0400 Subject: [PATCH 55/80] Alerting: Add endpoint to revert to a previous alertmanager configuration (#65751) * Alerting: Add endpoint to revert to a previous alertmanager configuration This endpoint is meant to be used in conjunction with /api/alertmanager/grafana/config/history to revert to a previously applied alertmanager configuration. This is done by ID instead of raw config string in order to avoid secure field complications. --- pkg/services/ngalert/api/api_alertmanager.go | 32 +++++++++ .../ngalert/api/api_alertmanager_test.go | 40 +++++++++++ pkg/services/ngalert/api/authorization.go | 2 + .../ngalert/api/authorization_test.go | 2 +- .../ngalert/api/forking_alertmanager.go | 4 ++ .../api/generated_base_api_alertmanager.go | 16 +++++ pkg/services/ngalert/api/tooling/api.json | 8 ++- .../api/tooling/definitions/alertmanager.go | 16 +++++ pkg/services/ngalert/api/tooling/post.json | 43 ++++++++++- pkg/services/ngalert/api/tooling/spec.json | 43 ++++++++++- .../ngalert/notifier/alertmanager_config.go | 30 ++++++++ .../notifier/multiorg_alertmanager_test.go | 71 +++++++++++++++++++ pkg/services/ngalert/notifier/testing.go | 15 ++++ pkg/services/ngalert/store/alertmanager.go | 24 ++++++- .../ngalert/store/alertmanager_test.go | 55 ++++++++++++++ pkg/services/ngalert/store/database.go | 1 + 16 files changed, 393 insertions(+), 9 deletions(-) diff --git a/pkg/services/ngalert/api/api_alertmanager.go b/pkg/services/ngalert/api/api_alertmanager.go index 663a6c38f50..2884433551a 100644 --- a/pkg/services/ngalert/api/api_alertmanager.go +++ b/pkg/services/ngalert/api/api_alertmanager.go @@ -228,6 +228,38 @@ func (srv AlertmanagerSrv) RouteGetSilences(c *contextmodel.ReqContext) response return response.JSON(http.StatusOK, gettableSilences) } +func (srv AlertmanagerSrv) RoutePostGrafanaAlertingConfigHistoryActivate(c *contextmodel.ReqContext, id string) response.Response { + confId, err := strconv.ParseInt(id, 10, 64) + if err != nil { + return ErrResp(http.StatusBadRequest, err, "failed to parse config id") + } + + err = srv.mam.ActivateHistoricalConfiguration(c.Req.Context(), c.OrgID, confId) + if err != nil { + var unknownReceiverError notifier.UnknownReceiverError + if errors.As(err, &unknownReceiverError) { + return ErrResp(http.StatusBadRequest, unknownReceiverError, "") + } + var configRejectedError notifier.AlertmanagerConfigRejectedError + if errors.As(err, &configRejectedError) { + return ErrResp(http.StatusBadRequest, configRejectedError, "") + } + if errors.Is(err, store.ErrNoAlertmanagerConfiguration) { + return response.Error(http.StatusNotFound, err.Error(), err) + } + if errors.Is(err, notifier.ErrNoAlertmanagerForOrg) { + return response.Error(http.StatusNotFound, err.Error(), err) + } + if errors.Is(err, notifier.ErrAlertmanagerNotReady) { + return response.Error(http.StatusConflict, err.Error(), err) + } + + return ErrResp(http.StatusInternalServerError, err, "") + } + + return response.JSON(http.StatusAccepted, util.DynMap{"message": "configuration activated"}) +} + func (srv AlertmanagerSrv) RoutePostAlertingConfig(c *contextmodel.ReqContext, body apimodels.PostableUserConfig) response.Response { currentConfig, err := srv.mam.GetAlertmanagerConfiguration(c.Req.Context(), c.OrgID) // If a config is present and valid we proceed with the guard, otherwise we diff --git a/pkg/services/ngalert/api/api_alertmanager_test.go b/pkg/services/ngalert/api/api_alertmanager_test.go index e5e3b6f2160..8cbe6168bb4 100644 --- a/pkg/services/ngalert/api/api_alertmanager_test.go +++ b/pkg/services/ngalert/api/api_alertmanager_test.go @@ -381,6 +381,46 @@ func TestRouteGetAlertingConfigHistory(t *testing.T) { }) } +func TestRoutePostGrafanaAlertingConfigHistoryActivate(t *testing.T) { + sut := createSut(t, nil) + + t.Run("assert 404 when no historical configurations are found", func(tt *testing.T) { + req, err := http.NewRequest(http.MethodGet, "https://grafana.net", nil) + require.NoError(tt, err) + q := req.URL.Query() + req.URL.RawQuery = q.Encode() + + rc := createRequestCtxInOrg(10) + + response := sut.RoutePostGrafanaAlertingConfigHistoryActivate(rc, "0") + require.Equal(tt, 404, response.Status()) + }) + + t.Run("assert 202 for a valid org and id", func(tt *testing.T) { + req, err := http.NewRequest(http.MethodGet, "https://grafana.net", nil) + require.NoError(tt, err) + q := req.URL.Query() + req.URL.RawQuery = q.Encode() + + rc := createRequestCtxInOrg(1) + + response := sut.RoutePostGrafanaAlertingConfigHistoryActivate(rc, "0") + require.Equal(tt, 202, response.Status()) + }) + + t.Run("assert 400 when id is not parseable", func(tt *testing.T) { + req, err := http.NewRequest(http.MethodGet, "https://grafana.net", nil) + require.NoError(tt, err) + q := req.URL.Query() + req.URL.RawQuery = q.Encode() + + rc := createRequestCtxInOrg(1) + + response := sut.RoutePostGrafanaAlertingConfigHistoryActivate(rc, "abc") + require.Equal(tt, 400, response.Status()) + }) +} + func TestSilenceCreate(t *testing.T) { makeSilence := func(comment string, createdBy string, startsAt, endsAt strfmt.DateTime, matchers amv2.Matchers) amv2.Silence { diff --git a/pkg/services/ngalert/api/authorization.go b/pkg/services/ngalert/api/authorization.go index 8157ea0ebf1..418b5692634 100644 --- a/pkg/services/ngalert/api/authorization.go +++ b/pkg/services/ngalert/api/authorization.go @@ -166,6 +166,8 @@ func (api *API) authorize(method, path string) web.Handler { case http.MethodPost + "/api/alertmanager/grafana/config/api/v1/alerts": // additional authorization is done in the request handler eval = ac.EvalAny(ac.EvalPermission(ac.ActionAlertingNotificationsWrite)) + case http.MethodPost + "/api/alertmanager/grafana/config/history/{id}/_activate": + eval = ac.EvalAny(ac.EvalPermission(ac.ActionAlertingNotificationsWrite)) case http.MethodGet + "/api/alertmanager/grafana/config/api/v1/receivers": eval = ac.EvalPermission(ac.ActionAlertingNotificationsRead) case http.MethodPost + "/api/alertmanager/grafana/config/api/v1/receivers/test": diff --git a/pkg/services/ngalert/api/authorization_test.go b/pkg/services/ngalert/api/authorization_test.go index e9cdab1a24a..528644021af 100644 --- a/pkg/services/ngalert/api/authorization_test.go +++ b/pkg/services/ngalert/api/authorization_test.go @@ -49,7 +49,7 @@ func TestAuthorize(t *testing.T) { } paths[p] = methods } - require.Len(t, paths, 46) + require.Len(t, paths, 47) ac := acmock.New() api := &API{AccessControl: ac} diff --git a/pkg/services/ngalert/api/forking_alertmanager.go b/pkg/services/ngalert/api/forking_alertmanager.go index a1762ee64fb..78b87ded9a0 100644 --- a/pkg/services/ngalert/api/forking_alertmanager.go +++ b/pkg/services/ngalert/api/forking_alertmanager.go @@ -163,6 +163,10 @@ func (f *AlertmanagerApiHandler) handleRouteGetGrafanaAlertingConfigHistory(ctx return f.GrafanaSvc.RouteGetAlertingConfigHistory(ctx) } +func (f *AlertmanagerApiHandler) handleRoutePostGrafanaAlertingConfigHistoryActivate(ctx *contextmodel.ReqContext, id string) response.Response { + return f.GrafanaSvc.RoutePostGrafanaAlertingConfigHistoryActivate(ctx, id) +} + func (f *AlertmanagerApiHandler) handleRouteGetGrafanaSilence(ctx *contextmodel.ReqContext, id string) response.Response { return f.GrafanaSvc.RouteGetSilence(ctx, id) } diff --git a/pkg/services/ngalert/api/generated_base_api_alertmanager.go b/pkg/services/ngalert/api/generated_base_api_alertmanager.go index d474837b9ec..c4fff9c3238 100644 --- a/pkg/services/ngalert/api/generated_base_api_alertmanager.go +++ b/pkg/services/ngalert/api/generated_base_api_alertmanager.go @@ -42,6 +42,7 @@ type AlertmanagerApi interface { RoutePostAMAlerts(*contextmodel.ReqContext) response.Response RoutePostAlertingConfig(*contextmodel.ReqContext) response.Response RoutePostGrafanaAlertingConfig(*contextmodel.ReqContext) response.Response + RoutePostGrafanaAlertingConfigHistoryActivate(*contextmodel.ReqContext) response.Response RoutePostTestGrafanaReceivers(*contextmodel.ReqContext) response.Response } @@ -167,6 +168,11 @@ func (f *AlertmanagerApiHandler) RoutePostGrafanaAlertingConfig(ctx *contextmode } return f.handleRoutePostGrafanaAlertingConfig(ctx, conf) } +func (f *AlertmanagerApiHandler) RoutePostGrafanaAlertingConfigHistoryActivate(ctx *contextmodel.ReqContext) response.Response { + // Parse Path Parameters + idParam := web.Params(ctx.Req)[":id"] + return f.handleRoutePostGrafanaAlertingConfigHistoryActivate(ctx, idParam) +} func (f *AlertmanagerApiHandler) RoutePostTestGrafanaReceivers(ctx *contextmodel.ReqContext) response.Response { // Parse Request Body conf := apimodels.TestReceiversConfigBodyParams{} @@ -408,6 +414,16 @@ func (api *API) RegisterAlertmanagerApiEndpoints(srv AlertmanagerApi, m *metrics m, ), ) + group.Post( + toMacaronPath("/api/alertmanager/grafana/config/history/{id}/_activate"), + api.authorize(http.MethodPost, "/api/alertmanager/grafana/config/history/{id}/_activate"), + metrics.Instrument( + http.MethodPost, + "/api/alertmanager/grafana/config/history/{id}/_activate", + srv.RoutePostGrafanaAlertingConfigHistoryActivate, + m, + ), + ) group.Post( toMacaronPath("/api/alertmanager/grafana/config/api/v1/receivers/test"), api.authorize(http.MethodPost, "/api/alertmanager/grafana/config/api/v1/receivers/test"), diff --git a/pkg/services/ngalert/api/tooling/api.json b/pkg/services/ngalert/api/tooling/api.json index 4f5222b196c..d989685b0b8 100644 --- a/pkg/services/ngalert/api/tooling/api.json +++ b/pkg/services/ngalert/api/tooling/api.json @@ -3644,6 +3644,7 @@ "type": "object" }, "alertGroup": { + "description": "AlertGroup alert group", "properties": { "alerts": { "description": "alerts", @@ -3667,6 +3668,7 @@ "type": "object" }, "alertGroups": { + "description": "AlertGroups alert groups", "items": { "$ref": "#/definitions/alertGroup" }, @@ -3771,6 +3773,7 @@ "type": "object" }, "gettableAlert": { + "description": "GettableAlert gettable alert", "properties": { "annotations": { "$ref": "#/definitions/labelSet" @@ -3826,13 +3829,13 @@ "type": "object" }, "gettableAlerts": { - "description": "GettableAlerts gettable alerts", "items": { "$ref": "#/definitions/gettableAlert" }, "type": "array" }, "gettableSilence": { + "description": "GettableSilence gettable silence", "properties": { "comment": { "description": "comment", @@ -3881,12 +3884,14 @@ "type": "object" }, "gettableSilences": { + "description": "GettableSilences gettable silences", "items": { "$ref": "#/definitions/gettableSilence" }, "type": "array" }, "integration": { + "description": "Integration integration", "properties": { "lastNotifyAttempt": { "description": "A timestamp indicating the last attempt to deliver a notification regardless of the outcome.\nFormat: date-time", @@ -4068,7 +4073,6 @@ "type": "object" }, "receiver": { - "description": "Receiver receiver", "properties": { "active": { "description": "active", diff --git a/pkg/services/ngalert/api/tooling/definitions/alertmanager.go b/pkg/services/ngalert/api/tooling/definitions/alertmanager.go index da55966efdd..720eb99cf4c 100644 --- a/pkg/services/ngalert/api/tooling/definitions/alertmanager.go +++ b/pkg/services/ngalert/api/tooling/definitions/alertmanager.go @@ -61,6 +61,15 @@ import ( // Responses: // 200: GettableHistoricUserConfigs +// swagger:route POST /api/alertmanager/grafana/config/history/{id}/_activate alertmanager RoutePostGrafanaAlertingConfigHistoryActivate +// +// revert Alerting configuration to the historical configuration specified by the given id +// +// Responses: +// 202: Ack +// 400: ValidationError +// 404: NotFound + // swagger:route DELETE /api/alertmanager/grafana/config/api/v1/alerts alertmanager RouteDeleteGrafanaAlertingConfig // // deletes the Alerting config for a tenant @@ -458,6 +467,13 @@ type BodyAlertingConfig struct { Body PostableUserConfig } +// swagger:parameters RoutePostGrafanaAlertingConfigHistoryActivate +type HistoricalConfigId struct { + // Id should be the id of the GettableHistoricUserConfig + // in:path + Id int64 `json:"id"` +} + // alertmanager routes // swagger:parameters RoutePostAlertingConfig RouteGetAlertingConfig RouteDeleteAlertingConfig RouteGetAMStatus RouteGetAMAlerts RoutePostAMAlerts RouteGetAMAlertGroups RouteGetSilences RouteCreateSilence RouteGetSilence RouteDeleteSilence RoutePostAlertingConfig // testing routes diff --git a/pkg/services/ngalert/api/tooling/post.json b/pkg/services/ngalert/api/tooling/post.json index 206e5e4e113..a4f647fe6b0 100644 --- a/pkg/services/ngalert/api/tooling/post.json +++ b/pkg/services/ngalert/api/tooling/post.json @@ -3432,7 +3432,6 @@ "type": "object" }, "URL": { - "description": "The general form represented is:\n\n[scheme:][//[userinfo@]host][/]path[?query][#fragment]\n\nURLs that do not start with a slash after the scheme are interpreted as:\n\nscheme:opaque[?query][#fragment]\n\nNote that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.\nA consequence is that it is impossible to tell which slashes in the Path were\nslashes in the raw URL and which were %2f. This distinction is rarely important,\nbut when it is, the code should use the EscapedPath method, which preserves\nthe original encoding of Path.\n\nThe RawPath field is an optional field which is only set when the default\nencoding of Path is different from the escaped path. See the EscapedPath method\nfor more details.\n\nURL's String method uses the EscapedPath method to obtain the path.", "properties": { "ForceQuery": { "type": "boolean" @@ -3468,7 +3467,7 @@ "$ref": "#/definitions/Userinfo" } }, - "title": "A URL represents a parsed URL (technically, a URI reference).", + "title": "URL is a custom URL type that allows validation at configuration load time.", "type": "object" }, "Userinfo": { @@ -3882,6 +3881,7 @@ "type": "object" }, "gettableSilences": { + "description": "GettableSilences gettable silences", "items": { "$ref": "#/definitions/gettableSilence" }, @@ -4629,6 +4629,45 @@ ] } }, + "/api/alertmanager/grafana/config/history/{id}/_activate": { + "post": { + "description": "revert Alerting configuration to the historical configuration specified by the given id", + "operationId": "RoutePostGrafanaAlertingConfigHistoryActivate", + "parameters": [ + { + "description": "Id should be the id of the GettableHistoricUserConfig", + "format": "int64", + "in": "path", + "name": "id", + "required": true, + "type": "integer" + } + ], + "responses": { + "202": { + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + }, + "404": { + "description": "NotFound", + "schema": { + "$ref": "#/definitions/NotFound" + } + } + }, + "tags": [ + "alertmanager" + ] + } + }, "/api/alertmanager/{DatasourceUID}/api/v2/alerts": { "get": { "description": "get alertmanager alerts", diff --git a/pkg/services/ngalert/api/tooling/spec.json b/pkg/services/ngalert/api/tooling/spec.json index aebd5a0bf1c..65794ac1b02 100644 --- a/pkg/services/ngalert/api/tooling/spec.json +++ b/pkg/services/ngalert/api/tooling/spec.json @@ -458,6 +458,45 @@ } } }, + "/api/alertmanager/grafana/config/history/{id}/_activate": { + "post": { + "description": "revert Alerting configuration to the historical configuration specified by the given id", + "tags": [ + "alertmanager" + ], + "operationId": "RoutePostGrafanaAlertingConfigHistoryActivate", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "Id should be the id of the GettableHistoricUserConfig", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "202": { + "description": "Ack", + "schema": { + "$ref": "#/definitions/Ack" + } + }, + "400": { + "description": "ValidationError", + "schema": { + "$ref": "#/definitions/ValidationError" + } + }, + "404": { + "description": "NotFound", + "schema": { + "$ref": "#/definitions/NotFound" + } + } + } + } + }, "/api/alertmanager/{DatasourceUID}/api/v2/alerts": { "get": { "description": "get alertmanager alerts", @@ -6107,9 +6146,8 @@ } }, "URL": { - "description": "The general form represented is:\n\n[scheme:][//[userinfo@]host][/]path[?query][#fragment]\n\nURLs that do not start with a slash after the scheme are interpreted as:\n\nscheme:opaque[?query][#fragment]\n\nNote that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.\nA consequence is that it is impossible to tell which slashes in the Path were\nslashes in the raw URL and which were %2f. This distinction is rarely important,\nbut when it is, the code should use the EscapedPath method, which preserves\nthe original encoding of Path.\n\nThe RawPath field is an optional field which is only set when the default\nencoding of Path is different from the escaped path. See the EscapedPath method\nfor more details.\n\nURL's String method uses the EscapedPath method to obtain the path.", "type": "object", - "title": "A URL represents a parsed URL (technically, a URI reference).", + "title": "URL is a custom URL type that allows validation at configuration load time.", "properties": { "ForceQuery": { "type": "boolean" @@ -6562,6 +6600,7 @@ "$ref": "#/definitions/gettableSilence" }, "gettableSilences": { + "description": "GettableSilences gettable silences", "type": "array", "items": { "$ref": "#/definitions/gettableSilence" diff --git a/pkg/services/ngalert/notifier/alertmanager_config.go b/pkg/services/ngalert/notifier/alertmanager_config.go index 09c02081b54..2f900d9d7c6 100644 --- a/pkg/services/ngalert/notifier/alertmanager_config.go +++ b/pkg/services/ngalert/notifier/alertmanager_config.go @@ -43,6 +43,36 @@ func (moa *MultiOrgAlertmanager) GetAlertmanagerConfiguration(ctx context.Contex return moa.gettableUserConfigFromAMConfigString(ctx, org, amConfig.AlertmanagerConfiguration) } +// ActivateHistoricalConfiguration will set the current alertmanager configuration to a previous value based on the provided +// alert_configuration_history id. +func (moa *MultiOrgAlertmanager) ActivateHistoricalConfiguration(ctx context.Context, orgId int64, id int64) error { + config, err := moa.configStore.GetHistoricalConfiguration(ctx, orgId, id) + if err != nil { + return fmt.Errorf("failed to get historical alertmanager configuration: %w", err) + } + + cfg, err := Load([]byte(config.AlertmanagerConfiguration)) + if err != nil { + return fmt.Errorf("failed to unmarshal historical alertmanager configuration: %w", err) + } + + am, err := moa.AlertmanagerFor(orgId) + if err != nil { + // It's okay if the alertmanager isn't ready yet, we're changing its config anyway. + if !errors.Is(err, ErrAlertmanagerNotReady) { + return err + } + } + + if err := am.SaveAndApplyConfig(ctx, cfg); err != nil { + moa.logger.Error("unable to save and apply historical alertmanager configuration", "error", err, "org", orgId, "id", id) + return AlertmanagerConfigRejectedError{err} + } + moa.logger.Info("applied historical alertmanager configuration", "org", orgId, "id", id) + + return nil +} + // GetAppliedAlertmanagerConfigurations returns the last n configurations marked as applied for a given org. func (moa *MultiOrgAlertmanager) GetAppliedAlertmanagerConfigurations(ctx context.Context, org int64, limit int) ([]*definitions.GettableHistoricUserConfig, error) { configs, err := moa.configStore.GetAppliedConfigurations(ctx, org, limit) diff --git a/pkg/services/ngalert/notifier/multiorg_alertmanager_test.go b/pkg/services/ngalert/notifier/multiorg_alertmanager_test.go index a9153587a88..7710a0783d1 100644 --- a/pkg/services/ngalert/notifier/multiorg_alertmanager_test.go +++ b/pkg/services/ngalert/notifier/multiorg_alertmanager_test.go @@ -18,6 +18,7 @@ import ( "github.com/grafana/grafana/pkg/services/ngalert/metrics" "github.com/grafana/grafana/pkg/services/ngalert/models" "github.com/grafana/grafana/pkg/services/ngalert/provisioning" + "github.com/grafana/grafana/pkg/services/ngalert/store" "github.com/grafana/grafana/pkg/services/secrets/fakes" secretsManager "github.com/grafana/grafana/pkg/services/secrets/manager" "github.com/grafana/grafana/pkg/setting" @@ -298,6 +299,76 @@ func TestMultiOrgAlertmanager_AlertmanagerFor(t *testing.T) { } } +func TestMultiOrgAlertmanager_ActivateHistoricalConfiguration(t *testing.T) { + configStore := NewFakeConfigStore(t, map[int64]*models.AlertConfiguration{}) + orgStore := &FakeOrgStore{ + orgs: []int64{1, 2, 3}, + } + tmpDir := t.TempDir() + defaultConfig := `{"template_files":null,"alertmanager_config":{"route":{"receiver":"grafana-default-email","group_by":["grafana_folder","alertname"]},"templates":null,"receivers":[{"name":"grafana-default-email","grafana_managed_receiver_configs":[{"uid":"","name":"email receiver","type":"email","disableResolveMessage":false,"settings":{"addresses":"\u003cexample@email.com\u003e"},"secureSettings":null}]}]}}` + cfg := &setting.Cfg{ + DataPath: tmpDir, + UnifiedAlerting: setting.UnifiedAlertingSettings{AlertmanagerConfigPollInterval: 3 * time.Minute, DefaultConfiguration: defaultConfig}, // do not poll in tests. + } + kvStore := NewFakeKVStore(t) + provStore := provisioning.NewFakeProvisioningStore() + secretsService := secretsManager.SetupTestService(t, fakes.NewFakeSecretsStore()) + decryptFn := secretsService.GetDecryptedValue + reg := prometheus.NewPedanticRegistry() + m := metrics.NewNGAlert(reg) + mam, err := NewMultiOrgAlertmanager(cfg, configStore, orgStore, kvStore, provStore, decryptFn, m.GetMultiOrgAlertmanagerMetrics(), nil, log.New("testlogger"), secretsService) + require.NoError(t, err) + ctx := context.Background() + + // Ensure that one Alertmanager is created per org. + { + require.NoError(t, mam.LoadAndSyncAlertmanagersForOrgs(ctx)) + require.Len(t, mam.alertmanagers, 3) + } + + // First, let's confirm the default configs are active. + cfgs, err := mam.getLatestConfigs(ctx) + require.NoError(t, err) + require.Equal(t, defaultConfig, cfgs[1].AlertmanagerConfiguration) + require.Equal(t, defaultConfig, cfgs[2].AlertmanagerConfiguration) + // Store id for later use. + originalId := cfgs[2].ID + require.Equal(t, defaultConfig, cfgs[3].AlertmanagerConfiguration) + + // Now let's save a new config for org 2. + newConfig := `{"template_files":null,"alertmanager_config":{"route":{"receiver":"grafana-default-email","group_by":["grafana_folder","alertname"]},"templates":null,"receivers":[{"name":"grafana-default-email","grafana_managed_receiver_configs":[{"uid":"","name":"some other name","type":"email","disableResolveMessage":false,"settings":{"addresses":"\u003cexample@email.com\u003e"},"secureSettings":null}]}]}}` + am, err := mam.AlertmanagerFor(2) + require.NoError(t, err) + + postable, err := Load([]byte(newConfig)) + require.NoError(t, err) + + err = am.SaveAndApplyConfig(ctx, postable) + require.NoError(t, err) + + // Verify that the org has the new config. + cfgs, err = mam.getLatestConfigs(ctx) + require.NoError(t, err) + require.Equal(t, newConfig, cfgs[2].AlertmanagerConfiguration) + + // First, let's try to activate a historical alertmanager config that doesn't exist. + { + err := mam.ActivateHistoricalConfiguration(ctx, 1, 42) + require.Error(t, err, store.ErrNoAlertmanagerConfiguration) + } + + // Finally, we activate the default config for org 2. + { + err := mam.ActivateHistoricalConfiguration(ctx, 2, originalId) + require.NoError(t, err) + } + + // Verify that the org has the old default config. + cfgs, err = mam.getLatestConfigs(ctx) + require.NoError(t, err) + require.Equal(t, defaultConfig, cfgs[2].AlertmanagerConfiguration) +} + var brokenConfig = ` "alertmanager_config": { "route": { diff --git a/pkg/services/ngalert/notifier/testing.go b/pkg/services/ngalert/notifier/testing.go index 22e1cef7c52..8dd7e111765 100644 --- a/pkg/services/ngalert/notifier/testing.go +++ b/pkg/services/ngalert/notifier/testing.go @@ -154,6 +154,21 @@ func (f *fakeConfigStore) GetAppliedConfigurations(_ context.Context, orgID int6 return configs, nil } +func (f *fakeConfigStore) GetHistoricalConfiguration(_ context.Context, orgID int64, id int64) (*models.HistoricAlertConfiguration, error) { + configsByOrg, ok := f.historicConfigs[orgID] + if !ok { + return &models.HistoricAlertConfiguration{}, store.ErrNoAlertmanagerConfiguration + } + + for _, conf := range configsByOrg { + if conf.ID == id && conf.OrgID == orgID { + return conf, nil + } + } + + return &models.HistoricAlertConfiguration{}, store.ErrNoAlertmanagerConfiguration +} + type FakeOrgStore struct { orgs []int64 } diff --git a/pkg/services/ngalert/store/alertmanager.go b/pkg/services/ngalert/store/alertmanager.go index 99552442ee9..b4d3ee81735 100644 --- a/pkg/services/ngalert/store/alertmanager.go +++ b/pkg/services/ngalert/store/alertmanager.go @@ -189,6 +189,26 @@ func (st *DBstore) GetAppliedConfigurations(ctx context.Context, orgID int64, li return configs, nil } +// GetHistoricalConfiguration returns a single historical configuration based on provided org and id. +func (st *DBstore) GetHistoricalConfiguration(ctx context.Context, orgID int64, id int64) (*models.HistoricAlertConfiguration, error) { + var config models.HistoricAlertConfiguration + if err := st.SQLStore.WithDbSession(ctx, func(sess *db.Session) error { + ok, err := sess.Table("alert_configuration_history"). + Where("id = ? AND org_id = ?", id, orgID). + Get(&config) + if err != nil { + return err + } + if !ok { + return ErrNoAlertmanagerConfiguration + } + return nil + }); err != nil { + return nil, err + } + return &config, nil +} + func (st *DBstore) deleteOldConfigurations(ctx context.Context, orgID int64, limit int) (int64, error) { if limit < 1 { return 0, fmt.Errorf("failed to delete old configurations: limit is set to '%d' but needs to be > 0", limit) @@ -219,11 +239,11 @@ func (st *DBstore) deleteOldConfigurations(ctx context.Context, orgID int64, lim } res, err := sess.Exec(` - DELETE FROM + DELETE FROM alert_configuration_history WHERE org_id = ? - AND + AND id < ? `, orgID, threshold) if err != nil { diff --git a/pkg/services/ngalert/store/alertmanager_test.go b/pkg/services/ngalert/store/alertmanager_test.go index 150adc9104d..306bbbc243f 100644 --- a/pkg/services/ngalert/store/alertmanager_test.go +++ b/pkg/services/ngalert/store/alertmanager_test.go @@ -425,6 +425,61 @@ func TestIntegrationGetAppliedConfigurations(t *testing.T) { }) } +func TestIntegrationGetHistoricalConfiguration(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } + sqlStore := db.InitTestDB(t) + store := &DBstore{ + SQLStore: sqlStore, + Logger: log.NewNopLogger(), + } + + // Tracks the autogenerated PK for the history table. + var historyTablePK int64 = 0 + + t.Run("no configurations = error", func(tt *testing.T) { + _, err := store.GetHistoricalConfiguration(context.Background(), 10, 10) + require.Error(tt, err) + }) + + t.Run("correct configurations should be returned", func(tt *testing.T) { + ctx := context.Background() + var org int64 = 1 + setupConfigInOrg(t, "testa", org, store) + historyTablePK += 1 + setupConfigInOrg(t, "testb", org, store) + historyTablePK += 1 + + cfg, err := store.GetHistoricalConfiguration(ctx, org, historyTablePK) + require.NoError(tt, err) + + // Check that the returned configuration is the one that we're expecting. + require.Equal(tt, "testb", cfg.AlertmanagerConfiguration) + }) + + t.Run("configurations from other orgs should not be retrievable by id", func(tt *testing.T) { + ctx := context.Background() + var org int64 = 1 + setupConfigInOrg(t, "test1", org, store) + historyTablePK += 1 + + // Create a config in a different org. + var otherOrg int64 = 2 + setupConfigInOrg(t, "test2", otherOrg, store) + historyTablePK += 1 + + // Sanity check that config is retrievable with correct org and id. + cfg, err := store.GetHistoricalConfiguration(ctx, otherOrg, historyTablePK) + require.NoError(tt, err) + require.Equal(tt, "test2", cfg.AlertmanagerConfiguration) + + // Verify that we cannot retrieve the config from org=2 when passing in org=1. + _, err = store.GetHistoricalConfiguration(ctx, org, historyTablePK) + require.Error(tt, err, ErrNoAlertmanagerConfiguration) + }) +} + func setupConfig(t *testing.T, config string, store *DBstore) (string, string) { t.Helper() return setupConfigInOrg(t, config, 1, store) diff --git a/pkg/services/ngalert/store/database.go b/pkg/services/ngalert/store/database.go index f91ac4788f7..16a170ae23e 100644 --- a/pkg/services/ngalert/store/database.go +++ b/pkg/services/ngalert/store/database.go @@ -29,6 +29,7 @@ type AlertingStore interface { UpdateAlertmanagerConfiguration(ctx context.Context, cmd *models.SaveAlertmanagerConfigurationCmd) error MarkConfigurationAsApplied(ctx context.Context, cmd *models.MarkConfigurationAsAppliedCmd) error GetAppliedConfigurations(ctx context.Context, orgID int64, limit int) ([]*models.HistoricAlertConfiguration, error) + GetHistoricalConfiguration(ctx context.Context, orgID int64, id int64) (*models.HistoricAlertConfiguration, error) } // DBstore stores the alert definitions and instances in the database. From f27326f7d9b89c654f915de3496c2ab3e533f29d Mon Sep 17 00:00:00 2001 From: Virginia Cepeda Date: Wed, 5 Apr 2023 15:13:33 -0300 Subject: [PATCH 56/80] Alerting: Choose a previous valid AM configuration in case of error (#65746) * Add new property to AlertmanagerConfig type * Implement fetching successfully applied configurations Added method to fetch them from the API and its corresponding action and reducer * Extract ConfigEditor as component to avoid code duplication * Display dropdown with valid configs upon error and allow to save them * Fix tests * Refactor to call new endpoint using RTK * Improve texts * Apply suggested refactor * Change constant casing * Only show config selector for Grafana AM * Remove ts-ignore * Move code together for simplicity * Remove invalid mock * Update endpoint and types based on backend changes * Rename property * Rename alermanager config property from backend changes * Disable editing old configurations Due to the latest backend changes, we no longer will provide the option to edit previous AM configurations in a textearea. Instead users will only be allowed to reset to a specific one with the same content. For this reason the textearea for old conf igurations is disabled and a different form action (not submit) is executed on the "reset config" button. The updateAlertManage rConfigAction is reset to its old functionality due to these changes. * Add id to AlertManagerCortexConfig type We'll need it to pass as a parameter to the new reset endpoint * Add new endpoint for resetting AM configs to an old version * Move the "Reset to selected configuration" button next to the drop-down * Add relative offset to configurations --- .../alerting/unified/api/alertmanager.ts | 2 + .../alerting/unified/api/alertmanagerApi.ts | 23 ++++ .../admin/AlertmanagerConfig.test.tsx | 8 +- .../components/admin/AlertmanagerConfig.tsx | 114 +++++++----------- .../admin/AlertmanagerConfigSelector.tsx | 110 +++++++++++++++++ .../unified/components/admin/ConfigEditor.tsx | 96 +++++++++++++++ .../alerting/unified/state/actions.ts | 10 +- .../plugins/datasource/alertmanager/types.ts | 3 + 8 files changed, 288 insertions(+), 78 deletions(-) create mode 100644 public/app/features/alerting/unified/components/admin/AlertmanagerConfigSelector.tsx create mode 100644 public/app/features/alerting/unified/components/admin/ConfigEditor.tsx diff --git a/public/app/features/alerting/unified/api/alertmanager.ts b/public/app/features/alerting/unified/api/alertmanager.ts index 2f75264468f..ba565453d42 100644 --- a/public/app/features/alerting/unified/api/alertmanager.ts +++ b/public/app/features/alerting/unified/api/alertmanager.ts @@ -34,6 +34,8 @@ export async function fetchAlertManagerConfig(alertManagerSourceName: string): P template_files: result.data.template_files ?? {}, template_file_provenances: result.data.template_file_provenances ?? {}, alertmanager_config: result.data.alertmanager_config ?? {}, + last_applied: result.data.last_applied, + id: result.data.id, }; } catch (e) { // if no config has been uploaded to grafana, it returns error instead of latest config diff --git a/public/app/features/alerting/unified/api/alertmanagerApi.ts b/public/app/features/alerting/unified/api/alertmanagerApi.ts index be7f2634b44..66f6d760422 100644 --- a/public/app/features/alerting/unified/api/alertmanagerApi.ts +++ b/public/app/features/alerting/unified/api/alertmanagerApi.ts @@ -1,12 +1,16 @@ import { AlertmanagerChoice, + AlertManagerCortexConfig, ExternalAlertmanagerConfig, ExternalAlertmanagers, ExternalAlertmanagersResponse, } from '../../../../plugins/datasource/alertmanager/types'; +import { getDatasourceAPIUid, GRAFANA_RULES_SOURCE_NAME } from '../utils/datasource'; import { alertingApi } from './alertingApi'; +const LIMIT_TO_SUCCESSFULLY_APPLIED_AMS = 10; + export interface AlertmanagersChoiceResponse { alertmanagersChoice: AlertmanagerChoice; numExternalAlertmanagers: number; @@ -33,5 +37,24 @@ export const alertmanagerApi = alertingApi.injectEndpoints({ query: (config) => ({ url: '/api/v1/ngalert/admin_config', method: 'POST', data: config }), invalidatesTags: ['AlertmanagerChoice'], }), + + getValidAlertManagersConfig: build.query({ + //this is only available for the "grafana" alert manager + query: () => ({ + url: `/api/alertmanager/${getDatasourceAPIUid( + GRAFANA_RULES_SOURCE_NAME + )}/config/history?limit=${LIMIT_TO_SUCCESSFULLY_APPLIED_AMS}`, + }), + }), + + resetAlertManagerConfigToOldVersion: build.mutation<{ message: string }, { id: number }>({ + //this is only available for the "grafana" alert manager + query: (config) => ({ + url: `/api/alertmanager/${getDatasourceAPIUid(GRAFANA_RULES_SOURCE_NAME)}/config/history/${ + config.id + }/_activate`, + method: 'POST', + }), + }), }), }); diff --git a/public/app/features/alerting/unified/components/admin/AlertmanagerConfig.test.tsx b/public/app/features/alerting/unified/components/admin/AlertmanagerConfig.test.tsx index a9bebf53196..5b6df00d2f9 100644 --- a/public/app/features/alerting/unified/components/admin/AlertmanagerConfig.test.tsx +++ b/public/app/features/alerting/unified/components/admin/AlertmanagerConfig.test.tsx @@ -100,9 +100,7 @@ describe('Admin config', () => { alertmanager_config: {}, }); mocks.api.deleteAlertManagerConfig.mockResolvedValue(); - - await renderAdminPage(dataSources.alertManager.name); - + renderAdminPage(dataSources.alertManager.name); await userEvent.click(await ui.resetButton.find()); await userEvent.click(ui.confirmButton.get()); await waitFor(() => expect(mocks.api.deleteAlertManagerConfig).toHaveBeenCalled()); @@ -128,7 +126,7 @@ describe('Admin config', () => { mocks.api.fetchConfig.mockImplementation(() => Promise.resolve(savedConfig ?? defaultConfig)); mocks.api.updateAlertManagerConfig.mockResolvedValue(); - await renderAdminPage(dataSources.alertManager.name); + renderAdminPage(dataSources.alertManager.name); const input = await ui.configInput.find(); expect(input.value).toEqual(JSON.stringify(defaultConfig, null, 2)); await userEvent.clear(input); @@ -147,7 +145,7 @@ describe('Admin config', () => { ...someCloudAlertManagerStatus, config: someCloudAlertManagerConfig.alertmanager_config, }); - await renderAdminPage(dataSources.promAlertManager.name); + renderAdminPage(dataSources.promAlertManager.name); await ui.readOnlyConfig.find(); expect(ui.configInput.query()).not.toBeInTheDocument(); diff --git a/public/app/features/alerting/unified/components/admin/AlertmanagerConfig.tsx b/public/app/features/alerting/unified/components/admin/AlertmanagerConfig.tsx index 959e55d4d3a..b5d4261ba13 100644 --- a/public/app/features/alerting/unified/components/admin/AlertmanagerConfig.tsx +++ b/public/app/features/alerting/unified/components/admin/AlertmanagerConfig.tsx @@ -2,7 +2,7 @@ import { css } from '@emotion/css'; import React, { useEffect, useState, useMemo } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; -import { Alert, Button, ConfirmModal, TextArea, HorizontalGroup, Field, Form, useStyles2 } from '@grafana/ui'; +import { Alert, useStyles2 } from '@grafana/ui'; import { useDispatch } from 'app/types'; import { useAlertManagerSourceName } from '../../hooks/useAlertManagerSourceName'; @@ -17,7 +17,10 @@ import { GRAFANA_RULES_SOURCE_NAME, isVanillaPrometheusAlertManagerDataSource } import { initialAsyncRequestState } from '../../utils/redux'; import { AlertManagerPicker } from '../AlertManagerPicker'; -interface FormValues { +import AlertmanagerConfigSelector, { ValidAmConfigOption } from './AlertmanagerConfigSelector'; +import { ConfigEditor } from './ConfigEditor'; + +export interface FormValues { configJSON: string; } @@ -29,11 +32,14 @@ export default function AlertmanagerConfig(): JSX.Element { const [showConfirmDeleteAMConfig, setShowConfirmDeleteAMConfig] = useState(false); const { loading: isDeleting } = useUnifiedAlertingSelector((state) => state.deleteAMConfig); const { loading: isSaving } = useUnifiedAlertingSelector((state) => state.saveAMConfig); + const readOnly = alertManagerSourceName ? isVanillaPrometheusAlertManagerDataSource(alertManagerSourceName) : false; const styles = useStyles2(getStyles); const configRequests = useUnifiedAlertingSelector((state) => state.amConfigs); + const [selectedAmConfig, setSelectedAmConfig] = useState(); + const { result: config, loading: isLoadingConfig, @@ -60,6 +66,13 @@ export default function AlertmanagerConfig(): JSX.Element { [config] ); + const defaultValidValues = useMemo( + (): FormValues => ({ + configJSON: selectedAmConfig ? JSON.stringify(selectedAmConfig.value, null, 2) : '', + }), + [selectedAmConfig] + ); + const loading = isDeleting || isLoadingConfig || isSaving; const onSubmit = (values: FormValues) => { @@ -84,9 +97,25 @@ export default function AlertmanagerConfig(): JSX.Element { dataSources={alertManagers} /> {loadingError && !loading && ( - - {loadingError.message || 'Unknown error.'} - + <> + + {loadingError.message || 'Unknown error.'} + + + {alertManagerSourceName === GRAFANA_RULES_SOURCE_NAME && ( + + )} + )} {isDeleting && alertManagerSourceName !== GRAFANA_RULES_SOURCE_NAME && ( @@ -94,70 +123,17 @@ export default function AlertmanagerConfig(): JSX.Element { )} {alertManagerSourceName && config && ( -
- {({ register, errors }) => ( - <> - {!readOnly && ( - -