integration-docs
Loading

MYSQL metrics for OpenTelemetry Collector

Stack 9.1.0 Serverless Observability Serverless Security

Version 0.1.1 Beta (View all)
Subscription level
What's this?
Basic
Level of support
What's this?
Elastic

The MySQL metrics from MySQL OpenTelemetry receiver allow you to monitor MySQL, an open-source Relational Database Management System (RDBMS) that enables users to store, manage, and retrieve structured data efficiently.

The MySQL OpenTelemetry assets provide a visual representation of MySQL metrics collected via OpenTelemetry (MySQL receiver), enabling you to monitor database performance and troubleshoot issues effectively in real time.

The MySQL OpenTelemetry assets have been tested with OpenTelemetry MySQL receiver v0.129.0.

Databases tested against:

  • MySQL 8.0, 9.4
  • MariaDB 10.11, 11.8

You need Elasticsearch for storing and searching your data and Kibana for visualizing and managing it. You can use our hosted Elasticsearch Service on Elastic Cloud, which is recommended, or self-manage the Elastic Stack on your own hardware.

  1. Install and configure the upstream OpenTelemetry Collector to export metrics to ElasticSearch, as shown in the following example:
receivers:
  mysql:
    endpoint: localhost:3306
    username: <MYSQL_USER>
    password: <MYSQL_PASSWORD>
    database: <your database name>
    collection_interval: 10s
    initial_delay: 1s
    statement_events:
      digest_text_limit: 120
      time_limit: 24h
      limit: 250
    metrics:
      mysql.query.client.count:
        enabled: true
      mysql.client.network.io:
        enabled: true
      mysql.commands:
        enabled: true
      mysql.max_used_connections:
        enabled: true
      mysql.connection.errors:
        enabled: true
      mysql.table_open_cache:
        enabled: true
      mysql.replica.sql_delay:
        enabled: true
      mysql.replica.time_behind_source:
        enabled: true
exporters:
  debug:
    verbosity: detailed
  elasticsearch/otel:
    endpoints: https://elasticsearch:9200
    user: <userid>
    password: <pwd>
    mapping:
      mode: otel
    metrics_dynamic_index:
      enabled: true
service:
  pipelines:
    metrics:
      exporters: [debug, elasticsearch/otel]
      receivers: [mysql]
		

Use this configuration to run the collector.

The following metrics should be enabled in the mysqlreceiver configuration for the dashboards to be populated:

For Database Overview dashboard:

mysql.query.client.count:
  enabled: true
mysql.client.network.io:
  enabled: true
mysql.commands:
  enabled: true
mysql.max_used_connections:
  enabled: true
mysql.connection.errors:
  enabled: true
mysql.table_open_cache:
  enabled: true
		

For Replica Status dashboard:

mysql.replica.sql_delay:
  enabled: true
mysql.replica.time_behind_source:
  enabled: true
		

Please refer to the documentation of the OpenTelemetry's MySQL receiver.

This integration includes one or more Kibana dashboards that visualizes the data collected by the integration. The screenshots below illustrate how the ingested data is displayed.