Skip to content

Commit

Permalink
Merge pull request #7 from grafana/main
Browse files Browse the repository at this point in the history
Chore: Merge Main
  • Loading branch information
Jayclifford345 authored Oct 20, 2023
2 parents af76807 + 3e24a50 commit 29509cb
Show file tree
Hide file tree
Showing 161 changed files with 29,604 additions and 5,945 deletions.
5 changes: 0 additions & 5 deletions .betterer.results
Original file line number Diff line number Diff line change
Expand Up @@ -689,11 +689,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Styles should be written using objects.", "2"],
[0, 0, 0, "Styles should be written using objects.", "3"]
],
"packages/grafana-plugin-configs/webpack.config.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
],
"packages/grafana-runtime/src/analytics/types.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
Expand Down
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
# Documentation sources might have different owners.
/docs/ @grafana/docs-tooling
/docs/sources/ @Eve832
/docs/sources/administration/ @Eve832 @GrafanaWriter
/docs/sources/administration/ @jdbaldry
/docs/sources/alerting/ @brendamuir
/docs/sources/dashboards/ @imatwawana
/docs/sources/datasources/ @lwandz13
Expand Down Expand Up @@ -329,6 +329,7 @@
/packages/grafana-schema/src/**/*tempo* @grafana/observability-traces-and-profiling
/packages/grafana-flamegraph/ @grafana/observability-traces-and-profiling
/plugins-bundled/ @grafana/plugins-platform-frontend
/packages/grafana-plugin-configs/ @grafana/plugins-platform-frontend


# root files, mostly frontend
Expand Down
8 changes: 8 additions & 0 deletions .github/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,5 +442,13 @@
"addToProject": {
"url": "https://github.com/orgs/grafana/projects/72"
}
},
{
"type": "label",
"name": "grafana program",
"action": "addToProject",
"addToProject": {
"url": "https://github.com/orgs/grafana/projects/471"
}
}
]
63 changes: 63 additions & 0 deletions .yarn/patches/history-npm-4.10.1-ee217563ae.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
diff --git a/cjs/history.js b/cjs/history.js
index fcd8ebab613c6d87b9ac824feb30ab1080cf0ef2..4df20d5cb2f9ba5fc8777899aada53f49399560b 100644
--- a/cjs/history.js
+++ b/cjs/history.js
@@ -103,16 +103,6 @@ function createLocation(path, state, key, currentLocation) {
if (state !== undefined && location.state === undefined) location.state = state;
}

- try {
- location.pathname = decodeURI(location.pathname);
- } catch (e) {
- if (e instanceof URIError) {
- throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');
- } else {
- throw e;
- }
- }
-
if (key) location.key = key;

if (currentLocation) {
diff --git a/esm/history.js b/esm/history.js
index df67820fe3eed558c44fca07a82b0cd409d46720..e0e0d4f69a407e8de782b3fdf8297d42708e110a 100644
--- a/esm/history.js
+++ b/esm/history.js
@@ -80,16 +80,6 @@ function createLocation(path, state, key, currentLocation) {
if (state !== undefined && location.state === undefined) location.state = state;
}

- try {
- location.pathname = decodeURI(location.pathname);
- } catch (e) {
- if (e instanceof URIError) {
- throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');
- } else {
- throw e;
- }
- }
-
if (key) location.key = key;

if (currentLocation) {
diff --git a/umd/history.js b/umd/history.js
index 80e4ff66c44a2a71d4f842cc05a252e48dd18e9a..f8f4901be95e48c66f5626fbf051747a2ffbe41d 100644
--- a/umd/history.js
+++ b/umd/history.js
@@ -207,16 +207,6 @@
if (state !== undefined && location.state === undefined) location.state = state;
}

- try {
- location.pathname = decodeURI(location.pathname);
- } catch (e) {
- if (e instanceof URIError) {
- throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');
- } else {
- throw e;
- }
- }
-
if (key) location.key = key;

if (currentLocation) {
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ Issue [#67014](https://github.com/grafana/grafana/issues/67014)

Grafana requires an Elasticsearch version of 7.16 or newer. If you use an older Elasticsearch version, you will get warnings in the query editor and on the datasource configuration page. Issue [#66928](https://github.com/grafana/grafana/issues/66928)

The deprecated `plugin:create` and `component:create` commands in the Grafana Toolkit have been removed in this release. The replacement `create-plugin` tool is recommended for [scaffolding new plugins](https://grafana.github.io/plugin-tools/docs/getting-started/creating-a-plugin) and a migration guide for moving from the toolkit is available [here](https://grafana.github.io/plugin-tools/docs/getting-started/migrating-from-toolkit). Issue [#66729](https://github.com/grafana/grafana/issues/66729)
The deprecated `plugin:create` and `component:create` commands in the Grafana Toolkit have been removed in this release. The replacement `create-plugin` tool is recommended for [scaffolding new plugins](https://grafana.com/developers/plugin-tools/) and a migration guide for moving from the toolkit is available [here](https://grafana.com/developers/plugin-tools/migration-guides/migrate-from-toolkit). Issue [#66729](https://github.com/grafana/grafana/issues/66729)

We've removed some now unused properties from the `NavModel` interface. Issue [#66548](https://github.com/grafana/grafana/issues/66548)

Expand Down
6 changes: 6 additions & 0 deletions devenv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ Grafana uses [Docker](https://docker.com) to make the task of setting up databas

## Developer dashboards and data sources

To setup developer dashboards and data sources
```bash
./setup.sh
```

To remove the setup developer dashboards and data sources
```bash
./setup.sh undev
```

After restarting the Grafana server, there should be a number of data sources named `gdev-<type>` provisioned as well as
a dashboard folder named `gdev dashboards`. This folder contains dashboard and panel features tests dashboards.

Expand Down
28 changes: 28 additions & 0 deletions devenv/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,31 @@ devDatasources() {
ln -s -f ../../../devenv/datasources.yaml ../conf/provisioning/datasources/dev.yaml
}

undev() {
echo -e "\xE2\x9C\x94 Reverting all dev provisioning"

# Removing generated dashboard files from bulk-dashboards
rm -f bulk-dashboards/dashboard*.json
echo -e " \xE2\x9C\x94 Reverting bulk-dashboards provisioning"

# Removing generated folders from bulk-folders
rm -rf bulk-folders/Bulk\ Folder*
echo -e " \xE2\x9C\x94 Reverting bulk-folders provisioning"


# Removing generated dashboard and datasource files from bulk-alerting-dashboards
rm -f bulk_alerting_dashboards/alerting_dashboard*.json
rm -f "bulk_alerting_dashboards/bulk_alerting_datasources.yaml"
echo -e " \xE2\x9C\x94 Reverting bulk-alerting-dashboards provisioning"

# Removing the symlinks
rm -f ../conf/provisioning/dashboards/custom.yaml
rm -f ../conf/provisioning/dashboards/bulk-folders.yaml
rm -f ../conf/provisioning/dashboards/dev.yaml
rm -f ../conf/provisioning/datasources/custom.yaml
rm -f ../conf/provisioning/datasources/dev.yaml
}

usage() {
echo -e "\n"
echo "Usage:"
Expand All @@ -67,6 +92,7 @@ usage() {
echo " bulk-folders [folders] [dashboards] - provision many folders with dashboards"
echo " bulk-folders - provision 200 folders with 3 dashboards in each"
echo " no args - provision core datasources and dev dashboards"
echo " undev - removes any provisioning done by the setup.sh"
}

main() {
Expand All @@ -84,6 +110,8 @@ main() {
bulkDashboard
elif [[ $cmd == "bulk-folders" ]]; then
bulkFolders "$arg1"
elif [[ $cmd == "undev" ]]; then
undev
else
devDashboards
devDatasources
Expand Down
15 changes: 10 additions & 5 deletions docs/sources/administration/correlations/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,30 @@ weight: 900

You can create interactive links for Explore visualizations to run queries related to presented data by setting up Correlations.

A correlation defines how data in one [data source]({{< relref "/docs/grafana/latest/datasources/" >}}) is used to query data in another data source. Some examples:
A correlation defines how data in one [data source]({{< relref "../../datasources" >}}) is used to query data in another data source.
Some examples:

- an application name returned in a logs data source can be used to query metrics related to that application in a metrics data source, or
- a user name returned by an SQL data source can be used to query logs related to that particular user in a logs data source

[Explore]({{< relref "/docs/grafana/latest/explore/" >}}) takes user-defined correlations to display links inside the visualizations. You can click on a link to run the related query and see results in [Explore Split View]({{< relref "/docs/grafana/latest/explore/#split-and-compare" >}}).
[Explore]({{< relref "../../explore" >}}) takes user-defined correlations to display links inside the visualizations.
You can click on a link to run the related query and see results in [Explore Split View]({{< relref "../../explore#split-and-compare" >}}).

Explore visualizations that currently support showing links based on correlations:

- [Logs Panel]({{< relref "./use-correlations-in-visualizations#correlations-in-logs-panel">}})
- [Table]({{< relref "./use-correlations-in-visualizations#correlations-in-table">}})

You can configure correlations using [Administration > Correlation page]({{< relref "/docs/grafana/latest/administration/" >}}) or with [provisioning]({{< relref "/docs/grafana/latest/administration/provisioning" >}}).
You can configure correlations using the **Administration > Correlation** page in Grafana or with [provisioning]({{< relref "../provisioning" >}}).

> **Note:** Correlations are available in Grafana 10.0+ as an opt-in beta feature. Modify Grafana [configuration file]({{< relref "/docs/grafana/latest/setup-grafana/configure-grafana/#configuration-file-location" >}}) to enable the `correlations` [feature toggle]({{< relref "/docs/grafana/latest/setup-grafana/configure-grafana/#feature_toggles" >}}) to use it.
{{% admonition type="note" %}}
Correlations are available in Grafana 10.0+ as an opt-in beta feature.
Modify the Grafana [configuration file]({{< relref "../../setup-grafana/configure-grafana#configuration-file-location" >}}) to enable the `correlations` [feature toggle]({{< relref "../../setup-grafana/configure-grafana#feature_toggles" >}}) to use it.
{{% /admonition %}}

## Example of how links work in Explore once set up

{{< figure src="/static/img/docs/correlations/correlations-in-explore-10-0.gif" caption="Correlations links in Explore" >}}
{{< figure src="/static/img/docs/correlations/correlations-in-explore-10-0.gif" alt="Demonstration of following a correlation link in Grafana Explore" caption="Correlations links in Explore" >}}

See also:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ weight: 30

## Before you begin

Adding access to create correlations for [Viewers and Editors]({{< relref "/docs/grafana/latest/administration/roles-and-permissions/" >}}) is available with [Role-based access control]({{< relref "/docs/grafana/latest/administration/roles-and-permissions/access-control/" >}}).
Adding access to create correlations for [Viewers and Editors]({{< relref "../../../administration/roles-and-permissions" >}}) is available with [Role-based access control]({{< relref "../../../administration/roles-and-permissions/access-control" >}}).

## Add permissions to create correlations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,21 @@ Learn how to create correlations using the [Administration page]({{< relref "./c

## Source data source and result field

Links are shown in Explore visualizations for the results from the correlation’s source data source. A link is assigned to one of the fields from the result provided in the correlation configuration (the results field). Each visualization displays fields with links in a different way ([Correlations in Logs Panel]({{< relref "./use-correlations-in-visualizations#correlations-in-logs-panel">}}) and see [Correlations in Table]({{< relref "./use-correlations-in-visualizations#correlations-in-table">}}))
Links are shown in Explore visualizations for the results from the correlation’s source data source.
A link is assigned to one of the fields from the result provided in the correlation configuration (the results field).
Each visualization displays fields with links in a different way ([Correlations in Logs Panel]({{< relref "./use-correlations-in-visualizations#correlations-in-logs-panel">}}) and see [Correlations in Table]({{< relref "./use-correlations-in-visualizations#correlations-in-table">}})).

## Target query

The target query is run when a link is clicked in the visualization. You can use the query editor of the selected target data source to specify the target query. Source data results can be accessed inside the target query with variables.

### Correlation Variables

You can use variables inside the target query to access the source data related to the query. Correlations use [Grafana variable syntax]({{< relref "/docs/grafana/latest/dashboards/variables/variable-syntax" >}}). Variables are filled with values from the source results when the link is clicked. There are two types of variables you can use:
You can use variables inside the target query to access the source data related to the query.
Correlations use [Grafana variable syntax]({{< relref "../../../dashboards/variables/variable-syntax" >}}).
Variables are filled with values from the source results when the link is clicked. There are two types of variables you can use:

- [field variables]({{< relref "/docs/grafana/latest/panels-visualizations/configure-data-links#field-variables" >}}) (allows to access field values and labels)
- [field variables]({{< relref "../../../panels-visualizations/configure-data-links#field-variables" >}}) (allows to access field values and labels)
- correlation variables (allows to access field values and transformations)

Example: If source results contain a field called “employee”, the value of the field can be accessed with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ weight: 20

# Permissions

Users with [Viewer base role]({{< relref "/docs/grafana/latest/administration/roles-and-permissions/" >}}) or with [datasources:query RBAC role]({{< relref "/docs/grafana/latest/administration/roles-and-permissions/access-control/" >}}) can:
Users with [Viewer base role]({{< relref "../../../administration/roles-and-permissions" >}}) or with [datasources:query RBAC role]({{< relref "../../../administration/roles-and-permissions/access-control" >}}) can:

- Use correlations in Explore’s visualizations
- List all available correlations in read-only mode
- Use correlations in Explore’s visualizations.
- List all available correlations in read-only mode.

Users with [Admin base role]({{< relref "/docs/grafana/latest/administration/roles-and-permissions/" >}}) or with [datasources:write RBAC role]({{< relref "/docs/grafana/latest/administration/roles-and-permissions/access-control/" >}}) can:
Users with [Admin base role]({{< relref "../../../administration/roles-and-permissions" >}}) or with [datasources:write RBAC role]({{< relref "../../../administration/roles-and-permissions/access-control" >}}) can:

- Add, edit and delete correlations
- Add, edit and delete correlations.
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ Make sure you have permission to add new correlations. Only users with write per
## Create a correlation in Explore's Correlations Editor

1. Go to Explore page.
1. Select a data source that you would like to be [the source data source]({{< relref "/docs/grafana/latest/administration/correlations/correlation-configuration#source-data-source-and-result-field" >}}) for a new correlation.
1. Run a query producing data in [a supported visualization]({{< relref "/docs/grafana/latest/administration/correlations/#correlations" >}}).
1. Click "+ Add" button in the top toolbar and select "Add correlation" (you can also select "Correlations Editor" from the [Command Palette]({{< relref "/docs/grafana/latest/search/#command-palette" >}})).
1. Select a data source that you would like to be [the source data source]({{< relref "../../../administration/correlations/correlation-configuration#source-data-source-and-result-field" >}}) for a new correlation.
1. Run a query producing data in [a supported visualization]({{< relref "../../../administration/correlations#correlations" >}}).
1. Click "+ Add" button in the top toolbar and select "Add correlation" (you can also select "Correlations Editor" from the [Command Palette]({{< relref "../../../search#command-palette" >}})).
1. Explore is now in Correlations Editor mode indicated by a blue border and top bar. You can exit Correlations Editor using the Exit button in the top bar.
1. The visualization is enriched with links allowing to create new correlations. Links are attached to the data that you can use to build a new query:
- Logs: links are displayed next to field values inside log details for each log row
- Table: every table cell is a link
1. Click on a link to begin adding new correlation. Links are associated with a field that will be used as [a results field of a correlation]({{< relref "/docs/grafana/latest/administration/correlations/correlation-configuration" >}}). This means the correlation link will be created on the link you select once the correlation is saved.
1. Explore opens a split view. Use the right pane to setup [the target query source of the correlation]({{< relref "/docs/grafana/latest/administration/correlations/correlation-configuration#target-query" >}}).
1. Build target query using [variables syntax]({{< relref "/docs/grafana/latest/dashboards/variables/variable-syntax" >}}) with variables from the list provided at the top of the pane. The list contains sample values from the selected data row.
1. Click on a link to begin adding new correlation. Links are associated with a field that will be used as [a results field of a correlation]({{< relref "../../../administration/correlations/correlation-configuration" >}}). This means the correlation link will be created on the link you select once the correlation is saved.
1. Explore opens a split view. Use the right pane to setup [the target query source of the correlation]({{< relref "../../../administration/correlations/correlation-configuration#target-query" >}}).
1. Build target query using [variables syntax]({{< relref "../../../dashboards/variables/variable-syntax" >}}) with variables from the list provided at the top of the pane. The list contains sample values from the selected data row.
1. Provide optional label and description. Label is used as the name of the link inside the visualization. It can contain variables.
1. Click "Save" button in the top bar to save the correlation and exit Correlations Editor mode.
1. The link used to create the correlation will be replaced with a data link in each row. The variables will be dynamically replaced with values from a selected row.

Please check [an example]({{< relref "/docs/grafana/latest/administration/correlations/use-correlations-editor-in-explore" >}}) to see how to create a sample correlation using test data source.
Please check [an example]({{< relref "../../../administration/correlations/use-correlations-editor-in-explore" >}}) to see how to create a sample correlation using test data source.

## Create a correlation in Administration page

Expand Down Expand Up @@ -99,7 +99,7 @@ Description of provisioning properties:
: Correlation type. “query” is the only supported type at the moment
**config.target**
: [Target query model]({{< relref "#determine-target-query-model-structure" >}})
: [Target query model](#determine-target-query-model-structure)
**config.field**
: Name of the field where link is shown
Expand Down
Loading

0 comments on commit 29509cb

Please sign in to comment.