grafana/public/app/plugins/datasource/mysql
Piotr Jamróz 9ace8686a1
Datasources: Improve error handling for testing data sources (#35120)
* Improve error handling for error messages

The error message will be read from error object from the following properties in the following order:
- message
- data.message
- statusText

* Convert api/ds/query errors to TestingStatus

SQL datasources (mysql, mssql, postgres) and CloudWatch use api/ds/query to test the data source, but previously didn't handle errors returned by this endpoint. If the error cannot be handled it's re-thrown to be handled in public/app/features/datasources/state/actions.ts

* Use async/await instead of Promises

* Remove incorrect type import

TestingStatus is in app/types. Should be pulled down to grafana/data but it depends on HealthCheckResultDetails that is public and lives in grafana/runtime. Ideally TestingStatus should live in grafana/data but I'm not sure if HealthCheckResultDetails can be move there too (?)

* Update packages/grafana-data/src/types/datasource.ts

Co-authored-by: Erik Sundell <erik.sundell@grafana.com>

* Handle errors with no details in toTestingStatus instead of re-throwing

* Update packages/grafana-data/src/types/datasource.ts

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>

Co-authored-by: Erik Sundell <erik.sundell@grafana.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2021-07-08 14:32:27 +02:00
..
img mysql: began work on backend macro engine 2017-04-19 10:10:08 +02:00
partials MySQL Datasource: Add timezone parameter (#27535) 2021-05-27 10:03:03 +02:00
specs Postgres/MySQL/MSSQL: Fix so that numeric/non-string values are returned from query variables (#35411) 2021-06-09 14:18:54 +02:00
datasource.ts Datasources: Improve error handling for testing data sources (#35120) 2021-07-08 14:32:27 +02:00
meta_query.ts noImplicitAny: Sub 3000 errors (#17821) 2019-07-01 11:11:57 +02:00
module.ts SQL data sources: Convert to return data frames (#32257) 2021-05-05 16:46:07 +02:00
mysql_query_model.ts SQL data sources: Convert to return data frames (#32257) 2021-05-05 16:46:07 +02:00
plugin.json Chore: show grafana labs not project (#23913) 2020-04-26 15:34:56 -07:00
query_ctrl.ts Postgres/MySQL: Fixes issue with toggle query editor mode (#35890) 2021-06-17 18:27:13 +02:00
README.md MySQL: Update README.md (#29003) 2020-11-11 07:47:08 +01:00
response_parser.ts Annotations: Fix sql annotation parsing for empty responses (#35367) 2021-06-09 21:14:28 +08:00
sql_part.ts noImplicitAny: Sub 3000 errors (#17821) 2019-07-01 11:11:57 +02:00
types.ts SQL data sources: Convert to return data frames (#32257) 2021-05-05 16:46:07 +02:00

MySQL Data Source - Native Plugin

Grafana ships with a built-in MySQL data source plugin that allows you to query and visualize data from a MySQL compatible database.

Adding the data source

  1. Open the side menu by clicking the Grafana icon in the top header.
  2. In the side menu under the Dashboards link you should find a link named Data Sources.
  3. Click the + Add data source button in the top header.
  4. Select MySQL from the Type dropdown.

Read more about it here:

http://docs.grafana.org/features/datasources/mysql/