Skip to content

MySQL

Collect MySQL/InnoDB server metrics and get curated dashboards and alerts for them with a single import.

MySQL is scraped by an OpenTelemetry Collector running the mysql receiver, which exports over OTLP to your LeanSignal agent gateway (one per cluster or environment) — never to a remote or third-party endpoint. The gateway keeps full fidelity locally and forwards only the demanded subset to your central dataplane. Run one collector that can reach the database; it scrapes InnoDB buffer-pool, threads/connections, row and handler throughput, locks, and more.

Metric names follow the standard OTLP → Prometheus normalization (dots become underscores, unit/_total suffixes are added), so mysql.buffer_pool.usage becomes mysql_buffer_pool_usage_bytes and mysql.row_operations becomes mysql_row_operations_total. The demands below are built against those names.

  • A LeanSignal agent gateway deployed and connected — one per cluster or environment. If you haven’t deployed it yet, follow Install the agent (source: LeanSignal/leansignal-agent). It should show as Connected under Agents in the LeanSignal app.
  • Network reachability to the gateway’s OTLP port4317 (gRPC) or 4318 (HTTP). See Agent configuration.
  • An OpenTelemetry Collector that can reach your MySQL server, plus a monitoring database user — both configured in Setup.
  • Editor or admin role in the LeanSignal app (importing a demand creates dashboards and alert rules).

Run an OpenTelemetry Collector (for example otel/opentelemetry-collector-contrib) with the mysql receiver, exporting OTLP to your LeanSignal agent gateway — not a SaaS endpoint.

Database user and grants (MySQL 8.0+, performance_schema enabled):

CREATE USER 'otel'@'%' IDENTIFIED BY 'REDACTED';
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'otel'@'%';

PROCESS reads global status/variables; performance_schema powers the table/ index I/O-wait metrics; REPLICATION CLIENT is needed for the opt-in replica metrics.

receivers:
mysql:
endpoint: mysql:3306
username: otel
password: ${env:MYSQL_PASSWORD}
collection_interval: 30s
tls:
insecure: true # DB-side TLS off; set false + ca_file to verify
# Extended demand also needs these opt-in metrics enabled:
# metrics:
# mysql.query.slow.count: { enabled: true }
# mysql.connection.errors: { enabled: true }
# mysql.replica.time_behind_source: { enabled: true }
processors:
resourcedetection:
detectors: [env, system]
system: { hostname_sources: [os] }
batch: {}
exporters:
otlp:
endpoint: leansignal-agent:4317 # per-cluster gateway (use :4318 for HTTP)
tls:
insecure: true # in-cluster plaintext; provide ca_file for TLS
service:
pipelines:
metrics:
receivers: [mysql]
processors: [resourcedetection, batch]
exporters: [otlp]

A database server produces logs, and its traces come from the clients:

  • Server logs — point a collector filelog receiver at the error log and slow query log and forward OTLP to the gateway; the receiver can run on the gateway itself if it can read the files. Already shipping them with a Promtail/Alloy-style agent? Repoint it at the gateway’s Loki push endpoint (:3500) instead.
  • Query traces — instrument the applications that call MySQL (see the runtime integrations); their database client spans carry db.* attributes, so slow statements show up inside request traces.

MySQL ships as a ready-made demand in three variants. You don’t copy any JSON — in the LeanSignal app go to Demands, press the ˅ arrow on the Add Demand button (the arrow opens the import menu), choose Import from catalog…, and pick the variant. Each variant below lists the slug that identifies its published bundle. See Integrations for the full import flow.

The variants are nested — Standard is a superset of Essential, Extended a superset of Standard. Pick whichever is closest to what you need and treat it as a starting point: after import everything is a normal, editable copy, so retune thresholds, add or drop panels, and adjust queries for your environment — your edits reshape the demand automatically. Start small and re-import a larger variant later if you outgrow it.

The golden signals. 1 dashboard · 4 panels · 3 alerts — connections, throughput, and buffer-pool efficiency at a glance.

Import this variant from the catalog. Its demand slug:

Demand slug
mysql-otel-demand-essential

Dashboard — Connected threads, Row operations, InnoDB buffer pool hit ratio, and Buffer pool utilization.

Alerts (3)

AlertSeverityFires when
MySQL instance restartedwarninguptime < 5m
MySQL high connection countwarning> 100 connected threads for 5m
MySQL low buffer pool hit ratiowarninghit ratio < 95% for 10m

Review the bundle JSON →

Each variant imports one MySQL dashboard, its panels grouped into collapsible sections. Every dashboard carries an Instance filter (on the mysql_instance_endpoint label), so one import covers the whole fleet — view every instance at once, or focus on one. Legends are sortable tables showing last/mean/max per series, so the outlier instance stands out. Dashboards are demand-driven: importing one tells your agents to forward exactly the timeseries its panels query, and nothing else. Panels are ordinary Perses panels — edit queries, add panels, or retune them after import, and your changes reshape the demand automatically.

Thresholds are conservative starting points — tune them to your workload.

Was this page helpful?