Skip to content

Releases: getsentry/sentry-java

8.0.0

21 Jan 13:00
Compare
Choose a tag to compare

Version 8 of the Sentry Android/Java SDK brings a variety of features and fixes. The most notable changes are:

  • Hub has been replaced by Scopes
  • New Scope types have been introduced, see "Behavioural Changes" for more details.
  • Lifecycle tokens have been introduced to manage Scope lifecycle, see "Behavioural Changes" for more details.
  • Bumping minSdk level to 21 (Android 5.0)
  • Our sentry-opentelemetry-agent has been improved and now works in combination with the rest of Sentry. You may now mix and match OpenTelemetry and Sentry API for instrumenting your application.
  • The SDK is now compatible with Spring Boot 3.4
  • We now support GraphQL v22 (sentry-graphql-22)
  • Metrics have been removed

Please take a look at our migration guide in docs.

Sentry Self-hosted Compatibility

This SDK version is compatible with a self-hosted version of Sentry 22.12.0 or higher. If you are using an older version of self-hosted Sentry (aka onpremise), you will need to upgrade. If you're using sentry.io no action is required.

Breaking Changes

  • The Android minSdk level for all Android modules is now 21 (#3852)
  • The minSdk level for sentry-android-ndk changed from 19 to 21 (#3851)
  • Throw IllegalArgumentException when calling Sentry.init on Android (#3596)
  • Metrics have been removed from the SDK (#3774)
    • Metrics will return but we don't know in what exact form yet
  • enableTracing option (a.k.a enable-tracing) has been removed from the SDK (#3776)
    • Please set tracesSampleRate to a value >= 0.0 for enabling performance instead. The default value is null which means performance is disabled.
  • Replace synchronized methods and blocks with ReentrantLock (AutoClosableReentrantLock) (#3715)
    • If you are subclassing any Sentry classes, please check if the parent class used synchronized before. Please make sure to use the same lock object as the parent class in that case.
  • traceOrigins option (io.sentry.traces.tracing-origins in manifest) has been removed, please use tracePropagationTargets (io.sentry.traces.trace-propagation-targets in manifest`) instead (#3780)
  • profilingEnabled option (io.sentry.traces.profiling.enable in manifest) has been removed, please use profilesSampleRate (io.sentry.traces.profiling.sample-rate instead) instead (#3780)
  • shutdownTimeout option has been removed, please use shutdownTimeoutMillis instead (#3780)
  • profilingTracesIntervalMillis option for Android has been removed (#3780)
  • io.sentry.session-tracking.enable manifest option has been removed (#3780)
  • Sentry.traceHeaders() method has been removed, please use Sentry.getTraceparent() instead (#3718)
  • Sentry.reportFullDisplayed() method has been removed, please use Sentry.reportFullyDisplayed() instead (#3717)
  • User.other has been removed, please use data instead (#3780)
  • SdkVersion.getIntegrations() has been removed, please use getIntegrationSet instead (#3780)
  • SdkVersion.getPackages() has been removed, please use getPackageSet() instead (#3780)
  • Device.language has been removed, please use locale instead (#3780)
  • TraceContext.user and TraceContextUser class have been removed, please use userId on TraceContext instead (#3780)
  • TransactionContext.fromSentryTrace() has been removed, please use Sentry.continueTrace() instead (#3780)
  • SentryDataFetcherExceptionHandler has been removed, please use SentryGenericDataFetcherExceptionHandler in combination with SentryInstrumentation instead (#3780)
  • sentry-android-okhttp has been removed in favor of sentry-okhttp, removing android dependency from the module (#3510)
  • Contexts no longer extends ConcurrentHashMap, instead we offer a selected set of methods.
  • User segment has been removed (#3512)
  • One of the AndroidTransactionProfiler constructors has been removed, please use a different one (#3780)
  • Use String instead of UUID for SessionId (#3834)
    • The Session constructor now takes a String instead of a UUID for the sessionId parameter.
    • Session.getSessionId() now returns a String instead of a UUID.
  • All status codes below 400 are now mapped to SpanStatus.OK (#3869)
  • Change OkHttp sub-spans to span attributes (#3556)
    • This will reduce the number of spans created by the SDK
  • instrumenter option should no longer be needed as our new OpenTelemetry integration now works in combination with the rest of Sentry

Behavioural Changes

  • We're introducing some new Scope types 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. Since Hub is 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.init has been called. It can be manipulated using Sentry.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 @Async and 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. It can be manipulated using Sentry.configureScope(ScopeType.CURRENT, (scope) -> { ... }).
  • Sentry.popScope has been deprecated, please call .close() on the token returned by Sentry.pushScope instead or use it in a way described in more detail in our migration guide.
  • We have chosen a default scope that is used for Sentry.configureScope() as well as API like Sentry.setTag()
    • For Android the type defaults to CURRENT scope
    • For Backend and other JVM applicatons it defaults to ISOLATION scope
  • Event processors on Scope can now be ordered by overriding the getOrder method on implementations of EventProcessor. NOTE: This order only applies to event processors on Scope but not SentryOptions at the moment. Feel free to request this if you need it.
  • Hub is deprecated in favor of Scopes, alongside some Hub relevant APIs. More details can be found in our migration guide.
  • Send file name and path only if isSendDefaultPii is true (#3919)
  • (Android) Enable Performance V2 by default (#3824)
    • With this change cold app start spans will include spans for ContentProviders, Application and Activity load.
  • (Android) Replace thread id with kernel thread id in span data (#3706)
  • (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-android example on how to configure CMake and consume sentry.h
  • The user ip-address is now only set to "{{auto}}" if sendDefaultPii is enabled (#4072)
    • This change gives you control over IP address collection directly on the client

Features

  • The SDK is now compatible with Spring Boot 3.4 (#3939)
  • Our sentry-opentelemetry-agent has 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 supp...
Read more

7.21.0-beta.1

20 Jan 16:19
Compare
Choose a tag to compare
7.21.0-beta.1 Pre-release
Pre-release

Fixes

  • Do not instrument File I/O operations if tracing is disabled (#4051)
  • Do not instrument User Interaction multiple times (#4051)
  • Speed up view traversal to find touched target in UserInteractionIntegration (#4051)
  • Reduce IPC/Binder calls performed by the SDK (#4058)

Behavioural Changes

  • Reduce the number of broadcasts the SDK is subscribed for (#4052)
    • Drop TempSensorBreadcrumbsIntegration
    • Drop PhoneStateBreadcrumbsIntegration
    • Reduce number of broadcasts in SystemEventsBreadcrumbsIntegration

Current list of the broadcast events can be found here. If you'd like to subscribe for more events, consider overriding the SystemEventsBreadcrumbsIntegration as follows:

SentryAndroid.init(context) { options ->
    options.integrations.removeAll { it is SystemEventsBreadcrumbsIntegration }
    options.integrations.add(SystemEventsBreadcrumbsIntegration(context, SystemEventsBreadcrumbsIntegration.getDefaultActions() + listOf(/* your custom actions */)))
}

If you would like to keep some of the default broadcast events as breadcrumbs, consider opening a GitHub issue.

7.20.1

20 Jan 15:47
Compare
Choose a tag to compare

Behavioural Changes

  • The user ip-address is now only set to "{{auto}}" if sendDefaultPii is enabled (#4071)
    • This change gives you control over IP address collection directly on the client

8.0.0-rc.4

09 Jan 16:22
Compare
Choose a tag to compare
8.0.0-rc.4 Pre-release
Pre-release

Features

  • Enable ThreadLocalAccessor for Spring Boot 3 WebFlux by default (#4023)

Internal

  • Warm starts cleanup (#3954)

Dependencies

7.20.0

02 Jan 19:35
Compare
Choose a tag to compare

Features

  • Session Replay GA (#4017)

To enable Replay use the sessionReplay.sessionSampleRate or sessionReplay.onErrorSampleRate options.

import io.sentry.SentryReplayOptions
import io.sentry.android.core.SentryAndroid

SentryAndroid.init(context) { options ->
 
  options.sessionReplay.sessionSampleRate = 1.0
  options.sessionReplay.onErrorSampleRate = 1.0

  // To change default redaction behavior (defaults to true)
  options.sessionReplay.redactAllImages = true
  options.sessionReplay.redactAllText = true

  // To change quality of the recording (defaults to MEDIUM)
  options.sessionReplay.quality = SentryReplayOptions.SentryReplayQuality.MEDIUM // (LOW|MEDIUM|HIGH)
}

To learn more about Session Replay, visit the documentation page: https://docs.sentry.io/platforms/android/session-replay/

Fixes

  • Fix warm start detection (#3937)
  • Session Replay: Reduce memory allocations, disk space consumption, and payload size (#4016)
  • Session Replay: Do not try to encode corrupted frames multiple times (#4016)

Internal

  • Session Replay: Allow overriding SdkVersion for replay events (#4014)
  • Session Replay: Send replay options as tags (#4015)

Breaking changes

  • Session Replay options were moved from under experimental to the main options object (#4017)

7.19.1

23 Dec 13:10
Compare
Choose a tag to compare

Fixes

  • Change TTFD timeout to 25 seconds (#3984)
  • Session Replay: Fix memory leak when masking Compose screens (#3985)
  • Session Replay: Fix potential ANRs in GestureRecorder (#4001)

Internal

  • Session Replay: Flutter improvements (#4007)

8.0.0-rc.3

20 Dec 14:35
Compare
Choose a tag to compare
8.0.0-rc.3 Pre-release
Pre-release

Features

  • Add sentry-opentelemetry-agentless-spring module (#4000)
    • This module can be added as a dependency when using Sentry with OpenTelemetry and Spring Boot but don't want to use our Agent. It takes care of configuring OpenTelemetry for use with Sentry.
    • You may want to set OTEL_LOGS_EXPORTER=none;OTEL_METRICS_EXPORTER=none;OTEL_TRACES_EXPORTER=none env vars to not have the log flooded with error messages regarding OpenTelemetry features we don't use.
  • Add sentry-opentelemetry-agentless module (#3961)
    • This module can be added as a dependency when using Sentry with OpenTelemetry but don't want to use our Agent. It takes care of configuring OpenTelemetry for use with Sentry.
    • To enable the auto configuration of it, please set -Dotel.java.global-autoconfigure.enabled=true on the java command, when starting your application.
    • You may also want to set OTEL_LOGS_EXPORTER=none;OTEL_METRICS_EXPORTER=none;OTEL_TRACES_EXPORTER=none env vars to not have the log flooded with error messages regarding OpenTelemetry features we don't use.
  • OpenTelemetryUtil.applyOpenTelemetryOptions now takes an enum instead of a boolean for its mode
  • Add openTelemetryMode option (#3994)
    • It defaults to AUTO meaning the SDK will figure out how to best configure itself for use with OpenTelemetry
    • Use of OpenTelemetry can also be disabled completely by setting it to OFF (#3995)
      • In this case even if OpenTelemetry is present, the Sentry SDK will not use it
    • Use AGENT when using sentry-opentelemetry-agent
    • Use AGENTLESS when using sentry-opentelemetry-agentless
    • Use AGENTLESS_SPRING when using sentry-opentelemetry-agentless-spring
  • Add scopeBindingMode to SpanOptions (#4004)
    • This setting only affects the SDK when used with OpenTelemetry.
    • Defaults to AUTO meaning the SDK will decide whether the span should be bound to the current scope. It will not bind transactions to scope using AUTO, it will only bind spans where the parent span is on the current scope.
    • ON sets the new span on the current scope.
    • OFF does not set the new span on the scope.

Fixes

  • Replace deprecated SimpleInstrumentation with SimplePerformantInstrumentation for graphql 22 (#3974)
  • Cache requests for Spring using Springs ContentCachingRequestWrapper instead of our own Wrapper to also cache parameters (#3641)
    • Previously only the body was cached which could lead to problems in the FilterChain as Request parameters were not available
  • We now hold a strong reference to the underlying OpenTelemetry span when it is created through Sentry API (#3997)
    • This keeps it from being garbage collected too early
  • Close backpressure monitor on SDK shutdown (#3998)
    • Due to the backpressure monitor rescheduling a task to run every 10s, it very likely caused shutdown to wait the full shutdownTimeoutMillis (defaulting to 2s) instead of being able to terminate immediately
  • Improve ignored check performance (#3992)
    • Checking if a span origin, a transaction or a checkIn should be ignored is now faster

7.19.0

12 Dec 10:01
Compare
Choose a tag to compare

Fixes

  • Session Replay: fix various crashes and issues (#3970)
    • Fix IndexOutOfBoundsException when tracking window changes
    • Fix IllegalStateException when adding/removing draw listener for a dead view
    • Fix ConcurrentModificationException when registering window listeners and stopping WindowRecorder/GestureRecorder
  • Add support for setting sentry-native handler_strategy (#3671)

Dependencies

8.0.0-rc.2

05 Dec 10:28
Compare
Choose a tag to compare
8.0.0-rc.2 Pre-release
Pre-release

Fixes

  • Fix incoming defer sampling decision sentry-trace header (#3942)
    • A sentry-trace header that only contains trace ID and span ID but no sampled flag (-1, -0 suffix) means the receiving system can make its own sampling decision
    • When generating sentry-trace header from PropagationContext we now copy the sampled flag.
    • In TransactionContext.fromPropagationContext when there is no parent sampling decision, keep the decision null so a new sampling decision is made instead of defaulting to false
  • Defer sampling decision by setting sampled to null in PropagationContext when using OpenTelemetry in case of an incoming defer sampling sentry-trace header. (#3945)
  • Build PropagationContext from SamplingDecision made by SentrySampler instead of parsing headers and potentially ignoring a sampling decision in case a sentry-trace header comes in with deferred sampling decision. (#3947)
  • Let OpenTelemetry handle extracting and injecting tracing information (#3953)
    • Our integrations no longer call .continueTrace and also do not inject tracing headers if the integration has been added to ignoredSpanOrigins
  • Changes up to 7.18.1 have been merged and are now included as well

8.0.0-rc.1

29 Nov 12:55
Compare
Choose a tag to compare
8.0.0-rc.1 Pre-release
Pre-release

Features

  • Extract OpenTelemetry URL_PATH span attribute into description (#3933)
  • Replace OpenTelemetry ContextStorage wrapper with ContextStorageProvider (#3938)
    • The wrapper had to be put in place before any call to Context whereas ContextStorageProvider is automatically invoked at the correct time.

Dependencies

  • Bump OpenTelemetry to 1.44.1, OpenTelemetry Java Agent to 2.10.0 and Semantic Conventions to 1.28.0 (#3935)