The OpenTelemetry Collector provides an integration with MySQL to ingest metrics. Metrics from the status
and innoDB
tables are sent to the Collector’s MySQL receiver. From there, the metrics are processed and exported to Cloud Observability.
To complete the integration, you will:
SHOW GLOBAL STATUS
. Additionally, the buffer_pool_size
metric requires access to the information_schema.innodb_metrics
table. Please refer to setup.sh for an example of how to configure these permissions.To add MySQL as a receiver to the Collector configuration file, add mysql
as a receiver and set the following:
endpoint
: The address of the MySQL serverusername
: Set to preferred username; i.e., otel
password
: Password for MySQL1
2
3
4
5
receivers:
mysql:
endpoint: "http://<address of server>:3306"
username: otel
password: $MYSQL_PASSWORD
The OpenTelemetry repo’s readme provides additional details about MySQL configuration.
Once the MySQL receiver is configured, enable it by adding it to one or more pipelines as described in the Collector configuration documentation.
You can validate that metrics are reporting to Cloud Observability on the Metrics details page in Settings.
In Cloud Observability, click Settings > Metric details.
Search for MySQL metric names.
See the receiver’s metadata file for a complete list of emitted metrics.
If needed, click on the metric to edit the description and how the units are displayed in Cloud Observability.
Use the Cloud Observability Terraform Provider to create a dashboard for the metrics.
For a more complete example that’s ready to run, see the MySQL integration in Cloud Observability OpenTelemetry Examples.
Updated Dec 1, 2022