Skip to content

fix(metrics): Gracefully handle errors when recording commit status metrics#521

Open
sentry[bot] wants to merge 1 commit intomainfrom
seer/fix/safe-commit-status-metrics
Open

fix(metrics): Gracefully handle errors when recording commit status metrics#521
sentry[bot] wants to merge 1 commit intomainfrom
seer/fix/safe-commit-status-metrics

Conversation

@sentry
Copy link

@sentry sentry bot commented Feb 21, 2026

Fixes SNUBA-9Y5. The issue was that: DatadogMetricsBackend's thread-local property corrupted during librdkafka callback exception, causing SystemError when logging metrics.

  • Wrapped calls to self.__metrics.increment in the __record_commit_status method with try...except blocks.
  • Logs a debug message if an exception occurs during metric incrementation, preventing potential consumer crashes due to metric system failures.

This fix was generated by Seer in Sentry, triggered by pierre.massat@sentry.io. 👁️ Run ID: 10536178

Not quite right? Click here to continue debugging with Seer.

@sentry sentry bot requested review from a team as code owners February 21, 2026 21:12
Comment on lines +276 to +285
try:
self.__metrics.increment(
name="arroyo.consumer.commit_status",
value=1,
tags=tags,
)
except Exception as e:
logger.debug(
"Failed to record commit status metric: %s", e, exc_info=False
)
Copy link
Member

Choose a reason for hiding this comment

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

Should we consolidate the try/except and metrics.increment() call as both sides of the branch have the same logic.

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.

1 participant