---
title: Configuration reference for MySQL monitoring with NRDOT
source: https://docs.newrelic.com/docs/opentelemetry/db360/mysql/config-reference
---

This reference provides comprehensive YAML configurations for MySQL monitoring with the New Relic Distribution of OpenTelemetry (NRDOT) Collector. These full-feature configurations include all available metrics and advanced processor settings for production environments across self-hosted and Amazon RDS deployments.

> #### ⚠️ IMPORTANT
>
> **Looking to get started quickly?** These are advanced configurations for production use. If you're setting up MySQL monitoring for the first time, we recommend starting with the standard configuration in our setup guides and returning to these comprehensive configurations once you've verified basic functionality.

## Self-hosted [#hosted]

**For self-hosted MySQL**

This configuration enables the complete MySQL metric catalog the `nrmysql` receiver can produce.

```yaml
extensions:
  health_check:

receivers:
  otlp:
    protocols:
      grpc:
      http:

  nrmysql:
    endpoint: "<YOUR_DB_HOST>:<YOUR_DB_PORT>"
    transport: tcp
    username: "<YOUR_DB_USERNAME>"
    password: "<YOUR_DB_PASSWORD>"
    allow_native_passwords: true
    collection_interval: 15s
    initial_delay: 1s
    # "procedure" collects EXPLAIN plans for write statements (UPDATE/DELETE/INSERT/REPLACE)
    # without granting DML to the monitoring user, via a SQL SECURITY DEFINER procedure.
    # Falls back to "inline" (default) automatically if the procedure is absent for a schema.
    # Requires one-time setup per schema -- see Prerequisites -> DML query plan collection.
    explain_mode: procedure
    statement_events:
      digest_text_limit: 4096
      time_limit: 24h
      limit: 500
    query_sample_collection:
      max_rows_per_query: 100
      # APM-DB correlation: surfaces the nr_service_guid SQL comment tag (e.g. injected by
      # transaction_tracer.sql_metadata_comments in the Java agent) as db.query.comment_tags /
      # db.query.comment_tags.nr_service_guid. Empty list by default -- nothing is extracted
      # unless the key is explicitly allow-listed here.
      allowed_comment_keys: [nr_service_guid]
    top_query_collection:
      lookback_time: 60
      max_query_sample_count: 5000
      top_query_count: 200
      collection_interval: 60s
      query_plan_cache_size: 1000
      query_plan_cache_ttl: 1h
      allowed_comment_keys: [nr_service_guid]
    events:
      db.server.query_sample:
        enabled: true
      db.server.top_query:
        enabled: true
      db.server.query_plan:
        enabled: true
    resource_attributes:
      db.system.version:
        enabled: true
    metrics:
      # ---- Default-enabled metrics (kept explicit for visibility) ----
      mysql.buffer_pool.data_pages:
        enabled: true
      mysql.buffer_pool.limit:
        enabled: true
      mysql.buffer_pool.operations:
        enabled: true
      mysql.buffer_pool.page_flushes:
        enabled: true
      mysql.buffer_pool.pages:
        enabled: true
      mysql.buffer_pool.usage:
        enabled: true
      mysql.double_writes:
        enabled: true
      mysql.handlers:
        enabled: true
      mysql.index.io.wait.count:
        enabled: true
      mysql.index.io.wait.time:
        enabled: true
      mysql.locks:
        enabled: true
      mysql.log_operations:
        enabled: true
      mysql.mysqlx_connections:
        enabled: true
      mysql.opened_resources:
        enabled: true
      mysql.operations:
        enabled: true
      mysql.page_operations:
        enabled: true
      mysql.prepared_statements:
        enabled: true
      mysql.row_locks:
        enabled: true
      mysql.row_operations:
        enabled: true
      mysql.sorts:
        enabled: true
      mysql.table.io.wait.count:
        enabled: true
      mysql.table.io.wait.time:
        enabled: true
      mysql.threads:
        enabled: true
      mysql.tmp_resources:
        enabled: true
      mysql.uptime:
        enabled: true

      # ---- Disabled-by-default metrics (explicitly turned on for full-feature) ----
      mysql.client.network.io:
        enabled: true
      mysql.commands:
        enabled: true
      mysql.connection.count:
        enabled: true
      mysql.connection.errors:
        enabled: true
      mysql.file.open:
        enabled: true
      mysql.innodb.data_file.io:
        enabled: true
      mysql.innodb.history_list.length:
        enabled: true
      mysql.innodb.operation.pending:
        enabled: true
      mysql.innodb.redo_log.checkpoint.age:
        enabled: true
      mysql.innodb.redo_log.lsn.checkpoint:
        enabled: true
      mysql.innodb.redo_log.lsn.current:
        enabled: true
      mysql.innodb.row_lock.wait.count:
        enabled: true
      mysql.innodb.row_lock.wait.duration.avg:
        enabled: true
      mysql.innodb.row_lock.wait.duration.max:
        enabled: true
      mysql.innodb.transaction.active.count:
        enabled: true
      mysql.innodb.transaction.active.duration.max:
        enabled: true
      mysql.joins:
        enabled: true
      mysql.max_used_connections:
        enabled: true
      mysql.myisam.key_cache.block.unused:
        enabled: true
      mysql.myisam.key_cache.block.used.max:
        enabled: true
      mysql.myisam.key_cache.disk.operation:
        enabled: true
      mysql.myisam.key_cache.request:
        enabled: true
      mysql.mysqlx_worker_threads:
        enabled: true
      mysql.page_size:
        enabled: true
      mysql.query.client.count:
        enabled: true
      mysql.query.count:
        enabled: true
      mysql.query.execution.time:
        enabled: true
      mysql.query.slow.count:
        enabled: true
      mysql.replica.sql_delay:
        enabled: true
      mysql.replica.temp_table.open:
        enabled: true
      mysql.replica.thread.running:
        enabled: true
      mysql.replica.time_behind_source:
        enabled: true
      mysql.server.healthy:
        enabled: true
      mysql.session.active.count:
        enabled: true
      mysql.statement_event.count:
        enabled: true
      mysql.statement_event.wait.time:
        enabled: true
      mysql.table.average_row_length:
        enabled: true
      mysql.table.lock_wait.read.count:
        enabled: true
      mysql.table.lock_wait.read.time:
        enabled: true
      mysql.table.lock_wait.write.count:
        enabled: true
      mysql.table.lock_wait.write.time:
        enabled: true
      mysql.table.open:
        enabled: true
      mysql.table.rows:
        enabled: true
      mysql.table.size:
        enabled: true
      mysql.table_open_cache:
        enabled: true
      mysql.thread.slow_launch:
        enabled: true

processors:
  transform:
    trace_statements:
      - context: span
        statements:
          - truncate_all(span.attributes, 4095)
          - truncate_all(resource.attributes, 4095)

  batch:

  resource_detection:
    detectors: ["system"]
    system:
      hostname_sources: ["os"]
      resource_attributes:
        host.id:
          enabled: true

  resource_detection/cloud:
    detectors: ["gcp", "ec2", "azure"]
    timeout: 2s
    override: true

  resource_detection/env:
    detectors: ["env"]
    timeout: 2s
    override: true

exporters:
  otlp/newrelic:
    endpoint: "<YOUR_NEWRELIC_OTLP_ENDPOINT>"
    headers:
      api-key: "<YOUR_NEWRELIC_LICENSE_KEY>"
    compression: gzip
    sending_queue:
      enabled: true
      sizer: bytes
      queue_size: 100_000_000
      num_consumers: 10
      batch:
        sizer: bytes
        max_size: 1_000_000
        min_size: 0
        flush_timeout: 5s
    retry_on_failure:
      enabled: true
      initial_interval: 5s
      max_interval: 30s
      max_elapsed_time: 300s

service:
  telemetry:
    metrics:
      level: none

  extensions: [health_check]

  pipelines:
    metrics/mysql:
      receivers: [nrmysql]
      processors:
        - resource_detection
        - resource_detection/cloud
        - resource_detection/env
        - batch
      exporters: [otlp/newrelic]

    logs/mysql:
      receivers: [nrmysql]
      processors:
        - resource_detection
        - resource_detection/cloud
        - resource_detection/env
        - batch
      exporters: [otlp/newrelic]

    traces:
      receivers: [otlp]
      processors: [transform, resource_detection, resource_detection/cloud, resource_detection/env, batch]
      exporters: [otlp/newrelic]

    metrics:
      receivers: [otlp]
      processors: [resource_detection, resource_detection/cloud, resource_detection/env, batch]
      exporters: [otlp/newrelic]

    logs:
      receivers: [otlp]
      processors: [resource_detection, resource_detection/cloud, resource_detection/env, batch]
      exporters: [otlp/newrelic]
```

> #### ⚠️ IMPORTANT
>
> MySQL integration via NRDOT Collector follows standard [data ingest pricing](https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-pricing-billing/data-ingest-billing/#data). Note that full feature configuration ingests more data than a standard setup, which may increase your overall bill.

## RDS [#rds]

**For Amazon RDS**

This configuration enables the complete MySQL metric catalog the `nrmysql` receiver can produce.

```yaml
extensions:
  health_check:

receivers:
  otlp:
    protocols:
      grpc:
      http:

  nrmysql:
    endpoint: "<YOUR_DB_HOST>:<YOUR_DB_PORT>"
    transport: tcp
    username: "<YOUR_DB_USERNAME>"
    password: "<YOUR_DB_PASSWORD>"
    allow_native_passwords: true
    collection_interval: 15s
    initial_delay: 1s
    # "procedure" collects EXPLAIN plans for write statements (UPDATE/DELETE/INSERT/REPLACE)
    # without granting DML to the monitoring user, via a SQL SECURITY DEFINER procedure.
    # Falls back to "inline" (default) automatically if the procedure is absent for a schema.
    # Requires one-time setup per schema -- see Prerequisites -> DML query plan collection.
    explain_mode: procedure
    statement_events:
      digest_text_limit: 4096
      time_limit: 24h
      limit: 500
    query_sample_collection:
      max_rows_per_query: 100
      # APM-DB correlation: surfaces the nr_service_guid SQL comment tag (e.g. injected by
      # transaction_tracer.sql_metadata_comments in the Java agent) as db.query.comment_tags /
      # db.query.comment_tags.nr_service_guid. Empty list by default -- nothing is extracted
      # unless the key is explicitly allow-listed here.
      allowed_comment_keys: [nr_service_guid]
    top_query_collection:
      lookback_time: 60
      max_query_sample_count: 5000
      top_query_count: 200
      collection_interval: 60s
      query_plan_cache_size: 1000
      query_plan_cache_ttl: 1h
      allowed_comment_keys: [nr_service_guid]
    events:
      db.server.query_sample:
        enabled: true
      db.server.top_query:
        enabled: true
      db.server.query_plan:
        enabled: true
    resource_attributes:
      db.system.version:
        enabled: true
    metrics:
      # ---- Default-enabled metrics (kept explicit for visibility) ----
      mysql.buffer_pool.data_pages:
        enabled: true
      mysql.buffer_pool.limit:
        enabled: true
      mysql.buffer_pool.operations:
        enabled: true
      mysql.buffer_pool.page_flushes:
        enabled: true
      mysql.buffer_pool.pages:
        enabled: true
      mysql.buffer_pool.usage:
        enabled: true
      mysql.double_writes:
        enabled: true
      mysql.handlers:
        enabled: true
      mysql.index.io.wait.count:
        enabled: true
      mysql.index.io.wait.time:
        enabled: true
      mysql.locks:
        enabled: true
      mysql.log_operations:
        enabled: true
      mysql.mysqlx_connections:
        enabled: true
      mysql.opened_resources:
        enabled: true
      mysql.operations:
        enabled: true
      mysql.page_operations:
        enabled: true
      mysql.prepared_statements:
        enabled: true
      mysql.row_locks:
        enabled: true
      mysql.row_operations:
        enabled: true
      mysql.sorts:
        enabled: true
      mysql.table.io.wait.count:
        enabled: true
      mysql.table.io.wait.time:
        enabled: true
      mysql.threads:
        enabled: true
      mysql.tmp_resources:
        enabled: true
      mysql.uptime:
        enabled: true

      # ---- Disabled-by-default metrics (explicitly turned on for full-feature) ----
      mysql.client.network.io:
        enabled: true
      mysql.commands:
        enabled: true
      mysql.connection.count:
        enabled: true
      mysql.connection.errors:
        enabled: true
      mysql.file.open:
        enabled: true
      mysql.innodb.data_file.io:
        enabled: true
      mysql.innodb.history_list.length:
        enabled: true
      mysql.innodb.operation.pending:
        enabled: true
      mysql.innodb.redo_log.checkpoint.age:
        enabled: true
      mysql.innodb.redo_log.lsn.checkpoint:
        enabled: true
      mysql.innodb.redo_log.lsn.current:
        enabled: true
      mysql.innodb.row_lock.wait.count:
        enabled: true
      mysql.innodb.row_lock.wait.duration.avg:
        enabled: true
      mysql.innodb.row_lock.wait.duration.max:
        enabled: true
      mysql.innodb.transaction.active.count:
        enabled: true
      mysql.innodb.transaction.active.duration.max:
        enabled: true
      mysql.joins:
        enabled: true
      mysql.max_used_connections:
        enabled: true
      mysql.myisam.key_cache.block.unused:
        enabled: true
      mysql.myisam.key_cache.block.used.max:
        enabled: true
      mysql.myisam.key_cache.disk.operation:
        enabled: true
      mysql.myisam.key_cache.request:
        enabled: true
      mysql.mysqlx_worker_threads:
        enabled: true
      mysql.page_size:
        enabled: true
      mysql.query.client.count:
        enabled: true
      mysql.query.count:
        enabled: true
      mysql.query.execution.time:
        enabled: true
      mysql.query.slow.count:
        enabled: true
      mysql.replica.sql_delay:
        enabled: true
      mysql.replica.temp_table.open:
        enabled: true
      mysql.replica.thread.running:
        enabled: true
      mysql.replica.time_behind_source:
        enabled: true
      mysql.server.healthy:
        enabled: true
      mysql.session.active.count:
        enabled: true
      mysql.statement_event.count:
        enabled: true
      mysql.statement_event.wait.time:
        enabled: true
      mysql.table.average_row_length:
        enabled: true
      mysql.table.lock_wait.read.count:
        enabled: true
      mysql.table.lock_wait.read.time:
        enabled: true
      mysql.table.lock_wait.write.count:
        enabled: true
      mysql.table.lock_wait.write.time:
        enabled: true
      mysql.table.open:
        enabled: true
      mysql.table.rows:
        enabled: true
      mysql.table.size:
        enabled: true
      mysql.table_open_cache:
        enabled: true
      mysql.thread.slow_launch:
        enabled: true

processors:
  transform:
    trace_statements:
      - context: span
        statements:
          - truncate_all(span.attributes, 4095)
          - truncate_all(resource.attributes, 4095)

  batch:

  resource_detection:
    detectors: ["system"]
    system:
      hostname_sources: ["os"]
      resource_attributes:
        host.id:
          enabled: true

  resource_detection/cloud:
    detectors: ["gcp", "ec2", "azure"]
    timeout: 2s
    override: true

  resource_detection/env:
    detectors: ["env"]
    timeout: 2s
    override: true

exporters:
  otlp/newrelic:
    endpoint: "<YOUR_NEWRELIC_OTLP_ENDPOINT>"
    headers:
      api-key: "<YOUR_NEWRELIC_LICENSE_KEY>"
    compression: gzip
    sending_queue:
      enabled: true
      sizer: bytes
      queue_size: 100_000_000
      num_consumers: 10
      batch:
        sizer: bytes
        max_size: 1_000_000
        min_size: 0
        flush_timeout: 5s
    retry_on_failure:
      enabled: true
      initial_interval: 5s
      max_interval: 30s
      max_elapsed_time: 300s

service:
  telemetry:
    metrics:
      level: none

  extensions: [health_check]

  pipelines:
    metrics/mysql:
      receivers: [nrmysql]
      processors:
        - resource_detection
        - resource_detection/cloud
        - resource_detection/env
        - batch
      exporters: [otlp/newrelic]

    logs/mysql:
      receivers: [nrmysql]
      processors:
        - resource_detection
        - resource_detection/cloud
        - resource_detection/env
        - batch
      exporters: [otlp/newrelic]

    traces:
      receivers: [otlp]
      processors: [transform, resource_detection, resource_detection/cloud, resource_detection/env, batch]
      exporters: [otlp/newrelic]

    metrics:
      receivers: [otlp]
      processors: [resource_detection, resource_detection/cloud, resource_detection/env, batch]
      exporters: [otlp/newrelic]

    logs:
      receivers: [otlp]
      processors: [resource_detection, resource_detection/cloud, resource_detection/env, batch]
      exporters: [otlp/newrelic]
```

> #### ⚠️ IMPORTANT
>
> MySQL integration via NRDOT Collector follows standard [data ingest pricing](https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-pricing-billing/data-ingest-billing/#data). Note that full feature configuration ingests more data than a standard setup, which may increase your overall bill.

## Related documentation [#related-docs]

[Self-hosted instrumentation](https://docs.newrelic.com/docs/opentelemetry/db360/mysql/hosted)

Learn how to set up MySQL monitoring in self-hosted environments with New Relic.

[RDS instrumentation](https://docs.newrelic.com/docs/opentelemetry/db360/mysql/rds)

Learn how to set up MySQL monitoring in RDS environments with New Relic.

[Metrics reference](https://docs.newrelic.com/docs/opentelemetry/db360/mysql/metrics-reference)

Learn about the available metrics collected by the NRDOT Collector.
