database_observability.mysql connects to a MySQL database and collects observability data from the performance_schema and information_schema.
The component collects query details, schema information, explain plans, query samples, and lock information.
It forwards this data as log entries to Loki receivers and exports targets for Prometheus scraping.
Whether to allow updates to performance_schema settings in any collector. Enable this in conjunction with other collector-specific settings where required.
false
no
The following collectors are configurable:
Name
Description
Enabled by default
query_details
Collect queries information.
yes
schema_details
Collect schemas and tables from information_schema.
Check and update performance_schema.setup_actors settings.
yes
locks
Collect queries that are waiting/blocking other queries.
no
explain_plans
Collect explain plans information.
yes
Blocks
You can use the following blocks with database_observability.mysql:
No valid configuration blocks found.
cloud_provider
The cloud_provider block has no attributes.
It contains zero or more [aws][aws], [azure][azure], or [gcp][gcp] blocks.
You use the cloud_provider block to provide information related to the cloud provider that hosts the database under observation.
This information is appended as labels to the collected metrics.
The labels make it easier for you to filter and group your metrics.
aws
The aws block supplies the ARN identifier for the database being monitored.
Name
Type
Description
Default
Required
arn
string
The ARN associated with the database under observation.
yes
azure
The azure block supplies the identifying information for the database being monitored.
Name
Type
Description
Default
Required
subscription_id
string
The Subscription ID for your Azure account.
yes
resource_group
string
The Resource Group that holds the database resource.
yes
server_name
string
The database server name.
no
gcp
The gcp block supplies the identifying information for the GCP Cloud SQL database being monitored.
Name
Type
Description
Default
Required
connection_name
string
The Cloud SQL instance connection name in the format project:region:instance, for example my-project:us-central1:my-db.
yes
setup_consumers
Name
Type
Description
Default
Required
collect_interval
duration
How frequently to collect performance_schema.setup_consumers information from the database.
"1h"
no
query_details
Name
Type
Description
Default
Required
collect_interval
duration
How frequently to collect information from database.
"1m"
no
statements_limit
integer
Max number of recent queries to collect details for.
250
no
schema_details
Name
Type
Description
Default
Required
collect_interval
duration
How frequently to collect information from database.
"1m"
no
cache_enabled
boolean
Whether to enable caching of table definitions.
true
no
cache_size
integer
Cache size.
256
no
cache_ttl
duration
Cache TTL.
"10m"
no
explain_plans
Name
Type
Description
Default
Required
collect_interval
duration
How frequently to collect information from database.
"1m"
no
initial_lookback
duration
How far back to look for explain plan queries on the first collection interval.
"24h"
no
per_collect_ratio
float
Ratio of explain plan queries to collect per collect interval.
1.0
no
locks
Name
Type
Description
Default
Required
collect_interval
duration
How frequently to collect information from database.
"30s"
no
threshold
duration
Threshold for locks to be considered slow. Locks that exceed this duration are logged.
"1s"
no
query_samples
Name
Type
Description
Default
Required
collect_interval
duration
How frequently to collect information from database.
"10s"
no
disable_query_redaction
bool
Collect unredacted SQL query text including parameters.
false
no
auto_enable_setup_consumers
boolean
Enables specific performance_schema.setup_consumers options. You must also enable allow_update_performance_schema_settings.
false
no
setup_consumers_check_interval
duration
How frequently to check if setup_consumers are correctly enabled.
"1h"
no
sample_min_duration
duration
Minimum duration for query samples to be collected. Set to “0s” to disable filtering and collect all samples regardless of their duration.
"0s"
no
wait_event_min_duration
duration
Minimum duration for a wait event to be collected. Set to “0s” to disable filtering and collect all wait events regardless of their duration.
"1us"
no
enable_pre_classified_wait_events
boolean
When true, emits wait_event_v2 entries with wait_event_type pre-classified as IO Wait, Lock Wait, Network Wait, or Other Wait in the log body, instead of the baseline wait_event entries.
false
no
setup_actors
Name
Type
Description
Default
Required
auto_update_setup_actors
boolean
Enables updates to performance_schema.setup_actors settings. You must also enable allow_update_performance_schema_settings.
false
no
collect_interval
duration
How frequently to check if setup_actors are configured correctly.
"1h"
no
health_check
Name
Type
Description
Default
Required
collect_interval
duration
How frequently to run health checks.
"1h"
no
prometheus_exporter
The prometheus_exporter block configures the embedded mysqld_exporter scrapers.
The data_source_name is inherited from the parent block.
Connecting some components may not be sensible or components may require further configuration to make the connection work correctly.
Refer to the linked documentation for more details.