platforms:
- type: GCE
  launch_stage: GA
  install_documentation_url: https://cloud.google.com/stackdriver/docs/solutions/agents/ops-agent/third-party/mysql
  agent_requirement:
    logs_minimum_supported_version:
      major: 2
      minor: 5
      patch: 0
    metrics_minimum_supported_version:
      major: 2
      minor: 32
      patch: 0
  detections:
  - characteristic_log:
      log_name_regex: mysql
  - characteristic_metric:
      metric_type: workload.googleapis.com/mysql.threads
  default_logs:
  - name: mysql_error
    fields:
    - name: jsonPayload.level
      type: string
      description: Log entry level
    - name: jsonPayload.message
      type: string
      description: Log message
    - name: jsonPayload.subsystem
      type: string
      description: MySQL subsystem where the log originated
    - name: jsonPayload.tid
      type: number
      description: Thread ID where the log originated
    - name: jsonPayload.errorCode
      type: string
      description: MySQL error code associated with the log
    - name: severity
      type: string
      description: ''
  - name: mysql_general
    fields:
    - name: jsonPayload.message
      type: string
      description: Log of the database action
    - name: jsonPayload.command
      type: string
      description: Type of database action being logged
    - name: jsonPayload.tid
      type: number
      description: Thread ID where the log originated
    - name: severity
      type: string
      description: ''
  - name: mysql_slow
    fields:
    - name: jsonPayload.message
      type: string
      description: Full text of the query
    - name: jsonPayload.user
      type: string
      description: User that executed the query
    - name: jsonPayload.database
      type: string
      description: Database where the query was executed
    - name: jsonPayload.host
      type: string
      description: Host of the database instance
    - name: jsonPayload.ipAddress
      type: string
      description: Address of the database instance
    - name: jsonPayload.tid
      type: number
      description: Thread ID where the query was logged
    - name: jsonPayload.queryTime
      type: number
      description: The statement execution time in seconds
    - name: jsonPayload.lockTime
      type: number
      description: The time to acquire locks in seconds
    - name: jsonPayload.rowsSent
      type: number
      description: The number of rows sent to the client
    - name: jsonPayload.rowsExamined
      type: number
      description: The number of rows examined by the server layer
    - name: jsonPayload.errorNumber
      type: number
      description: The statement error number, or 0 if no error occurred
    - name: jsonPayload.killed
      type: number
      description: If the statement was terminated, the error number indicating why,
        or 0 if the statement terminated normally
    - name: jsonPayload.bytesReceived
      type: number
      description: The number of bytes received from all clients
    - name: jsonPayload.bytesSent
      type: number
      description: The number of bytes sent to all clients
    - name: jsonPayload.readFirst
      type: number
      description: The number of times the first entry in an index was read
    - name: jsonPayload.readLast
      type: number
      description: The number of requests to read the last key in an index
    - name: jsonPayload.readKey
      type: number
      description: The number of requests to read a row based on a key
    - name: jsonPayload.readNext
      type: number
      description: The number of requests to read the next row in key order
    - name: jsonPayload.readPrev
      type: number
      description: The number of requests to read the previous row in key order
    - name: jsonPayload.readRnd
      type: number
      description: The number of requests to read a row based on a fixed position
    - name: jsonPayload.readRndNext
      type: number
      description: The number of requests to read the next row in the data file
    - name: jsonPayload.sortMergePasses
      type: number
      description: The number of merge passes that the sort algorithm has had to do
    - name: jsonPayload.sortRangeCount
      type: number
      description: The number of sorts that were done using ranges
    - name: jsonPayload.sortRows
      type: number
      description: The number of sorted rows
    - name: jsonPayload.sortScanCount
      type: number
      description: The number of sorts that were done by scanning the table
    - name: jsonPayload.createdTmpDiskTables
      type: number
      description: The number of internal on-disk temporary tables created by the
        server
    - name: jsonPayload.createdTmpTables
      type: number
      description: The number of internal temporary tables created by the server
    - name: jsonPayload.startTime
      type: string
      description: The statement execution start time
    - name: jsonPayload.endTime
      type: string
      description: The statement execution end time
    - name: severity
      type: string
      description: ''
    - name: jsonPayload.level
      type: string
      description: Log entry level
  default_metrics:
  - name: workload.googleapis.com/mysql.buffer_pool_data_pages
    value_type: INT64
    kind: GAUGE
    labels:
    - status
  - name: workload.googleapis.com/mysql.buffer_pool_limit
    value_type: INT64
    kind: GAUGE
    labels: []
  - name: workload.googleapis.com/mysql.buffer_pool_operations
    value_type: INT64
    kind: CUMULATIVE
    labels:
    - operation
  - name: workload.googleapis.com/mysql.buffer_pool_page_flushes
    value_type: INT64
    kind: CUMULATIVE
    labels: []
  - name: workload.googleapis.com/mysql.buffer_pool_pages
    value_type: DOUBLE
    kind: GAUGE
    labels:
    - kind
  - name: workload.googleapis.com/mysql.buffer_pool_size
    value_type: DOUBLE
    kind: GAUGE
    labels:
    - kind
  - name: workload.googleapis.com/mysql.commands
    value_type: INT64
    kind: CUMULATIVE
    labels:
    - command
  - name: workload.googleapis.com/mysql.double_writes
    value_type: INT64
    kind: CUMULATIVE
    labels:
    - kind
  - name: workload.googleapis.com/mysql.handlers
    value_type: INT64
    kind: CUMULATIVE
    labels:
    - kind
  - name: workload.googleapis.com/mysql.locks
    value_type: INT64
    kind: CUMULATIVE
    labels:
    - kind
  - name: workload.googleapis.com/mysql.log_operations
    value_type: INT64
    kind: CUMULATIVE
    labels:
    - operation
  - name: workload.googleapis.com/mysql.operations
    value_type: INT64
    kind: CUMULATIVE
    labels:
    - operation
  - name: workload.googleapis.com/mysql.page_operations
    value_type: INT64
    kind: CUMULATIVE
    labels:
    - operation
  - name: workload.googleapis.com/mysql.replica.time_behind_source
    value_type: INT64
    kind: GAUGE
    labels: []
  - name: workload.googleapis.com/mysql.replica.sql_delay
    value_type: INT64
    kind: GAUGE
    labels: []
  - name: workload.googleapis.com/mysql.row_locks
    value_type: INT64
    kind: CUMULATIVE
    labels:
    - kind
  - name: workload.googleapis.com/mysql.row_operations
    value_type: INT64
    kind: CUMULATIVE
    labels:
    - operation
  - name: workload.googleapis.com/mysql.sorts
    value_type: INT64
    kind: CUMULATIVE
    labels:
    - kind
  - name: workload.googleapis.com/mysql.threads
    value_type: DOUBLE
    kind: GAUGE
    labels:
    - kind
