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 Lightstep 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 Lightstep 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 Lightstep

You can validate that the metrics are reporting to Lightstep from the Metric details section of the Project Settings page.

  1. Open the Project settings page and scroll to the Metric details section.

  2. Search for MySQL metric names. Search for metric

    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 Lightstep.

Create a dashboard for the metrics

Use the Lightstep 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 Lightstep OpenTelemetry Examples.