apiVersion: v1
kind: ConfigMap
metadata:
  name: presto-jmx-config
  labels:
    app: presto
data:
  config.yml: |
    ---
    lowercaseOutputName: true
    lowercaseOutputLabelNames: true
    attrNameSnakeCase: false
    rules:
      # capture percentile and set quantile label
      - pattern: 'presto.plugin.hive<type=(.+), name=hive><>(.+AllTime).P(\d+): (.*)'
        name: 'presto_hive_$1_$2_seconds'
        type: GAUGE
        valueFactor: 0.001
        labels:
          quantile: '0.$3'
      # match non-percentiles
      - pattern: 'presto.plugin.hive<type=(.+), name=hive><>(.+AllTime.+): (.*)'
        name: 'presto_hive_$1_$2_seconds'
        type: GAUGE
        valueFactor: 0.001
        # counts
      - pattern: 'presto.plugin.hive<type=(.+), name=hive><>(.+TotalCount.*): (.*)'
        name: 'presto_hive_$1_$2_total'
        type: COUNTER
      # capture percentile and set quantile label
      - pattern: 'presto.plugin.hive.s3<type=(.+), name=hive><>(.+AllTime).P(\d+): (.*)'
        name: 'presto_hive_s3_$1_$2_seconds'
        type: GAUGE
        valueFactor: 0.001
        labels:
          quantile: '0.$3'
      # match non-percentiles
      - pattern: 'presto.plugin.hive.s3<type=(.+), name=hive><>(.+AllTime.+): (.*)'
        name: 'presto_hive_s3_$1_$2_seconds'
        type: GAUGE
        valueFactor: 0.001
        # counts
      - pattern: 'presto.plugin.hive.s3<type=(.+), name=hive><>(.+TotalCount.*): (.*)'
        name: 'presto_hive_s3_$1_$2_total'
        type: COUNTER
      # capture percentile and set quantile label
      - pattern: 'presto.plugin.hive.metastore.thrift<type=(.+), name=hive><>(.+AllTime).P(\d+): (.*)'
        name: 'presto_hive_metastore_thrift_$1_$2_seconds'
        type: GAUGE
        valueFactor: 0.001
        labels:
          quantile: '0.$3'
      # match non-percentiles
      - pattern: 'presto.plugin.hive.metastore.thrift<type=(.+), name=hive><>(.+AllTime.+): (.*)'
        name: 'presto_hive_metastore_thrift_$1_$2_count_seconds'
        type: GAUGE
        valueFactor: 0.001
      # counts
      - pattern: 'presto.plugin.hive.metastore.thrift<type=(.+), name=hive><>(.+TotalCount.*): (.*)'
        name: 'presto_hive_metastore_thrift_$1_$2_total'
        type: COUNTER
      - pattern: 'presto.execution<name=(.+)><>(.+AllTime).P(\d+): (.*)'
        name: 'presto_execution_$1_$2_seconds'
        type: GAUGE
        valueFactor: 0.001
        labels:
          quantile: '0.$3'
      - pattern: 'presto.execution<name=(.+)><>(.+AllTime.+): (.*)'
        name: 'presto_execution_$1_$2_seconds'
        type: GAUGE
        valueFactor: 0.001
      # counts
      - pattern: 'presto.execution<name=(.+)><>(.+TotalCount.*): (.*)'
        name: 'presto_execution_$1_$2_total'
        type: COUNTER
      - pattern: 'presto.memory<type=(.*), name=(.*)><>(.+): (.*)'
        name: 'presto_memory_$1_$2_$3'
        type: GAUGE
      - pattern: 'presto.failuredetector<name=HeartbeatFailureDetector><>ActiveCount: (.*)'
        name: 'presto_heartbeatdetector_activecount'
        type: GAUGE
