grafana/public/app/plugins/datasource/influxdb
Brett Buddin a5a85e0398
InfluxDB: Send retention policy with InfluxQL queries if its been specified. (#62149)
* InfluxDB: Send retention policy with InfluQL queries if it's been specified.

In InfluxDB v2, due to technical limitations of the InfluxDB v1
compatibility layer, retention policies in a query (e.g. "<retention
policy>.<measurement_name>") aren't honored and must be specified in the
URL query parameter `rp` to be applied. Grafana doesn't send this query
parameter which results in all queries resolving to the default
retention policy when querying InfluxDB v2 servers using InfluxQL.

This addresses the issue by sending the `rp` query parameter for queries
that have specified a retention policy in the `target` given to
`runExploreQuery`.

The outcomes are:

1. InfluxQL queries executed against InfluxDB v2 databases will have the
   necessary retention policy information for queries like `SHOW FIELD
   KEYS FROM measurement` to function correctly.
2. InfluxQL queries executed against InfluxDB v1 databases will be
   unaffected, because this `rp` query parameter is unsupported there.

You can read more about the rentention policy mapping behavior of
InfluxDB v2 in our documentation:

- https://docs.influxdata.com/influxdb/v2.6/reference/api/influxdb-1x/dbrp/#when-querying-data
- https://docs.influxdata.com/influxdb/v2.6/reference/api/influxdb-1x/query/#query-a-non-default-retention-policy

* Use the ? operator

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2023-01-26 19:14:02 +01:00
..
components Plugins: add UI for more supported datasources with secure socks proxy feature toggle (#61962) 2023-01-25 08:39:17 -07:00
img update influx logo 2017-02-13 18:19:14 -08:00
specs Influxdb: Remove backend migration feature toggle (#61308) 2023-01-17 15:11:26 +01:00
constants.ts InfluxDB: Remove browser ('direct' access) mode. (#53529) 2022-08-17 09:40:21 -03:00
datasource.mock.ts Prettier: Upgrade to 2 (#30387) 2021-01-20 07:59:48 +01:00
datasource.ts InfluxDB: Send retention policy with InfluxQL queries if its been specified. (#62149) 2023-01-26 19:14:02 +01:00
influx_query_model.ts Angular: Remove ngInject from influxdb and graphite (#61251) 2023-01-12 17:14:18 -05:00
influxQLMetadataQuery.ts InfluxDB: Send retention policy with InfluxQL queries if its been specified. (#62149) 2023-01-26 19:14:02 +01:00
migrations.ts Influxdb Datasource: Remove angular dependencies for Influxdb influxql annotations (#52546) 2022-08-17 13:20:46 -04:00
module.ts Influxdb Datasource: Remove angular dependencies for Influxdb influxql annotations (#52546) 2022-08-17 13:20:46 -04:00
plugin.json Plugins: Set backend metadata property for core plugins (#43349) 2021-12-22 17:59:26 +01:00
query_builder.ts grafana/data: Deprecate kbn.regexEscape and move to grafana/data (#60869) 2023-01-02 05:57:55 -08:00
query_help.md Prettier: Fix all markdown files and add markdown files to CI verify step (#39776) 2021-09-29 14:34:40 +02:00
query_part.ts Chore: ESlint import order (#44959) 2022-04-22 14:33:13 +01:00
queryUtils.test.ts Chore: ESlint import order (#44959) 2022-04-22 14:33:13 +01:00
queryUtils.ts Chore: ESlint import order (#44959) 2022-04-22 14:33:13 +01:00
README.md Prettier: Fix all markdown files and add markdown files to CI verify step (#39776) 2021-09-29 14:34:40 +02:00
response_parser.ts Influxdb Datasource: Remove angular dependencies for Influxdb influxql annotations (#52546) 2022-08-17 13:20:46 -04:00
types.ts InfluxDB: Interpolate ad-hoc filters from Dashboard to Explore (#56996) 2022-10-17 13:28:54 -03:00

InfluxDB data source

Grafana ships with built-in support for InfluxDB releases >0.9.x.

There are separate data sources for InfluxDB in Grafana: the latest InfluxDB release and InfluxDB 0.8.x that Grafana maintains support for as a convenience for its existing users. InfluxDB no longer maintains release 0.8.

The API and capabilities of the latest release of InfluxDB are completely different from those of InfluxDB 0.8.x, which is why Grafana handles them as different data sources.

For more information, refer to Using InfluxDB in Grafana.