Skip to content

feat(samples): Showcase scope attributes in all sample modules#5147

Closed
adinauer wants to merge 15 commits intomainfrom
feat/log-attribute-array-support
Closed

feat(samples): Showcase scope attributes in all sample modules#5147
adinauer wants to merge 15 commits intomainfrom
feat/log-attribute-array-support

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

adinauer and others added 15 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>
@adinauer adinauer force-pushed the feat/log-attribute-array-support branch from 9da8135 to 8e61d4d Compare March 3, 2026 14:25
@adinauer adinauer closed this Mar 3, 2026
@adinauer adinauer deleted the feat/log-attribute-array-support branch March 3, 2026 16:57
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