
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mysqlreceiver
Advanced tools
| Status | |
|---|---|
| Stability | development: logs |
| beta: metrics | |
| Distributions | contrib |
| Issues | |
| Code coverage | |
| Code Owners | @antonblock, @ishleenk17 | Seeking more code owners! |
| Emeritus | @djaglowski |
This receiver queries MySQL's global status and InnoDB tables.
Some metrics will not appear if their corresponding feature is inactive.
There are also optional metrics that you must specify in your configuration to collect, listed in documentation.md
This receiver supports MySQL version 8.0 and MariaDB 10.11.
Collecting most metrics requires the ability to execute SHOW GLOBAL STATUS.
Collecting query samples requires the performance_schema to be enabled:
GRANT SELECT ON performance_schema.* TO <your-user>@'%';
The following settings are optional:
endpoint: (default = localhost:3306)
tls: Defines the TLS configuration to use. If tls is not set, the default is to disable TLS connections.
insecure: (default = false) Set this to true to disable TLS connections.insecure_skip_verify: (default = false) Set this to true to enable TLS but not verify the certificate.server_name_override: This sets the ServerName in the TLSConfig.username: (default = root)
password: The password to the username.
allow_native_passwords: (default = true)
database: The database name. If not specified, metrics will be collected for all databases.
collection_interval (default = 10s): This receiver collects metrics on an interval. This value must be a string readable by Golang's time.ParseDuration. Valid time units are ns, us (or µs), ms, s, m, h.
initial_delay (default = 1s): defines how long this receiver waits before starting.
transport: (default = tcp): Defines the network to use for connecting to the server.
statement_events: Additional configuration for query to build mysql.statement_events.count and mysql.statement_events.wait.time metrics:
digest_text_limit - maximum length of digest_text. Longer text will be truncated (default=120)time_limit - maximum time from since the statements have been observed last time (default=24h)limit - limit of records, which is maximum number of generated metrics (default=250)query_sample_collection: Additional configuration for query sample collection(db.server.query_sample event):
max_rows_per_query - maximum number of rows to collect per scrape (default=100)top_query_collection: Additional configuration for top queries collection (db.server.top_query event):
lookback_time (optional, example = 60, default = 2 * collection_interval): The time window (in seconds) in which to query for top queries.
max_query_sample_count (optional, example = 5000, default = 1000): The maximum number of records to fetch in a single run.top_query_count: (optional, example = 100, default = 200): The maximum number of active queries to report (to the next consumer) in a single run.collection_interval: (optional, default = 60s): The interval at which top queries should be emitted by this receiver.
collection_interval set to 10s and top_query_collection.collection_interval set to 60s.
collection_interval set to 10s and top_query_collection.collection_interval set to 5s.
top_query_collection.collection_interval will have no impact on the collection frequency, which will run every 10s.query_plan_cache_size: (optional, default = 1000). The query plan cache size. Once we got query plan results from explain queries, we will store them in the cache.
This defines the cache's size for query plan.query_plan_cache_ttl: (optional, example = 1m, default = 1h). How long until a query plan expires in the cache. The receiver will run an explain query to MySQL to get the query plan after it expires.receivers:
mysql:
endpoint: localhost:3306
username: otel
password: ${env:MYSQL_PASSWORD}
database: otel
collection_interval: 10s
initial_delay: 1s
statement_events:
digest_text_limit: 120
time_limit: 24h
limit: 250
The full list of settings exposed for this receiver are documented in config.go with detailed sample configurations in testdata/config.yaml.
Details about the metrics produced by this receiver can be found in metadata.yaml
Details about the logs produced by this receiver can be found in documentation.md
| Parameter | Value | Description |
|---|---|---|
performance_schema | Enabled (Required) | Enable performance schema |
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 |
FAQs
Unknown package
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.