X Tutup
Skip to content

feat(samples): [Global Attributes 6] Showcase scope attributes in all sample modules#5149

Merged
adinauer merged 22 commits intomainfrom
feat/samples-scope-attributes
Mar 10, 2026
Merged

feat(samples): [Global Attributes 6] Showcase scope attributes in all sample modules#5149
adinauer merged 22 commits intomainfrom
feat/samples-scope-attributes

Conversation

@adinauer
Copy link
Member

@adinauer adinauer commented Mar 3, 2026

Add Sentry.setAttribute() calls to all sample source files and corresponding attribute assertions to all system tests. This extends the scope attributes showcase from sentry-samples-spring-boot-4 (added in #5121) to all 19 remaining sample modules with system tests.

Source files — added setAttribute calls for user.type (string), feature.version (int), and debug.enabled (boolean) before the first logger or metrics call in each sample's controller/main method.

Test files — added doesLogWithBodyHaveAttribute and doesMetricHaveAttribute assertions to verify the attributes are present on logs and metrics received by the mock Sentry server.

66 files changed across 19 modules (14 Spring, 2 console, 3 logger).

#skip-changelog

adinauer and others added 16 commits February 26, 2026 10:49
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>
Add Sentry.setAttribute() calls to all sample source files and
corresponding attribute assertions to all system tests. This extends
the scope attributes showcase from sentry-samples-spring-boot-4 to
all 19 remaining sample modules with system tests.

Co-Authored-By: Claude <noreply@anthropic.com>
@adinauer adinauer changed the title feat(samples): Showcase scope attributes in all sample modules feat(samples): [Global Attributes 6] Showcase scope attributes in all sample modules Mar 3, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 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.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

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

Generated by 🚫 dangerJS against aa6733c

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 313.11 ms 340.63 ms 27.52 ms
Size 0 B 0 B 0 B

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
ee747ae 396.82 ms 441.67 ms 44.86 ms
22f4345 314.79 ms 375.02 ms 60.23 ms
fcec2f2 314.96 ms 373.66 ms 58.70 ms
d15471f 315.20 ms 370.22 ms 55.02 ms
a416a65 295.53 ms 373.74 ms 78.21 ms
d15471f 322.58 ms 396.08 ms 73.50 ms
9fbb112 359.71 ms 421.85 ms 62.14 ms
27d7cf8 306.76 ms 366.66 ms 59.90 ms
3998a95 415.94 ms 478.54 ms 62.60 ms
83884a0 334.46 ms 400.92 ms 66.46 ms

App size

Revision Plain With Sentry Diff
ee747ae 1.58 MiB 2.10 MiB 530.95 KiB
22f4345 1.58 MiB 2.29 MiB 719.83 KiB
fcec2f2 1.58 MiB 2.12 MiB 551.50 KiB
d15471f 1.58 MiB 2.13 MiB 559.54 KiB
a416a65 1.58 MiB 2.12 MiB 555.26 KiB
d15471f 1.58 MiB 2.13 MiB 559.54 KiB
9fbb112 1.58 MiB 2.11 MiB 539.18 KiB
27d7cf8 1.58 MiB 2.12 MiB 549.42 KiB
3998a95 1.58 MiB 2.10 MiB 532.96 KiB
83884a0 1.58 MiB 2.29 MiB 722.97 KiB

Previous results on branch: feat/samples-scope-attributes

Startup times

Revision Plain With Sentry Diff
d275a00 324.20 ms 365.00 ms 40.80 ms
153b5b6 313.94 ms 338.40 ms 24.46 ms
bedf4d5 322.10 ms 354.88 ms 32.78 ms
ff7fb9a 371.71 ms 438.24 ms 66.54 ms
7cdcb7c 305.67 ms 356.33 ms 50.65 ms

App size

Revision Plain With Sentry Diff
d275a00 1.58 MiB 2.29 MiB 722.91 KiB
153b5b6 0 B 0 B 0 B
bedf4d5 1.58 MiB 2.29 MiB 719.90 KiB
ff7fb9a 0 B 0 B 0 B
7cdcb7c 0 B 0 B 0 B

Base automatically changed from feat/log-attribute-array-support to feat/global-attributes-api March 3, 2026 16:57
@adinauer adinauer marked this pull request as ready for review March 4, 2026 05:19
Base automatically changed from feat/global-attributes-api to main March 4, 2026 08:56
adinauer and others added 3 commits March 4, 2026 15:10
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sentry
Copy link

sentry bot commented Mar 9, 2026

Sentry Build Distribution

App Version Configuration
SDK Size 8.34.1 (1) release

@sentry
Copy link

sentry bot commented Mar 10, 2026

Sentry Build Distribution

App Version Configuration
SDK Size 8.34.1 (1) release

@adinauer adinauer enabled auto-merge (squash) March 10, 2026 10:18
@adinauer adinauer merged commit ee611d9 into main Mar 10, 2026
63 of 65 checks passed
@adinauer adinauer deleted the feat/samples-scope-attributes branch March 10, 2026 10:22
@sentry
Copy link

sentry bot commented Mar 10, 2026

Sentry Build Distribution

App Version Configuration
SDK Size 8.34.1 (1) release

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.

3 participants

X Tutup