Skip to content

feat(core): [Global Attributes 4] Detect integer attribute type correctly for all integer Number subtypes#5122

Open
adinauer wants to merge 2 commits intofeat/scope-attributes-sample-e2efrom
fix/attribute-integer-type-detection
Open

feat(core): [Global Attributes 4] Detect integer attribute type correctly for all integer Number subtypes#5122
adinauer wants to merge 2 commits intofeat/scope-attributes-sample-e2efrom
fix/attribute-integer-type-detection

Conversation

@adinauer
Copy link
Member

📜 Description

SentryAttributeType.inferFrom() only checked for Integer when detecting the INTEGER type. All other integer-like Number subtypes (Long, Short, Byte, BigInteger, AtomicInteger, AtomicLong) fell through to the Number catch-all and were incorrectly classified as DOUBLE.

Extended the INTEGER check to cover all integer-like Number subtypes. Floating-point types (Float, Double, BigDecimal) still correctly map to DOUBLE.

💡 Motivation and Context

💚 How did you test it?

Added SentryAttributeTypeTest with tests for all Number subtypes (Integer, Long, Short, Byte, BigInteger, AtomicInteger, AtomicLong, Double, Float, BigDecimal) as well as Boolean, String, and null.

📝 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

…ubtypes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@linear
Copy link

linear bot commented Feb 26, 2026

@github-actions
Copy link
Contributor

github-actions bot commented Feb 26, 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).


New Features ✨

Core

  • Wire scope attributes into LoggerApi and MetricsApi by adinauer in #5120
  • Add scope-level attributes API by adinauer in #5118

Bug Fixes 🐛

  • Detect integer attribute type correctly for all integer Number subtypes by adinauer in #5122
  • Safe unregister SystemEventsBroadcastReceiver by kollesnica1337 in #5106

Internal Changes 🔧

Deps

  • Bump github/codeql-action from 4.32.2 to 4.32.4 by dependabot in #5109
  • Bump getsentry/craft from 2.21.2 to 2.21.7 by dependabot in #5110

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 312.47 ms 356.04 ms 43.58 ms
Size 1.58 MiB 2.29 MiB 719.89 KiB

@adinauer adinauer changed the title fix: Detect integer attribute type correctly for all integer Number subtypes feat(core): [Global Attributes 4] Detect integer attribute type correctly for all integer Number subtypes Feb 26, 2026
@github-actions
Copy link
Contributor

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 3791872

@adinauer
Copy link
Member Author

PR Stack (Global Attributes):

  1. #5118 — Add scope-level attributes API
  2. #5120 — Wire scope attributes into LoggerApi and MetricsApi
  3. #5121 — Showcase scope attributes in Spring Boot 4 samples
  4. #5122 — Detect integer attribute type correctly for all integer Number subtypes
  5. #5124 — Support collections and arrays in log attribute type inference

@adinauer
Copy link
Member Author

@sentry review

@adinauer
Copy link
Member Author

cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

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