Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instr(kafka): Improve produce error handling #3351

Merged
merged 3 commits into from
Mar 28, 2024
Merged

Conversation

mcannizz
Copy link
Member

  • Include the name of the topic in the log message when producer.send fails.
  • Report a metric for the number of Kafka messages that fail to enqueue.

See INC-696 for the motivation behind these changes.

#skip-changelog

Include the name of the topic in the log message when `producer.send` fails.
Report a metric for the number of Kafka messages that fail to enqueue.
@mcannizz mcannizz requested a review from a team as a code owner March 28, 2024 02:49
@mcannizz mcannizz changed the title Improve Kafka produce error handling instr(kafka): Improve produce error handling Mar 28, 2024
@mcannizz
Copy link
Member Author

Hi, this is my first time contributing to Relay. I have not yet tested these changes. Can you please advise on what tests I should perform before merging this? Thanks!

@@ -402,7 +402,12 @@ impl Producer {
relay_log::error!(
error = &error as &dyn std::error::Error,
tags.variant = variant,
"error sending kafka message"
"error sending kafka message to topic {}",
topic_name
Copy link
Contributor

@olksdr olksdr Mar 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of changing the name, please, add the topic name into the tags. E.g.

 relay_log::error!(
      error = &error as &dyn std::error::Error,
      tags.variant = variant,
      tags.topic = topic_name,
      "error sending kafka message"

@@ -402,7 +402,12 @@ impl Producer {
relay_log::error!(
error = &error as &dyn std::error::Error,
tags.variant = variant,
"error sending kafka message"
tags.topic = topic_name,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, the error was already tagged by variant, which describes what data type was dropped (e.g. "metric").

@jjbayer jjbayer merged commit 80ffeb7 into master Mar 28, 2024
20 checks passed
@jjbayer jjbayer deleted the add-kafka-error-metric branch March 28, 2024 07:29
);
metric!(
counter(KafkaCounters::ProducerEnqueueError) += 1,
topic = topic_name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jjbayer do we wanna also tag this with the variant? I can PR that.

jan-auer added a commit that referenced this pull request Mar 28, 2024
* master:
  ref(cardinality): Pipeline Redis script invocations (#3321)
  ref(normalization): Remove StoreProcessor (#3097)
  feat(cardinality): Implement name based cardinality limits (#3313)
  instr(kafka): Tag existing metrics with variant (#3352)
  instr(kafka): More broker stats (#3349)
  instr(kafka): Improve produce error handling (#3351)
  feat(schema): Allow integers as username (#3328)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants