Class KafkaSinkMetrics

java.lang.Object
org.apache.beam.sdk.io.kafka.KafkaSinkMetrics

public class KafkaSinkMetrics extends Object
Helper class to create per worker metrics for Kafka Sink stages.

Metrics will be in the namespace 'KafkaSink' and have their name formatted as:

'{baseName}-{metricLabelKey1}:{metricLabelVal1};...{metricLabelKeyN}:{metricLabelValN};' ????

  • Field Details

  • Constructor Details

    • KafkaSinkMetrics

      public KafkaSinkMetrics()
  • Method Details

    • createRPCLatencyHistogram

      public static Histogram createRPCLatencyHistogram(org.apache.beam.sdk.io.kafka.KafkaSinkMetrics.RpcMethod method, String topic)
      Creates a Histogram metric to record RPC latency with the name

      'RpcLatency*rpc_method:{method};topic_name:{topic};'.

      Parameters:
      method - Kafka method associated with this metric.
      topic - Kafka topic associated with this metric.
      Returns:
      Histogram with exponential buckets with a sqrt(2) growth factor.
    • createBacklogGauge

      public static Gauge createBacklogGauge(MetricName name)
      Creates a Gauge metric to record per partition backlog with the name

      'name'.

      Parameters:
      name - MetricName for the KafkaSink.
      Returns:
      Counter.
    • getMetricGaugeName

      public static MetricName getMetricGaugeName(String topic, int partitionId)
      Creates an MetricName based on topic name and partition id.

      'EstimatedBacklogSize*topic_name:{topic};partition_id:{partitionId};'

      Parameters:
      topic - Kafka topic associated with this metric.
      partitionId - partition id associated with this metric.
      Returns:
      MetricName.
    • setSupportKafkaMetrics

      public static void setSupportKafkaMetrics(boolean supportKafkaMetrics)