type: flinkmetrics
scope_name: otelcol/flinkmetricsreceiver

status:
  class: receiver
  stability:
    alpha: [metrics]
  distributions: [contrib]
  codeowners:
    active: [JonathanWamsley, djaglowski]
    seeking_new: true

resource_attributes:
  # These resource attributes are Flinks system scope variables, which contains context information about metrics. These are required to uniquely identify incoming metrics as the same job can run multiple times concurrently. See https://nightlies.apache.org/flink/flink-docs-release-1.14/docs/ops/metrics/#system-scope for more information.
  host.name:
    description: The host name.
    type: string
    enabled: true
  flink.taskmanager.id:
    description: The taskmanager ID.
    type: string
    enabled: true
  flink.job.name:
    description: The job name.
    type: string
    enabled: true
  flink.task.name:
    description: The task name.
    type: string
    enabled: true
  flink.subtask.index:
    description: The subtask index.
    type: string
    enabled: true
  flink.resource.type:
    description: The flink scope type in which a metric belongs to.
    type: string
    enabled: true
    enum: [ jobmanager, taskmanager ]

attributes:
  operator_name:
    name_override: name
    description: The operator name.
    type: string
  garbage_collector_name:
    name_override: name
    description: The names for the parallel scavenge and garbage first garbage collectors.
    type: string
    enum: [ PS_MarkSweep, PS_Scavenge, G1_Young_Generation, G1_Old_Generation ]
  checkpoint:
    description: The number of checkpoints completed or that failed.
    type: string
    enum: [ completed, failed ]
  record:
    description: The number of records received in, sent out or dropped due to arriving late.
    type: string
    enum: [ in, out, dropped ]

metrics:
  flink.jvm.cpu.load:
    enabled: true
    description: The CPU usage of the JVM for a jobmanager or taskmanager.
    unit: "%"
    gauge:
      value_type: double
      input_type: string
    attributes: []
  flink.jvm.cpu.time:
    enabled: true
    description: The CPU time used by the JVM for a jobmanager or taskmanager.
    unit: ns
    sum:
      monotonic: true
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.jvm.memory.heap.used:
    enabled: true
    description: The amount of heap memory currently used.
    unit: By
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.jvm.memory.heap.committed:
    enabled: true
    description: The amount of heap memory guaranteed to be available to the JVM.
    unit: By
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.jvm.memory.heap.max:
    enabled: true
    description: The maximum amount of heap memory that can be used for memory management.
    unit: By
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.jvm.memory.nonheap.used:
    enabled: true
    description: The amount of non-heap memory currently used.
    unit: By
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.jvm.memory.nonheap.committed:
    enabled: true
    description: The amount of non-heap memory guaranteed to be available to the JVM.
    unit: By
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.jvm.memory.nonheap.max:
    enabled: true
    description: The maximum amount of non-heap memory that can be used for memory management.
    unit: By
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.jvm.memory.metaspace.used:
    enabled: true
    description: The amount of memory currently used in the Metaspace memory pool.
    unit: By
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.jvm.memory.metaspace.committed:
    enabled: true
    description: The amount of memory guaranteed to be available to the JVM in the Metaspace memory pool.
    unit: By
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.jvm.memory.metaspace.max:
    enabled: true
    description: The maximum amount of memory that can be used in the Metaspace memory pool.
    unit: By
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.jvm.memory.direct.used:
    enabled: true
    description: The amount of memory used by the JVM for the direct buffer pool.
    unit: By
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.jvm.memory.direct.total_capacity:
    enabled: true
    description: The total capacity of all buffers in the direct buffer pool.
    unit: By
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.jvm.memory.mapped.used:
    enabled: true
    description: The amount of memory used by the JVM for the mapped buffer pool.
    unit: By
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.jvm.memory.mapped.total_capacity:
    enabled: true
    description: The number of buffers in the mapped buffer pool.
    unit: By
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.memory.managed.used:
    enabled: true
    description: The amount of managed memory currently used.
    unit: By
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.memory.managed.total:
    enabled: true
    description: The total amount of managed memory.
    unit: By
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.jvm.threads.count:
    enabled: true
    description: The total number of live threads.
    unit: "{threads}"
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.jvm.gc.collections.count:
    enabled: true
    description: The total number of collections that have occurred.
    unit: "{collections}"
    sum:
      monotonic: true
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: [ garbage_collector_name ]
  flink.jvm.gc.collections.time:
    enabled: true
    description: The total time spent performing garbage collection.
    unit: ms
    sum:
      monotonic: true
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: [ garbage_collector_name ]
  flink.jvm.class_loader.classes_loaded:
    enabled: true
    description: The total number of classes loaded since the start of the JVM.
    unit: "{classes}"
    sum:
      monotonic: true
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.job.restart.count:
    enabled: true
    description: The total number of restarts since this job was submitted, including full restarts and fine-grained restarts.
    unit: "{restarts}"
    sum:
      monotonic: true
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.job.last_checkpoint.time:
    enabled: true
    description: The end to end duration of the last checkpoint.
    unit: ms
    gauge:
      value_type: int
      input_type: string
    attributes: []
  flink.job.last_checkpoint.size:
    enabled: true
    description: The total size of the last checkpoint.
    unit: By
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.job.checkpoint.count:
    enabled: true
    description: The number of checkpoints completed or failed.
    unit: "{checkpoints}"
    sum:
      monotonic: true
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: [ checkpoint ]
  flink.job.checkpoint.in_progress:
    enabled: true
    description: The number of checkpoints in progress.
    unit: "{checkpoints}"
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: []
  flink.task.record.count:
    enabled: true
    description: The number of records a task has.
    unit: "{records}"
    sum:
      monotonic: true
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: [ record ]
  flink.operator.record.count:
    enabled: true
    description: The number of records an operator has.
    unit: "{records}"
    sum:
      monotonic: true
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: [ operator_name, record ]
  flink.operator.watermark.output:
    enabled: true
    description: The last watermark this operator has emitted.
    unit: ms
    sum:
      monotonic: false
      aggregation_temporality: cumulative
      value_type: int
      input_type: string
    attributes: [ operator_name ]
tests:
  config: