개요

MySQL 대시보드의 OpenTelemetry MySQL 메트릭

MySQL 수신기를 사용하면 MySQL 메트릭을 수집하고 MySQL Overview 대시보드에 접근할 수 있습니다. mysqlreceiver 최신 버전 사양에 따라 수신기를 구성하세요.

자세한 내용은 OpenTelemetry 프로젝트 문서의 MySQL receiver 항목을 참고하세요.

설정

Datadog에서 사용할 MySQL 메트릭을 OpenTelemetry로 수집하는 방법:

  1. OpenTelemetry Collector 구성에서 MySQL 수신기를 설정하세요.
  2. OpenTelemetry Collector가 MySQL 데이터베이스와 동일한 서버에서 실행 중인 경우, 선택적으로 호스트 메트릭 수신기를 구성할 수 있습니다.
  3. OpenTelemetry Collector가 MySQL 데이터베이스와 동일한 서버에서 실행 중인 경우, 선택적으로 파일 로그 수신기를 구성할 수 있습니다.
  4. 서비스 파이프라인을 구성합니다.
  5. OpenTelemetry Collector가 Datadog로 내보내도록 구성되어 있는지 확인하세요.

MySQL 수신기

receivers:
  mysql/mysql-host-1:
    endpoint: "<HOST>:<PORT>"
    username: "<USERNAME>"
    password: "<PASSWORD>"
    collection_interval: 10s
    metrics:
      mysql.connection.count:
        enabled: true
      mysql.connection.errors:
        enabled: true
      mysql.commands:
        enabled: true
      mysql.query.slow.count:
        enabled: true
      mysql.max_used_connections:
        enabled: true

processors:
  resource/mysql-host-1:
    attributes:
      - action: insert
        key: datadog.host.name
        value: <HOST>
  transform/mysql-host-1:
    metric_statements:
      - convert_sum_to_gauge() where metric.name == "mysql.locks"
  cumulativetodelta: {}
  deltatorate:
    metrics:
      - mysql.connection.count
      - mysql.commands
      - mysql.operations
      - mysql.query.slow.count
      - mysql.connection.errors
      - mysql.log_operations
      - system.network.io

자세한 구성 옵션 및 요구 사항은 MySQL 수신기 설명서를 참고하세요.

호스트 메트릭 수신기

receivers:
  hostmetrics:
    scrapers:
      load:
      cpu:
        metrics:
         system.cpu.utilization:
           enabled: true
      memory:
      network:

파일 로그 수신기

receivers:
  filelog:
    include:
      - <PATH_TO_YOUR_MYSQL_ERROR_LOG>
      - <PATH_TO_YOUR_MYSQL_LOG_FILE>
    operators:
      - type: json_parser
        parse_from: body
        timestamp:
          parse_from: attributes.timestamp
          layout: "%Y-%m-%dT%H:%M:%SZ"

processors:
  transform/logs:
    log_statements:
      - context: resource
        statements:
          - set(attributes["datadog.host.name"], "<HOST>")
          - set(attributes["datadog.log.source"], "mysql")

  batch: {}

서비스 파이프라인

service:
  pipelines:
    metrics/mysql-host-1:
      receivers: [mysql/mysql-host-1]
      exporters: [datadog/exporter]
      processors: [resource/mysql-host-1,cumulativetodelta,deltatorate,transform/mysql-host-1]

구성한 경우 hostmetricsfilelog 수신기를 추가합니다. 예:

      receivers: [mysql/mysql-host-1,hostmetrics,filelog]

수집한 데이터

