Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Improve v8 upgrade notes for SQL data sources #38792

Merged
merged 8 commits into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/sources/datasources/mssql.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ The resulting table panel:
If you set `Format as` to `Time series`, for use in Graph panel for example, then the query must have a column named `time` that returns either a SQL datetime or any numeric datatype representing Unix epoch in seconds. You may return a column named `metric` that is used as metric name for the value column. Any column except `time` and `metric` is treated as a value column. If you omit the `metric` column, the name of the value column will be the metric name. You may select multiple value columns, each will have its name as metric.
If you return multiple value columns and a column named `metric` then this column is used as prefix for the series name (only available in Grafana 5.3+).

If you're not satisfied with the default series name formatting, please use the [Standard field options/Display name]({{< relref "../panels/standard-options.md#display-name" >}}) to customize it.
marefr marked this conversation as resolved.
Show resolved Hide resolved
marefr marked this conversation as resolved.
Show resolved Hide resolved

Result sets of time series queries need to be sorted by time.

**Example database table:**
Expand Down
6 changes: 4 additions & 2 deletions docs/sources/datasources/mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ Any column except `time` and `metric` is treated as a value column.
You may return a column named `metric` that is used as metric name for the value column.
If you return multiple value columns and a column named `metric` then this column is used as prefix for the series name (only available in Grafana 5.3+).

If you're not satisfied with the default series name formatting, please use the [Standard field options/Display name]({{< relref "../panels/standard-options.md#display-name" >}}) to customize it.

Resultsets of time series queries need to be sorted by time.

**Example with `metric` column:**
Expand All @@ -206,11 +208,11 @@ ORDER BY time
SELECT
$__timeGroup(createdAt,'5m',0),
sum(value_double) as value,
measurement
measurement as metric
FROM test_data
WHERE
$__timeFilter(createdAt)
GROUP BY time, measurement
GROUP BY time, metric
ORDER BY time
```

Expand Down
6 changes: 4 additions & 2 deletions docs/sources/datasources/postgres.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ Any column except `time` and `metric` are treated as a value column.
You may return a column named `metric` that is used as metric name for the value column.
If you return multiple value columns and a column named `metric` then this column is used as prefix for the series name (only available in Grafana 5.3+).

If you're not satisfied with the default series name formatting, please use the [Standard field options/Display name]({{< relref "../panels/standard-options.md#display-name" >}}) to customize it.

Resultsets of time series queries need to be sorted by time.

**Example with `metric` column:**
Expand All @@ -211,11 +213,11 @@ ORDER BY time
SELECT
$__timeGroup("createdAt",'5m',0),
sum(value) as value,
measurement
measurement as metric
FROM test_data
WHERE
$__timeFilter("createdAt")
GROUP BY time, measurement
GROUP BY time, metric
ORDER BY time
```

Expand Down
24 changes: 22 additions & 2 deletions docs/sources/installation/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,32 @@ Grafana v8.0 changes the underlying data structure to [data frames]({{< relref "
For any existing panels/visualizations using a _Time series_ query, where the time column is only needed for filtering the time range, for example, using the bar gauge or pie chart panel, we recommend that you use a _Table query_ instead and exclude the time column as a field in the response.
Refer to this [issue comment](https://github.com/grafana/grafana/issues/35534#issuecomment-861519658) for detailed instructions and workarounds.

#### Prefix added to legend/alias

Given you have a query similar to below, where there's a time value and a numeric value selected together with a string value that's not named `metric`. Then you might notice that the graph panel renders series legends/aliases as `value <hostname>` rather than just `<hostname>` which was the case before Grafana 8.

```sql
SELECT
$__timeGroup("createdAt",'10m'),
avg(value) as "value",
hostname
FROM grafana_metric
WHERE $__timeFilter("createdAt")
GROUP BY time, hostname
ORDER BY time
```

There's two possible workarounds to resolve this problem:
marefr marked this conversation as resolved.
Show resolved Hide resolved

1. Starting from Grafana v8.0.3 you should alias the string column selected as `metric`, i.e. `hostname as metric`.
marefr marked this conversation as resolved.
Show resolved Hide resolved
2. Use the [Standard field options/Display name]({{< relref "../panels/standard-options.md#display-name" >}}) to format the alias. Given example query above you would use `${__field.labels.hostname}`.
marefr marked this conversation as resolved.
Show resolved Hide resolved

## Upgrading to v8.1

### Use of unencrypted passwords for data sources no longer supported

As of Grafana v8.1, we no longer support unencrypted storage of passwords and basic auth passwords.

>**Note":** Since Grafana v6.2, new or updated data sources store passwords and basic auth passwords encrypted. See [upgrade note]({{< relref "#ensure-encryption-of-data-source-secrets" >}}) for more information. However, unencrypted passwords and basic auth passwords were also allowed.
> **Note":** Since Grafana v6.2, new or updated data sources store passwords and basic auth passwords encrypted. See [upgrade note]({{< relref "#ensure-encryption-of-data-source-secrets" >}}) for more information. However, unencrypted passwords and basic auth passwords were also allowed.
marefr marked this conversation as resolved.
Show resolved Hide resolved

To migrate to encrypted storage, follow the instructions from the [v6.2 upgrade notes]({{< relref "#ensure-encryption-of-data-source-secrets" >}}). You can also use a `grafana-cli` command to migrate all of your data sources to use encrypted storage of secrets. See [migrate data and encrypt passwords]({{< relref "../administration/cli.md#migrate-data-and-encrypt-passwords" >}}) for further instructions.