Skip to content

fix(spring-jakarta): [Queue Instrumentation 12] Add Kafka retry count attribute#5282

Draft
adinauer wants to merge 1 commit intofix/queue-instrumentation-producer-guardfrom
fix/queue-instrumentation-retry-count
Draft

fix(spring-jakarta): [Queue Instrumentation 12] Add Kafka retry count attribute#5282
adinauer wants to merge 1 commit intofix/queue-instrumentation-producer-guardfrom
fix/queue-instrumentation-retry-count

Conversation

@adinauer
Copy link
Copy Markdown
Member

@adinauer adinauer commented Apr 10, 2026

PR Stack (Queue Instrumentation)


📜 Description

Set messaging.message.retry.count on queue.process transactions when Spring Kafka provides the delivery attempt header. The retry count is derived as deliveryAttempt - 1 (attempt 1 → retry count 0).

If the header is missing, malformed, or non-positive, no retry count attribute is added.

💡 Motivation and Context

Kafka retries currently create multiple queue.process transactions for the same record. Adding retry-count metadata makes attempts distinguishable in traces and aligns with Sentry conventions.

💚 How did you test it?

  • Ran ./gradlew :sentry-spring-jakarta:test --tests='*SentryKafkaRecordInterceptorTest*'
  • Added tests:
    • sets retry count from delivery attempt header
    • does not set retry count when delivery attempt header is missing

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

None.

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into main.

#skip-changelog

… attribute

Set messaging.message.retry.count on queue.process transactions when the Spring Kafka delivery attempt header is present. This keeps retry context on consumer traces without changing transaction lifecycle behavior.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


This PR will not appear in the changelog.


🤖 This preview updates automatically when you update the PR.

@sentry
Copy link
Copy Markdown

sentry bot commented Apr 10, 2026

Sentry Build Distribution

App Name App ID Version Configuration Install Page
SDK Size io.sentry.tests.size 8.37.1 (1) release Install Build

Configure sentry-android build distribution settings

@github-actions
Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 316.72 ms 373.91 ms 57.19 ms
Size 0 B 0 B 0 B

Baseline results on branch: fix/queue-instrumentation-producer-guard

Startup times

Revision Plain With Sentry Diff
8bb14c7 347.98 ms 413.21 ms 65.23 ms

App size

Revision Plain With Sentry Diff
8bb14c7 0 B 0 B 0 B

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