Package org.apache.beam.sdk.io.kafka
Class KafkaSinkMetrics
java.lang.Object
org.apache.beam.sdk.io.kafka.KafkaSinkMetrics
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Gauge
createBacklogGauge
(MetricName name) Creates aGauge
metric to record per partition backlog with the namestatic Histogram
createRPCLatencyHistogram
(org.apache.beam.sdk.io.kafka.KafkaSinkMetrics.RpcMethod method, String topic) Creates aHistogram
metric to record RPC latency with the namestatic MetricName
getMetricGaugeName
(String topic, int partitionId) Creates an MetricName based on topic name and partition id.static void
setSupportKafkaMetrics
(boolean supportKafkaMetrics)
-
Field Details
-
METRICS_NAMESPACE
- See Also:
-
-
Constructor Details
-
KafkaSinkMetrics
public KafkaSinkMetrics()
-
-
Method Details
-
createRPCLatencyHistogram
public static Histogram createRPCLatencyHistogram(org.apache.beam.sdk.io.kafka.KafkaSinkMetrics.RpcMethod method, String topic) Creates aHistogram
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
Creates aGauge
metric to record per partition backlog with the name'name'.
- Parameters:
name
- MetricName for the KafkaSink.- Returns:
- Counter.
-
getMetricGaugeName
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)
-