OTELDATADOGDESCRIPTIONFILTER
mysql.buffer_pool.data_pagesmysql.innodb.buffer_pool_pages_dirtyThe number of data pages in the InnoDB buffer pool.status: dirty
mysql.buffer_pool.operationsmysql.innodb.buffer_pool_read_aheadThe number of operations on the InnoDB buffer pool.operation: read_ahead
mysql.buffer_pool.operationsmysql.innodb.buffer_pool_read_ahead_evictedThe number of operations on the InnoDB buffer pool.operation: read_ahead_evicted
mysql.buffer_pool.operationsmysql.innodb.buffer_pool_read_ahead_rndThe number of operations on the InnoDB buffer pool.operation: read_ahead_rnd
mysql.buffer_pool.operationsmysql.innodb.buffer_pool_read_requestsThe number of operations on the InnoDB buffer pool.operation: read_requests
mysql.buffer_pool.operationsmysql.innodb.buffer_pool_readsThe number of operations on the InnoDB buffer pool.operation: reads
mysql.buffer_pool.operationsmysql.innodb.buffer_pool_wait_freeThe number of operations on the InnoDB buffer pool.operation: wait_free
mysql.buffer_pool.operationsmysql.innodb.buffer_pool_write_requestsThe number of operations on the InnoDB buffer pool.operation: write_requests
mysql.buffer_pool.page_flushesmysql.innodb.buffer_pool_pages_flushedThe number of requests to flush pages from the InnoDB buffer pool.
mysql.buffer_pool.pagesmysql.innodb.buffer_pool_pages_dataThe number of pages in the InnoDB buffer pool.kind: data
mysql.buffer_pool.pagesmysql.innodb.buffer_pool_pages_freeThe number of pages in the InnoDB buffer pool.kind: free
mysql.buffer_pool.usagemysql.innodb.buffer_pool_dataThe number of bytes in the InnoDB buffer pool.
mysql.buffer_pool.usagemysql.innodb.buffer_pool_dirtyThe number of bytes in the InnoDB buffer pool.status: dirty
mysql.client.network.iomysql.performance.bytes_receivedThe number of transmitted bytes between server and clients.kind: received
mysql.client.network.iomysql.performance.bytes_sentThe number of transmitted bytes between server and clients.kind: sent
mysql.commandsmysql.performance.com_selectThe number of times each type of command has been executed.command: select
mysql.commandsmysql.performance.com_updateThe number of times each type of command has been executed.command: update
mysql.commandsmysql.performance.com_deleteThe number of times each type of command has been executed.command: delete
mysql.commandsmysql.performance.com_insertThe number of times each type of command has been executed.command: insert
mysql.connection.countmysql.net.connectionsThe number of connection attempts (successful or not) to the MySQL server.
mysql.connection.errorsmysql.net.aborted_connectsErrors that occur during the client connection process.error: aborted
mysql.double_writesmysql.innodb.dblwr_pages_writtenThe number of writes to the InnoDB doublewrite buffer.kind: pages_written
mysql.double_writesmysql.innodb.dblwr_writesThe number of writes to the InnoDB doublewrite buffer.kind: writes
mysql.handlersmysql.performance.handler_writeThe number of requests to various MySQL handlers.kind: write
mysql.handlersmysql.performance.handler_updateThe number of requests to various MySQL handlers.kind: update
mysql.handlersmysql.performance.handler_rollbackThe number of requests to various MySQL handlers.kind: rollback
mysql.handlersmysql.performance.handler_read_rnd_nextThe number of requests to various MySQL handlers.kind: read_rnd_next
mysql.handlersmysql.performance.handler_read_rndThe number of requests to various MySQL handlers.kind: read_rnd
mysql.handlersmysql.performance.handler_read_prevThe number of requests to various MySQL handlers.kind: read_prev
mysql.handlersmysql.performance.handler_read_firstThe number of requests to various MySQL handlers.kind: read_first
mysql.handlersmysql.performance.handler_read_keyThe number of requests to various MySQL handlers.kind: read_key
mysql.handlersmysql.performance.handler_prepareThe number of requests to various MySQL handlers.kind: prepare
mysql.handlersmysql.performance.handler_deleteThe number of requests to various MySQL handlers.kind: delete
mysql.handlersmysql.performance.handler_commitThe number of requests to various MySQL handlers.kind: commit
mysql.handlersmysql.performance.handler_read_nextThe number of requests to various MySQL handlers.kind: read_next
mysql.joinsmysql.performance.select_scanThe number of joins that perform table scans.kind: scan
mysql.joinsmysql.performance.select_range_checkThe number of joins that perform table scans.kind: range_check
mysql.joinsmysql.performance.select_full_range_joinThe number of joins that perform table scans.kind: full_range
mysql.joinsmysql.performance.select_rangeThe number of joins that perform table scans.kind: range
mysql.joinsmysql.performance.select_full_joinThe number of joins that perform table scans.kind: full
mysql.locksmysql.performance.table_locks_immediateThe number of MySQL locks.kind: immediate
mysql.locksmysql.performance.table_locks_waitedThe number of MySQL locks.kind: waited
mysql.log_operationsmysql.innodb.log_waitsThe number of InnoDB log operations.operation: waits
mysql.log_operationsmysql.innodb.log_write_requestsThe number of InnoDB log operations.operation: write_requests
mysql.log_operationsmysql.innodb.log_writesThe number of InnoDB log operations.operation: writes
mysql.log_operationsmysql.innodb.os_log_fsyncsThe number of InnoDB log operations.operation: fsyncs
mysql.max_used_connectionsmysql.net.max_connectionsMaximum number of connections used simultaneously since the server started.
mysql.operationsmysql.innodb.data_fsyncsThe number of InnoDB operations.operation: fsyncs
mysql.operationsmysql.innodb.data_writesThe number of InnoDB operations.operation: writes
mysql.operationsmysql.innodb.data_readsThe number of InnoDB operations.operation: reads
mysql.page_operationsmysql.innodb.pages_createdThe number of InnoDB page operations.operation: created
mysql.page_operationsmysql.innodb.pages_readThe number of InnoDB page operations.operation: read
mysql.page_operationsmysql.innodb.pages_writtenThe number of InnoDB page operations.operation: written
mysql.query.slow.countmysql.performance.slow_queriesThe number of slow queries.
mysql.replica.time_behind_sourcemysql.replication.seconds_behind_sourceThis field is an indication of how “late” the replica is.
mysql.row_locksmysql.innodb.row_lock_current_waitsThe number of InnoDB row locks.kind: waits
mysql.row_locksmysql.innodb.current_row_locksThe number of InnoDB row locks.
mysql.row_operationsmysql.innodb.rows_deletedThe number of InnoDB row operations.operation: deleted
mysql.row_operationsmysql.innodb.rows_insertedThe number of InnoDB row operations.operation: inserted
mysql.row_operationsmysql.innodb.rows_readThe number of InnoDB row operations.operation: read
mysql.row_operationsmysql.innodb.rows_updatedThe number of InnoDB row operations.operation: updated
mysql.sortsmysql.performance.sort_merge_passesThe number of MySQL sorts.kind: merge_passes
mysql.sortsmysql.performance.sort_rangeThe number of MySQL sorts.kind: range
mysql.sortsmysql.performance.sort_rowsThe number of MySQL sorts.kind: rows
mysql.sortsmysql.performance.sort_scanThe number of MySQL sorts.kind: scan
mysql.table_open_cachemysql.performance.table_cache_hitsThe number of hits, misses or overflows for open tables cache lookups.status: hit
mysql.table_open_cachemysql.performance.table_cache_missesThe number of hits, misses or overflows for open tables cache lookups.status: miss
mysql.threadsmysql.performance.threads_cachedThe state of MySQL threads.kind: cached
mysql.threadsmysql.performance.threads_connectedThe state of MySQL threads.kind: connected
mysql.threadsmysql.performance.threads_createdThe state of MySQL threads.kind: created
mysql.threadsmysql.performance.threads_runningThe state of MySQL threads.kind: running
mysql.tmp_resourcesmysql.performance.created_tmp_filesThe number of created temporary resources.resource: files
mysql.tmp_resourcesmysql.performance.created_tmp_disk_tablesThe number of created temporary resources.resource: disk_tables
mysql.tmp_resourcesmysql.performance.created_tmp_tablesThe number of created temporary resources.resource: tables

자세한 정보는 OpenTelemetry 메트릭 매핑을 참조하세요.

참고 자료

추가 유용한 문서, 링크 및 기사: