Skip to content

Commit 18a197e

Browse files
authoredMar 1, 2024
instr(kafka): Tag producer error metric with topic (#3189)
There is an alert based on this metric. Tagging it by topic will make the problem faster to diagnose (no need to go and check the accompanying sentry issue).
1 parent 6da246b commit 18a197e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed
 

‎relay-kafka/src/producer/utils.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ impl ProducerContext for CaptureErrorContext {
2626
"failed to produce message to Kafka (delivery callback)",
2727
);
2828

29-
metric!(counter(KafkaCounters::ProcessingProduceError) += 1);
29+
metric!(
30+
counter(KafkaCounters::ProcessingProduceError) += 1,
31+
topic = message.topic()
32+
);
3033
}
3134
}
3235
}

‎relay-kafka/src/statsd.rs

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ pub enum KafkaCounters {
77
/// These errors include, for example, _"MessageTooLarge"_ errors when the broker does not
88
/// accept the requests over a certain size, which is usually due to invalid or inconsistent
99
/// broker/producer configurations.
10+
///
11+
/// This metric is tagged with:
12+
/// - `topic`: The Kafka topic being produced to.
1013
ProcessingProduceError,
1114
}
1215

0 commit comments

Comments
 (0)
Please sign in to comment.