﻿---
title: MySQL (OpenTelemetry)
description: This input package enables collection of metrics and logs from MySQL database servers through OpenTelemetry protocols using the mysqlreceiver. This package...
url: https://www.elastic.co/docs/reference/integrations/mysql_input_otel
products:
  - Elastic integrations
applies_to:
  - Serverless Observability projects: Preview
  - Serverless Security projects: Preview
  - Elastic Stack: Preview since 9.4
---

# MySQL (OpenTelemetry)
|                                                                                                 |                                                                   |
|-------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| **Version**                                                                                     | 0.2.3 <applies-to>: Preview</applies-to> ([View all](#changelog)) |
| **Subscription level**[What's this?](https://www.elastic.co/subscriptions)                      | Basic                                                             |
| **Developed by**[What's this?](https://www.elastic.co/docs/reference/integrations/developed-by) | Elastic                                                           |
| **Minimum Kibana version(s)**                                                                   | 9.4.0                                                             |

<admonition title="The MySQL (OpenTelemetry) integration v0.2.3 is in technical preview">
  To use pre-release integrations, go to the **Integrations** page in Kibana, scroll down, and toggle on the _Display beta integrations_ option.
</admonition>


## Overview

This input package enables collection of metrics and logs from MySQL database servers through OpenTelemetry protocols using the [mysqlreceiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/mysqlreceiver).

### How it works

This package receives telemetry data from MySQL servers by configuring the MySQL endpoint and credentials in the Input Package, which then gets applied to the mysqlreceiver present in the EDOT collector, which then forwards the data to Elastic Agent. The Elastic Agent processes and enriches the data before sending it to Elasticsearch for indexing and analysis. Once the data arrives into Elasticsearch, its corresponding [MySQL OpenTelemetry Assets Package](https://www.elastic.co/docs/reference/integrations/mysql_otel) gets auto installed and the dashboards light up.
The package collects both **metrics** (from `SHOW GLOBAL STATUS` and InnoDB tables) and **logs** (query samples and top queries). Log events are controlled by the Enable Query Sample Events and Enable Top Query Events settings:
- **`db.server.query_sample`**: Current running database statements (enabled by default)
- **`db.server.top_query`**: Queries that consumed the most CPU (disabled by default)


## Requirements

- MySQL 8.0+ or MariaDB 10.11+
- A MySQL user with permissions to run `SHOW GLOBAL STATUS`
- For query sample collection, the `performance_schema` must be enabled


### MySQL requirements for log collection

To collect log events (query samples and top queries), configure MySQL as follows. For additional details, see the [upstream mysqlreceiver logs documentation](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/mysqlreceiver#logs).

| Parameter                                | Value   | Description                                                     |
|------------------------------------------|---------|-----------------------------------------------------------------|
| `performance_schema`                     | Enabled | Required for log collection                                     |
| `max_digest_length`                      | 4096    | Recommended maximum length of digest text                       |
| `performance_schema_max_digest_length`   | 4096    | Recommended maximum length of digest text on performance schema |
| `performance_schema_max_sql_text_length` | 4096    | Recommended maximum length of SQL text                          |

Also grant the MySQL user access to the performance schema:
```sql
GRANT SELECT ON performance_schema.* TO <your-user>@'%';
```


## Configuration

For the full list of settings exposed for the receiver and examples, refer to the [configuration](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/mysqlreceiver#configuration) section.

## Metrics and logs reference

For a complete list of all available metrics, log events, and their detailed descriptions, refer to the [MySQL Receiver documentation](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/mysqlreceiver/documentation.md) in the upstream OpenTelemetry Collector repository.

## Changelog

<dropdown title="Changelog">
  | Version   | Details                                                                                                                                                  | Minimum Kibana version |
  |-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------|
  | **0.2.3** | **Enhancement** ([View pull request](https://github.com/elastic/integrations/pull/20547))Add group field to package manifest.                            | 9.4.0                  |
  | **0.2.2** | **Enhancement** ([View pull request](https://github.com/elastic/integrations/pull/19526))Update package title and description to improve clarity of use. | 9.4.0                  |
  | **0.2.1** | **Bug fix** ([View pull request](https://github.com/elastic/integrations/pull/17850))Remove type for dynamic signal type manifest field                  | 9.4.0                  |
  | **0.2.0** | **Enhancement** ([View pull request](https://github.com/elastic/integrations/issues/17441))Add logs support via multisignal (query samples, top queries) | 9.4.0                  |
  | **0.1.1** | **Enhancement** ([View pull request](https://github.com/elastic/integrations/pull/17449))Add metrics configuration                                       | 9.2.2                  |
  | **0.1.0** | **Enhancement** ([View pull request](https://github.com/elastic/integrations/pull/17090))Initial release of MySQL OpenTelemetry input package            | 9.2.2                  |
</dropdown>