Releases: getsentry/sentry-java
7.12.0-alpha.4
8.0.0-alpha.4
Fixes
- Removed user segment (#3512)
- Use span id of remote parent (#3548)
- Traces were broken because on an incoming request, OtelSentrySpanProcessor did not set the parentSpanId on the span correctly. Traces were not referencing the actual parent span but some other (random) span ID which the server doesn't know.
- Attach active span to scope when using OpenTelemetry (#3549)
- Errors weren't linked to traces correctly due to parts of the SDK not knowing the current span
- Record dropped spans in client report when sampling out OpenTelemetry spans (#3552)
- Retrieve the correct current span from
Scope/Scopeswhen using OpenTelemetry (#3554)
8.0.0-alpha.3
Breaking Changes
sentry-android-okhttphas been removed in favor ofsentry-okhttp, removing android dependency from the module (#3510)
Fixes
- Support spans that are split into multiple batches (#3539)
- When spans belonging to a single transaction were split into multiple batches for SpanExporter, we did not add all spans because the isSpanTooOld check wasn't inverted.
- Parse and use
send-default-piiandmax-request-body-sizefromsentry.properties(#3534) span.startChildnow uses.makeCurrent()by default (#3544)- This caused an issue where the span tree wasn't correct because some spans were not added to their direct parent
- Partially fix bootstrap class loading (#3543)
- There was a problem with two separate Sentry
Scopesbeing active inside each OpenTelemetryContextdue to using context keys from more than one class loader.
- There was a problem with two separate Sentry
7.12.0-alpha.3
7.11.0
Features
- Report dropped spans (#3528)
Fixes
- Fix duplicate session start for React Native (#3504)
- Move onFinishCallback before span or transaction is finished (#3459)
- Add timestamp when a profile starts (#3442)
- Move fragment auto span finish to onFragmentStarted (#3424)
- Remove profiling timeout logic and disable profiling on API 21 (#3478)
- Properly reset metric flush flag on metric emission (#3493)
- Use SecureRandom in favor of Random for Metrics (#3495)
- Fix UncaughtExceptionHandlerIntegration Memory Leak (#3398)
- Deprecated
User.segment. Use a custom tag or context instead. (#3511) - Fix duplicated http spans (#3526)
- When capturing unhandled hybrid exception session should be ended and new start if need (#3480)
Dependencies
8.0.0-alpha.2
Behavioural Changes
- (Android) The JNI layer for sentry-native has now been moved from sentry-java to sentry-native (#3189)
- This now includes prefab support for sentry-native, allowing you to link and access the sentry-native API within your native app code
- Checkout the
sentry-samples/sentry-samples-androidexample on how to configure CMake and consumesentry.h
Features
- Our
sentry-opentelemetry-agenthas been completely reworked and now plays nicely with the rest of the Java SDK- You may also want to give this new agent a try even if you haven't used OpenTelemetry (with Sentry) before. It offers support for many more libraries and frameworks, improving on our trace propagation,
Scopes(used to beHub) propagation as well as performance instrumentation (i.e. more spans). - If you are using a framework we did not support before and currently resort to manual instrumentation, please give the agent a try. See here for a list of supported libraries, frameworks and application servers.
- NOTE: Not all features have been implemented yet for the OpenTelemetry agent. Features of note that are not working yet:
- Metrics
- Measurements
forceFinishon transactionscheduleFinishon transaction- see #3436 for a more up-to-date list of features we have (not) implemented
- Please see "Installing
sentry-opentelemetry-agent" for more details on how to set up the agent. - What's new about the Agent
- When the OpenTelemetry Agent is used, Sentry API creates OpenTelemetry spans under the hood, handing back a wrapper object which bridges the gap between traditional Sentry API and OpenTelemetry. We might be replacing some of the Sentry performance API in the future.
- This is achieved by configuring the SDK to use
OtelSpanFactoryinstead ofDefaultSpanFactorywhich is done automatically by the auto init of the Java Agent.
- This is achieved by configuring the SDK to use
- OpenTelemetry spans are now only turned into Sentry spans when they are finished so they can be sent to the Sentry server.
- Now registers an OpenTelemetry
Samplerwhich uses Sentry sampling configuration - Other Performance integrations automatically stop creating spans to avoid duplicate spans
- The Sentry SDK now makes use of OpenTelemetry
Contextfor storing SentryScopes(which is similar to what used to be calledHub) and thus relies on OpenTelemetry forContextpropagation. - Classes used for the previous version of our OpenTelemetry support have been deprecated but can still be used manually. We're not planning to keep the old agent around in favor of less complexity in the SDK.
- When the OpenTelemetry Agent is used, Sentry API creates OpenTelemetry spans under the hood, handing back a wrapper object which bridges the gap between traditional Sentry API and OpenTelemetry. We might be replacing some of the Sentry performance API in the future.
- You may also want to give this new agent a try even if you haven't used OpenTelemetry (with Sentry) before. It offers support for many more libraries and frameworks, improving on our trace propagation,
- Add
ignoredSpanOriginsoption for ignoring spans coming from certain integrations- We pre-configure this to ignore Performance instrumentation for Spring and other integrations when using our OpenTelemetry Agent to avoid duplicate spans
- Add data fetching environment hint to breadcrumb for GraphQL (#3413) (#3431)
Fixes
TracesSampleris now only created once inSentryOptionsinstead of creating a new one for everyHub(which is nowScopes). This means we're now creating fewerSecureRandominstances.- Move onFinishCallback before span or transaction is finished (#3459)
- Add timestamp when a profile starts (#3442)
- Move fragment auto span finish to onFragmentStarted (#3424)
- Remove profiling timeout logic and disable profiling on API 21 (#3478)
- Properly reset metric flush flag on metric emission (#3493)
Migration Guide / Deprecations
- Classes used for the previous version of the Sentry OpenTelemetry Java Agent have been deprecated (
SentrySpanProcessor,SentryPropagator,OpenTelemetryLinkErrorEventProcessor) - Sentry OpenTelemetry Java Agent has been reworked and now allows you to manually create spans using Sentry API as well.
- Please see "Installing
sentry-opentelemetry-agent" for more details on how to set up the agent.
Installing sentry-opentelemetry-agent
Upgrading from a previous agent
If you've been using the previous version of sentry-opentelemetry-agent, simply replace the agent JAR with the latest release and start your application. That should be it.
New to the agent
If you've not been using OpenTelemetry before, you can add sentry-opentelemetry-agent to your setup by downloading the latest release and using it when starting up your application
- SENTRY_PROPERTIES_FILE=sentry.properties java -javaagent:sentry-opentelemetry-agent-x.x.x.jar -jar your-application.jar
- Please use sentry.properties or environment variables to configure the SDK as the agent is now in charge of initializing the SDK and options coming from things like logging integrations or our Spring Boot integration will not take effect.
- You may find the docs page useful. While we haven't updated it yet to reflect the changes described here, the section about using the agent with auto init should still be valid.
If you want to skip auto initialization of the SDK performed by the agent, please follow the steps above and set the environment variable SENTRY_AUTO_INIT to false then add the following to your Sentry.init:
Sentry.init(options -> {
options.setDsn("https://[email protected]/1801383");
OpenTelemetryUtil.applyOpenTelemetryOptions(options);
...
});
If you're using our Spring (Boot) integration with auto init, use the following:
@Bean
Sentry.OptionsConfiguration<SentryOptions> optionsConfiguration() {
return (options) -> {
OpenTelemetryUtil.applyOpenTelemetryOptions(options);
};
}
Dependencies
7.11.0-alpha.2
- Session Replay for Android (#3339)
We released our third Alpha version of the SDK with support. To get access, it requires adding your Sentry org to our feature flag. Please let us know on the waitlist if you're interested
Fixes
- Move onFinishCallback before span or transaction is finished (#3459)
- Add timestamp when a profile starts (#3442)
- Move fragment auto span finish to onFragmentStarted (#3424)
- Remove profiling timeout logic and disable profiling on API 21 (#3478)
- Properly reset metric flush flag on metric emission (#3493)
7.10.0
8.0.0-alpha.1
Version 8 of the Sentry Android/Java SDK brings a variety of features and fixes. The most notable changes are:
- New
Scopetypes have been introduced, see "Behavioural Changes" for more details. - Lifecycle tokens have been introduced to manage
Scopelifecycle, see "Behavioural Changes" for more details. Hubhas been replaced byScopes
Behavioural Changes
- We're introducing some new
Scopetypes in the SDK, allowing for better control over what data is attached where. Previously there was a stack of scopes that was pushed and popped. Instead we now fork scopes for a given lifecycle and then restore the previous scopes. SinceHubis gone, it is also never cloned anymore. Separation of data now happens through the different scope types while making it easier to manipulate exactly what you need without having to attach data at the right time to have it apply where wanted.- Global scope is attached to all events created by the SDK. It can also be modified before
Sentry.inithas been called. It can be manipulated usingSentry.configureScope(ScopeType.GLOBAL, (scope) -> { ... }). - Isolation scope can be used e.g. to attach data to all events that come up while handling an incoming request. It can also be used for other isolation purposes. It can be manipulated using
Sentry.configureScope(ScopeType.ISOLATION, (scope) -> { ... }). The SDK automatically forks isolation scope in certain cases like incoming requests, CRON jobs, Spring@Asyncand more. - Current scope is forked often and data added to it is only added to events that are created while this scope is active. Data is also passed on to newly forked child scopes but not to parents.
- Global scope is attached to all events created by the SDK. It can also be modified before
Sentry.popScopehas been deprecated, please call.close()on the token returned bySentry.pushScopeinstead or use it in a way described in more detail in "Migration Guide".- We have chosen a default scope that is used for
Sentry.configureScope()as well as API likeSentry.setTag()- For Android the type defaults to
CURRENTscope - For Backend and other JVM applicatons it defaults to
ISOLATIONscope
- For Android the type defaults to
- Event processors on
Scopecan now be ordered by overriding thegetOrdermethod on implementations ofEventProcessor. NOTE: This order only applies to event processors onScopebut notSentryOptionsat the moment. Feel free to request this if you need it. Hubis deprecated in favor ofScopes, alongside someHubrelevant APIs. More details can be found in the "Migration Guide" section.
Breaking Changes
Contextsno longer extendsConcurrentHashMap, instead we offer a selected set of methods.
Migration Guide / Deprecations
Hubhas been deprecated, we're replacing the following:IHubhas been replaced byIScopes, however you should be able to simply passIHubinstances to code expectingIScopes, allowing for an easier migration.HubAdapter.getInstance()has been replaced byScopesAdapter.getInstance()- The
.clone()method onIHub/IScopeshas been deprecated, please use.pushScope()or.pushIsolationScope()instead - Some internal methods like
.getCurrentHub()and.setCurrentHub()have also been replaced.
Sentry.popScopehas been replaced by calling.close()on the token returned bySentry.pushScope()andSentry.pushIsolationScope(). The token can also be used in atryblock like this:
try (final @NotNull ISentryLifecycleToken ignored = Sentry.pushScope()) {
// this block has its separate current scope
}
as well as:
try (final @NotNull ISentryLifecycleToken ignored = Sentry.pushIsolationScope()) {
// this block has its separate isolation scope
}
You may also use LifecycleHelper.close(token), e.g. in case you need to pass the token around for closing later.