The OpenTelemetry Collector provides an integration with MySQL to ingest metrics. Metrics from the
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_sizemetric requires access to the
information_schema.innodb_metricstable. 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 server
username: Set to preferred username; i.e.,
password: Password for MySQL
1 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 Project settings.
In Cloud Observability, click Project 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