Merged
Conversation
Add setAttribute, setAttributes, removeAttribute, and getAttributes to IScope/IScopes/Sentry so users can set attributes on the scope that are automatically included in logs and metrics events. Also refactor type inference logic into SentryAttributeType.inferFrom and add SentryLogEventAttributeValue.fromAttribute factory method, removing duplicate getType helpers from LoggerApi and MetricsApi. Co-Authored-By: Claude <noreply@anthropic.com>
Move factory method extractions (SentryAttributeType.inferFrom, SentryLogEventAttributeValue.fromAttribute) and LoggerApi/MetricsApi scope attribute integration to a separate stacked PR. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract factory methods SentryAttributeType.inferFrom and SentryLogEventAttributeValue.fromAttribute to reduce duplication. Apply scope attributes to log and metric events automatically. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add Sentry.setAttribute() calls to PersonController and MetricController across all Spring Boot 4 sample variants to demonstrate scope attributes being auto-attached to logs and metrics. Add e2e test assertions and TestHelper methods to verify scope attributes appear on captured log and metric events. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This reverts commit 7189bdc.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ubtypes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add arrayAttribute and named array attribute usage to the four attribute tests in ScopesTest (log, count metric, distribution metric, gauge metric) to verify the factory method works end-to-end. Co-Authored-By: Claude <noreply@anthropic.com>
feat(core): [Global Attributes 1] Add scope-level attributes API
Contributor
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Internal Changes 🔧Deps
🤖 This preview updates automatically when you update the PR. |
Contributor
|
…metrics feat(core): [Global Attributes 2]Wire scope attributes into LoggerApi and MetricsApi
feat(samples): [Global Attributes 3] Showcase scope attributes in Spring Boot 4 sample
…tection feat(core): [Global Attributes 4] Detect integer attribute type correctly for all integer Number subtypes
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 91bb874 | 314.47 ms | 440.00 ms | 125.53 ms |
| dba088c | 333.98 ms | 381.16 ms | 47.18 ms |
| d15471f | 310.66 ms | 368.19 ms | 57.53 ms |
| bbc35bb | 298.53 ms | 372.17 ms | 73.64 ms |
| d15471f | 307.28 ms | 381.85 ms | 74.57 ms |
| ad8da22 | 362.98 ms | 453.94 ms | 90.96 ms |
| cf708bd | 408.35 ms | 458.98 ms | 50.63 ms |
| 96449e8 | 361.30 ms | 423.39 ms | 62.09 ms |
| 27d7cf8 | 309.43 ms | 364.27 ms | 54.85 ms |
| 91bb874 | 311.00 ms | 363.47 ms | 52.47 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 91bb874 | 1.58 MiB | 2.13 MiB | 559.07 KiB |
| dba088c | 1.58 MiB | 2.13 MiB | 558.99 KiB |
| d15471f | 1.58 MiB | 2.13 MiB | 559.54 KiB |
| bbc35bb | 1.58 MiB | 2.12 MiB | 553.01 KiB |
| d15471f | 1.58 MiB | 2.13 MiB | 559.54 KiB |
| ad8da22 | 1.58 MiB | 2.29 MiB | 719.83 KiB |
| cf708bd | 1.58 MiB | 2.11 MiB | 539.71 KiB |
| 96449e8 | 1.58 MiB | 2.11 MiB | 539.35 KiB |
| 27d7cf8 | 1.58 MiB | 2.12 MiB | 549.42 KiB |
| 91bb874 | 1.58 MiB | 2.13 MiB | 559.07 KiB |
feat(core): [Global Attributes 5] Support collections and arrays in log attributes
The arrayAttribute() factory only accepted Collection<?>, but inferFrom() also handles native Java arrays. Add an Object[] overload so users can pass object arrays like String[] directly without falling back to the untyped named() method. Co-Authored-By: Claude <noreply@anthropic.com>
alexander-alderman-webb
approved these changes
Mar 4, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Collection branch for individual PRs to implement Global Attributes API, i.e. adding attributes to
Scopewhich are then auto applied to logs and metrics (more in the future).PR Stack (Global Attributes):
💡 Motivation and Context
Closes #5084
💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps