Skip to content

Monitor MySQL with OpenTelemetry

Osuite monitors MySQL through the OpenTelemetry Collector’s mysql receiver, which reads the server’s global status counters and InnoDB statistics and exports them over OTLP. Because the metrics carry the same resource attributes as your services, buffer-pool pressure or lock contention lines up with the application traffic that caused it.

  • A reachable MySQL server (5.7 or later; MariaDB works with the same protocol).
  • A monitoring user with permission to read global status and the performance schema.
CREATE USER 'otel'@'%' IDENTIFIED BY 'a-strong-password';
GRANT PROCESS ON *.* TO 'otel'@'%';
GRANT SELECT ON performance_schema.* TO 'otel'@'%';

Export the password to the Collector’s environment:

Terminal window
export MYSQL_PASSWORD='a-strong-password'
  1. Add the mysql receiver, the otlp/osuite exporter, and a metrics pipeline. Pick the tab that matches where your Collector runs — only the receiver endpoint changes.

    receivers:
    mysql:
    endpoint: localhost:3306
    username: otel
    password: ${env:MYSQL_PASSWORD}
    database: mydb
    collection_interval: 30s
    processors:
    batch:
    resourcedetection:
    exporters:
    otlp/osuite:
    endpoint: ingest.<region>.osuite.io:443
    headers:
    x-osuite-ingest-token: <your-ingest-token>
    service:
    pipelines:
    metrics:
    receivers: [mysql]
    processors: [batch, resourcedetection]
    exporters: [otlp/osuite]
  2. Start the Collector. On Docker and Kubernetes, the Collector and MySQL must share a network so the endpoint resolves.

What you should see

Metrics named mysql.* appear in Dashboards → Explore metrics within a minute, tagged with the host or pod the Collector runs on.

MetricDescriptionUnit
mysql.buffer_pool.usageBytes in the InnoDB buffer poolBy
mysql.buffer_pool.limitConfigured buffer-pool sizeBy
mysql.buffer_pool.operationsOperations on the InnoDB buffer pool1
mysql.buffer_pool.data_pagesData pages in the buffer pool1
mysql.operationsInnoDB operations1
mysql.row_operationsInnoDB row operations1
mysql.handlersRequests to MySQL handlers1
mysql.locksMySQL locks1
mysql.log_operationsInnoDB log operations1
mysql.double_writesWrites to the InnoDB doublewrite buffer1

Enable per-command counts, thread and connection metrics, and query slow-log statistics with the receiver’s optional metric toggles when you need them.

Once metrics arrive, build a MySQL dashboard in the dashboard builder from the series above. Alerts in Osuite are PromQL-based — see Alerts. Useful starting conditions: a falling buffer-pool hit ratio (mysql.buffer_pool.operations), rising lock counts (mysql.locks), and sustained high row-operation rates.

  • Access denied — confirm the otel user has both PROCESS and SELECT on performance_schema, and that its host mask ('%') covers the Collector’s source address.
  • Missing metrics — confirm performance_schema is enabled on the server (SHOW VARIABLES LIKE 'performance_schema').

No data in Osuite after a few minutes? Work through these checks.

  • Endpoint — confirm the exporter targets exactly ingest.<region>.osuite.io:443 for your region, over TLS.
  • Token — confirm the ingest header carries a valid <your-ingest-token> and has not been rotated.
  • Pipeline — confirm the signal you expect (traces, logs, or metrics) is wired into an active pipeline with the otlp/osuite exporter attached.
  • Export errors — check the application or Collector logs for OTLP export failures (auth, DNS, TLS, connection refused).
  • Network — confirm the host has outbound access to the ingest endpoint on port 443.
  • Timing — allow up to a minute for the first data to appear before assuming a failure.

Still stuck? Ask the Investigation Agent or contact support.