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:

  • Configure the MySQL receiver for the Collector
  • Enable the integration by adding it to a pipeline

Prerequisites

  • MySQL 8.0 or later.
  • Collecting most metrics requires the ability to execute 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.
  • You’ve configured the Collector to export metric data to Cloud Observability.

    Configure the Collector receiver

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., otel
  • 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.

Enable the Collector receiver

Once the MySQL receiver is configured, enable it by adding it to one or more pipelines as described in the Collector configuration documentation.

Validate metrics are reporting to Cloud Observability

You can validate that metrics are reporting to Cloud Observability on the Metrics details page in Settings.

  1. In Cloud Observability, click Settings > Metric details.

  2. Search for MySQL metric names. Arrow points to the metrics search box.

    See the receiver’s metadata file for a complete list of emitted metrics.

  3. If needed, click on the metric to edit the description and how the units are displayed in Cloud Observability.

Create a dashboard for the metrics

Use the Cloud Observability Terraform Provider to create a dashboard for the metrics.

Additional resources

For a more complete example that’s ready to run, see the MySQL integration in Cloud Observability OpenTelemetry Examples.

See also

Create and manage dashboards

Create alerts

Updated Dec 1, 2022