You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 16b4e67
Browse filesBrowse the repository at this point in the historyBrowse files
Each namespaced options class is a `public static final class` inside `SentryOptions` with its own fields, getters/setters, and callbacks (e.g. `BeforeSendLogCallback`, `BeforeSendMetricCallback`).
18
+
Each namespaced options class is a `public static final class` inside `SentryOptions` with its own fields, getters/setters, factories, and callbacks (e.g. `BeforeSendLogCallback`, `BeforeSendMetricCallback`).
16
19
17
-
A typical namespaced options class contains:
18
-
- `enabled` boolean (default `false` for opt-in)
19
-
- `sampleRate` double (if the feature supports sampling)
20
-
- `beforeSend` callback interface (nested inside the options class)
20
+
Do not assume that a namespaced signal needs an aggregate `enabled` field. In particular, Logs and
21
+
Metrics are available through deliberate API calls whenever the SDK is enabled. Their namespaced
22
+
options contain signal-specific behavior such as `beforeSend`, limits, and processor factories. Add
23
+
options such as sampling only when the signal supports them. Automatic capture integrations use
24
+
source-local enable options that default to `false`.
21
25
22
26
To add a new namespaced options class:
23
27
1. Create the `public static final class` inside `SentryOptions` with fields, getters/setters, and any callback interfaces
@@ -47,21 +51,18 @@ The core options class. Add the field (or nested class) with getter/setter here.
47
51
Allows setting options via `sentry.properties` file or system properties. Fields use nullable wrapper types (`@Nullable Boolean`, `@Nullable Double`) since unset means "don't override the default."
`SentryProperties` extends `SentryOptions`, so namespaced options (nested classes) are automatically available as Spring Boot properties without extra code. For example, `SentryOptions.Logs` is automatically mapped to `sentry.logs.enabled` in `application.properties`.
90
+
`SentryProperties` extends `SentryOptions`, so bindable namespaced behavior options are available
91
+
through the `SentryOptions` class hierarchy. Spring-owned integration controls belong to a Spring
92
+
namespace instead. For example, `SentryProperties.Logging.enableLogs` binds to
93
+
`sentry.logging.enable-logs` and controls Logs forwarding from the auto-configured Logback
94
+
appender. `sentry.logging.enabled` separately controls whether that appender is installed.
87
95
88
-
No additional code is needed for namespaced options — Spring Boot auto-configuration handles this via property binding on the `SentryOptions` class hierarchy.
96
+
Do not add or restore `sentry.logs.enabled` or `sentry.metrics.enabled`; those aggregate properties
- Add the property (e.g. `"sentry.logs.enabled=true"`) to the existing `resolves all properties` test
100
+
- Add the new property to the existing binding test
92
101
- Assert the value is set on the resolved `SentryProperties` bean
102
+
- Test default, explicit `true`, explicit `false`, and propagation into the owning integration
93
103
- There are three Spring Boot modules with separate test files: `sentry-spring-boot`, `sentry-spring-boot-jakarta`, `sentry-spring-boot-4`
94
104
95
105
### 5. Reading Options at Runtime
96
106
97
-
Features check their options at usage time. For namespaced features the check typically happens in the feature's API class (e.g. `LoggerApi`, `MetricsApi`):
98
-
- Check `options.getLogs().isEnabled()` early and return if disabled
99
-
- Apply sampling via `options.getLogs().getSampleRate()` if applicable
100
-
- Apply `beforeSend` callback in `SentryClient` before sending
107
+
Deliberate APIs such as `LoggerApi` and `MetricsApi` do not check aggregate signal enable flags.
108
+
They capture whenever their scopes are enabled, then apply signal behavior such as sampling and
109
+
`beforeSend`.
110
+
111
+
Automatic integrations must check their source-local opt-in without affecting their existing event
112
+
or breadcrumb paths. Current Logs controls are:
113
+
- Logback: appender `enableLogs`
114
+
- Log4j2: appender `enableLogs`
115
+
- JUL: handler `enableLogs`
116
+
- Spring Boot Logback: `sentry.logging.enable-logs`
0 commit comments