diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 68a8f191bdb..9df2bdca323 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -46,7 +46,7 @@ agp = "9.5.1" sqlite = "2.6.2" sqliteRc = "2.8.0-alpha03" # Required by Room3 3.0.0-rc* slf4j = "1.7.30" -spotless = "8.8.0" +spotless = "8.11.0" springboot2 = "2.7.18" springboot3 = "3.5.0" springboot4 = "4.1.0" diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ActivityFramesTracker.java b/sentry-android-core/src/main/java/io/sentry/android/core/ActivityFramesTracker.java index 8aa737f7192..871021b4745 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ActivityFramesTracker.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ActivityFramesTracker.java @@ -231,16 +231,15 @@ private void runSafelyOnUiThread(final Runnable runnable, final String tag) { if (AndroidThreadChecker.getInstance().isMainThread()) { runnable.run(); } else { - handler.post( - () -> { - try { - runnable.run(); - } catch (Throwable ignored) { - if (tag != null) { - options.getLogger().log(SentryLevel.WARNING, "Failed to execute " + tag); - } - } - }); + handler.post(() -> { + try { + runnable.run(); + } catch (Throwable ignored) { + if (tag != null) { + options.getLogger().log(SentryLevel.WARNING, "Failed to execute " + tag); + } + } + }); } } catch (Throwable ignored) { if (tag != null) { diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java index 0c3b7d8d5ff..6d4a74429eb 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java @@ -228,23 +228,21 @@ private void startTracing(final @NotNull Activity activity) { transactionOptions.setTrimEnd(true); } transactionOptions.setWaitForChildren(true); - transactionOptions.setTransactionFinishedCallback( - (finishingTransaction) -> { - @Nullable Activity unwrappedActivity = weakActivity.get(); - if (unwrappedActivity != null) { - activityFramesTracker.setMetrics( - unwrappedActivity, finishingTransaction.getEventId()); - } else { - if (options != null) { - options - .getLogger() - .log( - SentryLevel.WARNING, - "Unable to track activity frames as the Activity %s has been destroyed.", - activityName); - } - } - }); + transactionOptions.setTransactionFinishedCallback(finishingTransaction -> { + @Nullable Activity unwrappedActivity = weakActivity.get(); + if (unwrappedActivity != null) { + activityFramesTracker.setMetrics(unwrappedActivity, finishingTransaction.getEventId()); + } else { + if (options != null) { + options + .getLogger() + .log( + SentryLevel.WARNING, + "Unable to track activity frames as the Activity %s has been destroyed.", + activityName); + } + } + }); // This will be the start timestamp of the transaction, as well as the ttid/ttfd spans final @NotNull SentryDate ttidStartTime; @@ -407,10 +405,9 @@ private void startTracing(final @NotNull Activity activity) { } // lets bind to the scope so other integrations can pick it up - scopes.configureScope( - scope -> { - applyScope(scope, transaction); - }); + scopes.configureScope(scope -> { + applyScope(scope, transaction); + }); activitiesWithOngoingTransactions.put(activity, transaction); } @@ -478,32 +475,30 @@ private boolean isWithinAppStartContinuationWindow(final @NotNull SentryDate uiL @VisibleForTesting void applyScope(final @NotNull IScope scope, final @NotNull ITransaction transaction) { - scope.withTransaction( - scopeTransaction -> { - // we'd not like to overwrite existent transactions bound to the Scope - // manually. - if (scopeTransaction == null) { - scope.setTransaction(transaction); - } else if (options != null) { - options - .getLogger() - .log( - SentryLevel.DEBUG, - "Transaction '%s' won't be bound to the Scope since there's one already in there.", - transaction.getName()); - } - }); + scope.withTransaction(scopeTransaction -> { + // we'd not like to overwrite existent transactions bound to the Scope + // manually. + if (scopeTransaction == null) { + scope.setTransaction(transaction); + } else if (options != null) { + options + .getLogger() + .log( + SentryLevel.DEBUG, + "Transaction '%s' won't be bound to the Scope since there's one already in there.", + transaction.getName()); + } + }); } @VisibleForTesting @SuppressWarnings("ReferenceEquality") void clearScope(final @NotNull IScope scope, final @NotNull ITransaction transaction) { - scope.withTransaction( - scopeTransaction -> { - if (scopeTransaction == transaction) { - scope.clearTransaction(); - } - }); + scope.withTransaction(scopeTransaction -> { + if (scopeTransaction == transaction) { + scope.clearTransaction(); + } + }); } private boolean isRunningTransactionOrTrace(final @NotNull Activity activity) { @@ -542,10 +537,9 @@ private void finishTransaction( if (scopes != null) { // make sure to remove the transaction from scope, as it may contain running children, // therefore `finish` method will not remove it from scope - scopes.configureScope( - scope -> { - clearScope(scope, transaction); - }); + scopes.configureScope(scope -> { + clearScope(scope, transaction); + }); } } } @@ -1066,10 +1060,8 @@ private void onHeadlessAppStart() { // Persist the end time (covering every finish path: user finish, first frame, deadline) so a // later ui.load can tell whether it is close enough to continue this trace; without it the // continuation window is unbounded. - txnOptions.setTransactionFinishedCallback( - finishedTransaction -> - AppStartMetrics.getInstance() - .setAppStartEndTime(finishedTransaction.getFinishDate())); + txnOptions.setTransactionFinishedCallback(finishedTransaction -> + AppStartMetrics.getInstance().setAppStartEndTime(finishedTransaction.getFinishDate())); } final @NotNull TransactionContext txnContext = diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/AndroidContinuousProfiler.java b/sentry-android-core/src/main/java/io/sentry/android/core/AndroidContinuousProfiler.java index cb54723d8e1..622f74ca55a 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/AndroidContinuousProfiler.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/AndroidContinuousProfiler.java @@ -379,23 +379,22 @@ private void sendChunks(final @NotNull IScopes scopes, final @NotNull SentryOpti try { options .getExecutorService() - .submit( - () -> { - // SDK is closed, we don't send the chunks - if (isClosed.get()) { - return; - } - final ArrayList payloads = new ArrayList<>(payloadBuilders.size()); - try (final @NotNull ISentryLifecycleToken ignored = payloadLock.acquire()) { - for (ProfileChunk.Builder builder : payloadBuilders) { - payloads.add(builder.build(options)); - } - payloadBuilders.clear(); - } - for (ProfileChunk payload : payloads) { - scopes.captureProfileChunk(payload); - } - }); + .submit(() -> { + // SDK is closed, we don't send the chunks + if (isClosed.get()) { + return; + } + final ArrayList payloads = new ArrayList<>(payloadBuilders.size()); + try (final @NotNull ISentryLifecycleToken ignored = payloadLock.acquire()) { + for (ProfileChunk.Builder builder : payloadBuilders) { + payloads.add(builder.build(options)); + } + payloadBuilders.clear(); + } + for (ProfileChunk payload : payloads) { + scopes.captureProfileChunk(payload); + } + }); } catch (Throwable e) { options.getLogger().log(SentryLevel.DEBUG, "Failed to send profile chunks.", e); } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/AnrIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/AnrIntegration.java index eb5a27c4a5e..a1b3abd3906 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/AnrIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/AnrIntegration.java @@ -67,14 +67,13 @@ private void register( try { options .getExecutorService() - .submit( - () -> { - try (final @NotNull ISentryLifecycleToken ignored = startLock.acquire()) { - if (!isClosed) { - startAnrWatchdog(scopes, options); - } - } - }); + .submit(() -> { + try (final @NotNull ISentryLifecycleToken ignored = startLock.acquire()) { + if (!isClosed) { + startAnrWatchdog(scopes, options); + } + } + }); } catch (Throwable e) { options .getLogger() diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ContextUtils.java b/sentry-android-core/src/main/java/io/sentry/android/core/ContextUtils.java index b71c3628c6e..3ee5d6d9f00 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ContextUtils.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ContextUtils.java @@ -98,45 +98,42 @@ private ContextUtils() {} */ @SuppressLint("NewApi") private static final @NotNull AndroidLazyEvaluator staticPackageInfo33 = - new AndroidLazyEvaluator<>( - context -> { - try { - return context - .getPackageManager() - .getPackageInfo(context.getPackageName(), PackageManager.PackageInfoFlags.of(0)); - } catch (Throwable e) { - return null; - } - }); + new AndroidLazyEvaluator<>(context -> { + try { + return context + .getPackageManager() + .getPackageInfo(context.getPackageName(), PackageManager.PackageInfoFlags.of(0)); + } catch (Throwable e) { + return null; + } + }); private static final @NotNull AndroidLazyEvaluator staticPackageInfo = - new AndroidLazyEvaluator<>( - context -> { - try { - return context.getPackageManager().getPackageInfo(context.getPackageName(), 0); - } catch (Throwable e) { - return null; - } - }); + new AndroidLazyEvaluator<>(context -> { + try { + return context.getPackageManager().getPackageInfo(context.getPackageName(), 0); + } catch (Throwable e) { + return null; + } + }); private static final @NotNull AndroidLazyEvaluator applicationName = - new AndroidLazyEvaluator<>( - context -> { - try { - final ApplicationInfo applicationInfo = context.getApplicationInfo(); - final int stringId = applicationInfo.labelRes; - if (stringId == 0) { - if (applicationInfo.nonLocalizedLabel != null) { - return applicationInfo.nonLocalizedLabel.toString(); - } - return context.getPackageManager().getApplicationLabel(applicationInfo).toString(); - } else { - return context.getString(stringId); - } - } catch (Throwable e) { - return null; + new AndroidLazyEvaluator<>(context -> { + try { + final ApplicationInfo applicationInfo = context.getApplicationInfo(); + final int stringId = applicationInfo.labelRes; + if (stringId == 0) { + if (applicationInfo.nonLocalizedLabel != null) { + return applicationInfo.nonLocalizedLabel.toString(); } - }); + return context.getPackageManager().getApplicationLabel(applicationInfo).toString(); + } else { + return context.getString(stringId); + } + } catch (Throwable e) { + return null; + } + }); /** * Since this applicationInfo uses the same flag (METADATA) we can assume it's static and cache it @@ -145,30 +142,28 @@ private ContextUtils() {} */ @SuppressLint("NewApi") private static final @NotNull AndroidLazyEvaluator staticAppInfo33 = - new AndroidLazyEvaluator<>( - context -> { - try { - return context - .getPackageManager() - .getApplicationInfo( - context.getPackageName(), - PackageManager.ApplicationInfoFlags.of(PackageManager.GET_META_DATA)); - } catch (Throwable e) { - return null; - } - }); + new AndroidLazyEvaluator<>(context -> { + try { + return context + .getPackageManager() + .getApplicationInfo( + context.getPackageName(), + PackageManager.ApplicationInfoFlags.of(PackageManager.GET_META_DATA)); + } catch (Throwable e) { + return null; + } + }); private static final @NotNull AndroidLazyEvaluator staticAppInfo = - new AndroidLazyEvaluator<>( - context -> { - try { - return context - .getPackageManager() - .getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); - } catch (Throwable e) { - return null; - } - }); + new AndroidLazyEvaluator<>(context -> { + try { + return context + .getPackageManager() + .getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); + } catch (Throwable e) { + return null; + } + }); /** * Return the Application's PackageInfo if possible, or null. diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/EnvelopeFileObserverIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/EnvelopeFileObserverIntegration.java index 7966ca98d99..e81577cfd4b 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/EnvelopeFileObserverIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/EnvelopeFileObserverIntegration.java @@ -49,14 +49,13 @@ public final void register(final @NotNull IScopes scopes, final @NotNull SentryO try { options .getExecutorService() - .submit( - () -> { - try (final @NotNull ISentryLifecycleToken ignored = startLock.acquire()) { - if (!isClosed) { - startOutboxSender(scopes, options, path); - } - } - }); + .submit(() -> { + try (final @NotNull ISentryLifecycleToken ignored = startLock.acquire()) { + if (!isClosed) { + startOutboxSender(scopes, options, path); + } + } + }); } catch (Throwable e) { logger.log( SentryLevel.DEBUG, diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/FeedbackShakeIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/FeedbackShakeIntegration.java index 3f042e08209..677678b2438 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/FeedbackShakeIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/FeedbackShakeIntegration.java @@ -286,30 +286,26 @@ private void startShakeDetection(final @NotNull Activity activity) { || Boolean.TRUE.equals(inBackground)) { return; } - active.runOnUiThread( - () -> { - // Re-check on the main thread: shake-to-report may have been disabled, or an - // earlier queued shake may have shown a dialog in the meantime (the dialog reports - // itself synchronously in onStart). - if (!enabled - || hasDialogOn(active) - || active.isFinishing() - || active.isDestroyed()) { - return; - } - @Nullable Dialog dialog = null; - try { - dialog = dialogFactory.create(active); - dialog.show(); - } catch (Throwable e) { - if (dialog != null) { - onDialogGone(dialog); - } - options - .getLogger() - .log(SentryLevel.ERROR, "Failed to show feedback dialog on shake.", e); - } - }); + active.runOnUiThread(() -> { + // Re-check on the main thread: shake-to-report may have been disabled, or an + // earlier queued shake may have shown a dialog in the meantime (the dialog reports + // itself synchronously in onStart). + if (!enabled || hasDialogOn(active) || active.isFinishing() || active.isDestroyed()) { + return; + } + @Nullable Dialog dialog = null; + try { + dialog = dialogFactory.create(active); + dialog.show(); + } catch (Throwable e) { + if (dialog != null) { + onDialogGone(dialog); + } + options + .getLogger() + .log(SentryLevel.ERROR, "Failed to show feedback dialog on shake.", e); + } + }); }); } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java b/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java index 5400478cbfa..104d2f0c803 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java @@ -293,28 +293,24 @@ public static void updateSessionForDroppedEventNonTerminating(final boolean cras private static void updateSessionNonTerminating(final boolean unhandled) { final @NotNull IScopes scopes = ScopesAdapter.getInstance(); final @NotNull SentryOptions options = scopes.getOptions(); - scopes.configureScope( - scope -> - scope.withSession( - session -> { - if (session == null) { - options.getLogger().log(INFO, "Session is null on updateSessionNonTerminating"); - return; - } - if (session.isTerminated()) { - options - .getLogger() - .log(INFO, "Session already terminated, not recording the error."); - return; - } - final boolean recorded = - unhandled - ? session.recordNonTerminatingUnhandledError() - : session.update(null, null, true, null); - if (recorded && options.getEnvelopeDiskCache() instanceof EnvelopeCache) { - ((EnvelopeCache) options.getEnvelopeDiskCache()).persistCurrentSession(session); - } - })); + scopes.configureScope(scope -> + scope.withSession(session -> { + if (session == null) { + options.getLogger().log(INFO, "Session is null on updateSessionNonTerminating"); + return; + } + if (session.isTerminated()) { + options.getLogger().log(INFO, "Session already terminated, not recording the error."); + return; + } + final boolean recorded = + unhandled + ? session.recordNonTerminatingUnhandledError() + : session.update(null, null, true, null); + if (recorded && options.getEnvelopeDiskCache() instanceof EnvelopeCache) { + ((EnvelopeCache) options.getEnvelopeDiskCache()).persistCurrentSession(session); + } + })); } /** What the events inside an envelope amount to, from the session's point of view. */ @@ -416,10 +412,9 @@ private static void deleteCurrentSessionFile( try { options .getExecutorService() - .submit( - () -> { - deleteCurrentSessionFile(options); - }); + .submit(() -> { + deleteCurrentSessionFile(options); + }); } catch (Throwable e) { options .getLogger() @@ -450,29 +445,27 @@ private static Session updateSession( final @Nullable Session.State status, final boolean crashedOrErrored) { final @NotNull AtomicReference sessionRef = new AtomicReference<>(); - scopes.configureScope( - scope -> { - scope.withSession( - session -> { - if (session != null) { - final boolean updated = session.update(status, null, crashedOrErrored, null); - // if we have an uncaughtExceptionHint we can end the session. - if (updated) { - if (session.getStatus() == Session.State.Crashed) { - session.end(); - // Session needs to be removed from the scope, otherwise it will be send twice - // standalone and with the crash event - scope.clearSession(); - } - // fromSession serializes lazily, on the transport thread, so handing out the - // live session would race a later mutation - sessionRef.set(session.clone()); - } - } else { - options.getLogger().log(INFO, "Session is null on updateSession"); - } - }); - }); + scopes.configureScope(scope -> { + scope.withSession(session -> { + if (session != null) { + final boolean updated = session.update(status, null, crashedOrErrored, null); + // if we have an uncaughtExceptionHint we can end the session. + if (updated) { + if (session.getStatus() == Session.State.Crashed) { + session.end(); + // Session needs to be removed from the scope, otherwise it will be send twice + // standalone and with the crash event + scope.clearSession(); + } + // fromSession serializes lazily, on the transport thread, so handing out the + // live session would race a later mutation + sessionRef.set(session.clone()); + } + } else { + options.getLogger().log(INFO, "Session is null on updateSession"); + } + }); + }); return sessionRef.get(); } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/LifecycleWatcher.java b/sentry-android-core/src/main/java/io/sentry/android/core/LifecycleWatcher.java index 478d9ed624c..b981ce6eda1 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/LifecycleWatcher.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/LifecycleWatcher.java @@ -66,15 +66,14 @@ private void startSession() { final long currentTimeMillis = currentDateProvider.getCurrentTimeMillis(); - scopes.configureScope( - scope -> { - if (lastUpdatedSession.get() == 0L) { - final @Nullable Session currentSession = scope.getSession(); - if (currentSession != null && currentSession.getStarted() != null) { - lastUpdatedSession.set(currentSession.getStarted().getTime()); - } - } - }); + scopes.configureScope(scope -> { + if (lastUpdatedSession.get() == 0L) { + final @Nullable Session currentSession = scope.getSession(); + if (currentSession != null && currentSession.getStarted() != null) { + lastUpdatedSession.set(currentSession.getStarted().getTime()); + } + } + }); final long lastUpdatedSession = this.lastUpdatedSession.get(); final boolean startNewSession = diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/PerfettoContinuousProfiler.java b/sentry-android-core/src/main/java/io/sentry/android/core/PerfettoContinuousProfiler.java index e41bbbf28fb..63512b7dd99 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/PerfettoContinuousProfiler.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/PerfettoContinuousProfiler.java @@ -458,18 +458,17 @@ private void stopInternal(final boolean restartProfiler) { // endAndCollect is non-blocking: the listener fires when the OS delivers the trace file. // Synchronous: result already available — callback runs inline, lock is still held (re-entrant) // Asynchronous: callback runs on an OS thread — acquires lock itself for restart - currentProfiler.endAndCollect( - traceFile -> - onChunkCollected( - traceFile, - chunkProfilerId, - chunkChunkId, - chunkRecord, - measurements, - chunkTimestamp, - shouldRestart, - scopes, - options)); + currentProfiler.endAndCollect(traceFile -> + onChunkCollected( + traceFile, + chunkProfilerId, + chunkChunkId, + chunkRecord, + measurements, + chunkTimestamp, + shouldRestart, + scopes, + options)); } private void onChunkCollected( diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SendCachedEnvelopeIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/SendCachedEnvelopeIntegration.java index 05352be394c..1f3dc572792 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SendCachedEnvelopeIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SendCachedEnvelopeIntegration.java @@ -89,62 +89,58 @@ private void sendCachedEnvelopes( final Future future = options .getExecutorService() - .submit( - () -> { - try { - if (isClosed.get()) { - options - .getLogger() - .log( - SentryLevel.INFO, - "SendCachedEnvelopeIntegration, not trying to send after closing."); - return; - } - - if (!isInitialized.getAndSet(true)) { - connectionStatusProvider = options.getConnectionStatusProvider(); - connectionStatusProvider.addConnectionStatusObserver(this); - - sender = factory.create(scopes, options); - } - - if (connectionStatusProvider != null - && connectionStatusProvider.getConnectionStatus() - == IConnectionStatusProvider.ConnectionStatus.DISCONNECTED) { - options - .getLogger() - .log(SentryLevel.INFO, "SendCachedEnvelopeIntegration, no connection."); - return; - } - - // in case there's rate limiting active, skip processing - final @Nullable RateLimiter rateLimiter = scopes.getRateLimiter(); - if (rateLimiter != null - && rateLimiter.isActiveForCategory(DataCategory.All)) { - options - .getLogger() - .log( - SentryLevel.INFO, - "SendCachedEnvelopeIntegration, rate limiting active."); - return; - } - - if (sender == null) { - options - .getLogger() - .log( - SentryLevel.ERROR, - "SendCachedEnvelopeIntegration factory is null."); - return; - } - - sender.send(); - } catch (Throwable e) { - options - .getLogger() - .log(SentryLevel.ERROR, "Failed trying to send cached events.", e); - } - }); + .submit(() -> { + try { + if (isClosed.get()) { + options + .getLogger() + .log( + SentryLevel.INFO, + "SendCachedEnvelopeIntegration, not trying to send after closing."); + return; + } + + if (!isInitialized.getAndSet(true)) { + connectionStatusProvider = options.getConnectionStatusProvider(); + connectionStatusProvider.addConnectionStatusObserver(this); + + sender = factory.create(scopes, options); + } + + if (connectionStatusProvider != null + && connectionStatusProvider.getConnectionStatus() + == IConnectionStatusProvider.ConnectionStatus.DISCONNECTED) { + options + .getLogger() + .log(SentryLevel.INFO, "SendCachedEnvelopeIntegration, no connection."); + return; + } + + // in case there's rate limiting active, skip processing + final @Nullable RateLimiter rateLimiter = scopes.getRateLimiter(); + if (rateLimiter != null && rateLimiter.isActiveForCategory(DataCategory.All)) { + options + .getLogger() + .log( + SentryLevel.INFO, + "SendCachedEnvelopeIntegration, rate limiting active."); + return; + } + + if (sender == null) { + options + .getLogger() + .log(SentryLevel.ERROR, "SendCachedEnvelopeIntegration factory is null."); + return; + } + + sender.send(); + } catch (Throwable e) { + options + .getLogger() + .log(SentryLevel.ERROR, "Failed trying to send cached events.", e); + } + }); // startupCrashMarkerEvaluator remains true on subsequent runs, let's ensure we only block on // the very first execution (=app start) diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroid.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroid.java index 7439de759d7..e3eb33af048 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroid.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroid.java @@ -201,13 +201,12 @@ public static void init( // so only start a session if it's not already started // This e.g. happens on React Native, or e.g. on deferred SDK init final AtomicBoolean sessionStarted = new AtomicBoolean(false); - scopes.configureScope( - scope -> { - final @Nullable Session currentSession = scope.getSession(); - if (currentSession != null && currentSession.getStarted() != null) { - sessionStarted.set(true); - } - }); + scopes.configureScope(scope -> { + final @Nullable Session currentSession = scope.getSession(); + if (currentSession != null && currentSession.getStarted() != null) { + sessionStarted.set(true); + } + }); if (!sessionStarted.get()) { scopes.startSession(); } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryShakeDetector.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryShakeDetector.java index f97bbf2e72f..72c100923cd 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryShakeDetector.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryShakeDetector.java @@ -114,11 +114,10 @@ public synchronized void stop() { } final @Nullable Handler h = handler; if (h != null) { - h.post( - () -> { - //noinspection Convert2MethodRef - queue.clear(); - }); + h.post(() -> { + //noinspection Convert2MethodRef + queue.clear(); + }); } } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackButton.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackButton.java index 22a010b07f9..c1d5a776449 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackButton.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackButton.java @@ -119,12 +119,11 @@ private void init( @Override public void setOnClickListener(final @Nullable OnClickListener listener) { delegate = listener; - super.setOnClickListener( - v -> { - new SentryUserFeedbackForm.Builder(getContext()).create().show(); - if (delegate != null) { - delegate.onClick(v); - } - }); + super.setOnClickListener(v -> { + new SentryUserFeedbackForm.Builder(getContext()).create().show(); + if (delegate != null) { + delegate.onClick(v); + } + }); } } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java index 4be90baad56..23f59f8e282 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryUserFeedbackForm.java @@ -150,12 +150,11 @@ private void stopShakeDetection() { } final @Nullable Activity active = activityRef.get(); if (active != null && !active.isFinishing() && !active.isDestroyed()) { - active.runOnUiThread( - () -> { - if (!active.isFinishing() && !active.isDestroyed()) { - show(); - } - }); + active.runOnUiThread(() -> { + if (!active.isFinishing() && !active.isDestroyed()) { + show(); + } + }); } }; } @@ -252,33 +251,32 @@ protected void onCreate(Bundle savedInstanceState) { // The button is made visible in onStart, once the screenshot picker is registered successfully btnAddScreenshot.setVisibility(View.GONE); - btnAddScreenshot.setOnClickListener( - v -> { - if (selectedImageUri == null) { - if (screenshotPicker != null) { - try { - screenshotPicker.launch(); - } catch (LinkageError e) { - // androidx.activity is compileOnly, so the version in the app's apk may not have - // the photo picker APIs this was compiled against - Sentry.getCurrentScopes() - .getOptions() - .getLogger() - .log(SentryLevel.ERROR, "Failed to launch the screenshot picker.", e); - } catch (Throwable t) { - ExceptionUtils.rethrowIfFatal(t); - // e.g. no photo picker on the device, or the launcher is no longer registered - Sentry.getCurrentScopes() - .getOptions() - .getLogger() - .log(SentryLevel.ERROR, "Failed to launch the screenshot picker.", t); - } - } - } else { - selectedImageUri = null; - btnAddScreenshot.setText(feedbackOptions.getAddScreenshotButtonLabel()); + btnAddScreenshot.setOnClickListener(v -> { + if (selectedImageUri == null) { + if (screenshotPicker != null) { + try { + screenshotPicker.launch(); + } catch (LinkageError e) { + // androidx.activity is compileOnly, so the version in the app's apk may not have + // the photo picker APIs this was compiled against + Sentry.getCurrentScopes() + .getOptions() + .getLogger() + .log(SentryLevel.ERROR, "Failed to launch the screenshot picker.", e); + } catch (Throwable t) { + ExceptionUtils.rethrowIfFatal(t); + // e.g. no photo picker on the device, or the launcher is no longer registered + Sentry.getCurrentScopes() + .getOptions() + .getLogger() + .log(SentryLevel.ERROR, "Failed to launch the screenshot picker.", t); } - }); + } + } else { + selectedImageUri = null; + btnAddScreenshot.setText(feedbackOptions.getAddScreenshotButtonLabel()); + } + }); if (feedbackOptions.isShowBranding()) { imgLogo.setVisibility(View.VISIBLE); @@ -329,76 +327,74 @@ protected void onCreate(Bundle savedInstanceState) { lblTitle.setText(feedbackOptions.getFormTitle()); btnSend.setText(feedbackOptions.getSubmitButtonLabel()); - btnSend.setOnClickListener( - v -> { - // Gather fields and trim them - final @NotNull String name = edtName.getText().toString().trim(); - final @NotNull String email = edtEmail.getText().toString().trim(); - final @NotNull String message = edtMessage.getText().toString().trim(); - - // If a required field is missing, shows the error label - if (name.isEmpty() && feedbackOptions.isNameRequired()) { - edtName.setError(lblName.getText()); - return; - } + btnSend.setOnClickListener(v -> { + // Gather fields and trim them + final @NotNull String name = edtName.getText().toString().trim(); + final @NotNull String email = edtEmail.getText().toString().trim(); + final @NotNull String message = edtMessage.getText().toString().trim(); + + // If a required field is missing, shows the error label + if (name.isEmpty() && feedbackOptions.isNameRequired()) { + edtName.setError(lblName.getText()); + return; + } - if (email.isEmpty() && feedbackOptions.isEmailRequired()) { - edtEmail.setError(lblEmail.getText()); - return; - } + if (email.isEmpty() && feedbackOptions.isEmailRequired()) { + edtEmail.setError(lblEmail.getText()); + return; + } - if (message.isEmpty()) { - edtMessage.setError(lblMessage.getText()); - return; - } + if (message.isEmpty()) { + edtMessage.setError(lblMessage.getText()); + return; + } - // Create the feedback object - final @NotNull Feedback feedback = new Feedback(message); - feedback.setName(name); - feedback.setContactEmail(email); - if (associatedEventId != null) { - feedback.setAssociatedEventId(associatedEventId); - } - if (currentReplayId != null) { - feedback.setReplayId(currentReplayId); - } + // Create the feedback object + final @NotNull Feedback feedback = new Feedback(message); + feedback.setName(name); + feedback.setContactEmail(email); + if (associatedEventId != null) { + feedback.setAssociatedEventId(associatedEventId); + } + if (currentReplayId != null) { + feedback.setReplayId(currentReplayId); + } - // Capture the feedback. If the ID is empty, it means that the feedback was not sent - final @NotNull Hint hint = new Hint(); - maybeAddImageAttachment(hint); - final @NotNull SentryId id = Sentry.feedback().capture(feedback, hint); - if (!id.equals(SentryId.EMPTY_ID)) { - Toast.makeText( - getContext(), feedbackOptions.getSuccessMessageText(), Toast.LENGTH_SHORT) - .show(); - final @Nullable SentryFeedbackOptions.SentryFeedbackCallback onSubmitSuccess = - feedbackOptions.getOnSubmitSuccess(); - if (onSubmitSuccess != null) { - try { - onSubmitSuccess.call(feedback); - } catch (Exception e) { - Sentry.getCurrentScopes() - .getOptions() - .getLogger() - .log(SentryLevel.ERROR, "onSubmitSuccess callback threw an exception.", e); - } - } - } else { - final @Nullable SentryFeedbackOptions.SentryFeedbackCallback onSubmitError = - feedbackOptions.getOnSubmitError(); - if (onSubmitError != null) { - try { - onSubmitError.call(feedback); - } catch (Exception e) { - Sentry.getCurrentScopes() - .getOptions() - .getLogger() - .log(SentryLevel.ERROR, "onSubmitError callback threw an exception.", e); - } - } + // Capture the feedback. If the ID is empty, it means that the feedback was not sent + final @NotNull Hint hint = new Hint(); + maybeAddImageAttachment(hint); + final @NotNull SentryId id = Sentry.feedback().capture(feedback, hint); + if (!id.equals(SentryId.EMPTY_ID)) { + Toast.makeText(getContext(), feedbackOptions.getSuccessMessageText(), Toast.LENGTH_SHORT) + .show(); + final @Nullable SentryFeedbackOptions.SentryFeedbackCallback onSubmitSuccess = + feedbackOptions.getOnSubmitSuccess(); + if (onSubmitSuccess != null) { + try { + onSubmitSuccess.call(feedback); + } catch (Exception e) { + Sentry.getCurrentScopes() + .getOptions() + .getLogger() + .log(SentryLevel.ERROR, "onSubmitSuccess callback threw an exception.", e); } - cancel(); - }); + } + } else { + final @Nullable SentryFeedbackOptions.SentryFeedbackCallback onSubmitError = + feedbackOptions.getOnSubmitError(); + if (onSubmitError != null) { + try { + onSubmitError.call(feedback); + } catch (Exception e) { + Sentry.getCurrentScopes() + .getOptions() + .getLogger() + .log(SentryLevel.ERROR, "onSubmitError callback threw an exception.", e); + } + } + } + cancel(); + }); btnCancel.setText(feedbackOptions.getCancelButtonLabel()); btnCancel.setOnClickListener(v -> cancel()); @@ -412,22 +408,19 @@ public void setOnDismissListener(final @Nullable OnDismissListener listener) { final @NotNull SentryOptions options = Sentry.getCurrentScopes().getOptions(); final @Nullable Runnable onFormClose = options.getFeedbackOptions().getOnFormClose(); if (onFormClose != null) { - super.setOnDismissListener( - dialog -> { - // User-provided callback: a crash in it must not take down the app or skip the - // cleanup and the user's own dismiss listener below - try { - onFormClose.run(); - } catch (Exception e) { - options - .getLogger() - .log(SentryLevel.ERROR, "onFormClose callback threw an exception.", e); - } - currentReplayId = null; - if (delegate != null) { - delegate.onDismiss(dialog); - } - }); + super.setOnDismissListener(dialog -> { + // User-provided callback: a crash in it must not take down the app or skip the + // cleanup and the user's own dismiss listener below + try { + onFormClose.run(); + } catch (Exception e) { + options.getLogger().log(SentryLevel.ERROR, "onFormClose callback threw an exception.", e); + } + currentReplayId = null; + if (delegate != null) { + delegate.onDismiss(dialog); + } + }); } else { super.setOnDismissListener(delegate); } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryWebViewTracing.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryWebViewTracing.java index 133a1c6d8b5..b96eb5d97bd 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryWebViewTracing.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryWebViewTracing.java @@ -234,28 +234,25 @@ private static void removeOnWebViewThread( final @NotNull ILogger logger) { final long replacementsSeen = replacementsOf(webView); new Handler(webViewLooper(webView)) - .post( - () -> { - if (replacementsOf(webView) != replacementsSeen) { - return; - } - // Runs outside of any app call, so only fatal errors may escape: for example, the - // WebView may have been destroyed since. - try { - installer.removeInstalledScript(webView); - } catch (LinkageError e) { - logger.log( - SentryLevel.WARNING, - "androidx.webkit is too old for WebView trace propagation, skipping.", - e); - } catch (Throwable e) { - ExceptionUtils.rethrowIfFatal(e); - logger.log( - SentryLevel.WARNING, - "Failed to remove the WebView trace propagation script.", - e); - } - }); + .post(() -> { + if (replacementsOf(webView) != replacementsSeen) { + return; + } + // Runs outside of any app call, so only fatal errors may escape: for example, the + // WebView may have been destroyed since. + try { + installer.removeInstalledScript(webView); + } catch (LinkageError e) { + logger.log( + SentryLevel.WARNING, + "androidx.webkit is too old for WebView trace propagation, skipping.", + e); + } catch (Throwable e) { + ExceptionUtils.rethrowIfFatal(e); + logger.log( + SentryLevel.WARNING, "Failed to remove the WebView trace propagation script.", e); + } + }); } private static long replacementsOf(final @NotNull WebView webView) { diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SpanFrameMetricsCollector.java b/sentry-android-core/src/main/java/io/sentry/android/core/SpanFrameMetricsCollector.java index 2d20acbcf11..2a6d57872a4 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SpanFrameMetricsCollector.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SpanFrameMetricsCollector.java @@ -42,22 +42,21 @@ public final class SpanFrameMetricsCollector // all running spans, sorted by span start nano time private final @NotNull SortedSet runningSpans = - new TreeSet<>( - (o1, o2) -> { - if (o1 == o2) { - return 0; - } - int timeDiff = o1.getStartDate().compareTo(o2.getStartDate()); - if (timeDiff != 0) { - return timeDiff; - } - // TreeSet uses compareTo to check for duplicates, so ensure that - // two non-equal spans with the same start date are not considered equal - return o1.getSpanContext() - .getSpanId() - .toString() - .compareTo(o2.getSpanContext().getSpanId().toString()); - }); + new TreeSet<>((o1, o2) -> { + if (o1 == o2) { + return 0; + } + int timeDiff = o1.getStartDate().compareTo(o2.getStartDate()); + if (timeDiff != 0) { + return timeDiff; + } + // TreeSet uses compareTo to check for duplicates, so ensure that + // two non-equal spans with the same start date are not considered equal + return o1.getSpanContext() + .getSpanId() + .toString() + .compareTo(o2.getSpanContext().getSpanId().toString()); + }); // all collected frames, sorted by frame end time // this is a concurrent set, as the frames are added on the main thread, diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java index 82bd4ce9f72..b3caf622c37 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegration.java @@ -137,53 +137,52 @@ private void registerReceiver( try { options .getExecutorService() - .submit( - () -> { - try (final @NotNull ISentryLifecycleToken ignored = receiverLock.acquire()) { - if (isClosed || isStopped || receiver != null) { - return; - } + .submit(() -> { + try (final @NotNull ISentryLifecycleToken ignored = receiverLock.acquire()) { + if (isClosed || isStopped || receiver != null) { + return; + } - receiver = new SystemEventsBroadcastReceiver(scopes, options); - final @NotNull IntentFilter filter = new IntentFilter(); - for (String item : actions) { - filter.addAction(item); - } - try { - // registerReceiver can throw SecurityException but it's not documented in the - // official docs - - // onReceive will be called on this handler thread - @NotNull Handler handler; - if (customHandler != null) { - handler = customHandler; - } else { - if (handlerThread == null) { - handlerThread = - new HandlerThread( - "SystemEventsReceiver", Process.THREAD_PRIORITY_BACKGROUND); - handlerThread.start(); - } - handler = new Handler(handlerThread.getLooper()); - } - ContextUtils.registerReceiver(context, options, receiver, filter, handler); - if (!isReceiverRegistered.getAndSet(true)) { - options - .getLogger() - .log(SentryLevel.DEBUG, "SystemEventsBreadcrumbsIntegration installed."); - addIntegrationToSdkVersion("SystemEventsBreadcrumbs"); - } - } catch (Throwable e) { - options.setEnableSystemEventBreadcrumbs(false); - options - .getLogger() - .log( - SentryLevel.ERROR, - "Failed to initialize SystemEventsBreadcrumbsIntegration.", - e); + receiver = new SystemEventsBroadcastReceiver(scopes, options); + final @NotNull IntentFilter filter = new IntentFilter(); + for (String item : actions) { + filter.addAction(item); + } + try { + // registerReceiver can throw SecurityException but it's not documented in the + // official docs + + // onReceive will be called on this handler thread + @NotNull Handler handler; + if (customHandler != null) { + handler = customHandler; + } else { + if (handlerThread == null) { + handlerThread = + new HandlerThread( + "SystemEventsReceiver", Process.THREAD_PRIORITY_BACKGROUND); + handlerThread.start(); } + handler = new Handler(handlerThread.getLooper()); } - }); + ContextUtils.registerReceiver(context, options, receiver, filter, handler); + if (!isReceiverRegistered.getAndSet(true)) { + options + .getLogger() + .log(SentryLevel.DEBUG, "SystemEventsBreadcrumbsIntegration installed."); + addIntegrationToSdkVersion("SystemEventsBreadcrumbs"); + } + } catch (Throwable e) { + options.setEnableSystemEventBreadcrumbs(false); + options + .getLogger() + .log( + SentryLevel.ERROR, + "Failed to initialize SystemEventsBreadcrumbsIntegration.", + e); + } + } + }); } catch (Throwable e) { options .getLogger() diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java b/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java index 8fad115eed6..4004310a3ff 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ViewHierarchyEventProcessor.java @@ -185,15 +185,14 @@ public static ViewHierarchy snapshotViewHierarchy( } else { final CountDownLatch latch = new CountDownLatch(1); final AtomicReference viewHierarchy = new AtomicReference<>(null); - activity.runOnUiThread( - () -> { - try { - viewHierarchy.set(snapshotViewHierarchy(decorView, exporters)); - latch.countDown(); - } catch (Throwable t) { - logger.log(SentryLevel.ERROR, "Failed to process view hierarchy.", t); - } - }); + activity.runOnUiThread(() -> { + try { + viewHierarchy.set(snapshotViewHierarchy(decorView, exporters)); + latch.countDown(); + } catch (Throwable t) { + logger.log(SentryLevel.ERROR, "Failed to process view hierarchy.", t); + } + }); if (latch.await(CAPTURE_TIMEOUT_MS, TimeUnit.MILLISECONDS)) { return viewHierarchy.get(); } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfilingIntegration.java b/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfilingIntegration.java index c101ef92adf..018fd49f6fd 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfilingIntegration.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/anr/AnrProfilingIntegration.java @@ -132,18 +132,17 @@ public void close() throws IOException { if (opts != null) { try { opts.getExecutorService() - .submit( - () -> { - if (pm == null) { - return; - } - - try { - pm.close(); - } catch (IOException e) { - logger.log(SentryLevel.WARNING, "Failed to close AnrProfileManager"); - } - }); + .submit(() -> { + if (pm == null) { + return; + } + + try { + pm.close(); + } catch (IOException e) { + logger.log(SentryLevel.WARNING, "Failed to close AnrProfileManager"); + } + }); } catch (Throwable e) { logger.log(SentryLevel.WARNING, "Failed to submit AnrProfileManager close"); } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java b/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java index 13148097289..245950a17ee 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/cache/AndroidEnvelopeCache.java @@ -266,7 +266,7 @@ void handle(final @NotNull Hint hint, final @NotNull SentryAndroidOptions option HintUtils.runIfHasType( hint, type, - (typedHint) -> { + typedHint -> { final @NotNull Long timestamp = timestampProvider.extract(typedHint); options .getLogger() diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureListener.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureListener.java index bb741d0cb2a..b7891743c51 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureListener.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/gestures/SentryGestureListener.java @@ -279,10 +279,9 @@ private void startTracing(final @NotNull UiElement target, final @NotNull Gestur scopes.startTransaction( new TransactionContext(name, TransactionNameSource.COMPONENT, op), transactionOptions); - scopes.configureScope( - scope -> { - applyScope(scope, transaction); - }); + scopes.configureScope(scope -> { + applyScope(scope, transaction); + }); activeTransaction = transaction; activeUiElement = target; @@ -299,12 +298,11 @@ void stopTracing(final @NotNull SpanStatus status) { activeTransaction.finish(); } } - scopes.configureScope( - scope -> { - // avoid method refs on Android due to some issues with older AGP setups - // noinspection Convert2MethodRef - clearScope(scope); - }); + scopes.configureScope(scope -> { + // avoid method refs on Android due to some issues with older AGP setups + // noinspection Convert2MethodRef + clearScope(scope); + }); activeTransaction = null; if (activeUiElement != null) { activeUiElement = null; @@ -315,30 +313,28 @@ void stopTracing(final @NotNull SpanStatus status) { @VisibleForTesting @SuppressWarnings("ReferenceEquality") void clearScope(final @NotNull IScope scope) { - scope.withTransaction( - transaction -> { - if (transaction == activeTransaction) { - scope.clearTransaction(); - } - }); + scope.withTransaction(transaction -> { + if (transaction == activeTransaction) { + scope.clearTransaction(); + } + }); } @VisibleForTesting void applyScope(final @NotNull IScope scope, final @NotNull ITransaction transaction) { - scope.withTransaction( - scopeTransaction -> { - // we'd not like to overwrite existent transactions bound to the Scope manually - if (scopeTransaction == null) { - scope.setTransaction(transaction); - } else { - options - .getLogger() - .log( - SentryLevel.DEBUG, - "Transaction '%s' won't be bound to the Scope since there's one already in there.", - transaction.getName()); - } - }); + scope.withTransaction(scopeTransaction -> { + // we'd not like to overwrite existent transactions bound to the Scope manually + if (scopeTransaction == null) { + scope.setTransaction(transaction); + } else { + options + .getLogger() + .log( + SentryLevel.DEBUG, + "Transaction '%s' won't be bound to the Scope since there's one already in there.", + transaction.getName()); + } + }); } private @NotNull String getActivityName(final @NotNull Activity activity) { diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/modules/AssetsModulesLoader.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/modules/AssetsModulesLoader.java index ea94ea8e262..27619febb2f 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/modules/AssetsModulesLoader.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/modules/AssetsModulesLoader.java @@ -27,10 +27,9 @@ public AssetsModulesLoader(final @NotNull Context context, final @NotNull Sentry try { options .getExecutorService() - .submit( - () -> { - getOrLoadModules(); - }); + .submit(() -> { + getOrLoadModules(); + }); } catch (Throwable e) { options.getLogger().log(SentryLevel.ERROR, "AssetsModulesLoader submit failed", e); } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidConnectionStatusProvider.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidConnectionStatusProvider.java index df8a3b976dc..fe9acc69a23 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidConnectionStatusProvider.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/AndroidConnectionStatusProvider.java @@ -629,15 +629,14 @@ private void unregisterNetworkCallback(final boolean clearObservers) { public void close() { closed = true; - submitSafe( - () -> { - unregisterNetworkCallback(/* clearObservers= */ true); - childCallbacks.clear(); - try (final @NotNull ISentryLifecycleToken ignored = connectivityManagerLock.acquire()) { - connectivityManager = null; - } - AppState.getInstance().removeAppStateListener(this); - }); + submitSafe(() -> { + unregisterNetworkCallback(/* clearObservers= */ true); + childCallbacks.clear(); + try (final @NotNull ISentryLifecycleToken ignored = connectivityManagerLock.acquire()) { + connectivityManager = null; + } + AppState.getInstance().removeAppStateListener(this); + }); } /** @@ -646,36 +645,35 @@ public void close() { */ @Override public void onForeground() { - submitSafe( - () -> { - // Check on the executor so any earlier background unregistration runs before we decide - // whether registration is needed. Checking before submission could leave the callback - // unregistered after a quick return to the foreground. - if (closed || networkCallback != null) { - return; - } + submitSafe(() -> { + // Check on the executor so any earlier background unregistration runs before we decide + // whether registration is needed. Checking before submission could leave the callback + // unregistered after a quick return to the foreground. + if (closed || networkCallback != null) { + return; + } - // proactively update cache and notify observers on foreground to ensure connectivity - // state is not stale - final @NotNull ConnectionStatus status = statusOf(refresh(currentSnapshot())); - if (status == ConnectionStatus.DISCONNECTED) { - // onLost is not called retroactively when we registerNetworkCallback (as opposed to - // onAvailable), so we have to do it manually for the DISCONNECTED case - onAvailableForwarded.set(false); - for (final @NotNull NetworkCallback cb : childCallbacks) { - //noinspection DataFlowIssue - cb.onLost(null); - } - } - for (final @NotNull IConnectionStatusObserver observer : connectionStatusObservers) { - observer.onConnectionStatusChanged(status); - } + // proactively update cache and notify observers on foreground to ensure connectivity + // state is not stale + final @NotNull ConnectionStatus status = statusOf(refresh(currentSnapshot())); + if (status == ConnectionStatus.DISCONNECTED) { + // onLost is not called retroactively when we registerNetworkCallback (as opposed to + // onAvailable), so we have to do it manually for the DISCONNECTED case + onAvailableForwarded.set(false); + for (final @NotNull NetworkCallback cb : childCallbacks) { + //noinspection DataFlowIssue + cb.onLost(null); + } + } + for (final @NotNull IConnectionStatusObserver observer : connectionStatusObservers) { + observer.onConnectionStatusChanged(status); + } - // this will ONLY do the necessary parts like registerNetworkCallback and onAvailable, but - // it won't refresh the cache and notify observers because we just did it above and the - // cached capabilities will be the same - ensureNetworkCallbackRegistered(); - }); + // this will ONLY do the necessary parts like registerNetworkCallback and onAvailable, but + // it won't refresh the cache and notify observers because we just did it above and the + // cached capabilities will be the same + ensureNetworkCallbackRegistered(); + }); } /** @@ -684,16 +682,15 @@ public void onForeground() { */ @Override public void onBackground() { - submitSafe( - () -> { - // Check on the executor so any earlier registration finishes before we decide whether - // to unregister. Checking before submission could miss a pending registration and leave - // the callbacks registered in the background. - if (networkCallback == null) { - return; - } - unregisterNetworkCallback(/* clearObservers= */ false); - }); + submitSafe(() -> { + // Check on the executor so any earlier registration finishes before we decide whether + // to unregister. Checking before submission could miss a pending registration and leave + // the callbacks registered in the background. + if (networkCallback == null) { + return; + } + unregisterNetworkCallback(/* clearObservers= */ false); + }); } /** diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/FirstDrawDoneListener.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/FirstDrawDoneListener.java index 885ce5c2859..749ec178f32 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/FirstDrawDoneListener.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/FirstDrawDoneListener.java @@ -111,13 +111,12 @@ public void onDraw() { } // OnDrawListeners cannot be removed within onDraw. Posting the removal instead of waiting for // the next global layout guarantees it happens, even if no layout pass follows the draw. - mainThreadHandler.post( - () -> { - final ViewTreeObserver observer = view.getViewTreeObserver(); - if (observer.isAlive()) { - observer.removeOnDrawListener(this); - } - }); + mainThreadHandler.post(() -> { + final ViewTreeObserver observer = view.getViewTreeObserver(); + if (observer.isAlive()) { + observer.removeOnDrawListener(this); + } + }); mainThreadHandler.postAtFrontOfQueue(callback); } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/ScreenshotMasking.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/ScreenshotMasking.java index 4d3e2d15955..896fda9f72d 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/ScreenshotMasking.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/ScreenshotMasking.java @@ -79,14 +79,13 @@ public static boolean isAvailable(final @NotNull ILogger logger) { final CountDownLatch latch = new CountDownLatch(1); try { - activity.runOnUiThread( - () -> { - try { - result.set(buildViewHierarchy(activity, screenshotOptions, logger)); - } finally { - latch.countDown(); - } - }); + activity.runOnUiThread(() -> { + try { + result.set(buildViewHierarchy(activity, screenshotOptions, logger)); + } finally { + latch.countDown(); + } + }); if (!latch.await(MASKING_TIMEOUT_MS, TimeUnit.MILLISECONDS)) { logger.log( diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/ScreenshotUtils.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/ScreenshotUtils.java index 776d0103d2c..f7d3082bced 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/ScreenshotUtils.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/ScreenshotUtils.java @@ -202,16 +202,15 @@ public final class ScreenshotUtils { view.draw(canvas); latch.countDown(); } else { - activity.runOnUiThread( - () -> { - try { - view.draw(canvas); - } catch (Throwable e) { - logger.log(SentryLevel.ERROR, "Taking screenshot failed (view.draw).", e); - } finally { - latch.countDown(); - } - }); + activity.runOnUiThread(() -> { + try { + view.draw(canvas); + } catch (Throwable e) { + logger.log(SentryLevel.ERROR, "Taking screenshot failed (view.draw).", e); + } finally { + latch.countDown(); + } + }); } if (!latch.await(CAPTURE_TIMEOUT_MS, TimeUnit.MILLISECONDS)) { diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollector.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollector.java index 697bf2a5a60..6425f78e767 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollector.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/SentryFrameMetricsCollector.java @@ -132,29 +132,26 @@ public SentryFrameMetricsCollector( // The Choreographer instance should be initialized asynchronously on the main thread to avoid // reflection during SDK init. new Handler(Looper.getMainLooper()) - .post( - () -> { - try { - choreographer = Choreographer.getInstance(); - } catch (Throwable e) { - logger.log( - SentryLevel.ERROR, - "Error retrieving Choreographer instance. Slow and frozen frames will not be reported.", - e); - } + .post(() -> { + try { + choreographer = Choreographer.getInstance(); + } catch (Throwable e) { + logger.log( + SentryLevel.ERROR, + "Error retrieving Choreographer instance. Slow and frozen frames will not be reported.", + e); + } - // Let's get the last frame timestamp from the choreographer private field - try { - choreographerLastFrameTimeField = - Choreographer.class.getDeclaredField("mLastFrameTimeNanos"); - choreographerLastFrameTimeField.setAccessible(true); - } catch (NoSuchFieldException e) { - logger.log( - SentryLevel.ERROR, - "Unable to get the frame timestamp from the choreographer: ", - e); - } - }); + // Let's get the last frame timestamp from the choreographer private field + try { + choreographerLastFrameTimeField = + Choreographer.class.getDeclaredField("mLastFrameTimeNanos"); + choreographerLastFrameTimeField.setAccessible(true); + } catch (NoSuchFieldException e) { + logger.log( + SentryLevel.ERROR, "Unable to get the frame timestamp from the choreographer: ", e); + } + }); frameMetricsAvailableListener = (window, frameMetrics, dropCountSinceLastInvocation) -> { @@ -361,19 +358,18 @@ public void stopCollection(final @Nullable String listenerId) { @SuppressLint("NewApi") private void stopTrackingWindow(final @NotNull Window window) { new Handler(Looper.getMainLooper()) - .post( - () -> { - try { - // Re-check if we should still remove the listener for this window - // in case trackCurrentWindow was called in the meantime - if (trackedWindows.remove(window)) { - windowFrameMetricsManager.removeOnFrameMetricsAvailableListener( - window, frameMetricsAvailableListener); - } - } catch (Throwable e) { - logger.log(SentryLevel.ERROR, "Failed to remove frameMetricsAvailableListener", e); - } - }); + .post(() -> { + try { + // Re-check if we should still remove the listener for this window + // in case trackCurrentWindow was called in the meantime + if (trackedWindows.remove(window)) { + windowFrameMetricsManager.removeOnFrameMetricsAvailableListener( + window, frameMetricsAvailableListener); + } + } catch (Throwable e) { + logger.log(SentryLevel.ERROR, "Failed to remove frameMetricsAvailableListener", e); + } + }); } @SuppressWarnings("ReferenceEquality") @@ -401,17 +397,16 @@ private void trackCurrentWindow() { if (handler != null) { // Ensure the addOnFrameMetricsAvailableListener is called on the main thread new Handler(Looper.getMainLooper()) - .post( - () -> { - if (trackedWindows.add(window)) { - try { - windowFrameMetricsManager.addOnFrameMetricsAvailableListener( - window, frameMetricsAvailableListener, handler); - } catch (Throwable e) { - logger.log(SentryLevel.ERROR, "Failed to add frameMetricsAvailableListener", e); - } - } - }); + .post(() -> { + if (trackedWindows.add(window)) { + try { + windowFrameMetricsManager.addOnFrameMetricsAvailableListener( + window, frameMetricsAvailableListener, handler); + } catch (Throwable e) { + logger.log(SentryLevel.ERROR, "Failed to add frameMetricsAvailableListener", e); + } + } + }); } } diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java b/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java index 3bb58e67048..509296a8463 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java @@ -558,24 +558,21 @@ private void scheduleHeadlessAppStartCheckOnMain() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Looper.getMainLooper() .getQueue() - .addIdleHandler( - () -> { - firstIdle = SystemClock.uptimeMillis(); - headlessAppStartCheckPending.set(false); - handleHeadlessAppStartIfNeededOnMain(); - return false; - }); - } else { - final Handler handler = new Handler(Looper.getMainLooper()); - handler.post( - () -> { + .addIdleHandler(() -> { firstIdle = SystemClock.uptimeMillis(); - handler.post( - () -> { - headlessAppStartCheckPending.set(false); - handleHeadlessAppStartIfNeededOnMain(); - }); + headlessAppStartCheckPending.set(false); + handleHeadlessAppStartIfNeededOnMain(); + return false; }); + } else { + final Handler handler = new Handler(Looper.getMainLooper()); + handler.post(() -> { + firstIdle = SystemClock.uptimeMillis(); + handler.post(() -> { + headlessAppStartCheckPending.set(false); + handleHeadlessAppStartIfNeededOnMain(); + }); + }); } } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ANRWatchDogTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ANRWatchDogTest.kt index 71f477b24a1..fa0f8a7b2fa 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ANRWatchDogTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ANRWatchDogTest.kt @@ -60,7 +60,7 @@ class ANRWatchDogTest { es.submit { sut.run() } assertTrue( - latch.await(10L, TimeUnit.SECONDS) + latch.await(10L, TimeUnit.SECONDS), ) // Wait until worker posts the job for the "UI thread" var waitCount = 0 do { @@ -159,7 +159,7 @@ class ANRWatchDogTest { es.submit { sut.run() } assertTrue( - latch.await(10L, TimeUnit.SECONDS) + latch.await(10L, TimeUnit.SECONDS), ) // Wait until worker posts the job for the "UI thread" var waitCount = 0 do { @@ -215,7 +215,7 @@ class ANRWatchDogTest { es.submit { sut.run() } assertTrue( - latch.await(10L, TimeUnit.SECONDS) + latch.await(10L, TimeUnit.SECONDS), ) // Wait until worker posts the job for the "UI thread" var waitCount = 0 do { diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ActivityLifecycleIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ActivityLifecycleIntegrationTest.kt index 1a88c1bec6d..bd406200408 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ActivityLifecycleIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ActivityLifecycleIntegrationTest.kt @@ -273,7 +273,7 @@ class ActivityLifecycleIntegrationTest { contexts.any { it.operation == ActivityLifecycleIntegration.APP_START_COLD || it.operation == ActivityLifecycleIntegration.APP_START_WARM - } + }, ) } @@ -341,7 +341,7 @@ class ActivityLifecycleIntegrationTest { assertTrue( appStartTransaction.children.any { it.operation == ActivityLifecycleIntegration.APP_START_EXTENDED_OP - } + }, ) assertTrue(AppStartMetrics.getInstance().appStartExtension.isActive) assertNotNull(AppStartMetrics.getInstance().appStartExtension.extendedAppStartSpan) @@ -473,7 +473,7 @@ class ActivityLifecycleIntegrationTest { assertTrue( transaction.children.any { it.operation == ActivityLifecycleIntegration.APP_START_EXTENDED_OP - } + }, ) assertFalse(transaction.isFinished) @@ -919,7 +919,7 @@ class ActivityLifecycleIntegrationTest { it.tracesSampleRate = 1.0 it.isEnableTimeToFullDisplayTracing = true it.idleTimeout = 100 - } + }, ) // the transaction idle timeout is scheduled on the dedicated timer executor fixture.options.timerExecutorService = SentryExecutorService() @@ -990,7 +990,7 @@ class ActivityLifecycleIntegrationTest { initializer = { it.tracesSampleRate = 1.0 it.isEnableActivityLifecycleTracingAutoFinish = false - } + }, ) sut.register(fixture.scopes, fixture.options) val activity = mock() @@ -1473,7 +1473,7 @@ class ActivityLifecycleIntegrationTest { uiLoadTransaction.children.any { it.operation == ActivityLifecycleIntegration.APP_START_COLD || it.operation == ActivityLifecycleIntegration.APP_START_WARM - } + }, ) sut.onActivityPostCreated(activity, fixture.bundle) @@ -1678,7 +1678,7 @@ class ActivityLifecycleIntegrationTest { assertFalse( fixture.capturedContexts.drop(1).any { it.operation == ActivityLifecycleIntegration.STANDALONE_APP_START_OP - } + }, ) assertEquals(appStartTransaction.spanContext.traceId, uiLoadContext.traceId) // siblings, not parent/child: ui.load has no parent span id @@ -1707,7 +1707,7 @@ class ActivityLifecycleIntegrationTest { assertTrue( fixture.createdTransactions.single().children.any { it.operation == ActivityLifecycleIntegration.APP_START_COLD - } + }, ) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/AndroidContinuousProfilerTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/AndroidContinuousProfilerTest.kt index a13f3fe1246..5a27a303342 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/AndroidContinuousProfilerTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/AndroidContinuousProfilerTest.kt @@ -215,7 +215,7 @@ class AndroidContinuousProfilerTest { assertContains(it.measurements, ProfileMeasurement.ID_CPU_USAGE) assertContains(it.measurements, ProfileMeasurement.ID_MEMORY_FOOTPRINT) assertContains(it.measurements, ProfileMeasurement.ID_MEMORY_NATIVE_FOOTPRINT) - } + }, ) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/AndroidOptionsInitializerTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/AndroidOptionsInitializerTest.kt index 5b1c25d82ef..226ea753977 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/AndroidOptionsInitializerTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/AndroidOptionsInitializerTest.kt @@ -279,8 +279,8 @@ class AndroidOptionsInitializerTest { assertTrue( fixture.sentryOptions.cacheDirPath?.endsWith( - "${File.separator}cache${File.separator}sentry" - )!! + "${File.separator}cache${File.separator}sentry", + )!!, ) } @@ -290,7 +290,7 @@ class AndroidOptionsInitializerTest { assertTrue( AndroidOptionsInitializer.getCacheDir(fixture.context) .path - .endsWith("${File.separator}cache${File.separator}sentry") + .endsWith("${File.separator}cache${File.separator}sentry"), ) } @@ -300,8 +300,8 @@ class AndroidOptionsInitializerTest { assertTrue( fixture.sentryOptions.profilingTracesDirPath?.endsWith( - "${File.separator}cache${File.separator}sentry${File.separator}profiling_traces" - )!! + "${File.separator}cache${File.separator}sentry${File.separator}profiling_traces", + )!!, ) assertFalse(File(fixture.sentryOptions.profilingTracesDirPath!!).exists()) } @@ -312,8 +312,8 @@ class AndroidOptionsInitializerTest { assertTrue( fixture.sentryOptions.outboxPath?.endsWith( - "${File.separator}cache${File.separator}sentry${File.separator}outbox" - )!! + "${File.separator}cache${File.separator}sentry${File.separator}outbox", + )!!, ) } @@ -407,7 +407,7 @@ class AndroidOptionsInitializerTest { configureOptions = { dsn = SAAS_DSN this.sslSocketFactory = sslSocketFactory - } + }, ) assertEquals(sslSocketFactory, fixture.sentryOptions.sslSocketFactory) @@ -438,7 +438,7 @@ class AndroidOptionsInitializerTest { assertTrue( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("PerfettoContinuousProfiling") + .contains("PerfettoContinuousProfiling"), ) } @@ -451,7 +451,7 @@ class AndroidOptionsInitializerTest { assertFalse( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("PerfettoContinuousProfiling") + .contains("PerfettoContinuousProfiling"), ) } @@ -502,7 +502,7 @@ class AndroidOptionsInitializerTest { configureOptions = { profilesSampleRate = 1.0 isEnableLegacyProfiling = false - } + }, ) assertEquals(NoOpTransactionProfiler.getInstance(), fixture.sentryOptions.transactionProfiler) @@ -515,7 +515,7 @@ class AndroidOptionsInitializerTest { configureOptions = { profilesSampler = mock() isEnableLegacyProfiling = false - } + }, ) assertEquals(NoOpTransactionProfiler.getInstance(), fixture.sentryOptions.transactionProfiler) @@ -530,7 +530,7 @@ class AndroidOptionsInitializerTest { configureOptions = { profilesSampleRate = 1.0 isEnableLegacyProfiling = false - } + }, ) assertEquals(NoOpTransactionProfiler.getInstance(), fixture.sentryOptions.transactionProfiler) @@ -638,7 +638,7 @@ class AndroidOptionsInitializerTest { @Test fun `NdkIntegration will load SentryNdk class and add to the integration list`() { fixture.initSutWithClassLoader( - classesToLoad = listOfNotNull(NdkIntegration.SENTRY_NDK_CLASS_NAME) + classesToLoad = listOfNotNull(NdkIntegration.SENTRY_NDK_CLASS_NAME), ) val actual = fixture.sentryOptions.integrations.firstOrNull { it is NdkIntegration } @@ -818,7 +818,7 @@ class AndroidOptionsInitializerTest { assertFalse( (activityLifeCycleIntegration as ActivityLifecycleIntegration) .activityFramesTracker - .isFrameMetricsAggregatorAvailable + .isFrameMetricsAggregatorAvailable, ) } @@ -839,7 +839,7 @@ class AndroidOptionsInitializerTest { assertTrue( (activityLifeCycleIntegration as ActivityLifecycleIntegration) .activityFramesTracker - .isFrameMetricsAggregatorAvailable + .isFrameMetricsAggregatorAvailable, ) } @@ -857,7 +857,7 @@ class AndroidOptionsInitializerTest { assertFalse( (activityLifeCycleIntegration as ActivityLifecycleIntegration) .activityFramesTracker - .isFrameMetricsAggregatorAvailable + .isFrameMetricsAggregatorAvailable, ) } @@ -876,7 +876,7 @@ class AndroidOptionsInitializerTest { assertFalse( (activityLifeCycleIntegration as ActivityLifecycleIntegration) .activityFramesTracker - .isFrameMetricsAggregatorAvailable + .isFrameMetricsAggregatorAvailable, ) } @@ -898,7 +898,7 @@ class AndroidOptionsInitializerTest { assertTrue( (activityLifeCycleIntegration as ActivityLifecycleIntegration) .activityFramesTracker - .isFrameMetricsAggregatorAvailable + .isFrameMetricsAggregatorAvailable, ) } @@ -954,7 +954,7 @@ class AndroidOptionsInitializerTest { listOf( AndroidOptionsInitializer.COMPOSE_CLASS_NAME, AndroidOptionsInitializer.SENTRY_COMPOSE_GESTURE_INTEGRATION_CLASS_NAME, - ) + ), ) assertTrue { fixture.sentryOptions.gestureTargetLocators.size == 2 } @@ -981,7 +981,7 @@ class AndroidOptionsInitializerTest { fixture.initSut() assertIs( - fixture.sentryOptions.compositePerformanceCollector + fixture.sentryOptions.compositePerformanceCollector, ) } @@ -1118,7 +1118,7 @@ class AndroidOptionsInitializerTest { AndroidOptionsInitializer.getCacheDir(fixture.context), PersistingScopeObserver.SCOPE_CACHE, ) - .exists() + .exists(), ) } @@ -1134,7 +1134,7 @@ class AndroidOptionsInitializerTest { threadChecker = mock() setSocketTagger(mock()) compositePerformanceCollector = mock() - } + }, ) assertFalse { fixture.sentryOptions.transportGate is AndroidTransportGate } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/AndroidProfilerTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/AndroidProfilerTest.kt index f402af24f80..8f493343d1e 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/AndroidProfilerTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/AndroidProfilerTest.kt @@ -153,12 +153,12 @@ class AndroidProfilerTest { assertFailsWith { ctor.newInstance( - arrayOf(null, 0, mock(), { mock() }, mock()) + arrayOf(null, 0, mock(), { mock() }, mock()), ) } assertFailsWith { ctor.newInstance( - arrayOf("mock", 0, null, { mock() }, mock()) + arrayOf("mock", 0, null, { mock() }, mock()), ) } assertFailsWith { diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/AndroidTransportGateTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/AndroidTransportGateTest.kt index 24817c85bdf..b275eaad8d2 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/AndroidTransportGateTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/AndroidTransportGateTest.kt @@ -31,14 +31,14 @@ class AndroidTransportGateTest { @Test fun `isConnected returns false if connection is not connected`() { assertFalse( - fixture.getSut().isConnected(IConnectionStatusProvider.ConnectionStatus.DISCONNECTED) + fixture.getSut().isConnected(IConnectionStatusProvider.ConnectionStatus.DISCONNECTED), ) } @Test fun `isConnected returns false if no permission`() { assertTrue( - fixture.getSut().isConnected(IConnectionStatusProvider.ConnectionStatus.NO_PERMISSION) + fixture.getSut().isConnected(IConnectionStatusProvider.ConnectionStatus.NO_PERMISSION), ) } } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/AnrV2IntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/AnrV2IntegrationTest.kt index e41d5778a7f..5d43c28ede3 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/AnrV2IntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/AnrV2IntegrationTest.kt @@ -79,7 +79,7 @@ class AnrV2IntegrationTest : ApplicationExitIntegrationTestBase() { Cmd line: com.example.app:mainProcess """ .trimIndent() - .byteInputStream() + .byteInputStream(), ) } else { whenever(mock.traceInputStream) @@ -115,7 +115,7 @@ class AnrV2IntegrationTest : ApplicationExitIntegrationTestBase() { (no managed stack frames) """ .trimIndent() - .byteInputStream() + .byteInputStream(), ) } } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/AppLifecycleIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/AppLifecycleIntegrationTest.kt index 896673085c2..eb417ee34bd 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/AppLifecycleIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/AppLifecycleIntegrationTest.kt @@ -69,9 +69,9 @@ class AppLifecycleIntegrationTest { assertNotNull(sut.watcher) Thread { - sut.close() - latch.countDown() - } + sut.close() + latch.countDown() + } .start() latch.await() diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/AppStartExtensionTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/AppStartExtensionTest.kt index 38f7f29e7df..20d4dc0b194 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/AppStartExtensionTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/AppStartExtensionTest.kt @@ -49,9 +49,9 @@ class AppStartExtensionTest { val done = CountDownLatch(1) val run = { Thread { - call() - done.countDown() - } + call() + done.countDown() + } .start() succeeded.set(done.await(2, TimeUnit.SECONDS)) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/AppStateTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/AppStateTest.kt index 4fe39b20f2e..27a8604950c 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/AppStateTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/AppStateTest.kt @@ -331,9 +331,9 @@ class AppStateTest { // Add listeners concurrently listeners.forEach { listener -> Thread { - sut.addAppStateListener(listener) - latch.countDown() - } + sut.addAppStateListener(listener) + latch.countDown() + } .start() } latch.await() diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitInfoCrossIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitInfoCrossIntegrationTest.kt index cac76c024af..104e0f6b3bc 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitInfoCrossIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitInfoCrossIntegrationTest.kt @@ -105,7 +105,7 @@ class ApplicationExitInfoCrossIntegrationTest { at android.os.Looper.loop(Looper.java:313) """ .trimIndent() - .byteInputStream() + .byteInputStream(), ) } shadowActivityManager.addApplicationExitInfo(exitInfo) @@ -121,8 +121,8 @@ class ApplicationExitInfoCrossIntegrationTest { whenever(mock.traceInputStream) .thenReturn( GZIPInputStream( - TombstoneIntegrationTest::class.java.getResourceAsStream("/tombstone.pb.gz") - ) + TombstoneIntegrationTest::class.java.getResourceAsStream("/tombstone.pb.gz"), + ), ) } shadowActivityManager.addApplicationExitInfo(exitInfo) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitInfoEventProcessorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitInfoEventProcessorTest.kt index 12c1bf08429..595e8bc28f1 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitInfoEventProcessorTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitInfoEventProcessorTest.kt @@ -820,7 +820,7 @@ class ApplicationExitInfoEventProcessorTest { brand = "Pixel" model = "3XL" memorySize = 4096 - } + }, ) platform = "NotAndroid" @@ -837,7 +837,7 @@ class ApplicationExitInfoEventProcessorTest { DebugImage().apply { type = DebugImage.PROGUARD uuid = "uuid1" - } + }, ) } user = @@ -893,7 +893,7 @@ class ApplicationExitInfoEventProcessorTest { lineno = 777 module = "io.sentry.samples.MainActivity" function = "run" - } + }, ) } @@ -905,7 +905,7 @@ class ApplicationExitInfoEventProcessorTest { name = "main" id = 13 this.stacktrace = stacktrace - } + }, ) } @@ -947,7 +947,7 @@ class ApplicationExitInfoEventProcessorTest { SentryThread().apply { name = "main" stacktrace = SentryStackTrace() - } + }, ) } @@ -966,7 +966,7 @@ class ApplicationExitInfoEventProcessorTest { SentryThread().apply { name = "main" stacktrace = SentryStackTrace() - } + }, ) } @@ -988,10 +988,10 @@ class ApplicationExitInfoEventProcessorTest { SentryStackFrame().apply { module = "io.sentry.samples.MainActivity" function = "run" - } - ) + }, + ), ) - } + }, ) } assertEquals(listOf("{{ default }}", "background-anr"), processedBackground.fingerprints) @@ -1008,10 +1008,10 @@ class ApplicationExitInfoEventProcessorTest { SentryStackFrame().apply { module = "io.sentry.samples.MainActivity" function = "run" - } - ) + }, + ), ) - } + }, ) } assertEquals(listOf("{{ default }}", "foreground-anr"), processedForeground.fingerprints) @@ -1026,7 +1026,7 @@ class ApplicationExitInfoEventProcessorTest { NoOpLogger.getInstance(), 0, true, - ) + ), ) val processed = @@ -1054,7 +1054,7 @@ class ApplicationExitInfoEventProcessorTest { NoOpLogger.getInstance(), 1_000, true, - ) + ), ) val processed = @@ -1074,7 +1074,7 @@ class ApplicationExitInfoEventProcessorTest { type = "MemoryLimitExceeded" value = expectedMessage mechanism = Mechanism().apply { type = "AppExitInfo" } - } + }, ) } @@ -1113,10 +1113,10 @@ class ApplicationExitInfoEventProcessorTest { module = "java.lang" filename = "Thread.java" function = "run" - } + }, ) } - } + }, ) } @@ -1142,10 +1142,10 @@ class ApplicationExitInfoEventProcessorTest { module = "java.lang" filename = "Thread.java" function = "run" - } + }, ) } - } + }, ) } @@ -1170,10 +1170,10 @@ class ApplicationExitInfoEventProcessorTest { SentryStackFrame().apply { module = "com.example.MyApp" function = "onCreate" - } + }, ) } - } + }, ) } @@ -1197,10 +1197,10 @@ class ApplicationExitInfoEventProcessorTest { SentryStackFrame().apply { module = "com.example.MyApp" function = "onCreate" - } + }, ) } - } + }, ) } assertNull(processed.contexts.profile) @@ -1237,7 +1237,7 @@ class ApplicationExitInfoEventProcessorTest { ), StackTraceElement("android.os.Handler", "dispatchMessage", "Handler.java", 5678), ), - ) + ), ) close() } @@ -1290,7 +1290,7 @@ class ApplicationExitInfoEventProcessorTest { StackTraceElement("com.example.MyApp", "blocked", "MyApp.java", 42), StackTraceElement("android.os.Handler", "dispatchMessage", "Handler.java", 5678), ), - ) + ), ) close() } @@ -1473,7 +1473,7 @@ class ApplicationExitInfoEventProcessorTest { timestamp, shouldEnrich, mechanism == "anr_background", - ) + ), ) } @@ -1487,7 +1487,7 @@ class ApplicationExitInfoEventProcessorTest { NoOpLogger.getInstance(), timestamp, shouldEnrich, - ) + ), ) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitIntegrationTestBase.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitIntegrationTestBase.kt index 3de3e054630..30214fe52c1 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitIntegrationTestBase.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ApplicationExitIntegrationTestBase.kt @@ -403,7 +403,7 @@ abstract class ApplicationExitIntegrationTestBase { ) protected class ApplicationExitTestFixture( - private val config: IntegrationTestConfig + private val config: IntegrationTestConfig, ) { lateinit var context: Context lateinit var shadowActivityManager: ShadowActivityManager diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ContextUtilsTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ContextUtilsTest.kt index 2e540ee13df..b0787b0b9a8 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ContextUtilsTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ContextUtilsTest.kt @@ -139,12 +139,12 @@ class ContextUtilsTest { mockedPackageManager.getApplicationInfo( any(), any(), - ) + ), ) .thenReturn(mockedApplicationInfo) whenever( - mockedPackageManager.getPackageInfo(any(), any()) + mockedPackageManager.getPackageInfo(any(), any()), ) .thenReturn(mockedPackageInfo) @@ -200,7 +200,7 @@ class ContextUtilsTest { availMem = 128 totalMem = 2048 lowMemory = true - } + }, ) val memInfo = ContextUtils.getMemInfo(context, logger) assertEquals(128, memInfo!!.availMem) @@ -257,8 +257,8 @@ class ContextUtilsTest { processName = "io.sentry.android.core.test" pid = Process.myPid() importance = RunningAppProcessInfo.IMPORTANCE_TOP_SLEEPING - } - ) + }, + ), ) assertFalse(ContextUtils.isForegroundImportance()) } @@ -299,18 +299,18 @@ class ContextUtilsTest { assertTrue( ContextUtils.appIsLibraryForComposePreview( - getMockContext("com.example.library.test", "androidx.compose.ui.tooling.PreviewActivity") - ) + getMockContext("com.example.library.test", "androidx.compose.ui.tooling.PreviewActivity"), + ), ) assertFalse( ContextUtils.appIsLibraryForComposePreview( - getMockContext("com.example.library.test", "com.example.HomeActivity") - ) + getMockContext("com.example.library.test", "com.example.HomeActivity"), + ), ) assertFalse( ContextUtils.appIsLibraryForComposePreview( - getMockContext("com.example.library", "androidx.compose.ui.tooling.PreviewActivity") - ) + getMockContext("com.example.library", "androidx.compose.ui.tooling.PreviewActivity"), + ), ) } } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ContextUtilsTestHelper.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ContextUtilsTestHelper.kt index cd09d280d1a..9d18a4fd405 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ContextUtilsTestHelper.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ContextUtilsTestHelper.kt @@ -23,7 +23,10 @@ object ContextUtilsTestHelper { whenever(mockContext.packageName).thenReturn("io.sentry.sample.test") whenever(mockContext.packageManager).thenReturn(mockPackageManager) whenever( - mockPackageManager.getApplicationInfo(mockContext.packageName, PackageManager.GET_META_DATA) + mockPackageManager.getApplicationInfo( + mockContext.packageName, + PackageManager.GET_META_DATA, + ), ) .thenReturn(mockApplicationInfo) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/DefaultAndroidEventProcessorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/DefaultAndroidEventProcessorTest.kt index 460e0bbec1d..3badbdbd853 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/DefaultAndroidEventProcessorTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/DefaultAndroidEventProcessorTest.kt @@ -194,7 +194,7 @@ class DefaultAndroidEventProcessorTest { SentryThread().apply { id = 10L isCurrent = true - } + }, ) } @@ -582,8 +582,8 @@ class DefaultAndroidEventProcessorTest { function = "onCreate" module = "com.example.Application" filename = "Application.java" - } - ) + }, + ), ) }, SentryException().apply { @@ -598,8 +598,8 @@ class DefaultAndroidEventProcessorTest { function = "run" module = "com.android.internal.os.RuntimeInit\$MethodAndArgsCaller" filename = "RuntimeInit.java" - } - ) + }, + ), ) }, ) @@ -629,8 +629,8 @@ class DefaultAndroidEventProcessorTest { function = "onCreate" module = "com.example.Application" filename = "Application.java" - } - ) + }, + ), ) }, SentryException().apply { @@ -643,8 +643,8 @@ class DefaultAndroidEventProcessorTest { function = "onCreate" module = "com.example.Application" filename = "Application.java" - } - ) + }, + ), ) }, ) @@ -689,7 +689,7 @@ class DefaultAndroidEventProcessorTest { DateUtils.dateToSeconds(DateUtils.getDateTime("2004-04-10T18:24:03.000Z")), "message", SentryLogLevel.WARN, - ) + ), ) assertNotNull(processedEvent?.attributes?.get("device.brand")) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/DeviceInfoUtilTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/DeviceInfoUtilTest.kt index fffdf6257ea..5d75ae983cc 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/DeviceInfoUtilTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/DeviceInfoUtilTest.kt @@ -32,7 +32,7 @@ class DeviceInfoUtilTest { context.sendStickyBroadcast( Intent(Intent.ACTION_BATTERY_CHANGED) .putExtra(BatteryManager.EXTRA_LEVEL, 75) - .putExtra(BatteryManager.EXTRA_PLUGGED, 0) + .putExtra(BatteryManager.EXTRA_PLUGGED, 0), ) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/EnvelopeFileObserverIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/EnvelopeFileObserverIntegrationTest.kt index 0b13f4ca4d8..fb2c23fff9c 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/EnvelopeFileObserverIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/EnvelopeFileObserverIntegrationTest.kt @@ -31,7 +31,7 @@ class EnvelopeFileObserverIntegrationTest { val logger = mock() fun getSut( - optionConfiguration: (SentryAndroidOptions) -> Unit = {} + optionConfiguration: (SentryAndroidOptions) -> Unit = {}, ): EnvelopeFileObserverIntegration { options = SentryAndroidOptions() options.setLogger(logger) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/FeedbackShakeIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/FeedbackShakeIntegrationTest.kt index f2118fb76de..82f7964bf04 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/FeedbackShakeIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/FeedbackShakeIntegrationTest.kt @@ -472,7 +472,7 @@ class FeedbackShakeIntegrationTest { val intervalNs = 20_000_000L for (i in 0 until 20) { listener.onSensorChanged( - createSensorEvent(floatArrayOf(20f, 0f, 0f), baseTimestamp + i * intervalNs) + createSensorEvent(floatArrayOf(20f, 0f, 0f), baseTimestamp + i * intervalNs), ) } } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/InternalSentrySdkTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/InternalSentrySdkTest.kt index 031df4c523c..baa46fdd3bb 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/InternalSentrySdkTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/InternalSentrySdkTest.kt @@ -160,10 +160,10 @@ class InternalSentrySdkTest { metrics.appStartType = AppStartMetrics.AppStartType.WARM metrics.appStartTimeSpan.setStartedAt( - 20 + 20, ) // Can't be 0, as that's the default value if not set metrics.appStartTimeSpan.setStartUnixTimeMs( - 20 + 20, ) // The order matters, unix time must be set after started at in tests to avoid overwrite metrics.appStartTimeSpan.setStoppedAt(200) metrics.classLoadedUptimeMs = 100 @@ -171,29 +171,29 @@ class InternalSentrySdkTest { AppStartMetrics.onApplicationCreate(mock()) metrics.applicationOnCreateTimeSpan.description = "Application created" metrics.applicationOnCreateTimeSpan.setStartedAt( - 30 + 30, ) // Can't be 0, as that's the default value if not set metrics.applicationOnCreateTimeSpan.setStartUnixTimeMs( - 30 + 30, ) // The order matters, unix time must be set after started at in tests to avoid overwrite metrics.applicationOnCreateTimeSpan.setStoppedAt(40) val activityLifecycleSpan = ActivityLifecycleTimeSpan() activityLifecycleSpan.onCreate.description = "Test Activity Lifecycle onCreate" activityLifecycleSpan.onCreate.setStartedAt( - 50 + 50, ) // Can't be 0, as that's the default value if not set activityLifecycleSpan.onCreate.setStartUnixTimeMs( - 50 + 50, ) // The order matters, unix time must be set after started at in tests to avoid overwrite activityLifecycleSpan.onCreate.setStoppedAt(60) activityLifecycleSpan.onStart.description = "Test Activity Lifecycle onStart" activityLifecycleSpan.onStart.setStartedAt( - 70 + 70, ) // Can't be 0, as that's the default value if not set activityLifecycleSpan.onStart.setStartUnixTimeMs( - 70 + 70, ) // The order matters, unix time must be set after started at in tests to avoid overwrite activityLifecycleSpan.onStart.setStoppedAt(80) metrics.addActivityLifecycleTimeSpans(activityLifecycleSpan) @@ -214,10 +214,10 @@ class InternalSentrySdkTest { metrics.appStartType = AppStartMetrics.AppStartType.WARM metrics.appStartTimeSpan.setStartedAt( - 20 + 20, ) // Can't be 0, as that's the default value if not set metrics.appStartTimeSpan.setStartUnixTimeMs( - 20 + 20, ) // The order matters, unix time must be set after started at in tests to avoid overwrite metrics.appStartTimeSpan.setStoppedAt(200) metrics.classLoadedUptimeMs = 100 @@ -225,10 +225,10 @@ class InternalSentrySdkTest { AppStartMetrics.onApplicationCreate(mock()) metrics.applicationOnCreateTimeSpan.description = "Application created" metrics.applicationOnCreateTimeSpan.setStartedAt( - 30 + 30, ) // Can't be 0, as that's the default value if not set metrics.applicationOnCreateTimeSpan.setStartUnixTimeMs( - 30 + 30, ) // The order matters, unix time must be set after started at in tests to avoid overwrite metrics.applicationOnCreateTimeSpan.setStoppedAt(40) } @@ -239,10 +239,10 @@ class InternalSentrySdkTest { metrics.appStartType = AppStartMetrics.AppStartType.WARM metrics.appStartTimeSpan.setStartedAt( - 20 + 20, ) // Can't be 0, as that's the default value if not set metrics.appStartTimeSpan.setStartUnixTimeMs( - 20 + 20, ) // The order matters, unix time must be set after started at in tests to avoid overwrite metrics.appStartTimeSpan.setStoppedAt(200) metrics.classLoadedUptimeMs = 100 @@ -250,7 +250,7 @@ class InternalSentrySdkTest { AppStartMetrics.onApplicationCreate(mock()) metrics.applicationOnCreateTimeSpan.description = "Application created" metrics.applicationOnCreateTimeSpan.setStartedAt( - 30 + 30, ) // Can't be 0, as that's the default value if not set val activityLifecycleSpan = @@ -400,7 +400,7 @@ class InternalSentrySdkTest { val serializedScope = InternalSentrySdk.serializeScope(context, options, scope) assertTrue( - ((serializedScope["contexts"] as Map<*, *>)["app"] as Map<*, *>).containsKey("app_name") + ((serializedScope["contexts"] as Map<*, *>)["app"] as Map<*, *>).containsKey("app_name"), ) } @@ -478,7 +478,7 @@ class InternalSentrySdkTest { val capturedNewSessionStart = fixture.options.serializer.deserialize( InputStreamReader( - ByteArrayInputStream(capturedStartSessionEnvelope.items.toList()[0].data) + ByteArrayInputStream(capturedStartSessionEnvelope.items.toList()[0].data), ), Session::class.java, )!! @@ -518,7 +518,7 @@ class InternalSentrySdkTest { // when capture envelope is called with an unhandled event through the non-terminating API fixture.captureEnvelopeNonTerminatingWithEvent( - fixture.createSentryEventWithUnhandledException() + fixture.createSentryEventWithUnhandledException(), ) // then only the original event envelope is captured, without a session item @@ -577,7 +577,7 @@ class InternalSentrySdkTest { fixture.init(context) fixture.captureEnvelopeNonTerminatingWithEvent( - fixture.createSentryEventWithUnhandledException() + fixture.createSentryEventWithUnhandledException(), ) fixture.capturedEnvelopes.clear() @@ -606,7 +606,7 @@ class InternalSentrySdkTest { fixture.init(context) fixture.captureEnvelopeNonTerminatingWithEvent( - fixture.createSentryEventWithUnhandledException() + fixture.createSentryEventWithUnhandledException(), ) val unhandledSession = AtomicReference() Sentry.configureScope { scope -> unhandledSession.set(scope.session) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/LifecycleWatcherTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/LifecycleWatcherTest.kt index 5f14e029d0e..1bafcdfdbde 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/LifecycleWatcherTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/LifecycleWatcherTest.kt @@ -154,7 +154,7 @@ class LifecycleWatcherTest { assertEquals("navigation", it.type) assertEquals(SentryLevel.INFO, it.level) // cant assert data, its not a public API - } + }, ) } @@ -177,7 +177,7 @@ class LifecycleWatcherTest { assertEquals("navigation", it.type) assertEquals(SentryLevel.INFO, it.level) // cant assert data, its not a public API - } + }, ) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt index 9ae1a9b023d..a6a3f1f34fd 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt @@ -1197,7 +1197,8 @@ class ManifestMetadataReaderTest { // Arrange val bundle = bundleOf( - ManifestMetadataReader.TRACE_PROPAGATION_TARGETS to """localhost,^(http|https)://api\..*$""" + ManifestMetadataReader.TRACE_PROPAGATION_TARGETS to + """localhost,^(http|https)://api\..*$""", ) val context = fixture.getContext(metaData = bundle) @@ -1738,7 +1739,7 @@ class ManifestMetadataReaderTest { val bundle = bundleOf( ManifestMetadataReader.SENTRY_GRADLE_PLUGIN_INTEGRATIONS to - "Database Instrumentation,OkHttp Instrumentation" + "Database Instrumentation,OkHttp Instrumentation", ) val context = fixture.getContext(metaData = bundle) @@ -2041,13 +2042,13 @@ class ManifestMetadataReaderTest { // Assert assertTrue( fixture.options.sessionReplay.unmaskViewClasses.contains( - SentryReplayOptions.IMAGE_VIEW_CLASS_NAME - ) + SentryReplayOptions.IMAGE_VIEW_CLASS_NAME, + ), ) assertTrue( fixture.options.sessionReplay.unmaskViewClasses.contains( - SentryReplayOptions.TEXT_VIEW_CLASS_NAME - ) + SentryReplayOptions.TEXT_VIEW_CLASS_NAME, + ), ) } @@ -2062,13 +2063,13 @@ class ManifestMetadataReaderTest { // Assert assertTrue( fixture.options.sessionReplay.maskViewClasses.contains( - SentryReplayOptions.IMAGE_VIEW_CLASS_NAME - ) + SentryReplayOptions.IMAGE_VIEW_CLASS_NAME, + ), ) assertTrue( fixture.options.sessionReplay.maskViewClasses.contains( - SentryReplayOptions.TEXT_VIEW_CLASS_NAME - ) + SentryReplayOptions.TEXT_VIEW_CLASS_NAME, + ), ) } @@ -2144,7 +2145,7 @@ class ManifestMetadataReaderTest { // Arrange val bundle = bundleOf( - ManifestMetadataReader.IN_APP_INCLUDES to "com.example.package1,com.example.package2" + ManifestMetadataReader.IN_APP_INCLUDES to "com.example.package1,com.example.package2", ) val context = fixture.getContext(metaData = bundle) @@ -2175,7 +2176,7 @@ class ManifestMetadataReaderTest { // Arrange val bundle = bundleOf( - ManifestMetadataReader.IN_APP_EXCLUDES to "com.example.excluded1,com.example.excluded2" + ManifestMetadataReader.IN_APP_EXCLUDES to "com.example.excluded1,com.example.excluded2", ) val context = fixture.getContext(metaData = bundle) @@ -2799,7 +2800,7 @@ class ManifestMetadataReaderTest { val bundle = bundleOf( ManifestMetadataReader.REPLAYS_NETWORK_DETAIL_ALLOW_URLS to - " https://api.example.com/.* , https://cdn.example.com/.* " + " https://api.example.com/.* , https://cdn.example.com/.* ", ) val context = fixture.getContext(metaData = bundle) @@ -2819,7 +2820,7 @@ class ManifestMetadataReaderTest { val bundle = bundleOf( ManifestMetadataReader.REPLAYS_NETWORK_REQUEST_HEADERS to - " Authorization , X-Custom-Header " + " Authorization , X-Custom-Header ", ) val context = fixture.getContext(metaData = bundle) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/NetworkBreadcrumbsIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/NetworkBreadcrumbsIntegrationTest.kt index 711f5f7fe0b..4ed43a40c3b 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/NetworkBreadcrumbsIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/NetworkBreadcrumbsIntegrationTest.kt @@ -132,7 +132,7 @@ class NetworkBreadcrumbsIntegrationTest { assertEquals("network.event", it.category) assertEquals(SentryLevel.INFO, it.level) assertEquals("NETWORK_AVAILABLE", it.data["action"]) - } + }, ) } @@ -154,7 +154,7 @@ class NetworkBreadcrumbsIntegrationTest { assertEquals("network.event", it.category) assertEquals(SentryLevel.INFO, it.level) assertEquals("NETWORK_LOST", it.data["action"]) - } + }, ) } @@ -448,7 +448,7 @@ class NetworkBreadcrumbsIntegrationTest { } private fun KInOrder.verifyBreadcrumbInOrder( - check: (detail: NetworkBreadcrumbConnectionDetail) -> Unit + check: (detail: NetworkBreadcrumbConnectionDetail) -> Unit, ) { verify(fixture.scopes, times(1)) .addBreadcrumb( diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/PerfettoContinuousProfilerTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/PerfettoContinuousProfilerTest.kt index 3bafc29be3d..cc0d63bb6a1 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/PerfettoContinuousProfilerTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/PerfettoContinuousProfilerTest.kt @@ -80,7 +80,7 @@ class PerfettoContinuousProfilerTest { } fun getSut( - optionConfig: ((options: SentryAndroidOptions) -> Unit) = {} + optionConfig: ((options: SentryAndroidOptions) -> Unit) = {}, ): PerfettoContinuousProfiler { options.executorService = executor optionConfig(options) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/PerfettoProfilerTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/PerfettoProfilerTest.kt index a21ca435b6a..a745143a38e 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/PerfettoProfilerTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/PerfettoProfilerTest.kt @@ -151,7 +151,7 @@ class PerfettoProfilerTest { val result = AtomicReference(File("sentinel")) capturedCallback.accept( - mockResult(errorCode = ProfilingResult.ERROR_UNKNOWN, errorMessage = "unknown error") + mockResult(errorCode = ProfilingResult.ERROR_UNKNOWN, errorMessage = "unknown error"), ) profiler.endAndCollect { result.set(it) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/PerformanceAndroidEventProcessorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/PerformanceAndroidEventProcessorTest.kt index 0ab922fc32a..c6b4b73fa78 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/PerformanceAndroidEventProcessorTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/PerformanceAndroidEventProcessorTest.kt @@ -288,7 +288,7 @@ class PerformanceAndroidEventProcessorTest { emptyMap(), emptyMap(), null, - ) + ), ) tr.spans.add( SentrySpan( @@ -304,7 +304,7 @@ class PerformanceAndroidEventProcessorTest { emptyMap(), emptyMap(), null, - ) + ), ) tr.spans.add( SentrySpan( @@ -320,7 +320,7 @@ class PerformanceAndroidEventProcessorTest { emptyMap(), emptyMap(), null, - ) + ), ) tr = sut.process(tr, Hint()) @@ -590,7 +590,7 @@ class PerformanceAndroidEventProcessorTest { val metrics = mapOf( MeasurementValue.KEY_FRAMES_TOTAL to - MeasurementValue(1f, MeasurementUnit.Duration.MILLISECOND.apiName()) + MeasurementValue(1f, MeasurementUnit.Duration.MILLISECOND.apiName()), ) whenever(fixture.activityFramesTracker.takeMetrics(any())).thenReturn(metrics) @@ -643,7 +643,7 @@ class PerformanceAndroidEventProcessorTest { assertTrue(tr.spans.any { "process.load" == it.op && appStartSpan.spanId == it.parentSpanId }) assertTrue( - tr.spans.any { "contentprovider.load" == it.op && appStartSpan.spanId == it.parentSpanId } + tr.spans.any { "contentprovider.load" == it.op && appStartSpan.spanId == it.parentSpanId }, ) assertTrue(tr.spans.any { "application.load" == it.op }) @@ -744,7 +744,7 @@ class PerformanceAndroidEventProcessorTest { "contentprovider.load" == it.op || "application.load" == it.op || "activity.load" == it.op - } + }, ) } @@ -795,7 +795,7 @@ class PerformanceAndroidEventProcessorTest { "contentprovider.load" == it.op || "application.load" == it.op || "activity.load" == it.op - } + }, ) } @@ -1266,7 +1266,7 @@ class PerformanceAndroidEventProcessorTest { } private fun createUiLoadTransactionWithAppStartChildSpan( - coldStart: Boolean = true + coldStart: Boolean = true, ): SentryTransaction = createUiLoadTransaction().also { txn -> txn.spans.add(createAppStartSpan(txn.contexts.trace!!.traceId, coldStart)) @@ -1275,7 +1275,7 @@ class PerformanceAndroidEventProcessorTest { private fun createUiLoadTransaction(): SentryTransaction = createTransaction(UI_LOAD_OP) private fun createStandaloneAppStartTransaction( - appStartScreen: String? = null + appStartScreen: String? = null, ): SentryTransaction = createTransaction(STANDALONE_APP_START_OP).also { txn -> if (appStartScreen != null) { diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ScreenshotEventProcessorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ScreenshotEventProcessorTest.kt index b27df5f6bf1..e33a62b08bf 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ScreenshotEventProcessorTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ScreenshotEventProcessorTest.kt @@ -596,7 +596,7 @@ private class EllipsizedTextActivity : Activity() { LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT).apply { setMargins(0, 8, 0, 0) } - } + }, ) // Ellipsize middle @@ -612,7 +612,7 @@ private class EllipsizedTextActivity : Activity() { LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT).apply { setMargins(0, 8, 0, 0) } - } + }, ) // Ellipsize start @@ -628,7 +628,7 @@ private class EllipsizedTextActivity : Activity() { LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT).apply { setMargins(0, 8, 0, 0) } - } + }, ) // Non-ellipsized text for comparison @@ -642,7 +642,7 @@ private class EllipsizedTextActivity : Activity() { LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT).apply { setMargins(0, 8, 0, 0) } - } + }, ) setContentView(linearLayout) @@ -779,7 +779,7 @@ private class MultiLineTextActivity : Activity() { LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT).apply { setMargins(0, 8, 0, 0) } - } + }, ) // Multi-line text with maxLines = 3 (wraps but capped) @@ -794,7 +794,7 @@ private class MultiLineTextActivity : Activity() { LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT).apply { setMargins(0, 8, 0, 0) } - } + }, ) // Short single-line text for comparison @@ -808,7 +808,7 @@ private class MultiLineTextActivity : Activity() { LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT).apply { setMargins(0, 8, 0, 0) } - } + }, ) setContentView(linearLayout) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SendCachedEnvelopeIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SendCachedEnvelopeIntegrationTest.kt index 32b38764626..46df2ee227c 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SendCachedEnvelopeIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SendCachedEnvelopeIntegrationTest.kt @@ -63,7 +63,7 @@ class SendCachedEnvelopeIntegrationTest { sender } else { null - } + }, ) return SendCachedEnvelopeIntegration(factory, LazyEvaluator { hasStartupCrashMarker }) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidOptionsTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidOptionsTest.kt index a223358c1d1..0934ab97a5f 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidOptionsTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidOptionsTest.kt @@ -33,13 +33,13 @@ class SentryAndroidOptionsTest { assertTrue( sdkVersion.packageSet.any { it.name == "maven:io.sentry:sentry-android-core" && it.version == BuildConfig.VERSION_NAME - } + }, ) assertTrue( sdkVersion.packageSet.any { it.name == "maven:io.sentry:sentry" && it.version == BuildConfig.VERSION_NAME - } + }, ) } @@ -179,7 +179,7 @@ class SentryAndroidOptionsTest { fun `ndk handler strategy option can be changed`() { val sentryOptions = SentryAndroidOptions() sentryOptions.setNativeHandlerStrategy( - NdkHandlerStrategy.SENTRY_HANDLER_STRATEGY_CHAIN_AT_START + NdkHandlerStrategy.SENTRY_HANDLER_STRATEGY_CHAIN_AT_START, ) assertEquals( NdkHandlerStrategy.SENTRY_HANDLER_STRATEGY_CHAIN_AT_START.value, diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt index 36a23bf3688..2717128af95 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt @@ -163,7 +163,7 @@ class SentryAndroidTest { (no managed stack frames) """ .trimIndent() - .byteInputStream() + .byteInputStream(), ) } shadowActivityManager.addApplicationExitInfo(exitInfo) @@ -251,7 +251,7 @@ class SentryAndroidTest { SystemEventsBreadcrumbsIntegration( ApplicationProvider.getApplicationContext(), CustomHandler(Looper.getMainLooper()), - ) + ), ) refOptions = it } @@ -454,7 +454,7 @@ class SentryAndroidTest { } await .withAlias( - "Failed because of BeforeSend callback above, but we swallow BeforeSend exceptions, hence the timeout" + "Failed because of BeforeSend callback above, but we swallow BeforeSend exceptions, hence the timeout", ) .untilTrue(asserted) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryPerformanceProviderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryPerformanceProviderTest.kt index bff6cdfad37..f5a6bfcd919 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryPerformanceProviderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryPerformanceProviderTest.kt @@ -148,7 +148,7 @@ class SentryPerformanceProviderTest { .log( eq(SentryLevel.WARNING), eq( - "Unable to deserialize the SentryAppStartProfilingOptions. App start profiling will not start." + "Unable to deserialize the SentryAppStartProfilingOptions. App start profiling will not start.", ), ) } @@ -163,7 +163,7 @@ class SentryPerformanceProviderTest { .log( eq(SentryLevel.WARNING), eq( - "Unable to deserialize the SentryAppStartProfilingOptions. App start profiling will not start." + "Unable to deserialize the SentryAppStartProfilingOptions. App start profiling will not start.", ), ) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryRootCaSslSocketFactoryTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryRootCaSslSocketFactoryTest.kt index e55eb5508fc..81734a37053 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryRootCaSslSocketFactoryTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryRootCaSslSocketFactoryTest.kt @@ -35,7 +35,7 @@ class SentryRootCaSslSocketFactoryTest { assertThat(fingerprints) .containsExactly( // ISRG Root X1 - ISRG_ROOT_X1_SHA256 + ISRG_ROOT_X1_SHA256, ) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryScreenshotOptionsTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryScreenshotOptionsTest.kt index ad6d29b5614..9cb941e4b1d 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryScreenshotOptionsTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryScreenshotOptionsTest.kt @@ -41,10 +41,10 @@ class SentryScreenshotOptionsTest { assertTrue(options.maskViewClasses.contains(SentryMaskingOptions.WEB_VIEW_CLASS_NAME)) assertTrue(options.maskViewClasses.contains(SentryMaskingOptions.VIDEO_VIEW_CLASS_NAME)) assertTrue( - options.maskViewClasses.contains(SentryMaskingOptions.CAMERAX_PREVIEW_VIEW_CLASS_NAME) + options.maskViewClasses.contains(SentryMaskingOptions.CAMERAX_PREVIEW_VIEW_CLASS_NAME), ) assertTrue( - options.maskViewClasses.contains(SentryMaskingOptions.ANDROIDX_MEDIA_VIEW_CLASS_NAME) + options.maskViewClasses.contains(SentryMaskingOptions.ANDROIDX_MEDIA_VIEW_CLASS_NAME), ) assertTrue(options.maskViewClasses.contains(SentryMaskingOptions.EXOPLAYER_CLASS_NAME)) assertTrue(options.maskViewClasses.contains(SentryMaskingOptions.EXOPLAYER_STYLED_CLASS_NAME)) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryUserFeedbackFormTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryUserFeedbackFormTest.kt index 19414515b87..c95ab14e743 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryUserFeedbackFormTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryUserFeedbackFormTest.kt @@ -330,7 +330,7 @@ class SentryUserFeedbackFormTest { eq(SentryLevel.WARNING), eq( "Feedback screenshot button won't be shown. It requires the androidx.activity " + - "dependency and the feedback form being shown from a ComponentActivity." + "dependency and the feedback form being shown from a ComponentActivity.", ), ) } @@ -472,7 +472,7 @@ class SentryUserFeedbackFormTest { eq(SentryLevel.WARNING), eq( "Unable to determine the size of the selected screenshot, the attachment size limit " + - "is applied when the feedback is captured." + "is applied when the feedback is captured.", ), any(), ) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryWebViewTracingTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryWebViewTracingTest.kt index f6bb1747426..96f8e060f00 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryWebViewTracingTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryWebViewTracingTest.kt @@ -275,7 +275,7 @@ class SentryWebViewTracingTest { listOf("example.com"), Sentry.getCurrentScopes(), installer, - ) + ), ) .isTrue() shadowOf(Looper.getMainLooper()).idle() @@ -320,7 +320,7 @@ class SentryWebViewTracingTest { loadClass.isClassAvailable( eq(SentryWebViewTracing.SCRIPT_HANDLER_CLASS_NAME), any(), - ) + ), ) .thenReturn(false) @@ -330,7 +330,7 @@ class SentryWebViewTracingTest { listOf("example.com"), scopes, loadClass, - ) + ), ) .isFalse() // The adoption marker is registered on use, even when nothing can be installed. diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SpanFrameMetricsCollectorTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SpanFrameMetricsCollectorTest.kt index d5932b75b90..f49c5d02c18 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SpanFrameMetricsCollectorTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SpanFrameMetricsCollectorTest.kt @@ -61,7 +61,7 @@ class SpanFrameMetricsCollectorTest { SentryNanotimeDate(System.currentTimeMillis(), endTimeStampNanos) } else { null - } + }, ) return span } @@ -81,7 +81,7 @@ class SpanFrameMetricsCollectorTest { SentryNanotimeDate(System.currentTimeMillis(), endTimeStampNanos) } else { null - } + }, ) return span } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegrationTest.kt index 60282aca26d..88ddba69a09 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SystemEventsBreadcrumbsIntegrationTest.kt @@ -389,7 +389,7 @@ class SystemEventsBreadcrumbsIntegrationTest { assertTrue( AppState.getInstance().lifecycleObserver!!.listeners.any { it is SystemEventsBreadcrumbsIntegration - } + }, ) } @@ -403,7 +403,7 @@ class SystemEventsBreadcrumbsIntegrationTest { assertFalse( AppState.getInstance().lifecycleObserver!!.listeners.any { it is SystemEventsBreadcrumbsIntegration - } + }, ) } @@ -416,7 +416,7 @@ class SystemEventsBreadcrumbsIntegrationTest { assertTrue( AppState.getInstance().lifecycleObserver!!.listeners.any { it is SystemEventsBreadcrumbsIntegration - } + }, ) sut.close() @@ -424,7 +424,7 @@ class SystemEventsBreadcrumbsIntegrationTest { assertFalse( AppState.getInstance().lifecycleObserver!!.listeners.any { it is SystemEventsBreadcrumbsIntegration - } + }, ) } @@ -436,9 +436,9 @@ class SystemEventsBreadcrumbsIntegrationTest { sut.register(fixture.scopes, fixture.options) Thread { - sut.close() - latch.countDown() - } + sut.close() + latch.countDown() + } .start() latch.await() @@ -449,7 +449,7 @@ class SystemEventsBreadcrumbsIntegrationTest { assertFalse( AppState.getInstance().lifecycleObserver!!.listeners.any { it is SystemEventsBreadcrumbsIntegration - } + }, ) } @@ -520,9 +520,9 @@ class SystemEventsBreadcrumbsIntegrationTest { assertNotNull(sut.receiver) Thread { - sut.close() - latch.countDown() - } + sut.close() + latch.countDown() + } .start() latch.await() diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/TombstoneIntegrationTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/TombstoneIntegrationTest.kt index ca4c51319aa..83514adc260 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/TombstoneIntegrationTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/TombstoneIntegrationTest.kt @@ -58,8 +58,8 @@ class TombstoneIntegrationTest : ApplicationExitIntegrationTestBase(), - ) + ), ) .thenReturn(isLifecycleAvailable) whenever(scopes.options).thenReturn(options) @@ -109,7 +109,7 @@ class UserInteractionIntegrationTest { sut.onActivityResumed(fixture.activity) assertIs(fixture.activity.window.callback) assertIs( - (fixture.activity.window.callback as SentryWindowCallback).delegate + (fixture.activity.window.callback as SentryWindowCallback).delegate, ) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/WebViewTracePropagationScriptTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/WebViewTracePropagationScriptTest.kt index 210bdf80dad..ce7d3f02bc4 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/WebViewTracePropagationScriptTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/WebViewTracePropagationScriptTest.kt @@ -84,7 +84,7 @@ class WebViewTracePropagationScriptTest { "pwned", 1, null, - ) + ), ) return Result(metas, pwned) } finally { @@ -220,7 +220,7 @@ class WebViewTracePropagationScriptTest { fun `normalizeHosts drops blank entries and duplicates`() { val hosts = WebViewTracePropagationScript.normalizeHosts( - listOf(" ", "", "example.com", "https://EXAMPLE.com/", "other.com") + listOf(" ", "", "example.com", "https://EXAMPLE.com/", "other.com"), ) assertThat(hosts).containsExactly("example.com", "other.com").inOrder() @@ -250,7 +250,7 @@ class WebViewTracePropagationScriptTest { fun `originRules keep a non-default port`() { val rules = WebViewTracePropagationScript.originRules( - listOf("example.com:8443", "https://other.com:443/x", "[::1]:8080", "10.0.2.2:3000") + listOf("example.com:8443", "https://other.com:443/x", "[::1]:8080", "10.0.2.2:3000"), ) assertThat(rules) @@ -280,7 +280,7 @@ class WebViewTracePropagationScriptTest { assertThat(WebViewTracePropagationScript.stripTransactionFromBaggage(baggage)) .isEqualTo( "sentry-trace_id=d4cda95b652f4a1592b449d5929fda1b,sentry-environment=prod," + - "sentry-sample_rate=1.0,othervendor=keepme" + "sentry-sample_rate=1.0,othervendor=keepme", ) } @@ -288,8 +288,8 @@ class WebViewTracePropagationScriptTest { fun `stripTransactionFromBaggage returns null when only sentry-transaction is left`() { assertThat( WebViewTracePropagationScript.stripTransactionFromBaggage( - "sentry-transaction=GET%20%2Fusers%2F123" - ) + "sentry-transaction=GET%20%2Fusers%2F123", + ), ) .isNull() assertThat(WebViewTracePropagationScript.stripTransactionFromBaggage(null)).isNull() diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/cache/AndroidEnvelopeCacheTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/cache/AndroidEnvelopeCacheTest.kt index 47163c0e841..d6e37383dea 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/cache/AndroidEnvelopeCacheTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/cache/AndroidEnvelopeCacheTest.kt @@ -168,7 +168,7 @@ class AndroidEnvelopeCacheTest { val hints = HintUtils.createWithTypeCheckHint( - AnrV2Hint(0, NoOpLogger.getInstance(), 12345678L, false, false) + AnrV2Hint(0, NoOpLogger.getInstance(), 12345678L, false, false), ) cache.storeEnvelope(fixture.envelope, hints) @@ -181,7 +181,7 @@ class AndroidEnvelopeCacheTest { val hints = HintUtils.createWithTypeCheckHint( - AnrV2Hint(0, NoOpLogger.getInstance(), 12345678L, false, false) + AnrV2Hint(0, NoOpLogger.getInstance(), 12345678L, false, false), ) cache.storeEnvelope(fixture.envelope, hints) @@ -227,7 +227,7 @@ class AndroidEnvelopeCacheTest { val hints = HintUtils.createWithTypeCheckHint( - MemoryLimiterHint(0, NoOpLogger.getInstance(), 23456789L, false) + MemoryLimiterHint(0, NoOpLogger.getInstance(), 23456789L, false), ) cache.storeEnvelope(fixture.envelope, hints) @@ -247,7 +247,7 @@ class AndroidEnvelopeCacheTest { cache.storeEnvelope( envelope, HintUtils.createWithTypeCheckHint( - MemoryLimiterHint(0, NoOpLogger.getInstance(), exitTimestamp, true) + MemoryLimiterHint(0, NoOpLogger.getInstance(), exitTimestamp, true), ), ) @@ -270,7 +270,7 @@ class AndroidEnvelopeCacheTest { cache.storeEnvelope( envelope, HintUtils.createWithTypeCheckHint( - MemoryLimiterHint(0, NoOpLogger.getInstance(), sessionStart.time - 1_000, true) + MemoryLimiterHint(0, NoOpLogger.getInstance(), sessionStart.time - 1_000, true), ), ) @@ -287,13 +287,13 @@ class AndroidEnvelopeCacheTest { cache.storeEnvelope( fixture.envelope, HintUtils.createWithTypeCheckHint( - AnrV2Hint(0, NoOpLogger.getInstance(), 12345678L, false, false) + AnrV2Hint(0, NoOpLogger.getInstance(), 12345678L, false, false), ), ) cache.storeEnvelope( fixture.envelope, HintUtils.createWithTypeCheckHint( - MemoryLimiterHint(0, NoOpLogger.getInstance(), 23456789L, false) + MemoryLimiterHint(0, NoOpLogger.getInstance(), 23456789L, false), ), ) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/debugmeta/AssetsDebugMetaLoaderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/debugmeta/AssetsDebugMetaLoaderTest.kt index 76f13b63822..0424121f500 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/debugmeta/AssetsDebugMetaLoaderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/debugmeta/AssetsDebugMetaLoaderTest.kt @@ -51,7 +51,7 @@ class AssetsDebugMetaLoaderTest { io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68 io.sentry.build-tool=maven """ - .trimIndent() + .trimIndent(), ) val options = SentryOptions() @@ -74,7 +74,7 @@ class AssetsDebugMetaLoaderTest { io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68,8d11a44a-facd-46c1-a49b-87d256227101 io.sentry.build-tool=maven """ - .trimIndent() + .trimIndent(), ) val options = SentryOptions() diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureListenerTracingTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureListenerTracingTest.kt index e73bf891c8e..b856a4cc622 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureListenerTracingTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureListenerTracingTest.kt @@ -411,7 +411,7 @@ class SentryGestureListenerTracingTest { // Verify that a new propagation context was set and it's different from the initial one assertNotNull(scope.propagationContext) assertNotEquals(initialPropagationContext, scope.propagationContext) - } + }, ) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/modules/AssetsModulesLoaderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/modules/AssetsModulesLoaderTest.kt index 34d03b175d7..6c6d260e9d9 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/modules/AssetsModulesLoaderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/modules/AssetsModulesLoaderTest.kt @@ -47,7 +47,7 @@ class AssetsModulesLoaderTest { com.squareup.okhttp3:okhttp:3.14.9 com.squareup.okio:okio:1.17.2 """ - .trimIndent() + .trimIndent(), ) assertEquals( @@ -65,7 +65,7 @@ class AssetsModulesLoaderTest { com.squareup.okhttp3:okhttp:3.14.9 com.squareup.okio:okio:1.17.2 """ - .trimIndent() + .trimIndent(), ) // first, call method to get modules cached @@ -95,7 +95,7 @@ class AssetsModulesLoaderTest { """ com.squareup.okhttp3;3.14.9 """ - .trimIndent() + .trimIndent(), ) assertTrue(sut.orLoadModules!!.isEmpty()) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/threaddump/ThreadDumpParserTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/threaddump/ThreadDumpParserTest.kt index e514ecbb88b..4c943550c94 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/threaddump/ThreadDumpParserTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/threaddump/ThreadDumpParserTest.kt @@ -233,9 +233,9 @@ class ThreadDumpParserTest { | sysTid=123 nice=-10 cgrp=top-app sched=0/0 handle=0x7deceb74f8 at MainActivity.run(MainActivity.java:177) """ - .trimIndent() - ) - ) + .trimIndent(), + ), + ), ) val parser = ThreadDumpParser(SentryOptions(), false) @@ -257,9 +257,9 @@ class ThreadDumpParserTest { | sysTid=123 nice=-10 cgrp=top-app sched=0/0 handle=0x7deceb74f8 at MainActivity.nativeRun(Native method) """ - .trimIndent() - ) - ) + .trimIndent(), + ), + ), ) val parser = ThreadDumpParser(SentryOptions(), false) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/tombstone/TombstoneParserTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/tombstone/TombstoneParserTest.kt index 03e73b1ec93..723f64c0563 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/tombstone/TombstoneParserTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/tombstone/TombstoneParserTest.kt @@ -121,7 +121,7 @@ class TombstoneParserTest { if (frame.isInApp!!) { assert( frame.function!!.startsWith(inAppIncludes[0]) || - frame.`package`!!.startsWith(nativeLibraryDir) + frame.`package`!!.startsWith(nativeLibraryDir), ) } } @@ -166,7 +166,7 @@ class TombstoneParserTest { "/system/lib64/libc.so", buildId, 0, - ) + ), ) // Second mapping: r-xp at offset 0x1000 (executable segment) .addMemoryMapping( @@ -180,7 +180,7 @@ class TombstoneParserTest { "/system/lib64/libc.so", buildId, 0, - ) + ), ) // Third mapping: r--p at offset 0x10000 (read-only data) .addMemoryMapping( @@ -194,7 +194,7 @@ class TombstoneParserTest { "/system/lib64/libc.so", buildId, 0, - ) + ), ) // Fourth mapping: rw-p at offset 0x11000 (writable data) .addMemoryMapping( @@ -208,7 +208,7 @@ class TombstoneParserTest { "/system/lib64/libc.so", buildId, 0, - ) + ), ) .addThread( TombstoneThread( @@ -221,7 +221,7 @@ class TombstoneParserTest { emptyList(), 0, 0, - ) + ), ) .build() @@ -262,7 +262,7 @@ class TombstoneParserTest { "/system/lib64/libdl.so", buildId, 0, - ) + ), ) // Second mapping: r-xp at offset 0 (duplicate!) .addMemoryMapping( @@ -276,7 +276,7 @@ class TombstoneParserTest { "/system/lib64/libdl.so", buildId, 0, - ) + ), ) // Third mapping: r--p at offset 0 (another duplicate!) .addMemoryMapping( @@ -290,7 +290,7 @@ class TombstoneParserTest { "/system/lib64/libdl.so", buildId, 0, - ) + ), ) .addThread( TombstoneThread( @@ -303,7 +303,7 @@ class TombstoneParserTest { emptyList(), 0, 0, - ) + ), ) .build() @@ -341,7 +341,7 @@ class TombstoneParserTest { apkPath, firstBuildId, 0, - ) + ), ) .addMemoryMapping( MemoryMapping( @@ -354,7 +354,7 @@ class TombstoneParserTest { apkPath, firstBuildId, 0, - ) + ), ) .addMemoryMapping( MemoryMapping( @@ -367,7 +367,7 @@ class TombstoneParserTest { apkPath, secondBuildId, 0, - ) + ), ) .addMemoryMapping( MemoryMapping( @@ -380,7 +380,7 @@ class TombstoneParserTest { apkPath, secondBuildId, 0, - ) + ), ) .build() @@ -417,7 +417,7 @@ class TombstoneParserTest { apkPath, buildId, 0, - ) + ), ) // The virtual-address progression can differ from the file-offset progression by one page. .addMemoryMapping( @@ -431,7 +431,7 @@ class TombstoneParserTest { apkPath, "", 0, - ) + ), ) // Each PT_LOAD adds one page of alignment drift. Validation must compare adjacent // mappings so this drift does not accumulate from the start of the module. @@ -446,7 +446,7 @@ class TombstoneParserTest { apkPath, "", 0, - ) + ), ) .build() @@ -478,7 +478,7 @@ class TombstoneParserTest { apkPath, buildId, 0, - ) + ), ) // A different ELF in the APK that does not have a GNU build ID. .addMemoryMapping( @@ -492,7 +492,7 @@ class TombstoneParserTest { apkPath, "", 0x4000, - ) + ), ) .build() @@ -526,7 +526,7 @@ class TombstoneParserTest { apkPath, buildId, 0, - ) + ), ) .addThread( TombstoneThread( @@ -545,12 +545,12 @@ class TombstoneParserTest { "$apkPath!libnative-sample.so", 0x156c000, buildId, - ) + ), ), emptyList(), 0, 0, - ) + ), ) .build() @@ -583,7 +583,7 @@ class TombstoneParserTest { "/system/lib64/libc.so", invalidBuildId, 0, - ) + ), ) .addMemoryMapping( MemoryMapping( @@ -596,7 +596,7 @@ class TombstoneParserTest { "/system/lib64/libm.so", validBuildId, 0, - ) + ), ) .addThread( TombstoneThread( @@ -609,7 +609,7 @@ class TombstoneParserTest { emptyList(), 0, 0, - ) + ), ) .build() @@ -633,7 +633,7 @@ class TombstoneParserTest { fun `parses APK embedded ELF from full tombstone fixture`() { val tombstoneStream = GZIPInputStream( - TombstoneParserTest::class.java.getResourceAsStream("/tombstone_apk_embedded.pb.gz") + TombstoneParserTest::class.java.getResourceAsStream("/tombstone_apk_embedded.pb.gz"), ) val event = TombstoneParser(tombstoneStream, inAppIncludes, inAppExcludes, nativeLibraryDir).parse() @@ -699,7 +699,7 @@ class TombstoneParserTest { emptyList(), 0, 0, - ) + ), ) .addThread( TombstoneThread( @@ -712,7 +712,7 @@ class TombstoneParserTest { emptyList(), 0, 0, - ) + ), ) .addThread( TombstoneThread( @@ -725,7 +725,7 @@ class TombstoneParserTest { emptyList(), 0, 0, - ) + ), ) .build() diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/AndroidConnectionStatusProviderConcurrencyTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/AndroidConnectionStatusProviderConcurrencyTest.kt index ed37286026f..bce34be5e27 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/AndroidConnectionStatusProviderConcurrencyTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/AndroidConnectionStatusProviderConcurrencyTest.kt @@ -432,7 +432,7 @@ class AndroidConnectionStatusProviderConcurrencyTest { override fun onAvailable(network: Network) { stall.block(Unit) } - } + }, ) val notification = fixture.startOnCallerThread { networkCallback.onAvailable(fixture.network) } stall.awaitEntered() @@ -464,7 +464,7 @@ class AndroidConnectionStatusProviderConcurrencyTest { override fun onAvailable(network: Network) { stall.block(Unit) } - } + }, ) val childNetworkCallback = mock() fixture.addChildNetworkCallback(childNetworkCallback) @@ -491,7 +491,7 @@ class AndroidConnectionStatusProviderConcurrencyTest { override fun onAvailable(network: Network) { AndroidConnectionStatusProvider.removeNetworkCallback(this) } - } + }, ) val otherChildNetworkCallback = mock() fixture.addChildNetworkCallback(otherChildNetworkCallback) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/AndroidConnectionStatusProviderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/AndroidConnectionStatusProviderTest.kt index b0fa556deae..38a3365ba8e 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/AndroidConnectionStatusProviderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/AndroidConnectionStatusProviderTest.kt @@ -80,7 +80,7 @@ class AndroidConnectionStatusProviderTest { whenever(contextMock.getSystemService(Context.CONNECTIVITY_SERVICE)) .thenReturn(connectivityManager) whenever( - contextMock.checkPermission(eq(Manifest.permission.ACCESS_NETWORK_STATE), any(), any()) + contextMock.checkPermission(eq(Manifest.permission.ACCESS_NETWORK_STATE), any(), any()), ) .thenReturn(PERMISSION_GRANTED) @@ -187,7 +187,7 @@ class AndroidConnectionStatusProviderTest { eq(Manifest.permission.ACCESS_NETWORK_STATE), any(), any(), - ) + ), ) .thenReturn(PERMISSION_GRANTED) @@ -266,7 +266,7 @@ class AndroidConnectionStatusProviderTest { whenever(contextMock.getSystemService(eq(Context.TELEPHONY_SERVICE))) .thenReturn(telephonyManager) whenever( - contextMock.checkPermission(eq(Manifest.permission.ACCESS_NETWORK_STATE), any(), any()) + contextMock.checkPermission(eq(Manifest.permission.ACCESS_NETWORK_STATE), any(), any()), ) .thenReturn(PERMISSION_DENIED) whenever(buildInfo.sdkInfoVersion).thenReturn(Build.VERSION_CODES.S) @@ -305,7 +305,7 @@ class AndroidConnectionStatusProviderTest { whenever(contextMock.checkPermission(eq(Manifest.permission.READ_PHONE_STATE), any(), any())) .thenReturn(PERMISSION_DENIED) whenever( - contextMock.checkPermission(eq(Manifest.permission.READ_BASIC_PHONE_STATE), any(), any()) + contextMock.checkPermission(eq(Manifest.permission.READ_BASIC_PHONE_STATE), any(), any()), ) .thenReturn(PERMISSION_DENIED) @@ -354,7 +354,7 @@ class AndroidConnectionStatusProviderTest { buildInfo, null, mock(), - ) + ), ) } @@ -384,7 +384,7 @@ class AndroidConnectionStatusProviderTest { @Test fun `addConnectionStatusObserver adds the observer and returns true when the network callback cannot be registered`() { whenever( - contextMock.checkPermission(eq(Manifest.permission.ACCESS_NETWORK_STATE), any(), any()) + contextMock.checkPermission(eq(Manifest.permission.ACCESS_NETWORK_STATE), any(), any()), ) .thenReturn(PERMISSION_DENIED) val provider = AndroidConnectionStatusProvider(contextMock, options, buildInfo, ticker) @@ -838,7 +838,7 @@ class AndroidConnectionStatusProviderTest { assertFalse( AppState.getInstance().lifecycleObserver!!.listeners.any { it is SystemEventsBreadcrumbsIntegration - } + }, ) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/CellularNetworkTechnologyProviderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/CellularNetworkTechnologyProviderTest.kt index 64d2b3dc281..52cd7e6d3c3 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/CellularNetworkTechnologyProviderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/CellularNetworkTechnologyProviderTest.kt @@ -57,7 +57,7 @@ class CellularNetworkTechnologyProviderTest { /** Registers the provider and returns the callback the telephony manager received. */ fun registerAndCaptureCallback( - provider: CellularNetworkTechnologyProvider + provider: CellularNetworkTechnologyProvider, ): TelephonyCallback.DisplayInfoListener { provider.register() val captor = argumentCaptor() @@ -118,17 +118,19 @@ class CellularNetworkTechnologyProviderTest { @Test fun `networkTypeToGeneration maps fourth and fifth generation network types`() { assertThat( - CellularNetworkTechnologyProvider.networkTypeToGeneration(TelephonyManager.NETWORK_TYPE_LTE) + CellularNetworkTechnologyProvider.networkTypeToGeneration( + TelephonyManager.NETWORK_TYPE_LTE, + ), ) .isEqualTo("4g") assertThat( CellularNetworkTechnologyProvider.networkTypeToGeneration( - TelephonyManager.NETWORK_TYPE_IWLAN - ) + TelephonyManager.NETWORK_TYPE_IWLAN, + ), ) .isEqualTo("4g") assertThat( - CellularNetworkTechnologyProvider.networkTypeToGeneration(TelephonyManager.NETWORK_TYPE_NR) + CellularNetworkTechnologyProvider.networkTypeToGeneration(TelephonyManager.NETWORK_TYPE_NR), ) .isEqualTo("5g") } @@ -137,8 +139,8 @@ class CellularNetworkTechnologyProviderTest { fun `networkTypeToGeneration returns null for unknown network types`() { assertThat( CellularNetworkTechnologyProvider.networkTypeToGeneration( - TelephonyManager.NETWORK_TYPE_UNKNOWN - ) + TelephonyManager.NETWORK_TYPE_UNKNOWN, + ), ) .isNull() } @@ -215,7 +217,7 @@ class CellularNetworkTechnologyProviderTest { fixture.displayInfo( networkType = TelephonyManager.NETWORK_TYPE_NR, overrideNetworkType = TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, - ) + ), ) assertThat(provider.cellularNetworkTechnology).isEqualTo("5g") @@ -230,7 +232,7 @@ class CellularNetworkTechnologyProviderTest { fixture.displayInfo( networkType = TelephonyManager.NETWORK_TYPE_LTE, overrideNetworkType = TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, - ) + ), ) assertThat(provider.cellularNetworkTechnology).isEqualTo("4g") @@ -255,10 +257,10 @@ class CellularNetworkTechnologyProviderTest { val done = CountDownLatch(threadCount) repeat(threadCount) { Thread { - start.await() - provider.register() - done.countDown() - } + start.await() + provider.register() + done.countDown() + } .start() } @@ -276,7 +278,7 @@ class CellularNetworkTechnologyProviderTest { fixture.displayInfo( networkType = TelephonyManager.NETWORK_TYPE_LTE, overrideNetworkType = TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, - ) + ), ) provider.unregister() @@ -294,7 +296,7 @@ class CellularNetworkTechnologyProviderTest { fixture.displayInfo( networkType = TelephonyManager.NETWORK_TYPE_NR, overrideNetworkType = TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, - ) + ), ) provider.unregister() diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/RootCheckerTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/RootCheckerTest.kt index 71368b80ae9..3dc060bb635 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/RootCheckerTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/RootCheckerTest.kt @@ -89,7 +89,7 @@ class RootCheckerTest { fixture.packageManager.getPackageInfo( eq("com.devadvance.rootcloak"), any(), - ) + ), ) .thenReturn(packageInfo) @@ -106,7 +106,7 @@ class RootCheckerTest { fixture.packageManager.getPackageInfo( eq("com.devadvance.rootcloak"), any(), - ) + ), ) .thenThrow(PackageManager.NameNotFoundException()) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/ScreenshotUtilsMaskedScreenshotTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/ScreenshotUtilsMaskedScreenshotTest.kt index 9bc6f9f85b0..cea4a6d5bbf 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/ScreenshotUtilsMaskedScreenshotTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/util/ScreenshotUtilsMaskedScreenshotTest.kt @@ -135,7 +135,7 @@ private class TextActivity : Activity() { setTextColor(Color.BLACK) textSize = 32f layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) - } + }, ) setContentView(linearLayout) } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTest.kt index a036583adb8..c4401d74c6c 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTest.kt @@ -164,7 +164,7 @@ class AppStartMetricsTest { description = "ExampleContentProvider" setStartedAt(1) setStoppedAt(2) - } + }, ) metrics.applicationOnCreateTimeSpan.apply { diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTestApi35.kt b/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTestApi35.kt index a7eace97371..c89054e9ca3 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTestApi35.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTestApi35.kt @@ -169,8 +169,8 @@ class AppStartMetricsTestApi35 { .thenReturn( mapOf( ApplicationStartInfo.START_TIMESTAMP_APPLICATION_ONCREATE to - TimeUnit.MILLISECONDS.toNanos(onCreateStartUptimeMs) - ) + TimeUnit.MILLISECONDS.toNanos(onCreateStartUptimeMs), + ), ) SentryShadowActivityManager.setHistoricalProcessStartReasons(listOf(mockStartInfo)) SentryShadowActivityManager.setImportance(RunningAppProcessInfo.IMPORTANCE_CACHED) @@ -255,7 +255,7 @@ class AppStartMetricsTestApi35 { @Test fun `does not crash when getHistoricalProcessStartReasons throws RuntimeException`() { SentryShadowActivityManager.setHistoricalProcessStartReasonsException( - RuntimeException("isolated process") + RuntimeException("isolated process"), ) val metrics = AppStartMetrics.getInstance() diff --git a/sentry-android-distribution/build.gradle.kts b/sentry-android-distribution/build.gradle.kts index c6e4bf44cbb..91a1e4afe3a 100644 --- a/sentry-android-distribution/build.gradle.kts +++ b/sentry-android-distribution/build.gradle.kts @@ -45,7 +45,7 @@ androidComponents.beforeVariants { dependencies { implementation(projects.sentry) implementation( - libs.jetbrains.annotations + libs.jetbrains.annotations, ) // Use implementation instead of compileOnly to override kotlin stdlib's version implementation(kotlin(Config.kotlinStdLib, Config.kotlinStdLibVersionAndroid)) testImplementation(libs.androidx.test.ext.junit) diff --git a/sentry-android-distribution/detekt-baseline.xml b/sentry-android-distribution/detekt-baseline.xml index 78b4ed376de..61fbab0629e 100644 --- a/sentry-android-distribution/detekt-baseline.xml +++ b/sentry-android-distribution/detekt-baseline.xml @@ -15,10 +15,6 @@ SwallowedException:DistributionIntegration.kt$DistributionIntegration$e: android.content.ActivityNotFoundException TooGenericExceptionCaught:DistributionIntegration.kt$DistributionIntegration$e: Exception TooGenericExceptionCaught:UpdateResponseParser.kt$UpdateResponseParser$e: Exception - UseCheckOrError:DistributionHttpClient.kt$DistributionHttpClient$throw IllegalStateException( "Missing required distribution configuration: orgSlug, projectSlug, or orgAuthToken" ) - UseCheckOrError:DistributionHttpClient.kt$DistributionHttpClient$throw IllegalStateException("sentryClientName must be set") - UseCheckOrError:DistributionIntegration.kt$DistributionIntegration$throw IllegalStateException("buildConfiguration must be set in distribution options") - UseRequire:UpdateResponseParser.kt$UpdateResponseParser$throw IllegalArgumentException( "Missing required fields in API response: ${missingFields.joinToString(", ")}" ) WildcardImport:DistributionHttpClientTest.kt$import org.junit.Assert.* diff --git a/sentry-android-distribution/src/main/java/io/sentry/android/distribution/DistributionHttpClient.kt b/sentry-android-distribution/src/main/java/io/sentry/android/distribution/DistributionHttpClient.kt index 9ffaf19949b..9d5e8c1107c 100644 --- a/sentry-android-distribution/src/main/java/io/sentry/android/distribution/DistributionHttpClient.kt +++ b/sentry-android-distribution/src/main/java/io/sentry/android/distribution/DistributionHttpClient.kt @@ -44,16 +44,14 @@ internal class DistributionHttpClient(private val options: SentryOptions) { val authToken = distributionOptions.orgAuthToken val baseUrl = distributionOptions.sentryBaseUrl - if (orgSlug.isNullOrEmpty() || projectSlug.isNullOrEmpty() || authToken.isNullOrEmpty()) { - throw IllegalStateException( - "Missing required distribution configuration: orgSlug, projectSlug, or orgAuthToken" - ) + check(!orgSlug.isNullOrEmpty() && !projectSlug.isNullOrEmpty() && !authToken.isNullOrEmpty()) { + "Missing required distribution configuration: orgSlug, projectSlug, or orgAuthToken" } val urlString = buildString { append(baseUrl.trimEnd('/')) append( - "/api/0/projects/${URLEncoder.encode(orgSlug, "UTF-8")}/${URLEncoder.encode(projectSlug, "UTF-8")}/preprodartifacts/check-for-updates/" + "/api/0/projects/${URLEncoder.encode(orgSlug, "UTF-8")}/${URLEncoder.encode(projectSlug, "UTF-8")}/preprodartifacts/check-for-updates/", ) append("?app_id=${URLEncoder.encode(params.appId, "UTF-8")}") append("&platform=${URLEncoder.encode(params.platform, "UTF-8")}") @@ -85,7 +83,7 @@ internal class DistributionHttpClient(private val options: SentryOptions) { connection.setRequestProperty("Accept", "application/json") connection.setRequestProperty( "User-Agent", - options.sentryClientName ?: throw IllegalStateException("sentryClientName must be set"), + checkNotNull(options.sentryClientName) { "sentryClientName must be set" }, ) connection.connectTimeout = options.connectionTimeoutMillis connection.readTimeout = options.readTimeoutMillis diff --git a/sentry-android-distribution/src/main/java/io/sentry/android/distribution/DistributionIntegration.kt b/sentry-android-distribution/src/main/java/io/sentry/android/distribution/DistributionIntegration.kt index 4a53b557a03..57590bc278d 100644 --- a/sentry-android-distribution/src/main/java/io/sentry/android/distribution/DistributionIntegration.kt +++ b/sentry-android-distribution/src/main/java/io/sentry/android/distribution/DistributionIntegration.kt @@ -142,7 +142,7 @@ public class DistributionIntegration(context: Context) : Integration, IDistribut val buildConfiguration = sentryOptions.distribution.buildConfiguration - ?: throw IllegalStateException("buildConfiguration must be set in distribution options") + ?: error("buildConfiguration must be set in distribution options") DistributionHttpClient.UpdateCheckParams( appId = appId, diff --git a/sentry-android-distribution/src/main/java/io/sentry/android/distribution/UpdateResponseParser.kt b/sentry-android-distribution/src/main/java/io/sentry/android/distribution/UpdateResponseParser.kt index 0734b80f485..8ac1e684d3e 100644 --- a/sentry-android-distribution/src/main/java/io/sentry/android/distribution/UpdateResponseParser.kt +++ b/sentry-android-distribution/src/main/java/io/sentry/android/distribution/UpdateResponseParser.kt @@ -72,10 +72,8 @@ internal class UpdateResponseParser(private val options: SentryOptions) { missingFields.add("downloadUrl") } - if (missingFields.isNotEmpty()) { - throw IllegalArgumentException( - "Missing required fields in API response: ${missingFields.joinToString(", ")}" - ) + require(missingFields.isEmpty()) { + "Missing required fields in API response: ${missingFields.joinToString(", ")}" } return UpdateInfo( diff --git a/sentry-android-distribution/src/test/java/io/sentry/android/distribution/UpdateResponseParserTest.kt b/sentry-android-distribution/src/test/java/io/sentry/android/distribution/UpdateResponseParserTest.kt index f1817a39f34..d3c491ba665 100644 --- a/sentry-android-distribution/src/test/java/io/sentry/android/distribution/UpdateResponseParserTest.kt +++ b/sentry-android-distribution/src/test/java/io/sentry/android/distribution/UpdateResponseParserTest.kt @@ -328,7 +328,7 @@ class UpdateResponseParserTest { assertTrue( "Error message should mention all missing required fields", error.message.contains( - "Missing required fields in API response: id, buildVersion, downloadUrl" + "Missing required fields in API response: id, buildVersion, downloadUrl", ), ) } diff --git a/sentry-android-fragment/src/main/java/io/sentry/android/fragment/FragmentLifecycleIntegration.kt b/sentry-android-fragment/src/main/java/io/sentry/android/fragment/FragmentLifecycleIntegration.kt index 8511b514b2e..122644f505f 100644 --- a/sentry-android-fragment/src/main/java/io/sentry/android/fragment/FragmentLifecycleIntegration.kt +++ b/sentry-android-fragment/src/main/java/io/sentry/android/fragment/FragmentLifecycleIntegration.kt @@ -26,7 +26,7 @@ public class FragmentLifecycleIntegration( } public constructor( - application: Application + application: Application, ) : this( application = application, filterFragmentLifecycleBreadcrumbs = FragmentLifecycleState.states, diff --git a/sentry-android-fragment/src/test/java/io/sentry/android/fragment/SentryFragmentLifecycleCallbacksTest.kt b/sentry-android-fragment/src/test/java/io/sentry/android/fragment/SentryFragmentLifecycleCallbacksTest.kt index 997c1206398..ea9ef550af5 100644 --- a/sentry-android-fragment/src/test/java/io/sentry/android/fragment/SentryFragmentLifecycleCallbacksTest.kt +++ b/sentry-android-fragment/src/test/java/io/sentry/android/fragment/SentryFragmentLifecycleCallbacksTest.kt @@ -50,7 +50,7 @@ class SentryFragmentLifecycleCallbacksTest { SentryOptions().apply { setTracesSampleRate(tracesSampleRate) isEnableScreenTracking = enableScreenTracking - } + }, ) whenever(span.spanContext) .thenReturn(SpanContext(SentryId.EMPTY_ID, SpanId.EMPTY_ID, "op", null, null)) diff --git a/sentry-android-integration-tests/sentry-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/EmptyBroadcastReceiver.kt b/sentry-android-integration-tests/sentry-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/EmptyBroadcastReceiver.kt index 3aef794189b..cc01e478840 100644 --- a/sentry-android-integration-tests/sentry-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/EmptyBroadcastReceiver.kt +++ b/sentry-android-integration-tests/sentry-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/EmptyBroadcastReceiver.kt @@ -14,9 +14,9 @@ class EmptyBroadcastReceiver : BroadcastReceiver() { val pendingResult = goAsync() Log.d(TAG, "onReceive: broadcast received") Thread { - Thread.sleep(1000) - pendingResult.finish() - } + Thread.sleep(1000) + pendingResult.finish() + } .start() } } diff --git a/sentry-android-integration-tests/sentry-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/MainActivity.kt b/sentry-android-integration-tests/sentry-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/MainActivity.kt index 1b98cd59c7b..195b388faf0 100644 --- a/sentry-android-integration-tests/sentry-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/MainActivity.kt +++ b/sentry-android-integration-tests/sentry-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/MainActivity.kt @@ -78,7 +78,7 @@ class MainActivity : ComponentActivity() { .trimIndent() file.writeText(corruptedEnvelopeContent) println("Wrote corrupted envelope to: ${file.absolutePath}") - } + }, ) { Text("Write Corrupted Envelope") } @@ -90,7 +90,7 @@ class MainActivity : ComponentActivity() { } else { postNotification() } - } + }, ) { Text("Trigger Notification") } @@ -101,11 +101,11 @@ class MainActivity : ComponentActivity() { addFlags( Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or - Intent.FLAG_ACTIVITY_SINGLE_TOP + Intent.FLAG_ACTIVITY_SINGLE_TOP, ) - } + }, ) - } + }, ) { Text("Launch Main Activity (singleTask)") } diff --git a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/AutomaticSpansTest.kt b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/AutomaticSpansTest.kt index 49bfb3fb09f..b986c2c1881 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/AutomaticSpansTest.kt +++ b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/AutomaticSpansTest.kt @@ -71,9 +71,9 @@ class AutomaticSpansTest : BaseUiTest() { relay.assert { findEnvelope { - assertEnvelopeTransaction(it.items.toList(), AndroidLogger()).transaction == - "ProfilingSampleActivity" - } + assertEnvelopeTransaction(it.items.toList(), AndroidLogger()).transaction == + "ProfilingSampleActivity" + } .assert { val transactionItem: SentryTransaction = it.assertTransaction() it.assertNoOtherItems() @@ -112,9 +112,9 @@ class AutomaticSpansTest : BaseUiTest() { relay.assert { findEnvelope { - assertEnvelopeTransaction(it.items.toList(), AndroidLogger()).transaction == - "ProfilingSampleActivity" - } + assertEnvelopeTransaction(it.items.toList(), AndroidLogger()).transaction == + "ProfilingSampleActivity" + } .assert { val transactionItem: SentryTransaction = it.assertTransaction() it.assertNoOtherItems() diff --git a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/EnvelopeTests.kt b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/EnvelopeTests.kt index 1d77c95663a..f036bbbbe0f 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/EnvelopeTests.kt +++ b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/EnvelopeTests.kt @@ -62,9 +62,9 @@ class EnvelopeTests : BaseUiTest() { transaction.finish() relay.assert { findEnvelope { - assertEnvelopeTransaction(it.items.toList(), AndroidLogger()).transaction == - "ProfilingSampleActivity" - } + assertEnvelopeTransaction(it.items.toList(), AndroidLogger()).transaction == + "ProfilingSampleActivity" + } .assert { val transactionItem: SentryTransaction = it.assertTransaction() it.assertNoOtherItems() @@ -72,8 +72,8 @@ class EnvelopeTests : BaseUiTest() { } findEnvelope { - assertEnvelopeProfile(it.items.toList()).transactionName == "profiledTransaction" - } + assertEnvelopeProfile(it.items.toList()).transactionName == "profiledTransaction" + } .assert { val transactionItem: SentryTransaction = it.assertTransaction() val profilingTraceData: ProfilingTraceData = it.assertProfile() @@ -234,7 +234,7 @@ class EnvelopeTests : BaseUiTest() { {"type":"transaction","length":1335} {"event_id":"729ff878-5539-458d-f657-a1acf423a127","platform":"native","transaction":"little.teapot","start_timestamp":"2025-04-02T10:02:04.731697Z","spans":[{"op":"littlest.teapot","span_id":"00028ba394454124","status":"ok","trace_id":"7160e289fe4c4496f02c72bbc7edb392","parent_span_id":"b0dc1649a8ec4101","description":null,"start_timestamp":"2025-04-02T10:02:04.732127Z","timestamp":"2025-04-02T10:02:04.732133Z"},{"op":"littler.teapot","span_id":"b0dc1649a8ec4101","status":"ok","trace_id":"7160e289fe4c4496f02c72bbc7edb392","parent_span_id":"7ad2e40529af4650","description":null,"start_timestamp":"2025-04-02T10:02:04.732118Z","data":{"span_data_says":"hi!"},"timestamp":"2025-04-02T10:02:04.732137Z"}],"type":"transaction","timestamp":"2025-04-02T10:02:04.732142Z","level":"info","contexts":{"trace":{"trace_id":"7160e289fe4c4496f02c72bbc7edb392","span_id":"7ad2e40529af4650","op":"Short and stout here is my handle and here is my spout","status":"ok","data":{"url":"https://example.com"}},"os":{"build":"android14-4-00257-g7e35917775b8-ab9964412","name":"Linux","version":"6.1.23"}},"release":"1.0.0","dist":"dist","environment":"production","sdk":{"name":"io.sentry.ndk","version":"0.8.3","packages":[{"name":"github:getsentry/sentry-native","version":"0.8.3"}],"integrations":["inproc"]},"tags":{},"extra":{},"breadcrumbs":[]} """ - .trimIndent() + .trimIndent(), ) relayIdlingResource.increment() diff --git a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/ReplayTest.kt b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/ReplayTest.kt index 86f30dc1a1a..f7203549c4c 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/ReplayTest.kt +++ b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/ReplayTest.kt @@ -37,7 +37,7 @@ class ReplayTest : BaseUiTest() { ReferencePattern.InstanceFieldPattern( "com.saucelabs.rdcinjector.testfairy.TestFairyEventQueue", "context", - ) + ), ), // Seems like a false-positive returned by LeakCanary when curtains is used in // the host application (LeakCanary uses it itself internally). We use kind of @@ -49,7 +49,7 @@ class ReplayTest : BaseUiTest() { ReferencePattern.InstanceFieldPattern( "curtains.internal.RootViewsSpy", "delegatingViewList", - ) + ), ), ) + ('a'..'z').map { char -> @@ -57,9 +57,9 @@ class ReplayTest : BaseUiTest() { ReferencePattern.StaticFieldPattern( "com.testfairy.modules.capture.TouchListener", "$char", - ) + ), ) - } + }, ) val activityScenario = launchActivity() diff --git a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/SdkInitTests.kt b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/SdkInitTests.kt index d3a60d2c198..6f71f15aeda 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/SdkInitTests.kt +++ b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/SdkInitTests.kt @@ -75,8 +75,8 @@ class SdkInitTests : BaseUiTest() { relay.assert { findEnvelope { - assertEnvelopeTransaction(it.items.toList(), AndroidLogger()).transaction == "e2etests" - } + assertEnvelopeTransaction(it.items.toList(), AndroidLogger()).transaction == "e2etests" + } .assert { val transactionItem: SentryTransaction = it.assertTransaction() it.assertNoOtherItems() @@ -84,9 +84,8 @@ class SdkInitTests : BaseUiTest() { } findEnvelope { - assertEnvelopeTransaction(it.items.toList(), AndroidLogger()).transaction == - "EmptyActivity" - } + assertEnvelopeTransaction(it.items.toList(), AndroidLogger()).transaction == "EmptyActivity" + } .assert { val transactionItem: SentryTransaction = it.assertTransaction() // Transaction-based Profiling is already in e2etests transaction, so it won't run again @@ -96,8 +95,8 @@ class SdkInitTests : BaseUiTest() { } findEnvelope { - assertEnvelopeTransaction(it.items.toList(), AndroidLogger()).transaction == "e2etests2" - } + assertEnvelopeTransaction(it.items.toList(), AndroidLogger()).transaction == "e2etests2" + } .assert { val transactionItem: SentryTransaction = it.assertTransaction() // Profiling uses executorService, so if the executorService is shutdown it would fail @@ -186,17 +185,17 @@ class SdkInitTests : BaseUiTest() { ReferencePattern.InstanceFieldPattern( "com.saucelabs.rdcinjector.testfairy.TestFairyEventQueue", "context", - ) - ) + ), + ), ) + ('a'..'z').map { char -> IgnoredReferenceMatcher( ReferencePattern.StaticFieldPattern( "com.testfairy.modules.capture.TouchListener", "$char", - ) + ), ) - } + }, ) val activityScenario = launchActivity() @@ -237,12 +236,12 @@ class SdkInitTests : BaseUiTest() { // so we need to set the current activity manually CurrentActivityHolder.getInstance().setActivity(activity) Thread { - initSentry(false) { options: SentryAndroidOptions -> - options.tracesSampleRate = 1.0 - options.profilesSampleRate = 1.0 - } - initLatch.countDown() + initSentry(false) { options: SentryAndroidOptions -> + options.tracesSampleRate = 1.0 + options.profilesSampleRate = 1.0 } + initLatch.countDown() + } .start() } initLatch.await() diff --git a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/UserFeedbackUiTest.kt b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/UserFeedbackUiTest.kt index 6bbbe95253a..b33f70830c6 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/UserFeedbackUiTest.kt +++ b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/UserFeedbackUiTest.kt @@ -428,7 +428,7 @@ class UserFeedbackUiTest : BaseUiTest() { name = "Test User" username = "Test UserName" email = "Test User Email" - } + }, ) showDialogAndCheck { // Name and email are filled with Sentry user properties @@ -452,7 +452,7 @@ class UserFeedbackUiTest : BaseUiTest() { name = "Test User" username = "Test UserName" email = "Test User Email" - } + }, ) showDialogAndCheck { // Name and email are not filled @@ -490,9 +490,9 @@ class UserFeedbackUiTest : BaseUiTest() { relay.assert { findEnvelope { - assertEnvelopeFeedback(it.items.toList(), AndroidLogger()).contexts.feedback!!.message == - "Description filled" - } + assertEnvelopeFeedback(it.items.toList(), AndroidLogger()).contexts.feedback!!.message == + "Description filled" + } .assert { val event: SentryEvent = it.assertItem() val feedback = event.contexts.feedback!! @@ -560,15 +560,17 @@ class UserFeedbackUiTest : BaseUiTest() { @Test fun userFeedbackWidgetDefaultsOverridden() { initSentry() - showWidgetAndCheck({ widget -> - widget.compoundDrawablePadding = 1 - widget.setCompoundDrawables(null, null, null, null) - widget.isAllCaps = true - widget.setBackgroundResource(R.drawable.sentry_edit_text_border) - widget.setTextColor(Color.RED) - widget.text = "My custom text" - widget.setPadding(0, 0, 0, 0) - }) { widget -> + showWidgetAndCheck( + { widget -> + widget.compoundDrawablePadding = 1 + widget.setCompoundDrawables(null, null, null, null) + widget.isAllCaps = true + widget.setBackgroundResource(R.drawable.sentry_edit_text_border) + widget.setTextColor(Color.RED) + widget.text = "My custom text" + widget.setPadding(0, 0, 0, 0) + }, + ) { widget -> val densityScale = context.resources.displayMetrics.density assertEquals(1, widget.compoundDrawablePadding) diff --git a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/UserInteractionTests.kt b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/UserInteractionTests.kt index 2ea1905b761..2327fb16a5d 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/UserInteractionTests.kt +++ b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/UserInteractionTests.kt @@ -53,13 +53,13 @@ class UserInteractionTests : BaseUiTest() { Press.FINGER, InputDevice.SOURCE_UNKNOWN, MotionEvent.BUTTON_PRIMARY, - ) + ), ) activity.moveToState(Lifecycle.State.DESTROYED) assertTrue( breadcrumbs .filter { it.category == "ui.click" && it.data["view.tag"] == "button_login" } - .size == 1 + .size == 1, ) } @@ -77,7 +77,7 @@ class UserInteractionTests : BaseUiTest() { .filter { it.category == "ui.swipe" && it.data["view.tag"] == "list" && it.data["direction"] == "up" } - .size == 1 + .size == 1, ) } diff --git a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/mockservers/RelayAsserter.kt b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/mockservers/RelayAsserter.kt index a449be66ae4..4d0ad2ab55b 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/mockservers/RelayAsserter.kt +++ b/sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/mockservers/RelayAsserter.kt @@ -37,7 +37,7 @@ class RelayAsserter(private val unassertedEnvelopes: MutableList) throw AssertionError( "No envelope request found with specified filter.\n" + "There was a total of ${originalUnassertedEnvelopes.size} envelopes: " + - originalUnassertedEnvelopes.joinToString { it.envelope!!.describeForTest() } + originalUnassertedEnvelopes.joinToString { it.envelope!!.describeForTest() }, ) } return unassertedEnvelopes.removeAt(relayResponseIndex) @@ -48,7 +48,7 @@ class RelayAsserter(private val unassertedEnvelopes: MutableList) if (unassertedEnvelopes.isNotEmpty()) { throw AssertionError( "There was a total of ${originalUnassertedEnvelopes.size} envelopes: " + - originalUnassertedEnvelopes.joinToString { it.envelope!!.describeForTest() } + originalUnassertedEnvelopes.joinToString { it.envelope!!.describeForTest() }, ) } } diff --git a/sentry-android-integration-tests/sentry-uitest-android/src/main/java/io/sentry/uitest/android/ComposeActivity.kt b/sentry-android-integration-tests/sentry-uitest-android/src/main/java/io/sentry/uitest/android/ComposeActivity.kt index c54af11f6d2..fd0ff09f4bc 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/src/main/java/io/sentry/uitest/android/ComposeActivity.kt +++ b/sentry-android-integration-tests/sentry-uitest-android/src/main/java/io/sentry/uitest/android/ComposeActivity.kt @@ -39,7 +39,7 @@ class ComposeActivity : AppCompatActivity() { .clickable { // no-op } - .testTag("button_login") + .testTag("button_login"), ) { Text("Login") } diff --git a/sentry-android-integration-tests/sentry-uitest-android/src/main/java/io/sentry/uitest/android/ProfilingSampleActivity.kt b/sentry-android-integration-tests/sentry-uitest-android/src/main/java/io/sentry/uitest/android/ProfilingSampleActivity.kt index fdfeb61e05f..849605d5095 100644 --- a/sentry-android-integration-tests/sentry-uitest-android/src/main/java/io/sentry/uitest/android/ProfilingSampleActivity.kt +++ b/sentry-android-integration-tests/sentry-uitest-android/src/main/java/io/sentry/uitest/android/ProfilingSampleActivity.kt @@ -53,7 +53,7 @@ class ProfilingSampleActivity : AppCompatActivity() { scrollingIdlingResource.decrement() } } - } + }, ) } } diff --git a/sentry-android-navigation3/src/main/kotlin/io/sentry/compose/navigation3/BackStackEntryMapper.kt b/sentry-android-navigation3/src/main/kotlin/io/sentry/compose/navigation3/BackStackEntryMapper.kt index d26336d1066..924f8c49728 100644 --- a/sentry-android-navigation3/src/main/kotlin/io/sentry/compose/navigation3/BackStackEntryMapper.kt +++ b/sentry-android-navigation3/src/main/kotlin/io/sentry/compose/navigation3/BackStackEntryMapper.kt @@ -165,7 +165,7 @@ public fun interface BackStackEntryMapper { * logic or recreating its own state whenever the mapper changed. */ internal class ForwardingBackStackEntryMapper( - private val currentMapper: () -> BackStackEntryMapper + private val currentMapper: () -> BackStackEntryMapper, ) { fun map(backStackEntry: T): SentryBackStackEntry? = Snapshot.withoutReadObservation { currentMapper().map(backStackEntry) diff --git a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/BackStackConverterTest.kt b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/BackStackConverterTest.kt index 1e332c67bd0..cb31be75fc7 100644 --- a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/BackStackConverterTest.kt +++ b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/BackStackConverterTest.kt @@ -37,7 +37,7 @@ class BackStackConverterTest { } private fun getSut( - entryMapper: BackStackEntryMapper = defaultEntryMapper + entryMapper: BackStackEntryMapper = defaultEntryMapper, ): BackStackConverter = BackStackConverter( entryMapper = ForwardingBackStackEntryMapper { entryMapper }, @@ -64,7 +64,7 @@ class BackStackConverterTest { else -> emptyMap() }, ) - } + }, ) val routes = @@ -154,7 +154,7 @@ class BackStackConverterTest { else -> emptyMap() }, ) - } + }, ) val routes = sut.convert(listOf(first, middle, last), RetentionPolicy.KEEP_FIRST) @@ -191,7 +191,7 @@ class BackStackConverterTest { else -> emptyMap() }, ) - } + }, ) val routes = sut.convert(listOf(first, middle, last), RetentionPolicy.KEEP_LAST) @@ -227,7 +227,7 @@ class BackStackConverterTest { else -> emptyMap() }, ) - } + }, ) val routes = sut.convert(listOf(first, middle, last), RetentionPolicy.KEEP_FIRST) @@ -263,7 +263,7 @@ class BackStackConverterTest { else -> emptyMap() }, ) - } + }, ) val routes = sut.convert(listOf(first, middle, last), RetentionPolicy.KEEP_LAST) @@ -313,14 +313,14 @@ class BackStackConverterTest { assertThat(sut.convert(HomeScreen())) .isEqualTo( - NormalizedSentryBackStackEntry(name = "/unknown", arguments = mapOf("userId" to "123")) + NormalizedSentryBackStackEntry(name = "/unknown", arguments = mapOf("userId" to "123")), ) verify(logger) .log( eq(WARNING), eq( "Nav3 backStackEntryMapper returned a blank name while processing this back stack update. " + - "Using /unknown instead." + "Using /unknown instead.", ), ) } @@ -342,13 +342,13 @@ class BackStackConverterTest { NormalizedSentryBackStackEntry( UNKNOWN_ENTRY_NAME, argumentDropReason = ArgumentDropReason.MAPPING_FAILED, - ) + ), ) verify(logger) .log( eq(WARNING), eq( - "Nav3 backStackEntryMapper threw while resolving an entry. Using /unknown without arguments instead." + "Nav3 backStackEntryMapper threw while resolving an entry. Using /unknown without arguments instead.", ), org.mockito.kotlin.any(), ) @@ -378,7 +378,7 @@ class BackStackConverterTest { "bytes" to byteArrayOf(4, 5), ), ) - } + }, ) assertThat(sut.convert(HomeScreen()).arguments) @@ -397,7 +397,7 @@ class BackStackConverterTest { "ints" to listOf(1, 2, 3), "chars" to listOf("a", "b"), "bytes" to listOf(4.toByte(), 5.toByte()), - ) + ), ) } @@ -417,19 +417,19 @@ class BackStackConverterTest { listOf('y', PrivacyMode.PRIVATE), booleanArrayOf(true, false), charArrayOf('q'), - ) - ) + ), + ), ), ) - } + }, ) assertThat(sut.convert(HomeScreen()).arguments) .isEqualTo( mapOf( "nested" to - mapOf("items" to listOf("x", listOf("y", "PRIVATE"), listOf(true, false), listOf("q"))) - ) + mapOf("items" to listOf("x", listOf("y", "PRIVATE"), listOf(true, false), listOf("q"))), + ), ) } @@ -461,7 +461,7 @@ class BackStackConverterTest { else -> emptyMap() }, ) - } + }, ) sut.convert(listOf(HomeScreen(), ProfileScreen("123")), RetentionPolicy.KEEP_FIRST) @@ -473,7 +473,7 @@ class BackStackConverterTest { "Nav3 backStackEntryMapper returned unsupported argument value of type %s while processing this " + "back stack update. Falling back to toString(). Use String, CharSequence, Char, " + "Number, Boolean, Enum, Map, Collection, object Array, and primitive array values " + - "for reliable results." + "for reliable results.", ), eq("OpaqueValue"), ) @@ -499,7 +499,7 @@ class BackStackConverterTest { "Nav3 backStackEntryMapper returned unsupported argument value of type %s while processing this " + "back stack update. Falling back to toString(). Use String, CharSequence, Char, " + "Number, Boolean, Enum, Map, Collection, object Array, and primitive array values " + - "for reliable results." + "for reliable results.", ), eq("OpaqueValue"), ) @@ -608,7 +608,7 @@ class BackStackConverterTest { else -> emptyMap() }, ) - } + }, ) val routes = @@ -638,7 +638,7 @@ class BackStackConverterTest { mapOf( "entry" to "/HomeScreen", "entry_arguments" to mapOf(ARGUMENT_DROP_REASON_KEY to "max_argument_count_exceeded"), - ) + ), ) } } diff --git a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/BackStackObserverTest.kt b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/BackStackObserverTest.kt index d7d8895c608..df7c9512532 100644 --- a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/BackStackObserverTest.kt +++ b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/BackStackObserverTest.kt @@ -209,7 +209,7 @@ class BackStackObserverTest { else -> emptyMap() }, ) - } + }, ) sut.onBackStackChanged(listOf(HomeScreen(), previousProfile)) @@ -269,7 +269,7 @@ class BackStackObserverTest { val fixture = Fixture() val sut = fixture.getSut( - config = ObserverConfig(captureBackStack = true, maxCapturedBackStackEntries = 2) + config = ObserverConfig(captureBackStack = true, maxCapturedBackStackEntries = 2), ) sut.onBackStackChanged(listOf(HomeScreen(), ProfileScreen("123"), SettingsScreen("privacy"))) @@ -306,7 +306,7 @@ class BackStackObserverTest { "entry" to "/HomeScreen", "entry_arguments" to mapOf(ARGUMENT_DROP_REASON_KEY to "max_argument_count_exceeded"), ), - ) + ), ) assertThat(fixture.startedTransactions.single().getData("arguments")) .isEqualTo(mapOf("userId" to "123")) @@ -331,7 +331,7 @@ class BackStackObserverTest { mapOf("entry" to "/ProfileScreen"), mapOf("entry" to "/SettingsScreen"), mapOf("entry" to "/HomeScreen"), - ) + ), ) } @@ -362,7 +362,7 @@ class BackStackObserverTest { val fixture = Fixture() val sut = fixture.getSut( - config = ObserverConfig(captureBackStack = true, maxCapturedBackStackEntries = 0) + config = ObserverConfig(captureBackStack = true, maxCapturedBackStackEntries = 0), ) fixture.scope.setContexts( NAVIGATION_CONTEXT_KEY, @@ -450,7 +450,7 @@ class BackStackObserverTest { else -> emptyMap() }, ) - } + }, ) sut.onBackStackChanged(listOf(home, profile)) @@ -491,7 +491,7 @@ class BackStackObserverTest { listOf( mapOf("entry" to "/ProfileScreen", "entry_arguments" to mapOf("userId" to "123")), mapOf("entry" to "/HomeScreen"), - ) + ), ) assertThat(fixture.scope.transaction).isSameInstanceAs(transaction) } @@ -506,7 +506,7 @@ class BackStackObserverTest { fixture.scopes.startTransaction( any(), transactionOptionsCaptor.capture(), - ) + ), ) .thenAnswer { val transactionContext = it.arguments[0] as TransactionContext @@ -656,9 +656,9 @@ class BackStackObserverTest { is CartScreen -> error("throwing in order to simulate a buggy entry mapper") is SettingsScreen -> "settings" else -> error("unknown entry: $entry") - } + }, ) - } + }, ) // Navigate to the home screen and verify that a transaction has started and related Sentry data @@ -693,7 +693,7 @@ class BackStackObserverTest { listOf( mapOf("entry" to NormalizedSentryBackStackEntry.UNKNOWN_ENTRY_NAME), mapOf("entry" to "/home"), - ) + ), ) // Navigate to the cart screen and verify the later failure is also recorded as /unknown rather @@ -729,7 +729,7 @@ class BackStackObserverTest { ), mapOf("entry" to NormalizedSentryBackStackEntry.UNKNOWN_ENTRY_NAME), mapOf("entry" to "/home"), - ) + ), ) // Navigate to the settings screen and verify a new /settings transaction is started and Sentry @@ -764,7 +764,7 @@ class BackStackObserverTest { ), mapOf("entry" to NormalizedSentryBackStackEntry.UNKNOWN_ENTRY_NAME), mapOf("entry" to "/home"), - ) + ), ) } diff --git a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/CoordinatedBackStackObserverTest.kt b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/CoordinatedBackStackObserverTest.kt index 2b8547b4084..d36d46d814b 100644 --- a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/CoordinatedBackStackObserverTest.kt +++ b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/CoordinatedBackStackObserverTest.kt @@ -89,8 +89,8 @@ class CoordinatedBackStackObserverTest { .isEqualTo( mapOf( "Back Stack" to - listOf(mapOf("entry" to "/PageB", "entry_arguments" to mapOf("page" to "PageB"))) - ) + listOf(mapOf("entry" to "/PageB", "entry_arguments" to mapOf("page" to "PageB"))), + ), ) assertThat(fixture.scope.screen).isEqualTo("/PageB") } @@ -283,8 +283,8 @@ class CoordinatedBackStackObserverTest { listOf( mapOf("entry" to "/PageA", "entry_arguments" to mapOf("page" to "PageA")), mapOf("entry" to "/Home", "entry_arguments" to mapOf("page" to "Home")), - ) - ) + ), + ), ) } @@ -311,7 +311,7 @@ class CoordinatedBackStackObserverTest { assertThat(restarted.name).isEqualTo("/PageA") assertThat(restarted.contexts[NAVIGATION_CONTEXT_KEY]) .isEqualTo( - mapOf("Back Stack" to listOf(mapOf("entry" to "/PageA"), mapOf("entry" to "/Settings"))) + mapOf("Back Stack" to listOf(mapOf("entry" to "/PageA"), mapOf("entry" to "/Settings"))), ) } @@ -437,7 +437,7 @@ class CoordinatedBackStackObserverTest { tracesSampleRate = 1.0 idleTimeout = null deadlineTimeout = 0 - } + }, ) val coordinator = NavLeaseCoordinator() val startedTransactions = mutableListOf() @@ -480,7 +480,7 @@ class CoordinatedBackStackObserverTest { scopes, NavRootInfo(otherLifecycle, activity = null), NoOpNavStatePublisher, - ) + ), ) other.onBackStackUpdate() otherLifecycle.currentState = Lifecycle.State.STARTED diff --git a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/ForwardingBackStackEntryMapperTest.kt b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/ForwardingBackStackEntryMapperTest.kt index 313b21d53c2..35f1df879ba 100644 --- a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/ForwardingBackStackEntryMapperTest.kt +++ b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/ForwardingBackStackEntryMapperTest.kt @@ -15,11 +15,13 @@ class ForwardingBackStackEntryMapperTest { fun `mapper returns name and arguments when present`() { val screen = ProfileScreen("123") val sut = - ForwardingBackStackEntryMapper({ - BackStackEntryMapper { entry -> - SentryBackStackEntry("profile-${entry.userId}", mapOf("userId" to entry.userId)) - } - }) + ForwardingBackStackEntryMapper( + { + BackStackEntryMapper { entry -> + SentryBackStackEntry("profile-${entry.userId}", mapOf("userId" to entry.userId)) + } + }, + ) assertThat(sut.map(screen)) .isEqualTo(SentryBackStackEntry("profile-123", mapOf("userId" to "123"))) diff --git a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/SentryNavEffectLifecycleIntegrationTest.kt b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/SentryNavEffectLifecycleIntegrationTest.kt index 145b5c0cf74..dc50114f250 100644 --- a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/SentryNavEffectLifecycleIntegrationTest.kt +++ b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/SentryNavEffectLifecycleIntegrationTest.kt @@ -1461,7 +1461,7 @@ class SentryNavEffectLifecycleIntegrationTest { * transaction holds the scope's transaction slot. */ fun returnToHomeWhileCheckoutUiLoadIsUnfinished( - finishHomeTransaction: Boolean = true + finishHomeTransaction: Boolean = true, ): Pair, ActivityController> { installActivityLifecycleIntegration(CheckoutActivity::class.java) val home = Robolectric.buildActivity(HomeActivity::class.java).setup() @@ -1545,7 +1545,7 @@ class SentryNavEffectLifecycleIntegrationTest { ) .forEach { activityClass: Class -> packageManager.addActivityIfNotPresent( - ComponentName(application.packageName, activityClass.name) + ComponentName(application.packageName, activityClass.name), ) } return Fixture(tracesSampleRate).also { current = it } diff --git a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/SentryNavEffectTest.kt b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/SentryNavEffectTest.kt index 7a0ed005f8e..dd4c3b29392 100644 --- a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/SentryNavEffectTest.kt +++ b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/SentryNavEffectTest.kt @@ -64,7 +64,7 @@ class SentryNavEffectTest { val appContext: Application = ApplicationProvider.getApplicationContext() Shadows.shadowOf(appContext.packageManager) .addActivityIfNotPresent( - ComponentName(appContext.packageName, ComponentActivity::class.java.name) + ComponentName(appContext.packageName, ComponentActivity::class.java.name), ) } } @@ -259,7 +259,7 @@ class SentryNavEffectTest { mapOf("entry" to "/ProfileRoute"), mapOf("entry" to "/HomeRoute"), mapOf("entry" to "/HomeRoute"), - ) + ), ) } @@ -361,7 +361,7 @@ class SentryNavEffectTest { mutableStateOf>( BackStackEntryMapper { entry -> SentryBackStackEntry(entry::class.simpleName ?: "") - } + }, ) composeRule.setContent { @@ -399,7 +399,7 @@ class SentryNavEffectTest { mutableStateOf>( BackStackEntryMapper { entry -> SentryBackStackEntry(entry::class.simpleName ?: "unknown") - } + }, ) composeRule.setContent { @@ -468,7 +468,7 @@ class SentryNavEffectTest { listOf( mapOf("entry" to "/ProfileRoute", "entry_arguments" to mapOf("userId" to "123")), mapOf("entry" to "/HomeRoute"), - ) + ), ) } diff --git a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/lifecycle/NavScopeTest.kt b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/lifecycle/NavScopeTest.kt index 5f8b0ccd003..d294a7ae01e 100644 --- a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/lifecycle/NavScopeTest.kt +++ b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/lifecycle/NavScopeTest.kt @@ -330,7 +330,7 @@ class NavScopeTest { override fun setTransaction(transaction: String?) { throw ThrowingScopeObserverException() } - } + }, ) assertThrows(ThrowingScopeObserverException::class.java) { @@ -442,7 +442,7 @@ class NavScopeTest { private fun resumedNavScopes(): NavScopes = NavScopes(scopes, coordinator).also { it.attach( - NavRootInfo(TestLifecycleOwner().also(lifecycleOwners::add).lifecycle, activity = null) + NavRootInfo(TestLifecycleOwner().also(lifecycleOwners::add).lifecycle, activity = null), ) } diff --git a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/lifecycle/NavScopesIntegrationTest.kt b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/lifecycle/NavScopesIntegrationTest.kt index fb9782877e2..b77500c7ef5 100644 --- a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/lifecycle/NavScopesIntegrationTest.kt +++ b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/lifecycle/NavScopesIntegrationTest.kt @@ -40,7 +40,7 @@ class NavScopesIntegrationTest { NavTransactionRequest( name = "/Checkout", newOptions = ::TransactionOptions, - ) + ), ) } assertThat(contextsAtSampling).isEmpty() diff --git a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/lifecycle/NavScopesTest.kt b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/lifecycle/NavScopesTest.kt index 84e1d1822c9..be5e1141210 100644 --- a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/lifecycle/NavScopesTest.kt +++ b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/lifecycle/NavScopesTest.kt @@ -187,7 +187,7 @@ class NavScopesTest { override fun setContexts(contexts: Contexts) { throw failure } - } + }, ) val thrown = assertThrows(IllegalStateException::class.java) { fixture.incoming.dispose() } @@ -393,7 +393,7 @@ class NavScopesTest { override fun setTransaction(transaction: String?) { if (transaction == "/Home") screensAtBinding += fixture.scope.screen } - } + }, ) fixture.incoming.dispose() @@ -540,7 +540,7 @@ class NavScopesTest { val fixture = Fixture.create() val covered = fixture.coveredNavScopes() covered.startNavTransaction( - navTransactionRequest("/Result", data = mapOf("arguments" to "id=1")) + navTransactionRequest("/Result", data = mapOf("arguments" to "id=1")), ) fixture.incoming.dispose() @@ -721,7 +721,7 @@ class NavScopesTest { override fun setContexts(contexts: Contexts) { if (observerThrows) throw failure } - } + }, ) val thrown = assertThrows(IllegalStateException::class.java) { fixture.incoming.dispose() } assertThat(thrown).isSameInstanceAs(failure) @@ -806,7 +806,7 @@ class NavScopesTest { SentryOptions().apply { setLogger(this@Fixture.logger) isDebug = true - } + }, ) doAnswer { if (isEnabled) { diff --git a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/lifecycle/StagedNavTransactionTest.kt b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/lifecycle/StagedNavTransactionTest.kt index 82c45a1df90..a1363ffdc25 100644 --- a/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/lifecycle/StagedNavTransactionTest.kt +++ b/sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/lifecycle/StagedNavTransactionTest.kt @@ -318,7 +318,7 @@ class StagedNavTransactionTest { whenever(finished.isFinished).thenReturn(true) stagedNavTransaction.updateRequest( - navTransactionRequest("/Profile", contexts = updatedContexts) + navTransactionRequest("/Profile", contexts = updatedContexts), ) stagedNavTransaction.publishTo(fixture.scope) @@ -332,7 +332,7 @@ class StagedNavTransactionTest { stagedNavTransaction.stage(request) stagedNavTransaction.updateRequest( - navTransactionRequest("/Profile", contexts = updatedContexts) + navTransactionRequest("/Profile", contexts = updatedContexts), ) stagedNavTransaction.publishTo(fixture.scope) @@ -348,7 +348,7 @@ class StagedNavTransactionTest { val started = fixture.start() stagedNavTransaction.updateRequest( - navTransactionRequest("/Profile", contexts = updatedContexts) + navTransactionRequest("/Profile", contexts = updatedContexts), ) stagedNavTransaction.publishTo(fixture.scope) @@ -365,7 +365,7 @@ class StagedNavTransactionTest { stagedNavTransaction.finish(fixture.scope) stagedNavTransaction.updateRequest( - navTransactionRequest("/Profile", contexts = updatedContexts) + navTransactionRequest("/Profile", contexts = updatedContexts), ) stagedNavTransaction.publishTo(fixture.scope) @@ -898,7 +898,7 @@ class StagedNavTransactionTest { SentryOptions().apply { setLogger(this@Fixture.logger) isDebug = true - } + }, ) whenever(scopes.startTransaction(any(), any())) .thenAnswer { @@ -923,7 +923,7 @@ class StagedNavTransactionTest { throw ThrowingScopeObserverException() } } - } + }, ) } diff --git a/sentry-android-ndk-outproc/src/test/java/io/sentry/android/ndk/outproc/NativeBackendTest.kt b/sentry-android-ndk-outproc/src/test/java/io/sentry/android/ndk/outproc/NativeBackendTest.kt index 96a68c1960f..61d56f4236b 100644 --- a/sentry-android-ndk-outproc/src/test/java/io/sentry/android/ndk/outproc/NativeBackendTest.kt +++ b/sentry-android-ndk-outproc/src/test/java/io/sentry/android/ndk/outproc/NativeBackendTest.kt @@ -38,10 +38,12 @@ class NativeBackendTest { @Test fun `propagates app hang tracking options`() { - initialize({ - isEnableNdkAppHangTracking = true - ndkAppHangTimeoutIntervalMillis = 2000 - }) { + initialize( + { + isEnableNdkAppHangTracking = true + ndkAppHangTimeoutIntervalMillis = 2000 + }, + ) { assertThat(it.isEnableAppHangTracking).isTrue() assertThat(it.appHangTimeoutMillis).isEqualTo(2000L) } diff --git a/sentry-android-ndk-outproc/src/test/java/io/sentry/android/ndk/outproc/SentryNdkCrashServiceTest.kt b/sentry-android-ndk-outproc/src/test/java/io/sentry/android/ndk/outproc/SentryNdkCrashServiceTest.kt index b8bf6f31e29..15f47d70780 100644 --- a/sentry-android-ndk-outproc/src/test/java/io/sentry/android/ndk/outproc/SentryNdkCrashServiceTest.kt +++ b/sentry-android-ndk-outproc/src/test/java/io/sentry/android/ndk/outproc/SentryNdkCrashServiceTest.kt @@ -380,7 +380,7 @@ class SentryNdkCrashServiceTest { .setReason(reason) .setTimestamp(timestamp) .setTraceInputStream(trace) - .build() + .build(), ) } diff --git a/sentry-android-ndk/src/main/java/io/sentry/android/ndk/NdkScopeObserver.java b/sentry-android-ndk/src/main/java/io/sentry/android/ndk/NdkScopeObserver.java index c35a294c828..0ec3446aa83 100644 --- a/sentry-android-ndk/src/main/java/io/sentry/android/ndk/NdkScopeObserver.java +++ b/sentry-android-ndk/src/main/java/io/sentry/android/ndk/NdkScopeObserver.java @@ -39,16 +39,15 @@ public void setUser(final @Nullable User user) { try { options .getExecutorService() - .submit( - () -> { - if (user == null) { - // remove user if its null - nativeScope.removeUser(); - } else { - nativeScope.setUser( - user.getId(), user.getEmail(), user.getIpAddress(), user.getUsername()); - } - }); + .submit(() -> { + if (user == null) { + // remove user if its null + nativeScope.removeUser(); + } else { + nativeScope.setUser( + user.getId(), user.getEmail(), user.getIpAddress(), user.getUsername()); + } + }); } catch (Throwable e) { options.getLogger().log(SentryLevel.ERROR, e, "Scope sync setUser has an error."); } @@ -68,34 +67,26 @@ public void addBreadcrumb(final @NotNull Breadcrumb crumb) { try { options .getExecutorService() - .submit( - () -> { - String level = null; - if (crumb.getLevel() != null) { - level = crumb.getLevel().name().toLowerCase(Locale.ROOT); - } - final String timestamp = DateUtils.getTimestamp(crumb.getTimestamp()); - - String data = null; - try { - final Map dataRef = crumb.getData(); - if (!dataRef.isEmpty()) { - data = options.getSerializer().serialize(dataRef); - } - } catch (Throwable e) { - options - .getLogger() - .log(SentryLevel.ERROR, e, "Breadcrumb data is not serializable."); - } - - nativeScope.addBreadcrumb( - level, - crumb.getMessage(), - crumb.getCategory(), - crumb.getType(), - timestamp, - data); - }); + .submit(() -> { + String level = null; + if (crumb.getLevel() != null) { + level = crumb.getLevel().name().toLowerCase(Locale.ROOT); + } + final String timestamp = DateUtils.getTimestamp(crumb.getTimestamp()); + + String data = null; + try { + final Map dataRef = crumb.getData(); + if (!dataRef.isEmpty()) { + data = options.getSerializer().serialize(dataRef); + } + } catch (Throwable e) { + options.getLogger().log(SentryLevel.ERROR, e, "Breadcrumb data is not serializable."); + } + + nativeScope.addBreadcrumb( + level, crumb.getMessage(), crumb.getCategory(), crumb.getType(), timestamp, data); + }); } catch (Throwable e) { options.getLogger().log(SentryLevel.ERROR, e, "Scope sync addBreadcrumb has an error."); } @@ -148,10 +139,9 @@ public void setTrace(@Nullable SpanContext spanContext, @NotNull IScope scope) { try { options .getExecutorService() - .submit( - () -> - nativeScope.setTrace( - spanContext.getTraceId().toString(), spanContext.getSpanId().toString())); + .submit(() -> + nativeScope.setTrace( + spanContext.getTraceId().toString(), spanContext.getSpanId().toString())); } catch (Throwable e) { options.getLogger().log(SentryLevel.ERROR, e, "Scope sync setTrace failed."); } diff --git a/sentry-android-ndk/src/test/java/io/sentry/android/ndk/SentryNdkTest.kt b/sentry-android-ndk/src/test/java/io/sentry/android/ndk/SentryNdkTest.kt index d9b332ac185..afa3d7061c6 100644 --- a/sentry-android-ndk/src/test/java/io/sentry/android/ndk/SentryNdkTest.kt +++ b/sentry-android-ndk/src/test/java/io/sentry/android/ndk/SentryNdkTest.kt @@ -49,7 +49,7 @@ class SentryNdkTest { dsn = "https://key@sentry.io/proj" cacheDirPath = "/cache" tracesSampleRate = null - } + }, ) { assertNotNull(fixture.capturedOptions) assertEquals(0.0f, fixture.capturedOptions!!.tracesSampleRate, 0.0001f) @@ -64,7 +64,7 @@ class SentryNdkTest { dsn = "https://key@sentry.io/proj" cacheDirPath = "/cache" tracesSampleRate = 0.75 - } + }, ) { assertNotNull(fixture.capturedOptions) assertEquals(0.75f, fixture.capturedOptions!!.tracesSampleRate, 0.0001f) @@ -89,7 +89,7 @@ class SentryNdkTest { cacheDirPath = "/cache" isEnableNdkAppHangTracking = true ndkAppHangTimeoutIntervalMillis = 2000 - } + }, ) { assertNotNull(fixture.capturedOptions) assertTrue(fixture.capturedOptions!!.isEnableAppHangTracking) diff --git a/sentry-android-ndk/src/test/java/io/sentry/android/ndk/SentryNdkUtilTest.kt b/sentry-android-ndk/src/test/java/io/sentry/android/ndk/SentryNdkUtilTest.kt index 943e4fb6df7..ee29d4a5118 100644 --- a/sentry-android-ndk/src/test/java/io/sentry/android/ndk/SentryNdkUtilTest.kt +++ b/sentry-android-ndk/src/test/java/io/sentry/android/ndk/SentryNdkUtilTest.kt @@ -13,7 +13,7 @@ class SentryNdkUtilTest { assertTrue( options.sdkVersion!!.packageSet.any { it.name == "maven:io.sentry:sentry-android-ndk" && it.version == BuildConfig.VERSION_NAME - } + }, ) } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/DefaultReplayBreadcrumbConverter.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/DefaultReplayBreadcrumbConverter.kt index bf8a7667a27..2788b39084d 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/DefaultReplayBreadcrumbConverter.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/DefaultReplayBreadcrumbConverter.kt @@ -44,7 +44,7 @@ public open class DefaultReplayBreadcrumbConverter() : ReplayBreadcrumbConverter * user-provided callback to provide the actual breadcrumb to process. */ private inner class ReplayBeforeBreadcrumbCallback( - private val delegate: BeforeBreadcrumbCallback? + private val delegate: BeforeBreadcrumbCallback?, ) : BeforeBreadcrumbCallback { override fun execute(breadcrumb: Breadcrumb, hint: Hint): Breadcrumb? { val resultBreadcrumb = @@ -81,11 +81,11 @@ public open class DefaultReplayBreadcrumbConverter() : ReplayBreadcrumbConverter Collections.synchronizedMap( object : LinkedHashMap() { override fun removeEldestEntry( - eldest: MutableMap.MutableEntry? + eldest: MutableMap.MutableEntry?, ): Boolean { return size > MAX_HTTP_NETWORK_DETAILS } - } + }, ) override fun convert(breadcrumb: Breadcrumb): RRWebEvent? { diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt index bebaf95d396..6bdca6f748f 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt @@ -267,7 +267,7 @@ public class ReplayIntegration( lifecycleState = STARTED, replayId = replayId ?: SentryId.EMPTY_ID, captureStrategy = strategy, - ) + ), ) registerRootViewListeners() @@ -370,7 +370,7 @@ public class ReplayIntegration( current.copy( replayId = replayId ?: SentryId.EMPTY_ID, captureStrategy = activeStrategy, - ) + ), ) } @@ -470,7 +470,7 @@ public class ReplayIntegration( lifecycleState = STOPPED, replayId = SentryId.EMPTY_ID, captureStrategy = null, - ) + ), ) } @@ -728,7 +728,7 @@ public class ReplayIntegration( segment.capture(scopes, hint) } cleanupReplays( - unfinishedReplayId = previousReplayIdString + unfinishedReplayId = previousReplayIdString, ) // will be cleaned up after the envelope is assembled } } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/WindowRecorder.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/WindowRecorder.kt index 19c61900889..8ee0041f8b1 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/WindowRecorder.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/WindowRecorder.kt @@ -205,7 +205,7 @@ internal class WindowRecorder( } return true } - } + }, ) } } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BaseCaptureStrategy.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BaseCaptureStrategy.kt index b6b8981f8ce..6b55cab0bb1 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BaseCaptureStrategy.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BaseCaptureStrategy.kt @@ -165,7 +165,7 @@ constructor( replayDeadline = null segmentTimestamp = null currentReplayId = SentryId.EMPTY_ID - } + }, ) } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BufferCaptureStrategy.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BufferCaptureStrategy.kt index 071acc19cae..988a62e6411 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BufferCaptureStrategy.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BufferCaptureStrategy.kt @@ -86,7 +86,7 @@ constructor( ReplayRunnable("$TAG.stop") { ReplayCache.deleteExceptSegmentVideos(replayCacheDir) currentSegment = -1 - } + }, ) super.stop() } @@ -144,7 +144,7 @@ constructor( val bufferLimit = now - options.sessionReplay.errorReplayDuration screenAtStart = cache?.rotate(bufferLimit) bufferedSegments.rotate(bufferLimit) - } + }, ) } @@ -283,7 +283,7 @@ constructor( currentConfig.bitRate, ) onSegmentCreated(segment) - } + }, ) } } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/SessionCaptureStrategy.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/SessionCaptureStrategy.kt index 8e6ae9fc4a4..58bbf887084 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/SessionCaptureStrategy.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/capture/SessionCaptureStrategy.kt @@ -167,7 +167,7 @@ constructor( options.replayController.stop() options.logger.log(INFO, "Session replay deadline exceeded (1h), stopping recording") } - } + }, ) } @@ -217,7 +217,7 @@ constructor( currentConfig.bitRate, ) onSegmentCreated(segment) - } + }, ) } } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/gestures/ReplayGestureConverter.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/gestures/ReplayGestureConverter.kt index 91a849627ea..55d90e0d622 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/gestures/ReplayGestureConverter.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/gestures/ReplayGestureConverter.kt @@ -114,7 +114,7 @@ internal class ReplayGestureConverter( id = 0 // html node id, but we don't have it, so hardcode to 0 to align with FE pointerId = pId interactionType = InteractionType.TouchStart - } + }, ) } MotionEvent.ACTION_UP, @@ -137,7 +137,7 @@ internal class ReplayGestureConverter( id = 0 // html node id, but we don't have it, so hardcode to 0 to align with FE pointerId = pId interactionType = InteractionType.TouchEnd - } + }, ) } MotionEvent.ACTION_CANCEL -> { @@ -151,7 +151,7 @@ internal class ReplayGestureConverter( id = 0 // html node id, but we don't have it, so hardcode to 0 to align with FE pointerId = 0 // the pointerId is not used for TouchCancel, so just set it to 0 interactionType = InteractionType.TouchCancel - } + }, ) } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/CanvasStrategy.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/CanvasStrategy.kt index 6956782cc27..e6019486fba 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/CanvasStrategy.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/CanvasStrategy.kt @@ -188,7 +188,7 @@ internal class CanvasStrategy( if (!pixelCopyInFlight) { releaseResources() } - } + }, ) unprocessedPictureRef.getAndSet(null) } diff --git a/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/PixelCopyStrategy.kt b/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/PixelCopyStrategy.kt index 06be58e19de..49ec7931ff1 100644 --- a/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/PixelCopyStrategy.kt +++ b/sentry-android-replay/src/main/java/io/sentry/android/replay/screenshot/PixelCopyStrategy.kt @@ -150,7 +150,7 @@ internal class PixelCopyStrategy( } finally { finishFrame() } - } + }, ) if (submitted == null) { finishFrame() @@ -344,7 +344,7 @@ internal class PixelCopyStrategy( } finally { finishFrame() } - } + }, ) if (submitted == null) { recycleCaptures(captures) @@ -386,7 +386,7 @@ internal class PixelCopyStrategy( } finally { finishFrame() } - } + }, ) if (submitted == null) { finishFrame() diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/AnrWithReplayIntegrationTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/AnrWithReplayIntegrationTest.kt index 3df08b2af24..9a48f226819 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/AnrWithReplayIntegrationTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/AnrWithReplayIntegrationTest.kt @@ -110,7 +110,7 @@ class AnrWithReplayIntegrationTest { (no managed stack frames) """ .trimIndent() - .byteInputStream() + .byteInputStream(), ) } shadowActivityManager.addApplicationExitInfo(exitInfo) @@ -180,7 +180,7 @@ class AnrWithReplayIntegrationTest { asserted.set(true) return event } - } + }, ) // have to do it after the cacheDir is set to options, because it adds a dsn hash after @@ -200,7 +200,7 @@ class AnrWithReplayIntegrationTest { $SEGMENT_KEY_TIMESTAMP=2024-07-11T10:25:21.454Z $SEGMENT_KEY_REPLAY_TYPE=BUFFER """ - .trimIndent() + .trimIndent(), ) } @@ -216,7 +216,7 @@ class AnrWithReplayIntegrationTest { await .withAlias( - "Failed because of BeforeSend callback above, but we swallow BeforeSend exceptions, hence the timeout" + "Failed because of BeforeSend callback above, but we swallow BeforeSend exceptions, hence the timeout", ) .untilTrue(asserted) } diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/DefaultReplayBreadcrumbConverterTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/DefaultReplayBreadcrumbConverterTest.kt index 9d9d5b72823..a6759419b29 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/DefaultReplayBreadcrumbConverterTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/DefaultReplayBreadcrumbConverterTest.kt @@ -426,7 +426,7 @@ class DefaultReplayBreadcrumbConverterTest { 100L, NetworkBody("request body content"), mapOf("Content-Type" to "application/json"), - ) + ), ) fakeOkHttpNetworkDetails.setResponseDetails( ReplayNetworkRequestOrResponse( @@ -434,7 +434,7 @@ class DefaultReplayBreadcrumbConverterTest { 500L, NetworkBody(mapOf("status" to "success", "message" to "OK")), mapOf("Content-Type" to "text/plain"), - ) + ), ) val hintWithFakeOKHttpNetworkDetails = Hint() hintWithFakeOKHttpNetworkDetails.set(SENTRY_REPLAY_NETWORK_DETAILS, fakeOkHttpNetworkDetails) @@ -488,7 +488,7 @@ class DefaultReplayBreadcrumbConverterTest { 150L, NetworkBody(listOf("item1", "item2", "item3")), mapOf("Content-Type" to "application/json"), - ) + ), ) fakeOkHttpNetworkDetails.setResponseDetails( ReplayNetworkRequestOrResponse( @@ -496,7 +496,7 @@ class DefaultReplayBreadcrumbConverterTest { 550L, NetworkBody(mapOf("status" to "success", "message" to "OK")), mapOf("Content-Type" to "text/plain"), - ) + ), ) val hintWithFakeOKHttpNetworkDetails = Hint() hintWithFakeOKHttpNetworkDetails.set(SENTRY_REPLAY_NETWORK_DETAILS, fakeOkHttpNetworkDetails) @@ -543,7 +543,7 @@ class DefaultReplayBreadcrumbConverterTest { } val networkRequestData = NetworkRequestData("GET") networkRequestData.setResponseDetails( - ReplayNetworkRequestOrResponse(200, null, null, mapOf("Content-Type" to "application/json")) + ReplayNetworkRequestOrResponse(200, null, null, mapOf("Content-Type" to "application/json")), ) // Simulates Scopes.addBreadcrumb, which hands the network details to the converter options.beforeBreadcrumb?.execute( @@ -558,7 +558,7 @@ class DefaultReplayBreadcrumbConverterTest { 21L, NetworkBody("response body content"), mapOf("Content-Type" to "application/json"), - ) + ), ) check(rrwebEvent is RRWebSpanEvent) @@ -584,7 +584,7 @@ class DefaultReplayBreadcrumbConverterTest { 100L, NetworkBody("request body content"), mapOf("Content-Type" to "application/json"), - ) + ), ) networkRequestData.setResponseDetails( ReplayNetworkRequestOrResponse( @@ -592,7 +592,7 @@ class DefaultReplayBreadcrumbConverterTest { 100L, NetworkBody("response body content"), mapOf("Content-Type" to "application/json"), - ) + ), ) hint.set(SENTRY_REPLAY_NETWORK_DETAILS, networkRequestData) diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/PreviousReplayIntegrationTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/PreviousReplayIntegrationTest.kt index 5999ac9826b..dc42b30e04a 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/PreviousReplayIntegrationTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/PreviousReplayIntegrationTest.kt @@ -73,7 +73,7 @@ class PreviousReplayIntegrationTest { capturedReplay.set(event) return event } - } + }, ) // have to do it after the cacheDir is set to options, because it adds a dsn hash after @@ -96,7 +96,7 @@ class PreviousReplayIntegrationTest { $SEGMENT_KEY_TIMESTAMP=2024-07-11T10:25:21.454Z $SEGMENT_KEY_REPLAY_TYPE=BUFFER """ - .trimIndent() + .trimIndent(), ) File(replayFolder, "1720693523997.jpg").outputStream().use { os -> Bitmap.createBitmap(1, 1, ARGB_8888).compress(JPEG, 80, os) diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayCacheTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayCacheTest.kt index 8e08b936bd5..5a447904829 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayCacheTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayCacheTest.kt @@ -271,7 +271,7 @@ class ReplayCacheTest { assertTrue( replayCache.replayCacheDir!!.listFiles()!!.none { it.name == "1.jpg" || it.name == "1001.jpg" - } + }, ) } @@ -367,7 +367,7 @@ class ReplayCacheTest { $SEGMENT_KEY_ID=0 $SEGMENT_KEY_TIMESTAMP=2024-07-11T10:25:21.454Z """ - .trimIndent() + .trimIndent(), ) // omitting replay type, which is required, for the test } @@ -396,7 +396,7 @@ class ReplayCacheTest { $SEGMENT_KEY_REPLAY_TYPE=SESSION $SEGMENT_KEY_REPLAY_RECORDING={}[{"type":3,"timestamp":1720693523997,"data":{"source":2,"type":7,"id":0,"x":314.2979431152344,"y":625.44140625,"pointerType":2,"pointerId":0}},{"type":3,"timestamp":1720693524774,"data":{"source":2,"type":9,"id":0,"x":322.00390625,"y":424.4384765625,"pointerType":2,"pointerId":0}}] """ - .trimIndent() + .trimIndent(), ) } @@ -449,7 +449,7 @@ class ReplayCacheTest { $SEGMENT_KEY_TIMESTAMP=2024-07-11T10:25:21.454Z $SEGMENT_KEY_REPLAY_TYPE=SESSION """ - .trimIndent() + .trimIndent(), ) } @@ -506,7 +506,7 @@ class ReplayCacheTest { $SEGMENT_KEY_TIMESTAMP=2024-07-11T10:25:21.454Z $SEGMENT_KEY_REPLAY_TYPE=BUFFER """ - .trimIndent() + .trimIndent(), ) } @@ -543,7 +543,7 @@ class ReplayCacheTest { $SEGMENT_KEY_SDK_NAME=sentry.java.android $SEGMENT_KEY_SDK_VERSION=8.0.0 """ - .trimIndent() + .trimIndent(), ) } File(replayCacheFolder, "1720693523997.jpg").outputStream().use { @@ -578,7 +578,7 @@ class ReplayCacheTest { $SEGMENT_KEY_TIMESTAMP=2024-07-11T10:25:21.454Z $SEGMENT_KEY_REPLAY_TYPE=BUFFER """ - .trimIndent() + .trimIndent(), ) } File(replayCacheFolder, "1720693523997.jpg").outputStream().use { @@ -609,7 +609,7 @@ class ReplayCacheTest { $SEGMENT_KEY_REPLAY_TYPE=BUFFER $SEGMENT_KEY_FLUSHED=true """ - .trimIndent() + .trimIndent(), ) } diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayIntegrationTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayIntegrationTest.kt index 49ec8565c1b..d66584f1085 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayIntegrationTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayIntegrationTest.kt @@ -102,7 +102,7 @@ class ReplayIntegrationTest { on { isMainThread }.thenAnswer { Looper.myLooper() == Looper.getMainLooper() } } setReplayController( - mock { on { breadcrumbConverter }.thenReturn(DefaultReplayBreadcrumbConverter()) } + mock { on { breadcrumbConverter }.thenReturn(DefaultReplayBreadcrumbConverter()) }, ) executorService = mock { doAnswer { (it.arguments[0] as Runnable).run() }.whenever(mock).submit(any()) @@ -1082,7 +1082,7 @@ class ReplayIntegrationTest { $SEGMENT_KEY_REPLAY_TYPE=SESSION $SEGMENT_KEY_REPLAY_RECORDING={}[{"type":3,"timestamp":1720693523997,"data":{"source":2,"type":7,"id":0,"x":314.2979431152344,"y":625.44140625,"pointerType":2,"pointerId":0}},{"type":3,"timestamp":1720693524774,"data":{"source":2,"type":9,"id":0,"x":322.00390625,"y":424.4384765625,"pointerType":2,"pointerId":0}}] """ - .trimIndent() + .trimIndent(), ) } diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplaySmokeTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplaySmokeTest.kt index d35ef4e8e0f..c7a368b06cb 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplaySmokeTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/ReplaySmokeTest.kt @@ -85,7 +85,7 @@ class ReplaySmokeTest { Callback { it.callback?.run() true - } + }, ) private val recordingThread = Executors.newSingleThreadScheduledExecutor() diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/BufferCaptureStrategyTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/BufferCaptureStrategyTest.kt index f3830bc1ed5..a926eb00358 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/BufferCaptureStrategyTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/BufferCaptureStrategyTest.kt @@ -59,7 +59,7 @@ class BufferCaptureStrategyTest { val options = SentryOptions().apply { setReplayController( - mock { on { breadcrumbConverter }.thenReturn(DefaultReplayBreadcrumbConverter()) } + mock { on { breadcrumbConverter }.thenReturn(DefaultReplayBreadcrumbConverter()) }, ) } val scope = Scope(options) @@ -329,7 +329,7 @@ class BufferCaptureStrategyTest { anyInt(), anyInt(), any(), - ) + ), ) .thenAnswer { invocation -> capturedFrom = invocation.arguments[1] as Long @@ -363,7 +363,7 @@ class BufferCaptureStrategyTest { anyInt(), anyInt(), any(), - ) + ), ) .thenAnswer { invocation -> capturedFrom = invocation.arguments[1] as Long diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt index 4c31090cee9..68f7bb0cb0f 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt @@ -77,7 +77,7 @@ class SessionCaptureStrategyTest { val options = SentryOptions().apply { setReplayController( - mock { on { breadcrumbConverter }.thenReturn(DefaultReplayBreadcrumbConverter()) } + mock { on { breadcrumbConverter }.thenReturn(DefaultReplayBreadcrumbConverter()) }, ) } val scope = Scope(options) diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/gestures/GestureRecorderTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/gestures/GestureRecorderTest.kt index 6f5a02b54c7..fe72df2562d 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/gestures/GestureRecorderTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/gestures/GestureRecorderTest.kt @@ -28,7 +28,7 @@ class GestureRecorderTest { val options = SentryOptions() fun getSut( - touchRecorderCallback: TouchRecorderCallback = NoOpTouchRecorderCallback() + touchRecorderCallback: TouchRecorderCallback = NoOpTouchRecorderCallback(), ): GestureRecorder = GestureRecorder(options, touchRecorderCallback) } @@ -65,7 +65,7 @@ class GestureRecorderTest { override fun onTouchEvent(event: MotionEvent) { called = true } - } + }, ) gestureRecorder.onRootViewsChanged(activity.root, true) @@ -92,7 +92,7 @@ class GestureRecorderTest { assertEquals(MotionEvent.ACTION_DOWN, event.action) called = true } - } + }, ) gestureRecorder.onRootViewsChanged(activity.root, true) diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/gestures/ReplayGestureConverterTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/gestures/ReplayGestureConverterTest.kt index 9e8c65bc75a..b06f85253d2 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/gestures/ReplayGestureConverterTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/gestures/ReplayGestureConverterTest.kt @@ -31,7 +31,7 @@ class ReplayGestureConverterTest { } fun getSut( - dateProvider: ICurrentDateProvider = ICurrentDateProvider { now } + dateProvider: ICurrentDateProvider = ICurrentDateProvider { now }, ): ReplayGestureConverter = ReplayGestureConverter(dateProvider, ticker) } diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/screenshot/PixelCopyStrategyTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/screenshot/PixelCopyStrategyTest.kt index 587927e9793..1bf2fa89a10 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/screenshot/PixelCopyStrategyTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/screenshot/PixelCopyStrategyTest.kt @@ -664,7 +664,7 @@ private class ActivityWithSurfaceView : Activity() { TextView(this).apply { text = "Overlay" layoutParams = FrameLayout.LayoutParams(200, 50) - } + }, ) root.addView(SurfaceView(this).apply { layoutParams = FrameLayout.LayoutParams(200, 200) }) setContentView(root) diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt index 0accb9ed16d..607b81d888d 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ComposeMaskingOptionsTest.kt @@ -221,7 +221,7 @@ class ComposeMaskingOptionsTest { @Test @Ignore( - "Flaky: Robolectric intermittently reports zero bounds for nodes, causing isVisible=false and making the assertion non-deterministic" + "Flaky: Robolectric intermittently reports zero bounds for nodes, causing isVisible=false and making the assertion non-deterministic", ) fun `when sentry-unmask modifier is set unmasks the node`() { ComposeMaskingOptionsActivity.textModifierApplier = { Modifier.sentryReplayUnmask() } diff --git a/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ContainerMaskingOptionsTest.kt b/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ContainerMaskingOptionsTest.kt index 5d5304555ce..d23a64926d1 100644 --- a/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ContainerMaskingOptionsTest.kt +++ b/sentry-android-replay/src/test/java/io/sentry/android/replay/viewhierarchy/ContainerMaskingOptionsTest.kt @@ -217,9 +217,9 @@ class ContainerMaskingOptionsTest { textViewInUnmask = this text = "Hello, World!" layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) - } + }, ) - } + }, ) linearLayout.addView( @@ -231,9 +231,9 @@ class ContainerMaskingOptionsTest { val image = this::class.java.classLoader.getResource("Tongariro.jpg")!! setImageDrawable(Drawable.createFromPath(image.path)) layoutParams = LayoutParams(50, 50).apply { setMargins(0, 16, 0, 0) } - } + }, ) - } + }, ) linearLayout.addView( @@ -243,23 +243,23 @@ class ContainerMaskingOptionsTest { CustomGroup(context).apply { customViewInUnmask = this this.addView(CustomView(context).apply { secondLayerChildInUnmask = this }) - } + }, ) - } + }, ) linearLayout.addView( CustomMask(context).apply { maskWithChildren = this this.addView(CustomGroup(context).apply { this.addView(CustomView(context)) }) - } + }, ) linearLayout.addView( CustomUnmask(context).apply { unmaskWithMaskChild = this this.addView(CustomMask(context).apply { maskAsDirectChildOfUnmask = this }) - } + }, ) setContentView(linearLayout) diff --git a/sentry-android-timber/src/test/java/io/sentry/android/timber/SentryTimberIntegrationTest.kt b/sentry-android-timber/src/test/java/io/sentry/android/timber/SentryTimberIntegrationTest.kt index 758e6568c10..696a8ccb806 100644 --- a/sentry-android-timber/src/test/java/io/sentry/android/timber/SentryTimberIntegrationTest.kt +++ b/sentry-android-timber/src/test/java/io/sentry/android/timber/SentryTimberIntegrationTest.kt @@ -110,7 +110,7 @@ class SentryTimberIntegrationTest { assertTrue( fixture.options.sdkVersion!!.packageSet.any { it.name == "maven:io.sentry:sentry-android-timber" && it.version == BuildConfig.VERSION_NAME - } + }, ) } @@ -147,7 +147,7 @@ class SentryTimberIntegrationTest { SentryLevel.ERROR, SentryLevel.INFO, SentryLogLevel.INFO, - ) + ), ) try { diff --git a/sentry-android-timber/src/test/java/io/sentry/android/timber/SentryTimberTreeTest.kt b/sentry-android-timber/src/test/java/io/sentry/android/timber/SentryTimberTreeTest.kt index 3fd80e495fd..bdc71ea3136 100644 --- a/sentry-android-timber/src/test/java/io/sentry/android/timber/SentryTimberTreeTest.kt +++ b/sentry-android-timber/src/test/java/io/sentry/android/timber/SentryTimberTreeTest.kt @@ -191,7 +191,7 @@ class SentryTimberTreeTest { check { assertEquals("tag", it.getTag("TimberTag")) assertEquals(sentryLevel, it.level) - } + }, ) } } @@ -210,7 +210,7 @@ class SentryTimberTreeTest { sut.e("message") verify(fixture.scopes) .captureEvent( - check { assertNotNull(it.message) { message -> assertEquals("message", message.message) } } + check { assertNotNull(it.message) { message -> assertEquals("message", message.message) } }, ) } @@ -226,7 +226,7 @@ class SentryTimberTreeTest { assertEquals("test count: 32", message.formatted) assertEquals("32", message.params!!.first()) } - } + }, ) } @@ -270,7 +270,7 @@ class SentryTimberTreeTest { assertEquals("Timber", it.category) assertEquals(SentryLevel.INFO, it.level) assertEquals("message", it.message) - } + }, ) } @@ -284,7 +284,7 @@ class SentryTimberTreeTest { assertEquals("exception", it.category) assertEquals(SentryLevel.ERROR, it.level) assertEquals("test", it.message) - } + }, ) } diff --git a/sentry-apache-http-client-5/src/test/kotlin/io/sentry/transport/apache/ApacheHttpClientTransportClientReportTest.kt b/sentry-apache-http-client-5/src/test/kotlin/io/sentry/transport/apache/ApacheHttpClientTransportClientReportTest.kt index afe0b38538d..128bf8e4100 100644 --- a/sentry-apache-http-client-5/src/test/kotlin/io/sentry/transport/apache/ApacheHttpClientTransportClientReportTest.kt +++ b/sentry-apache-http-client-5/src/test/kotlin/io/sentry/transport/apache/ApacheHttpClientTransportClientReportTest.kt @@ -60,7 +60,7 @@ class ApacheHttpClientTransportClientReportTest { envelopeAfterClientReportAttached = SentryEnvelope.from(options.serializer, SentryEvent(), null) whenever( - clientReportRecorder.attachReportToEnvelope(same(envelopeBeforeClientReportAttached)) + clientReportRecorder.attachReportToEnvelope(same(envelopeBeforeClientReportAttached)), ) .thenReturn(envelopeAfterClientReportAttached) } diff --git a/sentry-apache-http-client-5/src/test/kotlin/io/sentry/transport/apache/ApacheHttpClientTransportFactoryTest.kt b/sentry-apache-http-client-5/src/test/kotlin/io/sentry/transport/apache/ApacheHttpClientTransportFactoryTest.kt index 80dc653fa45..1bfb6519659 100644 --- a/sentry-apache-http-client-5/src/test/kotlin/io/sentry/transport/apache/ApacheHttpClientTransportFactoryTest.kt +++ b/sentry-apache-http-client-5/src/test/kotlin/io/sentry/transport/apache/ApacheHttpClientTransportFactoryTest.kt @@ -29,7 +29,7 @@ class ApacheHttpClientTransportFactoryTest { SentryOptions().apply { this.connectionTimeoutMillis = 1500 this.readTimeoutMillis = 2500 - } + }, ) val requestConfig = transport.getClient().getRequestConfig() assertEquals(1500, requestConfig.connectTimeout.toMilliseconds()) diff --git a/sentry-apollo-3/src/main/java/io/sentry/apollo3/SentryApolloBuilderExtensions.kt b/sentry-apollo-3/src/main/java/io/sentry/apollo3/SentryApolloBuilderExtensions.kt index 076cfea521d..79f7059124b 100644 --- a/sentry-apollo-3/src/main/java/io/sentry/apollo3/SentryApolloBuilderExtensions.kt +++ b/sentry-apollo-3/src/main/java/io/sentry/apollo3/SentryApolloBuilderExtensions.kt @@ -20,7 +20,7 @@ fun ApolloClient.Builder.sentryTracing( captureFailedRequests = captureFailedRequests, failedRequestTargets = failedRequestTargets, beforeSpan = beforeSpan, - ) + ), ) return this } diff --git a/sentry-apollo-3/src/test/java/io/sentry/apollo3/SentryApollo3InterceptorClientErrors.kt b/sentry-apollo-3/src/test/java/io/sentry/apollo3/SentryApollo3InterceptorClientErrors.kt index 315f15a97b3..a450acbb96e 100644 --- a/sentry-apollo-3/src/test/java/io/sentry/apollo3/SentryApollo3InterceptorClientErrors.kt +++ b/sentry-apollo-3/src/test/java/io/sentry/apollo3/SentryApollo3InterceptorClientErrors.kt @@ -88,7 +88,7 @@ class SentryApollo3InterceptorClientErrors { sdkVersion = SdkVersion("test", "1.2.3") isSendDefaultPii = sendDefaultPii configureOptions() - } + }, ) } whenever(scopes.captureEvent(any(), any())).thenReturn(SentryId.EMPTY_ID) @@ -151,7 +151,7 @@ class SentryApollo3InterceptorClientErrors { fixture.getSut(captureFailedRequests = false) assertFalse( - SentryIntegrationPackageStorage.getInstance().integrations.contains("Apollo3ClientError") + SentryIntegrationPackageStorage.getInstance().integrations.contains("Apollo3ClientError"), ) } @@ -160,7 +160,7 @@ class SentryApollo3InterceptorClientErrors { fixture.getSut() assertTrue( - SentryIntegrationPackageStorage.getInstance().integrations.contains("Apollo3ClientError") + SentryIntegrationPackageStorage.getInstance().integrations.contains("Apollo3ClientError"), ) } diff --git a/sentry-apollo-3/src/test/java/io/sentry/apollo3/SentryApollo3InterceptorTest.kt b/sentry-apollo-3/src/test/java/io/sentry/apollo3/SentryApollo3InterceptorTest.kt index e53da365d56..07e36ea4b5c 100644 --- a/sentry-apollo-3/src/test/java/io/sentry/apollo3/SentryApollo3InterceptorTest.kt +++ b/sentry-apollo-3/src/test/java/io/sentry/apollo3/SentryApollo3InterceptorTest.kt @@ -112,7 +112,7 @@ class SentryApollo3InterceptorTest { MockResponse() .setBody(responseBody) .setSocketPolicy(socketPolicy) - .setResponseCode(httpStatusCode) + .setResponseCode(httpStatusCode), ) if (beforeSpan != null) { @@ -273,8 +273,8 @@ class SentryApollo3InterceptorTest { assertEquals(baggageHeaderValues.size, 1) assertTrue( baggageHeaderValues[0].startsWith( - "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue" - ) + "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue", + ), ) assertTrue(baggageHeaderValues[0].contains("sentry-public_key=key")) assertTrue(baggageHeaderValues[0].contains("sentry-transaction=op")) @@ -365,8 +365,8 @@ class SentryApollo3InterceptorTest { beforeSpan = { span, request, response -> span.description = "overwritten description" span - } - ) + }, + ), ) verify(fixture.scopes) @@ -411,7 +411,7 @@ class SentryApollo3InterceptorTest { beforeSpan = { span, _, _ -> span.spanContext.sampled = false error("callback failed") - } + }, ) assertThat(sut.query(LaunchDetailsQuery("83")).execute().data).isNotNull() @@ -438,7 +438,7 @@ class SentryApollo3InterceptorTest { beforeSpan = { span, _, _ -> span.description = "partially modified" throw failure - } + }, ) val response = sut.query(LaunchDetailsQuery("83")).execute() diff --git a/sentry-apollo-3/src/test/java/io/sentry/apollo3/SentryApollo3InterceptorWithVariablesTest.kt b/sentry-apollo-3/src/test/java/io/sentry/apollo3/SentryApollo3InterceptorWithVariablesTest.kt index a77c3b6ecd4..297be0093dc 100644 --- a/sentry-apollo-3/src/test/java/io/sentry/apollo3/SentryApollo3InterceptorWithVariablesTest.kt +++ b/sentry-apollo-3/src/test/java/io/sentry/apollo3/SentryApollo3InterceptorWithVariablesTest.kt @@ -63,7 +63,7 @@ class SentryApollo3InterceptorWithVariablesTest { MockResponse() .setBody(responseBody) .setSocketPolicy(socketPolicy) - .setResponseCode(httpStatusCode) + .setResponseCode(httpStatusCode), ) return ApolloClient.Builder() diff --git a/sentry-apollo-3/src/test/java/io/sentry/apollo3/selections/LaunchDetailsQuerySelections.kt b/sentry-apollo-3/src/test/java/io/sentry/apollo3/selections/LaunchDetailsQuerySelections.kt index 19d38491023..4f166f19871 100644 --- a/sentry-apollo-3/src/test/java/io/sentry/apollo3/selections/LaunchDetailsQuerySelections.kt +++ b/sentry-apollo-3/src/test/java/io/sentry/apollo3/selections/LaunchDetailsQuerySelections.kt @@ -46,6 +46,6 @@ public object LaunchDetailsQuerySelections { CompiledField.Builder(name = "launch", type = Launch.type) .arguments(listOf(CompiledArgument("id", CompiledVariable("id")))) .selections(launch) - .build() + .build(), ) } diff --git a/sentry-apollo-4/src/main/java/io/sentry/apollo4/SentryApolloBuilderExtensions.kt b/sentry-apollo-4/src/main/java/io/sentry/apollo4/SentryApolloBuilderExtensions.kt index 51383d33ed7..da8cd7f5c1e 100644 --- a/sentry-apollo-4/src/main/java/io/sentry/apollo4/SentryApolloBuilderExtensions.kt +++ b/sentry-apollo-4/src/main/java/io/sentry/apollo4/SentryApolloBuilderExtensions.kt @@ -20,7 +20,7 @@ fun ApolloClient.Builder.sentryTracing( captureFailedRequests = captureFailedRequests, failedRequestTargets = failedRequestTargets, beforeSpan = beforeSpan, - ) + ), ) return this } diff --git a/sentry-apollo-4/src/test/java/io/sentry/apollo4/SentryApollo4BuilderExtensionsClientErrorsTest.kt b/sentry-apollo-4/src/test/java/io/sentry/apollo4/SentryApollo4BuilderExtensionsClientErrorsTest.kt index 4c13e35a83e..dfdf728708d 100644 --- a/sentry-apollo-4/src/test/java/io/sentry/apollo4/SentryApollo4BuilderExtensionsClientErrorsTest.kt +++ b/sentry-apollo-4/src/test/java/io/sentry/apollo4/SentryApollo4BuilderExtensionsClientErrorsTest.kt @@ -47,7 +47,7 @@ class SentryApollo4BuilderExtensionsClientErrorsTestWithV3Implementation : abstract class SentryApollo4BuilderExtensionsClientErrorsTest( private val executeQueryImplementation: - KSuspendFunction1, ApolloResponse> + KSuspendFunction1, ApolloResponse>, ) { class Fixture { val server = MockWebServer() @@ -102,7 +102,7 @@ abstract class SentryApollo4BuilderExtensionsClientErrorsTest( sdkVersion = SdkVersion("test", "1.2.3") isSendDefaultPii = sendDefaultPii configureOptions() - } + }, ) } whenever(scopes.captureEvent(any(), any())).thenReturn(SentryId.EMPTY_ID) @@ -165,7 +165,7 @@ abstract class SentryApollo4BuilderExtensionsClientErrorsTest( fixture.getSut(captureFailedRequests = false) assertFalse( - SentryIntegrationPackageStorage.getInstance().integrations.contains("Apollo4ClientError") + SentryIntegrationPackageStorage.getInstance().integrations.contains("Apollo4ClientError"), ) } @@ -174,7 +174,7 @@ abstract class SentryApollo4BuilderExtensionsClientErrorsTest( fixture.getSut() assertTrue( - SentryIntegrationPackageStorage.getInstance().integrations.contains("Apollo4ClientError") + SentryIntegrationPackageStorage.getInstance().integrations.contains("Apollo4ClientError"), ) } diff --git a/sentry-apollo-4/src/test/java/io/sentry/apollo4/SentryApollo4BuilderExtensionsTest.kt b/sentry-apollo-4/src/test/java/io/sentry/apollo4/SentryApollo4BuilderExtensionsTest.kt index 654ff307eba..6b28d145b25 100644 --- a/sentry-apollo-4/src/test/java/io/sentry/apollo4/SentryApollo4BuilderExtensionsTest.kt +++ b/sentry-apollo-4/src/test/java/io/sentry/apollo4/SentryApollo4BuilderExtensionsTest.kt @@ -44,7 +44,7 @@ class SentryApollo4BuilderExtensionsTestWithV3Implementation : abstract class SentryApollo4BuilderExtensionsTest( private val executeQueryImplementation: - KSuspendFunction1, ApolloResponse> + KSuspendFunction1, ApolloResponse>, ) { class Fixture { val server = MockWebServer() @@ -78,7 +78,7 @@ abstract class SentryApollo4BuilderExtensionsTest( MockResponse() .setBody(responseBody) .setSocketPolicy(socketPolicy) - .setResponseCode(httpStatusCode) + .setResponseCode(httpStatusCode), ) return ApolloClient.Builder() diff --git a/sentry-apollo-4/src/test/java/io/sentry/apollo4/SentryApollo4HttpInterceptorTest.kt b/sentry-apollo-4/src/test/java/io/sentry/apollo4/SentryApollo4HttpInterceptorTest.kt index 756f0d9c26b..c31a83db0b8 100644 --- a/sentry-apollo-4/src/test/java/io/sentry/apollo4/SentryApollo4HttpInterceptorTest.kt +++ b/sentry-apollo-4/src/test/java/io/sentry/apollo4/SentryApollo4HttpInterceptorTest.kt @@ -75,7 +75,7 @@ class SentryApollo4HttpInterceptorTestWithV3Implementation : abstract class SentryApollo4HttpInterceptorTest( private val executeQueryImplementation: - KSuspendFunction1, ApolloResponse> + KSuspendFunction1, ApolloResponse>, ) { class Fixture { val server = MockWebServer() @@ -126,7 +126,7 @@ abstract class SentryApollo4HttpInterceptorTest( MockResponse() .setBody(responseBody) .setSocketPolicy(socketPolicy) - .setResponseCode(httpStatusCode) + .setResponseCode(httpStatusCode), ) if (beforeSpan != null) { @@ -287,8 +287,8 @@ abstract class SentryApollo4HttpInterceptorTest( assertEquals(baggageHeaderValues.size, 1) assertTrue( baggageHeaderValues[0].startsWith( - "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue" - ) + "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue", + ), ) assertTrue(baggageHeaderValues[0].contains("sentry-public_key=key")) assertTrue(baggageHeaderValues[0].contains("sentry-transaction=op")) @@ -379,8 +379,8 @@ abstract class SentryApollo4HttpInterceptorTest( beforeSpan = { span, request, response -> span.description = "overwritten description" span - } - ) + }, + ), ) verify(fixture.scopes) @@ -425,7 +425,7 @@ abstract class SentryApollo4HttpInterceptorTest( beforeSpan = { span, _, _ -> span.spanContext.sampled = false error("callback failed") - } + }, ) assertThat(executeQueryImplementation(sut.query(LaunchDetailsQuery("83"))).data).isNotNull() @@ -452,7 +452,7 @@ abstract class SentryApollo4HttpInterceptorTest( beforeSpan = { span, _, _ -> span.description = "partially modified" throw failure - } + }, ) val response = executeQueryImplementation(sut.query(LaunchDetailsQuery("83"))) diff --git a/sentry-apollo-5/src/main/java/io/sentry/apollo5/SentryApollo5HttpInterceptor.kt b/sentry-apollo-5/src/main/java/io/sentry/apollo5/SentryApollo5HttpInterceptor.kt index f74d0fec111..7333ef04bcf 100644 --- a/sentry-apollo-5/src/main/java/io/sentry/apollo5/SentryApollo5HttpInterceptor.kt +++ b/sentry-apollo-5/src/main/java/io/sentry/apollo5/SentryApollo5HttpInterceptor.kt @@ -135,7 +135,7 @@ constructor( var headers = request.headers.toMutableList() headers.add( - HttpHeader(tracingHeaders.sentryTraceHeader.name, tracingHeaders.sentryTraceHeader.value) + HttpHeader(tracingHeaders.sentryTraceHeader.name, tracingHeaders.sentryTraceHeader.value), ) tracingHeaders.baggageHeader?.let { baggageHeader -> headers = diff --git a/sentry-apollo-5/src/main/java/io/sentry/apollo5/SentryApolloBuilderExtensions.kt b/sentry-apollo-5/src/main/java/io/sentry/apollo5/SentryApolloBuilderExtensions.kt index aed866942b6..780cd4fc125 100644 --- a/sentry-apollo-5/src/main/java/io/sentry/apollo5/SentryApolloBuilderExtensions.kt +++ b/sentry-apollo-5/src/main/java/io/sentry/apollo5/SentryApolloBuilderExtensions.kt @@ -21,7 +21,7 @@ fun ApolloClient.Builder.sentryTracing( captureFailedRequests = captureFailedRequests, failedRequestTargets = failedRequestTargets, beforeSpan = beforeSpan, - ) + ), ) return this } diff --git a/sentry-apollo-5/src/test/java/io/sentry/apollo5/SentryApollo5BuilderExtensionsClientErrorsTest.kt b/sentry-apollo-5/src/test/java/io/sentry/apollo5/SentryApollo5BuilderExtensionsClientErrorsTest.kt index 1307544eb89..82f8471d9e4 100644 --- a/sentry-apollo-5/src/test/java/io/sentry/apollo5/SentryApollo5BuilderExtensionsClientErrorsTest.kt +++ b/sentry-apollo-5/src/test/java/io/sentry/apollo5/SentryApollo5BuilderExtensionsClientErrorsTest.kt @@ -44,7 +44,7 @@ class SentryApollo5BuilderExtensionsClientErrorsTestWithV5Implementation : abstract class SentryApollo5BuilderExtensionsClientErrorsTest( private val executeQueryImplementation: - KSuspendFunction1, ApolloResponse> + KSuspendFunction1, ApolloResponse>, ) { class Fixture { val server = MockWebServer() @@ -99,7 +99,7 @@ abstract class SentryApollo5BuilderExtensionsClientErrorsTest( sdkVersion = SdkVersion("test", "1.2.3") isSendDefaultPii = sendDefaultPii configureOptions() - } + }, ) } whenever(scopes.captureEvent(any(), any())).thenReturn(SentryId.EMPTY_ID) @@ -164,7 +164,7 @@ abstract class SentryApollo5BuilderExtensionsClientErrorsTest( fixture.getSut(captureFailedRequests = false) assertFalse( - SentryIntegrationPackageStorage.getInstance().integrations.contains("Apollo5ClientError") + SentryIntegrationPackageStorage.getInstance().integrations.contains("Apollo5ClientError"), ) } @@ -173,7 +173,7 @@ abstract class SentryApollo5BuilderExtensionsClientErrorsTest( fixture.getSut() assertTrue( - SentryIntegrationPackageStorage.getInstance().integrations.contains("Apollo5ClientError") + SentryIntegrationPackageStorage.getInstance().integrations.contains("Apollo5ClientError"), ) } diff --git a/sentry-apollo-5/src/test/java/io/sentry/apollo5/SentryApollo5BuilderExtensionsTest.kt b/sentry-apollo-5/src/test/java/io/sentry/apollo5/SentryApollo5BuilderExtensionsTest.kt index 4050fc2b607..465f5a97c31 100644 --- a/sentry-apollo-5/src/test/java/io/sentry/apollo5/SentryApollo5BuilderExtensionsTest.kt +++ b/sentry-apollo-5/src/test/java/io/sentry/apollo5/SentryApollo5BuilderExtensionsTest.kt @@ -55,7 +55,7 @@ class SentryApollo5BuilderExtensionsTestWithV5Implementation : abstract class SentryApollo5BuilderExtensionsTest( private val executeQueryImplementation: - KSuspendFunction1, ApolloResponse> + KSuspendFunction1, ApolloResponse>, ) { class Fixture { val server = MockWebServer() @@ -90,7 +90,7 @@ abstract class SentryApollo5BuilderExtensionsTest( MockResponse() .setBody(responseBody) .setSocketPolicy(socketPolicy) - .setResponseCode(httpStatusCode) + .setResponseCode(httpStatusCode), ) val builder = @@ -120,7 +120,7 @@ abstract class SentryApollo5BuilderExtensionsTest( transportBuilder.httpRequestComposer( object : HttpRequestComposer { override fun compose( - apolloRequest: ApolloRequest + apolloRequest: ApolloRequest, ): HttpRequest { val request = defaultComposer.compose(apolloRequest) return HttpRequest.Builder(request.method, request.url) @@ -129,14 +129,14 @@ abstract class SentryApollo5BuilderExtensionsTest( .addExecutionContext(apolloRequest.executionContext) .build() } - } + }, ) } else { transportBuilder.serverUrl(serverUrl) } if (manuallyInstallHttpInterceptor) { transportBuilder.addInterceptor( - SentryApollo5HttpInterceptor(scopes = scopes, captureFailedRequests = false) + SentryApollo5HttpInterceptor(scopes = scopes, captureFailedRequests = false), ) } @@ -261,7 +261,7 @@ abstract class SentryApollo5BuilderExtensionsTest( fixture.getSutWithCustomNetworkTransport( manuallyInstallHttpInterceptor = true, useCustomRequestComposer = true, - ) + ), ) verify(fixture.scopes) @@ -305,7 +305,7 @@ abstract class SentryApollo5BuilderExtensionsTest( operationName = LaunchDetailsQuery.OPERATION_NAME, operationType = "query", variables = "{id=83}", - ) + ), ) } @@ -371,7 +371,7 @@ abstract class SentryApollo5BuilderExtensionsTest( assertThat( recordedRequest.headers.names().none { it.startsWith("SENTRY-APOLLO-5-", ignoreCase = true) - } + }, ) .isTrue() } diff --git a/sentry-apollo-5/src/test/java/io/sentry/apollo5/SentryApollo5HttpInterceptorTest.kt b/sentry-apollo-5/src/test/java/io/sentry/apollo5/SentryApollo5HttpInterceptorTest.kt index acd27f0ee1b..f0e17bef225 100644 --- a/sentry-apollo-5/src/test/java/io/sentry/apollo5/SentryApollo5HttpInterceptorTest.kt +++ b/sentry-apollo-5/src/test/java/io/sentry/apollo5/SentryApollo5HttpInterceptorTest.kt @@ -72,7 +72,7 @@ class SentryApollo5HttpInterceptorTestWithV5Implementation : abstract class SentryApollo5HttpInterceptorTest( private val executeQueryImplementation: - KSuspendFunction1, ApolloResponse> + KSuspendFunction1, ApolloResponse>, ) { class Fixture { val server = MockWebServer() @@ -123,7 +123,7 @@ abstract class SentryApollo5HttpInterceptorTest( MockResponse() .setBody(responseBody) .setSocketPolicy(socketPolicy) - .setResponseCode(httpStatusCode) + .setResponseCode(httpStatusCode), ) if (beforeSpan != null) { @@ -383,8 +383,8 @@ abstract class SentryApollo5HttpInterceptorTest( assertEquals(baggageHeaderValues.size, 1) assertTrue( baggageHeaderValues[0].startsWith( - "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue" - ) + "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue", + ), ) assertTrue(baggageHeaderValues[0].contains("sentry-public_key=key")) assertTrue(baggageHeaderValues[0].contains("sentry-transaction=op")) @@ -398,8 +398,8 @@ abstract class SentryApollo5HttpInterceptorTest( beforeSpan = { span, request, response -> span.description = "overwritten description" span - } - ) + }, + ), ) verify(fixture.scopes) @@ -441,7 +441,7 @@ abstract class SentryApollo5HttpInterceptorTest( beforeSpan = { span, _, _ -> span.spanContext.sampled = false throw IllegalStateException("callback failed") - } + }, ) assertThat(executeQueryImplementation(sut.query(LaunchDetailsQuery("83"))).data).isNotNull() @@ -465,7 +465,7 @@ abstract class SentryApollo5HttpInterceptorTest( beforeSpan = { span, _, _ -> span.description = "partially modified" throw failure - } + }, ) val response = executeQueryImplementation(sut.query(LaunchDetailsQuery("83"))) diff --git a/sentry-apollo-5/src/test/java/io/sentry/apollo5/generated/selections/LaunchDetailsQuerySelections.kt b/sentry-apollo-5/src/test/java/io/sentry/apollo5/generated/selections/LaunchDetailsQuerySelections.kt index a36f4f962e8..43b07d3b1ae 100644 --- a/sentry-apollo-5/src/test/java/io/sentry/apollo5/generated/selections/LaunchDetailsQuerySelections.kt +++ b/sentry-apollo-5/src/test/java/io/sentry/apollo5/generated/selections/LaunchDetailsQuerySelections.kt @@ -34,8 +34,8 @@ public object LaunchDetailsQuerySelections { listOf( CompiledArgument.Builder(CompiledArgumentDefinition.Builder("size").build()) .value("LARGE") - .build() - ) + .build(), + ), ) .build(), ) @@ -90,10 +90,10 @@ public object LaunchDetailsQuerySelections { listOf( CompiledArgument.Builder(CompiledArgumentDefinition.Builder("id").build()) .value("id") - .build() - ) + .build(), + ), ) .selections(launch) - .build() + .build(), ) } diff --git a/sentry-apollo/src/test/java/io/sentry/apollo/SentryApolloInterceptorTest.kt b/sentry-apollo/src/test/java/io/sentry/apollo/SentryApolloInterceptorTest.kt index b212e2212c8..c31ccee0e7f 100644 --- a/sentry-apollo/src/test/java/io/sentry/apollo/SentryApolloInterceptorTest.kt +++ b/sentry-apollo/src/test/java/io/sentry/apollo/SentryApolloInterceptorTest.kt @@ -95,7 +95,7 @@ class SentryApolloInterceptorTest { MockResponse() .setBody(responseBody) .setSocketPolicy(socketPolicy) - .setResponseCode(httpStatusCode) + .setResponseCode(httpStatusCode), ) if (beforeSpan != null || !attachTracingHeaders) { @@ -232,7 +232,7 @@ class SentryApolloInterceptorTest { fixture.getSut { span, _, _ -> span.description = "overwritten description" span - } + }, ) verify(fixture.scopes) diff --git a/sentry-async-profiler/src/main/java/io/sentry/asyncprofiler/profiling/JavaContinuousProfiler.java b/sentry-async-profiler/src/main/java/io/sentry/asyncprofiler/profiling/JavaContinuousProfiler.java index ced363d4a58..c7e2bcdd9b2 100644 --- a/sentry-async-profiler/src/main/java/io/sentry/asyncprofiler/profiling/JavaContinuousProfiler.java +++ b/sentry-async-profiler/src/main/java/io/sentry/asyncprofiler/profiling/JavaContinuousProfiler.java @@ -400,23 +400,22 @@ private void sendChunks(final @NotNull IScopes scopes, final @NotNull SentryOpti try { options .getExecutorService() - .submit( - () -> { - // SDK is closed, we don't send the chunks - if (isClosed.get()) { - return; - } - final ArrayList payloads = new ArrayList<>(payloadBuilders.size()); - try (final @NotNull ISentryLifecycleToken ignored = payloadLock.acquire()) { - for (ProfileChunk.Builder builder : payloadBuilders) { - payloads.add(builder.build(options)); - } - payloadBuilders.clear(); - } - for (ProfileChunk payload : payloads) { - scopes.captureProfileChunk(payload); - } - }); + .submit(() -> { + // SDK is closed, we don't send the chunks + if (isClosed.get()) { + return; + } + final ArrayList payloads = new ArrayList<>(payloadBuilders.size()); + try (final @NotNull ISentryLifecycleToken ignored = payloadLock.acquire()) { + for (ProfileChunk.Builder builder : payloadBuilders) { + payloads.add(builder.build(options)); + } + payloadBuilders.clear(); + } + for (ProfileChunk payload : payloads) { + scopes.captureProfileChunk(payload); + } + }); } catch (Throwable e) { options.getLogger().log(SentryLevel.DEBUG, "Failed to send profile chunks.", e); } diff --git a/sentry-async-profiler/src/test/java/io/sentry/asyncprofiler/profiling/JavaContinuousProfilerTest.kt b/sentry-async-profiler/src/test/java/io/sentry/asyncprofiler/profiling/JavaContinuousProfilerTest.kt index 745139a20a6..3ffc4ef6bae 100644 --- a/sentry-async-profiler/src/test/java/io/sentry/asyncprofiler/profiling/JavaContinuousProfilerTest.kt +++ b/sentry-async-profiler/src/test/java/io/sentry/asyncprofiler/profiling/JavaContinuousProfilerTest.kt @@ -277,7 +277,7 @@ class JavaContinuousProfilerTest { .log( eq(SentryLevel.WARNING), eq( - "Disabling profiling because traces directory is not writable or does not exist: %s (writable=%b, exists=%b)" + "Disabling profiling because traces directory is not writable or does not exist: %s (writable=%b, exists=%b)", ), eq(expectedPath), eq(false), diff --git a/sentry-compose/build.gradle.kts b/sentry-compose/build.gradle.kts index 69d4db93866..d3628be16f3 100644 --- a/sentry-compose/build.gradle.kts +++ b/sentry-compose/build.gradle.kts @@ -142,9 +142,9 @@ tasks.withType().configureEach { // suppress unattached source sets for docs dokkaSourceSets { matching { - it.name.contains("androidandroid", ignoreCase = true) || - it.name.contains("testfixtures", ignoreCase = true) - } + it.name.contains("androidandroid", ignoreCase = true) || + it.name.contains("testfixtures", ignoreCase = true) + } .configureEach { suppress.set(true) } } } diff --git a/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryNavigationIntegration.kt b/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryNavigationIntegration.kt index b95f65393d3..07dd300075f 100644 --- a/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryNavigationIntegration.kt +++ b/sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryNavigationIntegration.kt @@ -59,7 +59,7 @@ internal class SentryLifecycleObserver( @Composable @NonRestartableComposable public fun NavHostController.withSentryObservableEffect( - navListener: SentryNavigationListener + navListener: SentryNavigationListener, ): NavHostController { val navListenerSnapshot by rememberUpdatedState(navListener) @@ -105,7 +105,7 @@ public fun NavHostController.withSentryObservableEffect( enableNavigationBreadcrumbs = enableBreadcrumbsSnapshot, enableNavigationTracing = enableTracingSnapshot, traceOriginAppendix = TRACE_ORIGIN_APPENDIX, - ) + ), ) } diff --git a/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/ComposeIntegrationTests.kt b/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/ComposeIntegrationTests.kt index f4195b1d6f3..c7be12652ab 100644 --- a/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/ComposeIntegrationTests.kt +++ b/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/ComposeIntegrationTests.kt @@ -39,7 +39,7 @@ class ComposeIntegrationTests { val appContext: Application = ApplicationProvider.getApplicationContext() Shadows.shadowOf(appContext.packageManager) .addActivityIfNotPresent( - ComponentName(appContext.packageName, ComponentActivity::class.java.name) + ComponentName(appContext.packageName, ComponentActivity::class.java.name), ) } } diff --git a/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/SentryModifierComposeTest.kt b/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/SentryModifierComposeTest.kt index 7e80f10a5e7..42728885d5e 100644 --- a/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/SentryModifierComposeTest.kt +++ b/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/SentryModifierComposeTest.kt @@ -35,7 +35,7 @@ class SentryModifierComposeTest { val appContext: Application = ApplicationProvider.getApplicationContext() Shadows.shadowOf(appContext.packageManager) .addActivityIfNotPresent( - ComponentName(appContext.packageName, ComponentActivity::class.java.name) + ComponentName(appContext.packageName, ComponentActivity::class.java.name), ) } } @@ -49,7 +49,7 @@ class SentryModifierComposeTest { .onNode( SemanticsMatcher(TAG_VALUE) { it.config.find { (key, _) -> key.name == SentryModifier.TAG }?.value == TAG_VALUE - } + }, ) .assertExists() } diff --git a/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/SentryTracedTest.kt b/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/SentryTracedTest.kt index 935fb6933d5..73b2ebc8201 100644 --- a/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/SentryTracedTest.kt +++ b/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/SentryTracedTest.kt @@ -60,7 +60,7 @@ class SentryTracedTest { val appContext: Application = ApplicationProvider.getApplicationContext() Shadows.shadowOf(appContext.packageManager) .addActivityIfNotPresent( - ComponentName(appContext.packageName, ComponentActivity::class.java.name) + ComponentName(appContext.packageName, ComponentActivity::class.java.name), ) } } @@ -86,7 +86,7 @@ class SentryTracedTest { assertThat(tx.countSpans(OP_COMPOSE)).isEqualTo(1) assertThat(tx.countSpans(OP_PARENT_RENDER)).isEqualTo(0) assertThat( - tx.singleSpan(OP_PARENT_COMPOSITION).startDate.isAfter(tx.singleSpan(OP_COMPOSE).startDate) + tx.singleSpan(OP_PARENT_COMPOSITION).startDate.isAfter(tx.singleSpan(OP_COMPOSE).startDate), ) .isFalse() } @@ -415,7 +415,7 @@ class SentryTracedTest { modifier = Modifier.fillMaxSize(), enableUserInteractionTracing = false, ) {} - } + }, ) { measurables, constraints -> val placeable = measurables.single().measure(constraints) layout(placeable.width, placeable.height) { diff --git a/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocatorTest.kt b/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocatorTest.kt index 407c5d2f748..ae51ee4bd23 100644 --- a/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocatorTest.kt +++ b/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/gestures/ComposeGestureTargetLocatorTest.kt @@ -688,7 +688,7 @@ class ComposeGestureTargetLocatorTest { config.set(SemanticsPropertyKey("TestTag") { s: String?, _: String? -> s }, tag) return config } - } + }, ) return modifierInfo } @@ -706,7 +706,7 @@ class ComposeGestureTargetLocatorTest { } return config } - } + }, ) return modifierInfo } @@ -718,7 +718,7 @@ class ComposeGestureTargetLocatorTest { Class.forName(className) } catch (_: ClassNotFoundException) { Modifier::class.java - } + }, ) as Modifier val modifierInfo = Mockito.mock(ModifierInfo::class.java) whenever(modifierInfo.modifier).thenReturn(modifierWithClassName) diff --git a/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/viewhierarchy/ComposeViewHierarchyExporterTest.kt b/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/viewhierarchy/ComposeViewHierarchyExporterTest.kt index 7113db59d6c..7679ce05bee 100644 --- a/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/viewhierarchy/ComposeViewHierarchyExporterTest.kt +++ b/sentry-compose/src/androidUnitTest/kotlin/io/sentry/compose/viewhierarchy/ComposeViewHierarchyExporterTest.kt @@ -78,7 +78,7 @@ class ComposeViewHierarchyExporterTest { config.set(SemanticsPropertyKey("SentryTag") { s: String?, s2: String? -> s }, tag) return config } - } + }, ) val modifierInfoList: MutableList = ArrayList() modifierInfoList.add(modifierInfo) diff --git a/sentry-graphql-22/src/main/java/io/sentry/graphql22/SentryInstrumentation.java b/sentry-graphql-22/src/main/java/io/sentry/graphql22/SentryInstrumentation.java index d4833cafee3..e4f08e6fbbd 100644 --- a/sentry-graphql-22/src/main/java/io/sentry/graphql22/SentryInstrumentation.java +++ b/sentry-graphql-22/src/main/java/io/sentry/graphql22/SentryInstrumentation.java @@ -170,10 +170,9 @@ public SentryInstrumentation( final @NotNull InstrumentationExecutionParameters parameters, final @NotNull InstrumentationState state) { return super.instrumentExecutionResult(executionResult, parameters, state) - .whenComplete( - (result, exception) -> { - instrumentation.instrumentExecutionResultComplete(parameters, result, exception); - }); + .whenComplete((result, exception) -> { + instrumentation.instrumentExecutionResultComplete(parameters, result, exception); + }); } @Override diff --git a/sentry-graphql-22/src/test/kotlin/io/sentry/graphql22/SentryInstrumentationAnotherTest.kt b/sentry-graphql-22/src/test/kotlin/io/sentry/graphql22/SentryInstrumentationAnotherTest.kt index 238b420bc16..574883936d7 100644 --- a/sentry-graphql-22/src/test/kotlin/io/sentry/graphql22/SentryInstrumentationAnotherTest.kt +++ b/sentry-graphql-22/src/test/kotlin/io/sentry/graphql22/SentryInstrumentationAnotherTest.kt @@ -316,7 +316,7 @@ class SentryInstrumentationAnotherTest { fixture.executionContext.executionId.toString(), breadcrumb.data["operation_id"], ) - } + }, ) } @@ -368,7 +368,7 @@ class SentryInstrumentationAnotherTest { assertSame( fixture.scopes, fixture.instrumentationExecutionParameters.graphQLContext.get( - SentryGraphqlInstrumentation.SENTRY_SCOPES_CONTEXT_KEY + SentryGraphqlInstrumentation.SENTRY_SCOPES_CONTEXT_KEY, ), ) assertNotNull(fixture.instrumentationState.transaction) @@ -385,7 +385,7 @@ class SentryInstrumentationAnotherTest { GraphqlErrorException.newErrorException() .message("exception message") .errorClassification(ErrorType.ValidationError) - .build() + .build(), ) .build() val resultFuture = @@ -418,7 +418,7 @@ class SentryInstrumentationAnotherTest { mapOf( SentryGraphqlInstrumentation.SENTRY_EXCEPTIONS_CONTEXT_KEY to listOf(exception), SentryGraphqlInstrumentation.SENTRY_SCOPES_CONTEXT_KEY to fixture.scopes, - ) + ), ) val executionResult = ExecutionResult.newExecutionResult().data("raw result").build() val resultFuture = @@ -452,19 +452,19 @@ class SentryInstrumentationAnotherTest { GraphqlErrorException.newErrorException() .message("exception message") .errorClassification(ErrorType.DataFetchingException) - .build() + .build(), ) .addError( GraphqlErrorException.newErrorException() .message("exception message") .errorClassification(org.springframework.graphql.execution.ErrorType.INTERNAL_ERROR) - .build() + .build(), ) .addError( GraphqlErrorException.newErrorException() .message("exception message") .errorClassification(com.netflix.graphql.types.errors.ErrorType.INTERNAL) - .build() + .build(), ) .build() val resultFuture = @@ -488,7 +488,7 @@ class SentryInstrumentationAnotherTest { GraphqlErrorException.newErrorException() .message("exception message") .errorClassification(SomeErrorClassification.SOME_ERROR) - .build() + .build(), ) .build() val resultFuture = @@ -526,6 +526,6 @@ class SentryInstrumentationAnotherTest { data class Show(val id: Int) enum class SomeErrorClassification : ErrorClassification { - SOME_ERROR + SOME_ERROR, } } diff --git a/sentry-graphql-22/src/test/kotlin/io/sentry/graphql22/SentryInstrumentationTest.kt b/sentry-graphql-22/src/test/kotlin/io/sentry/graphql22/SentryInstrumentationTest.kt index a28ff2af582..6d37b68a191 100644 --- a/sentry-graphql-22/src/test/kotlin/io/sentry/graphql22/SentryInstrumentationTest.kt +++ b/sentry-graphql-22/src/test/kotlin/io/sentry/graphql22/SentryInstrumentationTest.kt @@ -85,7 +85,7 @@ class SentryInstrumentationTest { val graphQL = GraphQL.newGraphQL(graphQLSchema) .instrumentation( - SentryInstrumentation(beforeSpan, NoOpSubscriptionHandler.getInstance(), true) + SentryInstrumentation(beforeSpan, NoOpSubscriptionHandler.getInstance(), true), ) .build() @@ -166,7 +166,7 @@ class SentryInstrumentationTest { fun `beforeSpan can drop spans`() { val sut = fixture.getSut( - beforeSpan = SentryGraphqlInstrumentation.BeforeSpanCallback { _, _, _ -> null } + beforeSpan = SentryGraphqlInstrumentation.BeforeSpanCallback { _, _, _ -> null }, ) val onDiscard = mock() fixture.scopes.options.onDiscard = onDiscard @@ -194,7 +194,7 @@ class SentryInstrumentationTest { beforeSpan = { span, _, _ -> span.spanContext.sampled = false throw IllegalStateException("callback failed") - } + }, ) fixture.activeSpan.spanContext.sampled = sampled fixture.scopes.options.onDiscard = onDiscard @@ -220,7 +220,7 @@ class SentryInstrumentationTest { beforeSpan = { span, _, _ -> span.description = "partially modified" throw failure - } + }, ) fixture.scopes.options.isDebug = true fixture.scopes.options.setLogger(logger) @@ -300,7 +300,7 @@ class SentryInstrumentationTest { beforeSpan = SentryGraphqlInstrumentation.BeforeSpanCallback { span, _, _ -> span.apply { description = "changed" } - } + }, ) withMockScopes { @@ -333,7 +333,7 @@ class SentryInstrumentationTest { GraphQLScalarType.newScalar() .name("MyResponseType") .coercing(GraphqlStringCoercing()) - .build() + .build(), ) .build() val environment = @@ -341,7 +341,7 @@ class SentryInstrumentationTest { .graphQLContext(graphQLContext) .executionStepInfo(executionStepInfo) .operationDefinition( - OperationDefinition.newOperationDefinition().operation(operation).build() + OperationDefinition.newOperationDefinition().operation(operation).build(), ) .build() val executionContext = diff --git a/sentry-graphql-core/src/main/java/io/sentry/graphql/ExceptionReporter.java b/sentry-graphql-core/src/main/java/io/sentry/graphql/ExceptionReporter.java index 4330a49e22d..c06f236ea51 100644 --- a/sentry-graphql-core/src/main/java/io/sentry/graphql/ExceptionReporter.java +++ b/sentry-graphql-core/src/main/java/io/sentry/graphql/ExceptionReporter.java @@ -72,13 +72,12 @@ private void setRequestDetailsOnEvent( final @NotNull IScopes scopes, final @NotNull ExceptionDetails exceptionDetails, final @NotNull SentryEvent event) { - scopes.configureScope( - (scope) -> { - final @Nullable Request scopeRequest = scope.getRequest(); - final @NotNull Request request = scopeRequest == null ? new Request() : scopeRequest; - setDetailsOnRequest(scopes, exceptionDetails, request); - event.setRequest(request); - }); + scopes.configureScope(scope -> { + final @Nullable Request scopeRequest = scope.getRequest(); + final @NotNull Request request = scopeRequest == null ? new Request() : scopeRequest; + setDetailsOnRequest(scopes, exceptionDetails, request); + event.setRequest(request); + }); } private void setDetailsOnRequest( diff --git a/sentry-graphql-core/src/main/java/io/sentry/graphql/SentryGraphqlInstrumentation.java b/sentry-graphql-core/src/main/java/io/sentry/graphql/SentryGraphqlInstrumentation.java index cb1757e30d4..3d1a53f2b6d 100644 --- a/sentry-graphql-core/src/main/java/io/sentry/graphql/SentryGraphqlInstrumentation.java +++ b/sentry-graphql-core/src/main/java/io/sentry/graphql/SentryGraphqlInstrumentation.java @@ -292,16 +292,15 @@ public void beginExecuteOperation( maybeCallSubscriptionHandler(parameters, environment, tmpResult); if (result instanceof CompletableFuture) { ((CompletableFuture) result) - .whenComplete( - (r, ex) -> { - if (ex != null) { - span.setThrowable(ex); - span.setStatus(SpanStatus.INTERNAL_ERROR); - } else { - span.setStatus(SpanStatus.OK); - } - finish(span, environment, r); - }); + .whenComplete((r, ex) -> { + if (ex != null) { + span.setThrowable(ex); + span.setStatus(SpanStatus.INTERNAL_ERROR); + } else { + span.setStatus(SpanStatus.OK); + } + finish(span, environment, r); + }); } else { span.setStatus(SpanStatus.OK); finish(span, environment, result); diff --git a/sentry-graphql-core/src/test/kotlin/io/sentry/graphql/ExceptionReporterTest.kt b/sentry-graphql-core/src/test/kotlin/io/sentry/graphql/ExceptionReporterTest.kt index c054911396d..0124c603834 100644 --- a/sentry-graphql-core/src/test/kotlin/io/sentry/graphql/ExceptionReporterTest.kt +++ b/sentry-graphql-core/src/test/kotlin/io/sentry/graphql/ExceptionReporterTest.kt @@ -64,7 +64,7 @@ class ExceptionReporterTest { GraphqlErrorException.newErrorException() .message("exception message") .errorClassification(ErrorType.ValidationError) - .build() + .build(), ) .build() val executionInput = diff --git a/sentry-graphql-core/src/test/kotlin/io/sentry/graphql/SentryGenericDataFetcherExceptionHandlerTest.kt b/sentry-graphql-core/src/test/kotlin/io/sentry/graphql/SentryGenericDataFetcherExceptionHandlerTest.kt index 927829632b6..07324a2a3f0 100644 --- a/sentry-graphql-core/src/test/kotlin/io/sentry/graphql/SentryGenericDataFetcherExceptionHandlerTest.kt +++ b/sentry-graphql-core/src/test/kotlin/io/sentry/graphql/SentryGenericDataFetcherExceptionHandlerTest.kt @@ -26,7 +26,7 @@ class SentryGenericDataFetcherExceptionHandlerTest { .dataFetchingEnvironment( DataFetchingEnvironmentImpl.newDataFetchingEnvironment() .graphQLContext(GraphQLContext.of(emptyMap())) - .build() + .build(), ) .build() handler.onException(parameters) diff --git a/sentry-graphql-core/src/test/kotlin/io/sentry/graphql/SentryGraphqlInstrumentationTest.kt b/sentry-graphql-core/src/test/kotlin/io/sentry/graphql/SentryGraphqlInstrumentationTest.kt index 09843710bea..b5789c7e9da 100644 --- a/sentry-graphql-core/src/test/kotlin/io/sentry/graphql/SentryGraphqlInstrumentationTest.kt +++ b/sentry-graphql-core/src/test/kotlin/io/sentry/graphql/SentryGraphqlInstrumentationTest.kt @@ -24,7 +24,7 @@ class SentryGraphqlInstrumentationTest { .thenReturn( GraphQLContext.newContext() .of(SentryGraphqlInstrumentation.SENTRY_SCOPES_CONTEXT_KEY, scopes) - .build() + .build(), ) } @@ -45,7 +45,7 @@ class SentryGraphqlInstrumentationTest { CustomErrorClassification( "graphql.validation.interpolation.ResourceBundleMessageInterpolator\$ValidationErrorType@1", mapOf("type" to "ExtendedValidationError"), - ) + ), ), ignoredErrorTypes = listOf("ExtendedValidationError"), ) @@ -73,7 +73,7 @@ class SentryGraphqlInstrumentationTest { CustomErrorClassification( "graphql.validation.interpolation.ResourceBundleMessageInterpolator\$ValidationErrorType@1", mapOf("type" to "ExtendedValidationError"), - ) + ), ), ignoredErrorTypes = listOf("ExtendedValidationError"), enableSpecificationErrorTypeFiltering = true, diff --git a/sentry-graphql/src/main/java/io/sentry/graphql/SentryInstrumentation.java b/sentry-graphql/src/main/java/io/sentry/graphql/SentryInstrumentation.java index 0d0736f8b70..456bd96d6e2 100644 --- a/sentry-graphql/src/main/java/io/sentry/graphql/SentryInstrumentation.java +++ b/sentry-graphql/src/main/java/io/sentry/graphql/SentryInstrumentation.java @@ -163,10 +163,9 @@ public SentryInstrumentation( public CompletableFuture instrumentExecutionResult( ExecutionResult executionResult, InstrumentationExecutionParameters parameters) { return super.instrumentExecutionResult(executionResult, parameters) - .whenComplete( - (result, exception) -> { - instrumentation.instrumentExecutionResultComplete(parameters, result, exception); - }); + .whenComplete((result, exception) -> { + instrumentation.instrumentExecutionResultComplete(parameters, result, exception); + }); } @Override diff --git a/sentry-graphql/src/test/kotlin/io/sentry/graphql/SentryInstrumentationAnotherTest.kt b/sentry-graphql/src/test/kotlin/io/sentry/graphql/SentryInstrumentationAnotherTest.kt index 9d77da698ac..d1742bc45dc 100644 --- a/sentry-graphql/src/test/kotlin/io/sentry/graphql/SentryInstrumentationAnotherTest.kt +++ b/sentry-graphql/src/test/kotlin/io/sentry/graphql/SentryInstrumentationAnotherTest.kt @@ -287,7 +287,7 @@ class SentryInstrumentationAnotherTest { fixture.executionContext.executionId.toString(), breadcrumb.data["operation_id"], ) - } + }, ) } @@ -332,7 +332,7 @@ class SentryInstrumentationAnotherTest { assertSame( fixture.scopes, fixture.instrumentationExecutionParameters.graphQLContext.get( - SentryGraphqlInstrumentation.SENTRY_SCOPES_CONTEXT_KEY + SentryGraphqlInstrumentation.SENTRY_SCOPES_CONTEXT_KEY, ), ) assertNotNull(fixture.instrumentationState.transaction) @@ -349,7 +349,7 @@ class SentryInstrumentationAnotherTest { GraphqlErrorException.newErrorException() .message("exception message") .errorClassification(ErrorType.ValidationError) - .build() + .build(), ) .build() val resultFuture = @@ -381,7 +381,7 @@ class SentryInstrumentationAnotherTest { mapOf( SentryGraphqlInstrumentation.SENTRY_EXCEPTIONS_CONTEXT_KEY to listOf(exception), SentryGraphqlInstrumentation.SENTRY_SCOPES_CONTEXT_KEY to fixture.scopes, - ) + ), ) val executionResult = ExecutionResultImpl.newExecutionResult().data("raw result").build() val resultFuture = @@ -414,19 +414,19 @@ class SentryInstrumentationAnotherTest { GraphqlErrorException.newErrorException() .message("exception message") .errorClassification(ErrorType.DataFetchingException) - .build() + .build(), ) .addError( GraphqlErrorException.newErrorException() .message("exception message") .errorClassification(org.springframework.graphql.execution.ErrorType.INTERNAL_ERROR) - .build() + .build(), ) .addError( GraphqlErrorException.newErrorException() .message("exception message") .errorClassification(com.netflix.graphql.types.errors.ErrorType.INTERNAL) - .build() + .build(), ) .build() val resultFuture = @@ -449,7 +449,7 @@ class SentryInstrumentationAnotherTest { GraphqlErrorException.newErrorException() .message("exception message") .errorClassification(SomeErrorClassification.SOME_ERROR) - .build() + .build(), ) .build() val resultFuture = @@ -485,6 +485,6 @@ class SentryInstrumentationAnotherTest { data class Show(val id: Int) enum class SomeErrorClassification : ErrorClassification { - SOME_ERROR + SOME_ERROR, } } diff --git a/sentry-graphql/src/test/kotlin/io/sentry/graphql/SentryInstrumentationTest.kt b/sentry-graphql/src/test/kotlin/io/sentry/graphql/SentryInstrumentationTest.kt index 5f61ccfe912..117ba8314d3 100644 --- a/sentry-graphql/src/test/kotlin/io/sentry/graphql/SentryInstrumentationTest.kt +++ b/sentry-graphql/src/test/kotlin/io/sentry/graphql/SentryInstrumentationTest.kt @@ -81,7 +81,7 @@ class SentryInstrumentationTest { val graphQL = GraphQL.newGraphQL(graphQLSchema) .instrumentation( - SentryInstrumentation(beforeSpan, NoOpSubscriptionHandler.getInstance(), true) + SentryInstrumentation(beforeSpan, NoOpSubscriptionHandler.getInstance(), true), ) .build() @@ -162,7 +162,7 @@ class SentryInstrumentationTest { fun `beforeSpan can drop spans`() { val sut = fixture.getSut( - beforeSpan = SentryGraphqlInstrumentation.BeforeSpanCallback { _, _, _ -> null } + beforeSpan = SentryGraphqlInstrumentation.BeforeSpanCallback { _, _, _ -> null }, ) val onDiscard = mock() fixture.scopes.options.onDiscard = onDiscard @@ -190,7 +190,7 @@ class SentryInstrumentationTest { beforeSpan = { span, _, _ -> span.spanContext.sampled = false throw IllegalStateException("callback failed") - } + }, ) fixture.activeSpan.spanContext.sampled = sampled fixture.scopes.options.onDiscard = onDiscard @@ -216,7 +216,7 @@ class SentryInstrumentationTest { beforeSpan = { span, _, _ -> span.description = "partially modified" throw failure - } + }, ) fixture.scopes.options.isDebug = true fixture.scopes.options.setLogger(logger) @@ -296,7 +296,7 @@ class SentryInstrumentationTest { beforeSpan = SentryGraphqlInstrumentation.BeforeSpanCallback { span, _, _ -> span.apply { description = "changed" } - } + }, ) withMockScopes { @@ -329,7 +329,7 @@ class SentryInstrumentationTest { GraphQLScalarType.newScalar() .name("MyResponseType") .coercing(GraphqlStringCoercing()) - .build() + .build(), ) .build() val environment = @@ -337,7 +337,7 @@ class SentryInstrumentationTest { .graphQLContext(graphQLContext) .executionStepInfo(executionStepInfo) .operationDefinition( - OperationDefinition.newOperationDefinition().operation(operation).build() + OperationDefinition.newOperationDefinition().operation(operation).build(), ) .build() val executionContext = diff --git a/sentry-jcache/src/test/kotlin/io/sentry/jcache/SentryJCacheWrapperTest.kt b/sentry-jcache/src/test/kotlin/io/sentry/jcache/SentryJCacheWrapperTest.kt index 9e523d3df21..bde3860d7fe 100644 --- a/sentry-jcache/src/test/kotlin/io/sentry/jcache/SentryJCacheWrapperTest.kt +++ b/sentry-jcache/src/test/kotlin/io/sentry/jcache/SentryJCacheWrapperTest.kt @@ -470,7 +470,9 @@ class SentryJCacheWrapperTest { fun `getConfiguration delegates to underlying cache`() { val config = mock>() whenever( - delegate.getConfiguration(Configuration::class.java as Class>) + delegate.getConfiguration( + Configuration::class.java as Class>, + ), ) .thenReturn(config) val wrapper = SentryJCacheWrapper(delegate, scopes) diff --git a/sentry-jdbc/src/test/kotlin/io/sentry/jdbc/DatabaseUtilsTest.kt b/sentry-jdbc/src/test/kotlin/io/sentry/jdbc/DatabaseUtilsTest.kt index 8f8b25007b7..27a6ac69708 100644 --- a/sentry-jdbc/src/test/kotlin/io/sentry/jdbc/DatabaseUtilsTest.kt +++ b/sentry-jdbc/src/test/kotlin/io/sentry/jdbc/DatabaseUtilsTest.kt @@ -123,7 +123,7 @@ class DatabaseUtilsTest { fun `detects db system for dynamodb`() { val details = DatabaseUtils.parse( - "jdbc:amazondynamodb:Access Key=xxx;Secret Key=xxx;Domain=amazonaws.com;Region=OREGON;" + "jdbc:amazondynamodb:Access Key=xxx;Secret Key=xxx;Domain=amazonaws.com;Region=OREGON;", ) assertEquals("amazondynamodb", details.dbSystem) assertNull(details.dbName) @@ -140,7 +140,7 @@ class DatabaseUtilsTest { fun `detects db system for oracle2`() { val details = DatabaseUtils.parse( - "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myoracle.db.server)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=my_servicename)))" + "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myoracle.db.server)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=my_servicename)))", ) assertEquals("oracle", details.dbSystem) assertEquals("my_servicename", details.dbName) @@ -150,7 +150,7 @@ class DatabaseUtilsTest { fun `detects db system for mariadb`() { val details = DatabaseUtils.parse( - "jdbc:mariadb://example.skysql.net:5001/jdbc_demo?useSsl=true&serverSslCert=/path/to/skysql_chain.pem" + "jdbc:mariadb://example.skysql.net:5001/jdbc_demo?useSsl=true&serverSslCert=/path/to/skysql_chain.pem", ) assertEquals("mariadb", details.dbSystem) assertEquals("jdbc_demo", details.dbName) @@ -167,7 +167,7 @@ class DatabaseUtilsTest { fun `detects db system for mysql`() { val details = DatabaseUtils.parse( - "jdbc:mysql://mysql.db.server:3306/my_database?useSSL=false&serverTimezone=UTC" + "jdbc:mysql://mysql.db.server:3306/my_database?useSSL=false&serverTimezone=UTC", ) assertEquals("mysql", details.dbSystem) assertEquals("my_database", details.dbName) @@ -184,7 +184,7 @@ class DatabaseUtilsTest { fun `detects db system for mssql`() { val details = DatabaseUtils.parse( - "jdbc:sqlserver://mssql.db.server\\\\mssql_instance;databaseName=my_database" + "jdbc:sqlserver://mssql.db.server\\\\mssql_instance;databaseName=my_database", ) assertEquals("sqlserver", details.dbSystem) assertEquals("my_database", details.dbName) @@ -194,7 +194,7 @@ class DatabaseUtilsTest { fun `detects db system for mssql2`() { val details = DatabaseUtils.parse( - "jdbc:sqlserver://mssql.db.server\\\\mssql_instance;databaseName=my_database;otherProperty=value" + "jdbc:sqlserver://mssql.db.server\\\\mssql_instance;databaseName=my_database;otherProperty=value", ) assertEquals("sqlserver", details.dbSystem) assertEquals("my_database", details.dbName) @@ -212,7 +212,7 @@ class DatabaseUtilsTest { fun `detects db system for postgres`() { val details = DatabaseUtils.parse( - "jdbc:postgresql://postgresql.db.server:5430/my_database?ssl=true&loglevel=2" + "jdbc:postgresql://postgresql.db.server:5430/my_database?ssl=true&loglevel=2", ) assertEquals("postgresql", details.dbSystem) assertEquals("my_database", details.dbName) @@ -229,7 +229,7 @@ class DatabaseUtilsTest { fun `detects db system for datadirect postgres`() { val details = DatabaseUtils.parse( - "jdbc:datadirect:postgresql://postgresql.db.server:5430/my_database?ssl=true&loglevel=2" + "jdbc:datadirect:postgresql://postgresql.db.server:5430/my_database?ssl=true&loglevel=2", ) assertEquals("postgresql", details.dbSystem) assertEquals("my_database", details.dbName) @@ -239,7 +239,7 @@ class DatabaseUtilsTest { fun `detects db system for tibcosoftware postgres`() { val details = DatabaseUtils.parse( - "jdbc:tibcosoftware:postgresql://postgresql.db.server:5430/my_database?ssl=true&loglevel=2" + "jdbc:tibcosoftware:postgresql://postgresql.db.server:5430/my_database?ssl=true&loglevel=2", ) assertEquals("postgresql", details.dbSystem) assertEquals("my_database", details.dbName) @@ -249,7 +249,7 @@ class DatabaseUtilsTest { fun `detects db system for jtds postgres`() { val details = DatabaseUtils.parse( - "jdbc:jtds:postgresql://postgresql.db.server:5430/my_database?ssl=true&loglevel=2" + "jdbc:jtds:postgresql://postgresql.db.server:5430/my_database?ssl=true&loglevel=2", ) assertEquals("postgresql", details.dbSystem) assertEquals("my_database", details.dbName) @@ -259,7 +259,7 @@ class DatabaseUtilsTest { fun `detects db system for microsoft sqlserver`() { val details = DatabaseUtils.parse( - "jdbc:microsoft:sqlserver://mssql.db.server\\\\mssql_instance;databaseName=my_database" + "jdbc:microsoft:sqlserver://mssql.db.server\\\\mssql_instance;databaseName=my_database", ) assertEquals("sqlserver", details.dbSystem) assertEquals("my_database", details.dbName) diff --git a/sentry-jul/src/test/kotlin/io/sentry/jul/SentryHandlerTest.kt b/sentry-jul/src/test/kotlin/io/sentry/jul/SentryHandlerTest.kt index ab160faac40..e6fba7b8326 100644 --- a/sentry-jul/src/test/kotlin/io/sentry/jul/SentryHandlerTest.kt +++ b/sentry-jul/src/test/kotlin/io/sentry/jul/SentryHandlerTest.kt @@ -282,7 +282,7 @@ class SentryHandlerTest { fixture = Fixture() fixture.logger.config( - "this should not be a breadcrumb as the level is lower than the minimum INFO" + "this should not be a breadcrumb as the level is lower than the minimum INFO", ) fixture.logger.info("this should be a breadcrumb") fixture.logger.warning("this should not be sent as the event but be a breadcrumb") @@ -409,7 +409,7 @@ class SentryHandlerTest { assertTrue( it.packageSet.any { pkg -> "maven:io.sentry:sentry-jul" == pkg.name && BuildConfig.VERSION_NAME == pkg.version - } + }, ) assertTrue(it.integrationSet.contains("Jul")) } @@ -430,7 +430,7 @@ class SentryHandlerTest { checkLogs { event -> assertEquals(SentryLogLevel.TRACE, event.items.first().level) assertEquals("auto.log.jul", event.items.first().attributes?.get("sentry.origin")?.value) - } + }, ) } @@ -502,7 +502,7 @@ class SentryHandlerTest { val log = logs.items.first() assertEquals("testing message without parameters", log.body) assertNull(log.attributes?.get("sentry.message.template")) - } + }, ) } @@ -520,7 +520,7 @@ class SentryHandlerTest { assertEquals("testing message param", log.body) assertEquals("testing message {0}", log.attributes?.get("sentry.message.template")?.value) assertEquals("param", log.attributes?.get("sentry.message.parameter.0")?.value) - } + }, ) } @@ -538,7 +538,7 @@ class SentryHandlerTest { assertEquals("testing message param", log.body) assertEquals("testing message %s", log.attributes?.get("sentry.message.template")?.value) assertEquals("param", log.attributes?.get("sentry.message.parameter.0")?.value) - } + }, ) } @@ -560,7 +560,7 @@ class SentryHandlerTest { ) assertEquals(1, log.attributes?.get("sentry.message.parameter.0")?.value) assertNull(log.attributes?.get("sentry.message.parameter.1")) - } + }, ) } @@ -582,7 +582,7 @@ class SentryHandlerTest { val attributes = log.attributes!! assertEquals("someValue", attributes["mdc.someTag"]?.value) assertNull(attributes["otherTag"]) - } + }, ) } } diff --git a/sentry-kotlin-extensions/src/main/java/io/sentry/kotlin/SentryCoroutineExceptionHandler.kt b/sentry-kotlin-extensions/src/main/java/io/sentry/kotlin/SentryCoroutineExceptionHandler.kt index 13145a8345a..e519d73bbff 100644 --- a/sentry-kotlin-extensions/src/main/java/io/sentry/kotlin/SentryCoroutineExceptionHandler.kt +++ b/sentry-kotlin-extensions/src/main/java/io/sentry/kotlin/SentryCoroutineExceptionHandler.kt @@ -17,7 +17,7 @@ import org.jetbrains.annotations.ApiStatus */ @ApiStatus.Experimental public open class SentryCoroutineExceptionHandler( - private val scopes: IScopes = ScopesAdapter.getInstance() + private val scopes: IScopes = ScopesAdapter.getInstance(), ) : AbstractCoroutineContextElement(CoroutineExceptionHandler), CoroutineExceptionHandler { override fun handleException(context: CoroutineContext, exception: Throwable) { val mechanism = diff --git a/sentry-kotlin-extensions/src/test/java/io/sentry/kotlin/SentryContextTest.kt b/sentry-kotlin-extensions/src/test/java/io/sentry/kotlin/SentryContextTest.kt index 55fa4f58d6a..457773550b0 100644 --- a/sentry-kotlin-extensions/src/test/java/io/sentry/kotlin/SentryContextTest.kt +++ b/sentry-kotlin-extensions/src/test/java/io/sentry/kotlin/SentryContextTest.kt @@ -87,10 +87,10 @@ class SentryContextTest { assertEquals("c1value", getTag("c1")) assertNull(getTag("c2")) launch { - Sentry.setTag("c2", "c2value") - assertEquals("c2value", getTag("c2")) - assertEquals("c1value", getTag("c1")) - } + Sentry.setTag("c2", "c2value") + assertEquals("c2value", getTag("c2")) + assertEquals("c1value", getTag("c1")) + } .join() } c1.join() @@ -182,8 +182,8 @@ class SentryContextTest { SentryContext( Sentry.getCurrentScopes().forkedScopes("test").also { it.setTag("cloned", "clonedValue") - } - ) + }, + ), ) { Sentry.setTag("c2", "c2value") assertEquals("c2value", getTag("c2")) @@ -222,8 +222,8 @@ class SentryContextTest { it.configureScope(ScopeType.CURRENT) { scope -> scope.setTag("cloned", "clonedValue") } - } - ) + }, + ), ) { Sentry.configureScope(ScopeType.CURRENT) { scope -> scope.setTag("c2", "c2value") } assertEquals("c2value", getTag("c2", ScopeType.CURRENT)) @@ -247,7 +247,7 @@ class SentryContextTest { fun `mergeForChild returns copy of initial context if Key not present`() { val initialContextElement = SentryContext( - Sentry.getCurrentScopes().forkedScopes("test").also { it.setTag("cloned", "clonedValue") } + Sentry.getCurrentScopes().forkedScopes("test").also { it.setTag("cloned", "clonedValue") }, ) val mergedContextElement = initialContextElement.mergeForChild(CoroutineName("test")) @@ -259,7 +259,7 @@ class SentryContextTest { fun `mergeForChild returns passed context`() { val initialContextElement = SentryContext( - Sentry.getCurrentScopes().forkedScopes("test").also { it.setTag("cloned", "clonedValue") } + Sentry.getCurrentScopes().forkedScopes("test").also { it.setTag("cloned", "clonedValue") }, ) val mergedContextElement = SentryContext().mergeForChild(initialContextElement) diff --git a/sentry-kotlin-extensions/src/test/java/io/sentry/kotlin/SentryCoroutineExceptionHandlerTest.kt b/sentry-kotlin-extensions/src/test/java/io/sentry/kotlin/SentryCoroutineExceptionHandlerTest.kt index 53462602a25..9eccaf9f244 100644 --- a/sentry-kotlin-extensions/src/test/java/io/sentry/kotlin/SentryCoroutineExceptionHandlerTest.kt +++ b/sentry-kotlin-extensions/src/test/java/io/sentry/kotlin/SentryCoroutineExceptionHandlerTest.kt @@ -56,7 +56,7 @@ class SentryCoroutineExceptionHandlerTest { assertTrue { exception.toString().equals(it.throwable.toString()) } // stack trace will differ - } + }, ) } } diff --git a/sentry-ktor-client/src/main/java/io/sentry/ktorClient/SentryKtorClientPlugin.kt b/sentry-ktor-client/src/main/java/io/sentry/ktorClient/SentryKtorClientPlugin.kt index 0109aeb9fbc..45bfdeb8862 100644 --- a/sentry-ktor-client/src/main/java/io/sentry/ktorClient/SentryKtorClientPlugin.kt +++ b/sentry-ktor-client/src/main/java/io/sentry/ktorClient/SentryKtorClientPlugin.kt @@ -246,7 +246,7 @@ public open class SentryKtorClientPluginContextHook(protected val scopes: IScope client.requestPipeline.intercept(phase) { val scopes = this@SentryKtorClientPluginContextHook.scopes.forkedCurrentScope( - SENTRY_KTOR_CLIENT_PLUGIN_KEY + SENTRY_KTOR_CLIENT_PLUGIN_KEY, ) withContext(SentryContext(scopes)) { proceed() } } diff --git a/sentry-ktor-client/src/test/java/io/sentry/ktorClient/SentryKtorClientPluginTest.kt b/sentry-ktor-client/src/test/java/io/sentry/ktorClient/SentryKtorClientPluginTest.kt index 55a87e9ad9d..99d4c05be08 100644 --- a/sentry-ktor-client/src/test/java/io/sentry/ktorClient/SentryKtorClientPluginTest.kt +++ b/sentry-ktor-client/src/test/java/io/sentry/ktorClient/SentryKtorClientPluginTest.kt @@ -78,7 +78,7 @@ class SentryKtorClientPluginTest { failedRequestTargets: List = listOf(".*"), failedRequestStatusCodes: List = listOf( - HttpStatusCodeRange(HttpStatusCodeRange.DEFAULT_MIN, HttpStatusCodeRange.DEFAULT_MAX) + HttpStatusCodeRange(HttpStatusCodeRange.DEFAULT_MIN, HttpStatusCodeRange.DEFAULT_MAX), ), sendDefaultPii: Boolean = false, optionsConfiguration: Sentry.OptionsConfiguration? = null, @@ -118,7 +118,7 @@ class SentryKtorClientPluginTest { .addHeader("myResponseHeader", "myValue") .addHeader("Set-Cookie", "theme=dark; Path=/") .setSocketPolicy(socketPolicy) - .setResponseCode(httpStatusCode) + .setResponseCode(httpStatusCode), ) return HttpClient(httpClientEngine) { @@ -457,7 +457,7 @@ class SentryKtorClientPluginTest { beforeSpan = { span, _ -> span.spanContext.sampled = false error("callback failed") - } + }, ) fixture.sentryTracer.spanContext.sampled = sampled fixture.options.onDiscard = onDiscard @@ -481,7 +481,7 @@ class SentryKtorClientPluginTest { beforeSpan = { span, _ -> span.description = "partially modified" throw failure - } + }, ) fixture.options.isDebug = true fixture.options.setLogger(logger) @@ -536,7 +536,7 @@ class SentryKtorClientPluginTest { beforeSpan = { span, _ -> span.description = "changed" span - } + }, ) sut.use { sut.get(fixture.server.url("/hello").toString()) } val span = fixture.sentryTracer.children.single() @@ -699,8 +699,8 @@ class SentryKtorClientPluginTest { "thirdPartyBaggage=someValue," + "secondThirdPartyBaggage=secondValue; " + "property;propertyKey=propertyValue," + - "anotherThirdPartyBaggage=anotherValue" - ) + "anotherThirdPartyBaggage=anotherValue", + ), ) assertTrue(baggageHeaderValues[0].contains("sentry-public_key=key")) assertTrue(baggageHeaderValues[0].contains("sentry-transaction=name")) diff --git a/sentry-log4j2/build.gradle.kts b/sentry-log4j2/build.gradle.kts index 66a05bf2e59..15decc64c72 100644 --- a/sentry-log4j2/build.gradle.kts +++ b/sentry-log4j2/build.gradle.kts @@ -66,7 +66,7 @@ tasks.named("compileJava") { listOf( "-Alog4j.graalvm.groupId=${project.group}", "-Alog4j.graalvm.artifactId=${project.name}", - ) + ), ) } diff --git a/sentry-log4j2/src/test/kotlin/io/sentry/log4j2/SentryAppenderTest.kt b/sentry-log4j2/src/test/kotlin/io/sentry/log4j2/SentryAppenderTest.kt index c32459ea022..c32853a3f63 100644 --- a/sentry-log4j2/src/test/kotlin/io/sentry/log4j2/SentryAppenderTest.kt +++ b/sentry-log4j2/src/test/kotlin/io/sentry/log4j2/SentryAppenderTest.kt @@ -102,7 +102,7 @@ class SentryAppenderTest { ILoggerBatchProcessorFactory { options, client -> LoggerBatchProcessor(options, client, ImmediateExecutorService()) } - } + }, ) loggerContext.start() @@ -268,7 +268,7 @@ class SentryAppenderTest { "auto.log.log4j2", event.items.first().attributes?.get("sentry.origin")?.value, ) - } + }, ) } @@ -441,7 +441,7 @@ class SentryAppenderTest { it.packageSet.any { pkg -> "maven:io.sentry:sentry-log4j2" == pkg.name && BuildConfig.VERSION_NAME == pkg.version - } + }, ) assertTrue(it.integrationSet.contains("Log4j")) } @@ -557,7 +557,7 @@ class SentryAppenderTest { val log = logs.items.first() assertEquals("testing message without parameters", log.body) assertNull(log.attributes?.get("sentry.message.template")) - } + }, ) } @@ -575,7 +575,7 @@ class SentryAppenderTest { assertEquals("testing message param", log.body) assertEquals("testing message {}", log.attributes?.get("sentry.message.template")?.value) assertEquals("param", log.attributes?.get("sentry.message.parameter.0")?.value) - } + }, ) } @@ -598,7 +598,7 @@ class SentryAppenderTest { assertEquals("param1", log.attributes?.get("sentry.message.parameter.0")?.value) assertEquals("param2", log.attributes?.get("sentry.message.parameter.1")?.value) assertNull(log.attributes?.get("sentry.message.parameter.2")) - } + }, ) } @@ -620,7 +620,7 @@ class SentryAppenderTest { val attributes = log.attributes!! assertEquals("someValue", attributes["mdc.someTag"]?.value) assertNull(attributes["otherTag"]) - } + }, ) } } diff --git a/sentry-logback/src/test/kotlin/io/sentry/logback/SentryAppenderTest.kt b/sentry-logback/src/test/kotlin/io/sentry/logback/SentryAppenderTest.kt index bb10c5ede9c..68c8824d284 100644 --- a/sentry-logback/src/test/kotlin/io/sentry/logback/SentryAppenderTest.kt +++ b/sentry-logback/src/test/kotlin/io/sentry/logback/SentryAppenderTest.kt @@ -481,7 +481,7 @@ class SentryAppenderTest { assertEquals("Testing {} level", attributes["sentry.message.template"]?.value) assertEquals("TRACE", attributes["sentry.message.parameter.0"]?.value) assertEquals("auto.log.logback", attributes["sentry.origin"]?.value) - } + }, ) } @@ -502,7 +502,7 @@ class SentryAppenderTest { val attributes = log.attributes!! assertNull(attributes["sentry.message.template"]) assertNull(attributes["sentry.message.parameter.0"]) - } + }, ) } @@ -528,7 +528,7 @@ class SentryAppenderTest { val attributes = log.attributes!! assertEquals("Testing {} level", attributes["sentry.message.template"]?.value) assertEquals("TRACE", attributes["sentry.message.parameter.0"]?.value) - } + }, ) } @@ -555,7 +555,7 @@ class SentryAppenderTest { val attributes = log.attributes!! assertEquals("Testing {} level", attributes["sentry.message.template"]?.value) assertEquals("TRACE", attributes["sentry.message.parameter.0"]?.value) - } + }, ) } @@ -671,7 +671,7 @@ class SentryAppenderTest { it.packageSet.any { pkg -> "maven:io.sentry:sentry-logback" == pkg.name && BuildConfig.VERSION_NAME == pkg.version - } + }, ) assertTrue(it.integrationSet.contains("Logback")) } @@ -735,7 +735,7 @@ class SentryAppenderTest { fixture = Fixture() fixture.logger.debug( - "this should not be a breadcrumb as the level is lower than the minimum INFO" + "this should not be a breadcrumb as the level is lower than the minimum INFO", ) fixture.logger.info("this should be a breadcrumb") fixture.logger.warn("this should not be sent as the event but be a breadcrumb") @@ -776,7 +776,7 @@ class SentryAppenderTest { fixture = Fixture(dsn = "DSN_IS_UNDEFINED", minimumEventLevel = Level.DEBUG) assertTrue( - fixture.loggerContext.statusManager.copyOfStatusList.none { it.level == Status.WARN } + fixture.loggerContext.statusManager.copyOfStatusList.none { it.level == Status.WARN }, ) } @@ -823,7 +823,7 @@ class SentryAppenderTest { val log = logs.items.first() assertEquals("testing message without parameters", log.body) assertNull(log.attributes?.get("sentry.message.template")) - } + }, ) } @@ -841,7 +841,7 @@ class SentryAppenderTest { assertEquals("testing message param", log.body) assertEquals("testing message {}", log.attributes?.get("sentry.message.template")?.value) assertEquals("param", log.attributes?.get("sentry.message.parameter.0")?.value) - } + }, ) } @@ -864,7 +864,7 @@ class SentryAppenderTest { assertEquals("param1", log.attributes?.get("sentry.message.parameter.0")?.value) assertEquals("param2", log.attributes?.get("sentry.message.parameter.1")?.value) assertNull(log.attributes?.get("sentry.message.parameter.2")) - } + }, ) } @@ -890,7 +890,7 @@ class SentryAppenderTest { assertEquals("encoded testing message param", log.body) assertNull(log.attributes?.get("sentry.message.template")) assertNull(log.attributes?.get("sentry.message.parameter.0")) - } + }, ) } @@ -917,7 +917,7 @@ class SentryAppenderTest { assertThat(log.attributes?.get("sentry.message.template")?.value) .isEqualTo("testing message {}") assertThat(log.attributes?.get("sentry.message.parameter.0")?.value).isEqualTo("param") - } + }, ) } @@ -943,7 +943,7 @@ class SentryAppenderTest { assertEquals("encoded testing message param", log.body) assertEquals("testing message {}", log.attributes?.get("sentry.message.template")?.value) assertEquals("param", log.attributes?.get("sentry.message.parameter.0")?.value) - } + }, ) } @@ -964,7 +964,7 @@ class SentryAppenderTest { val attributes = log.attributes!! assertEquals("someValue", attributes["mdc.someTag"]?.value) assertNull(attributes["otherTag"]) - } + }, ) } } diff --git a/sentry-okhttp/src/main/java/io/sentry/okhttp/SentryOkHttpEventListener.kt b/sentry-okhttp/src/main/java/io/sentry/okhttp/SentryOkHttpEventListener.kt index 12836a732b0..c1cbc3d2d8e 100644 --- a/sentry-okhttp/src/main/java/io/sentry/okhttp/SentryOkHttpEventListener.kt +++ b/sentry-okhttp/src/main/java/io/sentry/okhttp/SentryOkHttpEventListener.kt @@ -96,13 +96,13 @@ public open class SentryOkHttpEventListener( public constructor() : this(ScopesAdapter.getInstance(), originalEventListenerCreator = null) public constructor( - originalEventListener: EventListener + originalEventListener: EventListener, ) : this(ScopesAdapter.getInstance(), originalEventListenerCreator = { originalEventListener }) { fixedOriginalEventListener = originalEventListener } public constructor( - originalEventListenerFactory: Factory + originalEventListenerFactory: Factory, ) : this( ScopesAdapter.getInstance(), originalEventListenerCreator = { originalEventListenerFactory.create(it) }, diff --git a/sentry-okhttp/src/main/java/io/sentry/okhttp/SentryOkHttpInterceptor.kt b/sentry-okhttp/src/main/java/io/sentry/okhttp/SentryOkHttpInterceptor.kt index bdd680ac662..b7c55b74d41 100644 --- a/sentry-okhttp/src/main/java/io/sentry/okhttp/SentryOkHttpInterceptor.kt +++ b/sentry-okhttp/src/main/java/io/sentry/okhttp/SentryOkHttpInterceptor.kt @@ -177,7 +177,7 @@ public open class SentryOkHttpInterceptor( }, scopes.options.sessionReplay.networkRequestHeaders, { req: Request -> req.headers.toMap() }, - ) + ), ) request = requestBuilder.build() @@ -381,7 +381,7 @@ public open class SentryOkHttpInterceptor( e, ) } - } + }, ) .build() } @@ -404,7 +404,7 @@ public open class SentryOkHttpInterceptor( { body() }, scopes.options.sessionReplay.networkResponseHeaders, { resp: Response -> resp.headers.toMap() }, - ) + ), ) } diff --git a/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpEventListenerTest.kt b/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpEventListenerTest.kt index 7f9915f13b1..8ef0443381c 100644 --- a/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpEventListenerTest.kt +++ b/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpEventListenerTest.kt @@ -76,7 +76,7 @@ class SentryOkHttpEventListenerTest { .setBody("responseBody") .addHeader("myResponseHeader", "myValue") .setSocketPolicy(SocketPolicy.KEEP_OPEN) - .setResponseCode(httpStatusCode) + .setResponseCode(httpStatusCode), ) val builder = OkHttpClient.Builder() diff --git a/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpEventTest.kt b/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpEventTest.kt index 89d5078c6fd..3017ad3abd7 100644 --- a/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpEventTest.kt +++ b/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpEventTest.kt @@ -244,7 +244,7 @@ class SentryOkHttpEventTest { val sut = fixture.getSut() sut.setRequest( - Request.Builder().post("".toRequestBody()).url("https://foo.bar/updated").build() + Request.Builder().post("".toRequestBody()).url("https://foo.bar/updated").build(), ) sut.finish() diff --git a/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpInterceptorTest.kt b/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpInterceptorTest.kt index baa37a7716a..8e4d492692a 100644 --- a/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpInterceptorTest.kt +++ b/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpInterceptorTest.kt @@ -86,7 +86,7 @@ class SentryOkHttpInterceptorTest { failedRequestTargets: List = listOf(".*"), failedRequestStatusCodes: List = listOf( - HttpStatusCodeRange(HttpStatusCodeRange.DEFAULT_MIN, HttpStatusCodeRange.DEFAULT_MAX) + HttpStatusCodeRange(HttpStatusCodeRange.DEFAULT_MIN, HttpStatusCodeRange.DEFAULT_MAX), ), sendDefaultPii: Boolean = false, eventListener: EventListener? = null, @@ -120,7 +120,7 @@ class SentryOkHttpInterceptorTest { .setBody(responseBody) .addHeader("myResponseHeader", "myValue") .setSocketPolicy(socketPolicy) - .setResponseCode(httpStatusCode) + .setResponseCode(httpStatusCode), ) val interceptor = @@ -184,7 +184,7 @@ class SentryOkHttpInterceptorTest { } private fun postRequest( - body: RequestBody = "request-body".toRequestBody("text/plain".toMediaType()) + body: RequestBody = "request-body".toRequestBody("text/plain".toMediaType()), ): Request = Request.Builder().post(body).url(fixture.server.url("/hello")).build() @SuppressWarnings("MaxLineLength") @@ -283,8 +283,8 @@ class SentryOkHttpInterceptorTest { "thirdPartyBaggage=someValue," + "secondThirdPartyBaggage=secondValue; " + "property;propertyKey=propertyValue," + - "anotherThirdPartyBaggage=anotherValue" - ) + "anotherThirdPartyBaggage=anotherValue", + ), ) assertTrue(baggageHeaderValues[0].contains("sentry-public_key=key")) assertTrue(baggageHeaderValues[0].contains("sentry-transaction=name")) @@ -364,7 +364,7 @@ class SentryOkHttpInterceptorTest { it.dataCollection.httpHeaders.request = KeyValueCollectionBehavior.off() it.dataCollection.httpHeaders.response = KeyValueCollectionBehavior.off() it.sessionReplay.setNetworkDetailAllowUrls(listOf(".*")) - } + }, ) val request = postRequest().newBuilder().addHeader("Accept", "application/json").build() @@ -377,7 +377,7 @@ class SentryOkHttpInterceptorTest { hint.firstValue.getAs( TypeCheckHint.SENTRY_REPLAY_NETWORK_DETAILS, NetworkRequestData::class.java, - ) + ), ) assertEquals("request-body", networkDetails.request?.body?.body) assertEquals("application/json", networkDetails.request?.headers?.get("Accept")) @@ -400,7 +400,7 @@ class SentryOkHttpInterceptorTest { hint.firstValue.getAs( TypeCheckHint.SENTRY_REPLAY_NETWORK_DETAILS, NetworkRequestData::class.java, - ) + ), ) .isNull() } @@ -449,7 +449,7 @@ class SentryOkHttpInterceptorTest { beforeSpan = { span, _, _ -> span.description = "overwritten description" span - } + }, ) val request = getRequest() sut.newCall(request).execute() @@ -468,7 +468,7 @@ class SentryOkHttpInterceptorTest { assertEquals(request.method, request.method) assertNotNull(response) { assertEquals(201, it.code) } span - } + }, ) val request = getRequest() sut.newCall(request).execute() @@ -497,7 +497,7 @@ class SentryOkHttpInterceptorTest { beforeSpan = { span, _, _ -> span.spanContext.sampled = false error("callback failed") - } + }, ) fixture.sentryTracer.spanContext.sampled = sampled fixture.options.onDiscard = onDiscard @@ -521,7 +521,7 @@ class SentryOkHttpInterceptorTest { beforeSpan = { span, _, _ -> span.description = "partially modified" throw failure - } + }, ) fixture.options.isDebug = true fixture.options.setLogger(logger) @@ -578,7 +578,7 @@ class SentryOkHttpInterceptorTest { .getSut( beforeSpan = { _, _, _ -> throw IllegalStateException("callback failed") - } + }, ) .newBuilder() .addInterceptor { throw requestFailure } @@ -850,9 +850,9 @@ class SentryOkHttpInterceptorTest { .request() .newBuilder() .url(chain.request().url.newBuilder().addPathSegment("v1").build()) - .build() + .build(), ) - } + }, ), ) @@ -886,7 +886,7 @@ class SentryOkHttpInterceptorTest { fun `adds W3C traceparent header when propagateTraceparent is enabled`() { val client = fixture.getSut( - optionsConfiguration = Sentry.OptionsConfiguration { it.isPropagateTraceparent = true } + optionsConfiguration = Sentry.OptionsConfiguration { it.isPropagateTraceparent = true }, ) fixture.server.enqueue(MockResponse().setResponseCode(200)) @@ -903,7 +903,7 @@ class SentryOkHttpInterceptorTest { fun `does not add W3C traceparent header when propagateTraceparent is disabled`() { val client = fixture.getSut( - optionsConfiguration = Sentry.OptionsConfiguration { it.isPropagateTraceparent = false } + optionsConfiguration = Sentry.OptionsConfiguration { it.isPropagateTraceparent = false }, ) fixture.server.enqueue(MockResponse().setResponseCode(200)) diff --git a/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpInterceptorUnknownContentLengthTest.kt b/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpInterceptorUnknownContentLengthTest.kt index b6257bfc50b..5fda8edfaaf 100644 --- a/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpInterceptorUnknownContentLengthTest.kt +++ b/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpInterceptorUnknownContentLengthTest.kt @@ -78,7 +78,7 @@ class SentryOkHttpInterceptorUnknownContentLengthTest { hint.firstValue.getAs( TypeCheckHint.SENTRY_REPLAY_NETWORK_DETAILS, NetworkRequestData::class.java, - ) + ), ) } @@ -273,7 +273,7 @@ class SentryOkHttpInterceptorUnknownContentLengthTest { thread.set(Thread.currentThread().name) done.countDown() } - } + }, ) assertTrue(done.await(10, TimeUnit.SECONDS), "the callback must be reached") @@ -350,7 +350,7 @@ class SentryOkHttpInterceptorUnknownContentLengthTest { MockResponse() .setBody(payload) .removeHeader("Content-Length") - .setHeader("Content-Type", "text/event-stream") + .setHeader("Content-Type", "text/event-stream"), ) sut = sut.newBuilder().protocols(listOf(Protocol.H2_PRIOR_KNOWLEDGE)).build() @@ -381,7 +381,7 @@ class SentryOkHttpInterceptorUnknownContentLengthTest { MockResponse() .setBody(gzipped) .setHeader("Content-Encoding", "gzip") - .setHeader("Content-Type", "application/json") + .setHeader("Content-Type", "application/json"), ) val response = sut.newCall(requestTo(server.url("/json").toString())).execute() diff --git a/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpUtilsTest.kt b/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpUtilsTest.kt index a11398fed57..b89a1f5bf5c 100644 --- a/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpUtilsTest.kt +++ b/sentry-okhttp/src/test/java/io/sentry/okhttp/SentryOkHttpUtilsTest.kt @@ -58,7 +58,7 @@ class SentryOkHttpUtilsTest { .addHeader("myResponseHeader", "myValue") .addHeader("Set-Cookie", "theme=dark; Path=/") .setSocketPolicy(socketPolicy) - .setResponseCode(httpStatusCode) + .setResponseCode(httpStatusCode), ) return OkHttpClient.Builder().build() } diff --git a/sentry-openfeign/src/test/kotlin/io/sentry/openfeign/SentryFeignClientTest.kt b/sentry-openfeign/src/test/kotlin/io/sentry/openfeign/SentryFeignClientTest.kt index 3f47b4f6e17..8813d3fcabf 100644 --- a/sentry-openfeign/src/test/kotlin/io/sentry/openfeign/SentryFeignClientTest.kt +++ b/sentry-openfeign/src/test/kotlin/io/sentry/openfeign/SentryFeignClientTest.kt @@ -121,8 +121,8 @@ class SentryFeignClientTest { listOf( "thirdPartyBaggage=someValue", "secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue", - ) - ) + ), + ), ) val recorderRequest = @@ -134,8 +134,8 @@ class SentryFeignClientTest { assertEquals(baggageHeaderValues.size, 1) assertTrue( baggageHeaderValues[0].startsWith( - "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue" - ) + "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue", + ), ) assertTrue(baggageHeaderValues[0].contains("sentry-public_key=key")) assertTrue(baggageHeaderValues[0].contains("sentry-transaction=name")) @@ -307,7 +307,7 @@ class SentryFeignClientTest { beforeSpan = { span, _, _ -> span.spanContext.sampled = false throw IllegalStateException("callback failed") - } + }, ) fixture.sentryTracer.spanContext.sampled = sampled fixture.sentryOptions.onDiscard = onDiscard @@ -333,7 +333,7 @@ class SentryFeignClientTest { beforeSpan = { span, _, _ -> span.description = "partially modified" throw failure - } + }, ) assertThat(sut.getOk()).isEqualTo("success") diff --git a/sentry-opentelemetry/sentry-opentelemetry-agent/build.gradle.kts b/sentry-opentelemetry/sentry-opentelemetry-agent/build.gradle.kts index 67c9feea2d6..47da060ae57 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-agent/build.gradle.kts +++ b/sentry-opentelemetry/sentry-opentelemetry-agent/build.gradle.kts @@ -218,7 +218,7 @@ tasks { test { jvmArgumentProviders.add( - objects.newInstance().apply { agentJar.from(shadowJar) } + objects.newInstance().apply { agentJar.from(shadowJar) }, ) } } diff --git a/sentry-opentelemetry/sentry-opentelemetry-agentcustomization/src/main/java/io/sentry/opentelemetry/SentryAutoConfigurationCustomizerProvider.java b/sentry-opentelemetry/sentry-opentelemetry-agentcustomization/src/main/java/io/sentry/opentelemetry/SentryAutoConfigurationCustomizerProvider.java index e11ae4c72b3..42277f53c26 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-agentcustomization/src/main/java/io/sentry/opentelemetry/SentryAutoConfigurationCustomizerProvider.java +++ b/sentry-opentelemetry/sentry-opentelemetry-agentcustomization/src/main/java/io/sentry/opentelemetry/SentryAutoConfigurationCustomizerProvider.java @@ -35,15 +35,14 @@ public void customize(AutoConfigurationCustomizer autoConfiguration) { ManifestVersionReader.getInstance().readOpenTelemetryVersion(); if (isSentryAutoInitEnabled()) { - Sentry.init( - options -> { - options.setEnableExternalConfiguration(true); - options.setInitPriority(InitPriority.HIGH); - final @Nullable SdkVersion sdkVersion = createSdkVersion(options, versionInfoHolder); - if (sdkVersion != null) { - options.setSdkVersion(sdkVersion); - } - }); + Sentry.init(options -> { + options.setEnableExternalConfiguration(true); + options.setInitPriority(InitPriority.HIGH); + final @Nullable SdkVersion sdkVersion = createSdkVersion(options, versionInfoHolder); + if (sdkVersion != null) { + options.setSdkVersion(sdkVersion); + } + }); } autoConfiguration diff --git a/sentry-opentelemetry/sentry-opentelemetry-agentless/src/test/kotlin/io/sentry/opentelemetry/agentless/AgentlessEndToEndTest.kt b/sentry-opentelemetry/sentry-opentelemetry-agentless/src/test/kotlin/io/sentry/opentelemetry/agentless/AgentlessEndToEndTest.kt index 6d519ed4174..e4ac7595757 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-agentless/src/test/kotlin/io/sentry/opentelemetry/agentless/AgentlessEndToEndTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-agentless/src/test/kotlin/io/sentry/opentelemetry/agentless/AgentlessEndToEndTest.kt @@ -75,7 +75,7 @@ class AgentlessEndToEndTest { addBreadcrumb(Breadcrumb("Processed by the event processor")) } } - } + }, ) } Sentry.withScope { @@ -95,11 +95,11 @@ class AgentlessEndToEndTest { message = Message().apply { message = "Detailed event" } fingerprints = listOf("NewClientDebug") level = SentryLevel.DEBUG - } + }, ) repeat(10) { i -> Sentry.captureEvent( - SentryEvent().apply { message = Message().apply { message = "event $i" } } + SentryEvent().apply { message = Message().apply { message = "event $i" } }, ) } val transaction = Sentry.startTransaction("transaction name", "op") diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/OpenTelemetryAttributesExtractor.java b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/OpenTelemetryAttributesExtractor.java index cf0fb06c11a..5ae9de98cc6 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/OpenTelemetryAttributesExtractor.java +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/OpenTelemetryAttributesExtractor.java @@ -79,30 +79,27 @@ private static Map collectHeaders( final @NotNull Attributes attributes, final @NotNull SentryOptions options) { Map headers = new HashMap<>(); - attributes.forEach( - (key, value) -> { - final @NotNull String attributeKeyAsString = key.getKey(); - if (attributeKeyAsString.startsWith(HTTP_REQUEST_HEADER_PREFIX)) { - final @NotNull String headerName = - StringUtils.removePrefix(attributeKeyAsString, HTTP_REQUEST_HEADER_PREFIX); - if (options.isSendDefaultPii() || !HttpUtils.containsSensitiveHeader(headerName)) { - if (value instanceof List) { - try { - final @NotNull List headerValues = (List) value; - headers.put( - headerName, - toString( - CookieUtils.filterOutSecurityCookiesFromHeader( - headerValues, headerName, null))); - } catch (Throwable t) { - options - .getLogger() - .log(SentryLevel.WARNING, "Expected a List as header", t); - } - } + attributes.forEach((key, value) -> { + final @NotNull String attributeKeyAsString = key.getKey(); + if (attributeKeyAsString.startsWith(HTTP_REQUEST_HEADER_PREFIX)) { + final @NotNull String headerName = + StringUtils.removePrefix(attributeKeyAsString, HTTP_REQUEST_HEADER_PREFIX); + if (options.isSendDefaultPii() || !HttpUtils.containsSensitiveHeader(headerName)) { + if (value instanceof List) { + try { + final @NotNull List headerValues = (List) value; + headers.put( + headerName, + toString( + CookieUtils.filterOutSecurityCookiesFromHeader( + headerValues, headerName, null))); + } catch (Throwable t) { + options.getLogger().log(SentryLevel.WARNING, "Expected a List as header", t); } } - }); + } + } + }); return headers; } diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/OtelSentrySpanProcessor.java b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/OtelSentrySpanProcessor.java index 1cf6fa5d833..880a2840757 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/OtelSentrySpanProcessor.java +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/OtelSentrySpanProcessor.java @@ -156,13 +156,11 @@ private boolean isRootSpan(SpanData otelSpan) { private static void updatePropagationContext( IScopes scopes, PropagationContext propagationContext) { - scopes.configureScope( - scope -> { - scope.withPropagationContext( - oldPropagationContext -> { - scope.setPropagationContext(propagationContext); - }); - }); + scopes.configureScope(scope -> { + scope.withPropagationContext(oldPropagationContext -> { + scope.setPropagationContext(propagationContext); + }); + }); } @Override diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySampler.java b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySampler.java index 1a9e8724ca6..6fd2f037f25 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySampler.java +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySampler.java @@ -148,13 +148,12 @@ public SamplingResult shouldSample( final @NotNull Map mapWithStringKeys = new HashMap<>(attributes.size()); if (attributes != null) { - attributes.forEach( - (key, value) -> { - if (key != null) { - final @NotNull String stringKey = key.getKey(); - mapWithStringKeys.put(stringKey, value); - } - }); + attributes.forEach((key, value) -> { + if (key != null) { + final @NotNull String stringKey = key.getKey(); + mapWithStringKeys.put(stringKey, value); + } + }); } return mapWithStringKeys; diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanExporter.java b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanExporter.java index 2583f4a0469..93b11eff4ab 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanExporter.java +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanExporter.java @@ -120,7 +120,7 @@ public CompletableResultCode export(Collection spans) { final @NotNull SentryInstantDate now = new SentryInstantDate(); final @NotNull List nonExpired = - remaining.stream().filter((span) -> !isSpanTooOld(span, now)).collect(Collectors.toList()); + remaining.stream().filter(span -> !isSpanTooOld(span, now)).collect(Collectors.toList()); this.finishedSpans.addAll(nonExpired); @@ -146,7 +146,7 @@ private boolean isSpanTooOld(final @NotNull SpanData span, final @NotNull Sentry private @NotNull List filterOutSentrySpans(final @NotNull Collection spans) { return spans.stream() - .filter((span) -> !isSentryRequest(scopes, span.getKind(), span.getAttributes())) + .filter(span -> !isSentryRequest(scopes, span.getKind(), span.getAttributes())) .collect(Collectors.toList()); } @@ -177,8 +177,8 @@ private List maybeSend(final @NotNull List spans) { } return remaining.stream() - .map((node) -> node.getSpan()) - .filter((it) -> it != null) + .map(node -> node.getSpan()) + .filter(it -> it != null) .collect(Collectors.toList()); } @@ -384,7 +384,7 @@ private void transferSpanDetails( private List findCompletedRootNodes(final @NotNull List grouped) { final @NotNull Predicate isRootPredicate = - (node) -> { + node -> { return node.getParentNode() == null && node.getSpan() != null; }; return grouped.stream().filter(isRootPredicate).collect(Collectors.toList()); @@ -512,15 +512,14 @@ private SpanStatus mapOtelStatus( final @NotNull Map mapWithStringKeys = new HashMap<>(); if (attributes != null) { - attributes.forEach( - (key, value) -> { - if (key != null) { - final @NotNull String stringKey = key.getKey(); - if (!shouldRemoveAttribute(stringKey)) { - mapWithStringKeys.put(stringKey, value); - } - } - }); + attributes.forEach((key, value) -> { + if (key != null) { + final @NotNull String stringKey = key.getKey(); + if (!shouldRemoveAttribute(stringKey)) { + mapWithStringKeys.put(stringKey, value); + } + } + }); } return mapWithStringKeys; diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanProcessor.java b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanProcessor.java index 31bd6368318..7da9917807a 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanProcessor.java +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SentrySpanProcessor.java @@ -131,7 +131,6 @@ public void onStart(final @NotNull Context parentContext, final @NotNull ReadWri traceData.getBaggage(), spanId, scopes.getOptions())); - ; transactionContext.setName(transactionName); transactionContext.setTransactionNameSource(transactionNameSource); transactionContext.setOperation(op); @@ -326,12 +325,11 @@ private void updateSpanWithOtelData( spanData .getAttributes() - .forEach( - (attributeKey, value) -> { - if (value != null) { - sentrySpan.setData(attributeKey.getKey(), value); - } - }); + .forEach((attributeKey, value) -> { + if (value != null) { + sentrySpan.setData(attributeKey.getKey(), value); + } + }); final @NotNull OtelSpanInfo otelSpanInfo = spanDescriptionExtractor.extractSpanInfo(otelSpan.toSpanData(), null, scopes.getOptions()); @@ -369,12 +367,11 @@ private boolean hasSentryBeenInitialized() { final @NotNull Map mapWithStringKeys = new HashMap<>(); if (attributes != null) { - attributes.forEach( - (key, value) -> { - if (key != null) { - mapWithStringKeys.put(key.getKey(), value); - } - }); + attributes.forEach((key, value) -> { + if (key != null) { + mapWithStringKeys.put(key.getKey(), value); + } + }); } return mapWithStringKeys; diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OpenTelemetryAttributesExtractorTest.kt b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OpenTelemetryAttributesExtractorTest.kt index 6d37240f0b2..080f69ce442 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OpenTelemetryAttributesExtractorTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OpenTelemetryAttributesExtractorTest.kt @@ -42,7 +42,7 @@ class OpenTelemetryAttributesExtractorTest { UrlAttributes.URL_QUERY to "q=123456&b=X", ServerAttributes.SERVER_ADDRESS to "io.sentry", ServerAttributes.SERVER_PORT to 8081L, - ) + ), ) whenExtractingAttributes() @@ -63,7 +63,7 @@ class OpenTelemetryAttributesExtractorTest { UrlAttributes.URL_QUERY to "q=123456&b=X", ServerAttributes.SERVER_ADDRESS to "io.sentry", ServerAttributes.SERVER_PORT to 8081L, - ) + ), ) whenExtractingAttributes() @@ -89,7 +89,7 @@ class OpenTelemetryAttributesExtractorTest { UrlAttributes.URL_QUERY to "q=123456&b=X", ServerAttributes.SERVER_ADDRESS to "io.sentry", ServerAttributes.SERVER_PORT to 8081L, - ) + ), ) whenExtractingAttributes() @@ -107,7 +107,7 @@ class OpenTelemetryAttributesExtractorTest { it.queryString = "s=abc" } givenAttributes( - mapOf(UrlAttributes.URL_FULL to "https://io.sentry:8081/path/to/123?q=123456&b=X") + mapOf(UrlAttributes.URL_FULL to "https://io.sentry:8081/path/to/123?q=123456&b=X"), ) whenExtractingAttributes() @@ -125,7 +125,7 @@ class OpenTelemetryAttributesExtractorTest { UrlAttributes.URL_SCHEME to "https", UrlAttributes.URL_PATH to "/path/to/123", ServerAttributes.SERVER_ADDRESS to "io.sentry", - ) + ), ) whenExtractingAttributes() @@ -141,7 +141,7 @@ class OpenTelemetryAttributesExtractorTest { HttpAttributes.HTTP_REQUEST_METHOD to "GET", UrlAttributes.URL_SCHEME to "https", ServerAttributes.SERVER_ADDRESS to "io.sentry", - ) + ), ) whenExtractingAttributes() @@ -153,7 +153,7 @@ class OpenTelemetryAttributesExtractorTest { @Test fun `does not set URL if server address is missing`() { givenAttributes( - mapOf(HttpAttributes.HTTP_REQUEST_METHOD to "GET", UrlAttributes.URL_SCHEME to "https") + mapOf(HttpAttributes.HTTP_REQUEST_METHOD to "GET", UrlAttributes.URL_SCHEME to "https"), ) whenExtractingAttributes() @@ -168,7 +168,7 @@ class OpenTelemetryAttributesExtractorTest { mapOf( HttpAttributes.HTTP_REQUEST_METHOD to "GET", ServerAttributes.SERVER_ADDRESS to "io.sentry", - ) + ), ) whenExtractingAttributes() @@ -203,7 +203,7 @@ class OpenTelemetryAttributesExtractorTest { ServerAttributes.SERVER_ADDRESS to "sentry.io", ServerAttributes.SERVER_PORT to 8082L, UrlAttributes.URL_PATH to "/some/path", - ) + ), ) val url = whenExtractingUrl() @@ -218,7 +218,7 @@ class OpenTelemetryAttributesExtractorTest { UrlAttributes.URL_SCHEME to "https", ServerAttributes.SERVER_ADDRESS to "sentry.io", UrlAttributes.URL_PATH to "/some/path", - ) + ), ) val url = whenExtractingUrl() @@ -233,7 +233,7 @@ class OpenTelemetryAttributesExtractorTest { ServerAttributes.SERVER_ADDRESS to "sentry.io", ServerAttributes.SERVER_PORT to 8082L, UrlAttributes.URL_PATH to "/some/path", - ) + ), ) val url = whenExtractingUrl() @@ -248,7 +248,7 @@ class OpenTelemetryAttributesExtractorTest { UrlAttributes.URL_SCHEME to "https", ServerAttributes.SERVER_PORT to 8082L, UrlAttributes.URL_PATH to "/some/path", - ) + ), ) val url = whenExtractingUrl() @@ -259,7 +259,7 @@ class OpenTelemetryAttributesExtractorTest { @Test fun `returns reconstructed URL if attributes present without port and path`() { givenAttributes( - mapOf(UrlAttributes.URL_SCHEME to "https", ServerAttributes.SERVER_ADDRESS to "sentry.io") + mapOf(UrlAttributes.URL_SCHEME to "https", ServerAttributes.SERVER_ADDRESS to "sentry.io"), ) val url = whenExtractingUrl() @@ -274,7 +274,7 @@ class OpenTelemetryAttributesExtractorTest { UrlAttributes.URL_SCHEME to "https", ServerAttributes.SERVER_ADDRESS to "sentry.io", ServerAttributes.SERVER_PORT to 8082L, - ) + ), ) val url = whenExtractingUrl() @@ -304,7 +304,7 @@ class OpenTelemetryAttributesExtractorTest { "__" + UUID.randomUUID().toString() + "__" + - UUID.randomUUID().toString() + UUID.randomUUID().toString(), ), ) givenAttributes(map) @@ -336,7 +336,7 @@ class OpenTelemetryAttributesExtractorTest { @Test fun `if there is no request method attribute does not set request on scope`() { givenAttributes( - mapOf(UrlAttributes.URL_SCHEME to "https", ServerAttributes.SERVER_ADDRESS to "io.sentry") + mapOf(UrlAttributes.URL_SCHEME to "https", ServerAttributes.SERVER_ADDRESS to "io.sentry"), ) whenExtractingAttributes() diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelInternalSpanDetectionUtilTest.kt b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelInternalSpanDetectionUtilTest.kt index 63a6c77c520..2269dde7f7b 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelInternalSpanDetectionUtilTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelInternalSpanDetectionUtilTest.kt @@ -40,7 +40,7 @@ class OtelInternalSpanDetectionUtilTest { UrlAttributes.URL_QUERY to "q=123456&b=X", ServerAttributes.SERVER_ADDRESS to "io.sentry", ServerAttributes.SERVER_PORT to 8081L, - ) + ), ) thenRequestIsConsideredInternal() @@ -67,7 +67,7 @@ class OtelInternalSpanDetectionUtilTest { UrlAttributes.URL_QUERY to "q=123456&b=X", ServerAttributes.SERVER_ADDRESS to "io.sentry", ServerAttributes.SERVER_PORT to 8081L, - ) + ), ) thenRequestIsConsideredInternal() diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelSentryPropagatorTest.kt b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelSentryPropagatorTest.kt index 6b9e733157d..c45cf2bec75 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelSentryPropagatorTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelSentryPropagatorTest.kt @@ -129,8 +129,8 @@ class OtelSentryPropagatorTest { whenever(sentrySpan.toBaggageHeader(anyOrNull())) .thenReturn( BaggageHeader( - "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d" - ) + "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", + ), ) val otelSpanContext = SpanContext.create( @@ -163,8 +163,8 @@ class OtelSentryPropagatorTest { whenever(sentrySpan.toBaggageHeader(anyOrNull())) .thenReturn( BaggageHeader( - "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d" - ) + "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", + ), ) whenever(sentrySpan.openTelemetrySpanAttributes).thenReturn(otelAttributes) val otelSpanContext = @@ -202,8 +202,8 @@ class OtelSentryPropagatorTest { whenever(sentrySpan.toBaggageHeader(anyOrNull())) .thenReturn( BaggageHeader( - "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d" - ) + "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", + ), ) whenever(sentrySpan.openTelemetrySpanAttributes).thenReturn(otelAttributes) val otelSpanContext = @@ -241,8 +241,8 @@ class OtelSentryPropagatorTest { whenever(sentrySpan.toBaggageHeader(anyOrNull())) .thenReturn( BaggageHeader( - "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d" - ) + "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", + ), ) whenever(sentrySpan.openTelemetrySpanAttributes).thenReturn(otelAttributes) val otelSpanContext = @@ -278,8 +278,8 @@ class OtelSentryPropagatorTest { whenever(sentrySpan.toBaggageHeader(anyOrNull())) .thenReturn( BaggageHeader( - "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d" - ) + "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", + ), ) whenever(sentrySpan.openTelemetrySpanAttributes).thenReturn(otelAttributes) val otelSpanContext = diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelSpanWrapperTest.kt b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelSpanWrapperTest.kt index 98d3989aaaf..237bb6c4498 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelSpanWrapperTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/OtelSpanWrapperTest.kt @@ -31,7 +31,7 @@ class OtelSpanWrapperTest { "cedf5b7571cb4972", TraceFlags.getSampled(), TraceState.getDefault(), - ) + ), ) whenever(otelSpan.name).thenReturn("parent") diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SentrySpanProcessorTest.kt b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SentrySpanProcessorTest.kt index df2cf9596dd..61baf4ef423 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SentrySpanProcessorTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SentrySpanProcessorTest.kt @@ -103,7 +103,7 @@ class SentrySpanProcessorTest { anyOrNull(), eq(Instrumenter.OTEL), any(), - ) + ), ) .thenReturn(span) diff --git a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SpanDescriptionExtractorTest.kt b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SpanDescriptionExtractorTest.kt index a43afb849e6..4290b0cf7e3 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SpanDescriptionExtractorTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SpanDescriptionExtractorTest.kt @@ -107,7 +107,7 @@ class SpanDescriptionExtractorTest { mapOf( HttpAttributes.HTTP_REQUEST_METHOD to "GET", UrlAttributes.URL_FULL to "https://sentry.io/some/path?q=1#top", - ) + ), ) val info = whenExtractingSpanInfo() @@ -121,7 +121,7 @@ class SpanDescriptionExtractorTest { fun `uses URL_PATH for description`() { givenSpanKind(SpanKind.SERVER) givenAttributes( - mapOf(HttpAttributes.HTTP_REQUEST_METHOD to "GET", UrlAttributes.URL_PATH to "/some/path") + mapOf(HttpAttributes.HTTP_REQUEST_METHOD to "GET", UrlAttributes.URL_PATH to "/some/path"), ) val info = whenExtractingSpanInfo() @@ -140,7 +140,7 @@ class SpanDescriptionExtractorTest { HttpAttributes.HTTP_ROUTE to "/some/{id}", HttpIncubatingAttributes.HTTP_TARGET to "some/path?q=1#top", UrlAttributes.URL_PATH to "/some/path", - ) + ), ) val info = whenExtractingSpanInfo() @@ -181,7 +181,7 @@ class SpanDescriptionExtractorTest { mapOf( DbIncubatingAttributes.DB_SYSTEM to "some", DbIncubatingAttributes.DB_QUERY_TEXT to "SELECT * FROM tbl", - ) + ), ) val info = whenExtractingSpanInfo() @@ -197,7 +197,7 @@ class SpanDescriptionExtractorTest { mapOf( DbIncubatingAttributes.DB_SYSTEM to "some", DbIncubatingAttributes.DB_STATEMENT to "SELECT * FROM tbl", - ) + ), ) val info = whenExtractingSpanInfo() @@ -238,7 +238,7 @@ class SpanDescriptionExtractorTest { MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic", MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "publish", - ) + ), ) val info = whenExtractingSpanInfo(queueTracingEnabled = false) @@ -255,7 +255,7 @@ class SpanDescriptionExtractorTest { MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic", MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "publish", - ) + ), ) val info = whenExtractingSpanInfo(queueTracingEnabled = true) @@ -272,7 +272,7 @@ class SpanDescriptionExtractorTest { MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic", MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "send", - ) + ), ) val info = whenExtractingSpanInfo(queueTracingEnabled = true) @@ -289,7 +289,7 @@ class SpanDescriptionExtractorTest { MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic", MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "process", - ) + ), ) val info = whenExtractingSpanInfo(queueTracingEnabled = true) @@ -306,7 +306,7 @@ class SpanDescriptionExtractorTest { MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic", MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "deliver", - ) + ), ) val info = whenExtractingSpanInfo(queueTracingEnabled = true) @@ -323,7 +323,7 @@ class SpanDescriptionExtractorTest { MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic", MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "create", - ) + ), ) val info = whenExtractingSpanInfo(queueTracingEnabled = true) @@ -340,7 +340,7 @@ class SpanDescriptionExtractorTest { MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic", MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "receive", - ) + ), ) val info = whenExtractingSpanInfo(queueTracingEnabled = true) @@ -357,7 +357,7 @@ class SpanDescriptionExtractorTest { MessagingIncubatingAttributes.MESSAGING_SYSTEM to "rabbitmq", MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-queue", MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "settle", - ) + ), ) val info = whenExtractingSpanInfo(queueTracingEnabled = true) @@ -375,7 +375,7 @@ class SpanDescriptionExtractorTest { MessagingIncubatingAttributes.MESSAGING_SYSTEM to "rabbitmq", MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "queue-name", MessagingIncubatingAttributes.MESSAGING_OPERATION to "publish", - ) + ), ) val info = whenExtractingSpanInfo(queueTracingEnabled = true) @@ -391,7 +391,7 @@ class SpanDescriptionExtractorTest { mapOf( MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic", - ) + ), ) val info = whenExtractingSpanInfo(queueTracingEnabled = true) @@ -407,7 +407,7 @@ class SpanDescriptionExtractorTest { mapOf( MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic", - ) + ), ) val info = whenExtractingSpanInfo(queueTracingEnabled = true) @@ -423,7 +423,7 @@ class SpanDescriptionExtractorTest { mapOf( MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka", MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "publish", - ) + ), ) val info = whenExtractingSpanInfo(queueTracingEnabled = true) @@ -444,7 +444,7 @@ class SpanDescriptionExtractorTest { MessagingIncubatingAttributes.MESSAGING_SYSTEM to "aws.sqs", MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-queue", MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "publish", - ) + ), ) val info = whenExtractingSpanInfo(queueTracingEnabled = true) @@ -464,7 +464,7 @@ class SpanDescriptionExtractorTest { MessagingIncubatingAttributes.MESSAGING_SYSTEM to "aws.sqs", MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-queue", MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "publish", - ) + ), ) val info = whenExtractingSpanInfo(queueTracingEnabled = false) diff --git a/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtelSentryPropagatorTest.kt b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtelSentryPropagatorTest.kt index d0220daf952..61a8f20bc5a 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtelSentryPropagatorTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtelSentryPropagatorTest.kt @@ -160,7 +160,7 @@ class OpenTelemetryOtlpPropagatorTest { val otelSpan = Span.wrap(otelSpanContext) val baggage = Baggage.fromHeader( - "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d" + "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", ) val context = Context.root().with(otelSpan).with(OpenTelemetryOtlpPropagator.SENTRY_BAGGAGE_KEY, baggage) @@ -194,7 +194,7 @@ class OpenTelemetryOtlpPropagatorTest { .startSpan() val baggage = Baggage.fromHeader( - "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d" + "sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", ) try { diff --git a/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtlpEndToEndTest.kt b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtlpEndToEndTest.kt index ca94bc1fad3..f92f7bcff4e 100644 --- a/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtlpEndToEndTest.kt +++ b/sentry-opentelemetry/sentry-opentelemetry-otlp/src/test/kotlin/OtlpEndToEndTest.kt @@ -26,7 +26,7 @@ class OtlpEndToEndTest { .setTracerProvider( SdkTracerProvider.builder() .addSpanProcessor(SimpleSpanProcessor.create(SpanExporter.composite())) - .build() + .build(), ) .build() diff --git a/sentry-quartz/src/test/kotlin/io/sentry/quartz/SentryJobListenerTest.kt b/sentry-quartz/src/test/kotlin/io/sentry/quartz/SentryJobListenerTest.kt index 7f6ddd68bab..d447b0c97ca 100644 --- a/sentry-quartz/src/test/kotlin/io/sentry/quartz/SentryJobListenerTest.kt +++ b/sentry-quartz/src/test/kotlin/io/sentry/quartz/SentryJobListenerTest.kt @@ -44,7 +44,7 @@ class SentryJobListenerTest { fun `cron trigger is sent as crontab monitor config with timezone`() { val config = inProgressMonitorConfig( - cronTrigger("0 15 10 ? * MON-FRI", TimeZone.getTimeZone("America/New_York")) + cronTrigger("0 15 10 ? * MON-FRI", TimeZone.getTimeZone("America/New_York")), ) assertThat(config).isNotNull() @@ -161,7 +161,7 @@ class SentryJobListenerTest { val trigger = TriggerBuilder.newTrigger() .withSchedule( - CalendarIntervalScheduleBuilder.calendarIntervalSchedule().withIntervalInDays(1) + CalendarIntervalScheduleBuilder.calendarIntervalSchedule().withIntervalInDays(1), ) .build() diff --git a/sentry-samples/sentry-samples-android/build.gradle.kts b/sentry-samples/sentry-samples-android/build.gradle.kts index 3a1de5a704a..aee693598cb 100644 --- a/sentry-samples/sentry-samples-android/build.gradle.kts +++ b/sentry-samples/sentry-samples-android/build.gradle.kts @@ -38,7 +38,7 @@ plugins.withId("io.sentry.android.gradle") { InstrumentationFeature.COMPOSE, InstrumentationFeature.DATABASE, InstrumentationFeature.OKHTTP, - ) + ), ) logcat.enabled.set(false) appStart.enabled.set(false) @@ -82,7 +82,7 @@ android { "ContentDescription", "LabelFor", "HardcodedText", - ) + ), ) } @@ -270,7 +270,7 @@ abstract class ToggleNativeLoggingTask : Exec() { companion object { private val regex = Regex( - """]*android:name="io\.sentry\.session-replay\.debug"[^>]*android:value="([^"]+)"""" + """]*android:name="io\.sentry\.session-replay\.debug"[^>]*android:value="([^"]+)"""", ) } } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/FrameDataForSpansActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/FrameDataForSpansActivity.kt index 2eb995dbcf1..e8acb496816 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/FrameDataForSpansActivity.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/FrameDataForSpansActivity.kt @@ -134,7 +134,7 @@ fun JankyButton(name: String, delay: Long, counter: MutableIntState) { counter.intValue += 1 Thread.sleep(delay) } - } + }, ) { Text(color = MaterialTheme.colorScheme.onPrimary, text = "$name: ${counter.intValue}") } @@ -192,9 +192,9 @@ class ViewModel { fun onStopDelayedSpanClicked() { Thread { - Thread.sleep(3000) - onStopSpanClicked() - } + Thread.sleep(3000) + onStopSpanClicked() + } .start() } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/GithubAPI.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/GithubAPI.kt index df3ee7d33fa..2cd26b7405e 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/GithubAPI.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/GithubAPI.kt @@ -15,7 +15,7 @@ object GitHubApi { SentryOkHttpInterceptor( captureFailedRequests = true, failedRequestStatusCodes = listOf(HttpStatusCodeRange(400, 599)), - ) + ), ) .build() diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt index 76b6a69f3fb..743178ae6b8 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt @@ -204,9 +204,9 @@ fun MainScreen() { Modifier.fillMaxSize() .windowInsetsPadding( WindowInsets.safeDrawing.only( - WindowInsetsSides.Top + WindowInsetsSides.Bottom + WindowInsetsSides.End - ) - ) + WindowInsetsSides.Top + WindowInsetsSides.Bottom + WindowInsetsSides.End, + ), + ), ) { when (selectedCategory) { Category.ERRORS -> ErrorsScreen() @@ -303,7 +303,7 @@ fun ErrorsScreen() { onClick = { tagSampleAction("crash_from_java") throw RuntimeException("Crash from Java button: uncaught RuntimeException") - } + }, ) { Text("Crash from Java", maxLines = 2, overflow = TextOverflow.Ellipsis) } @@ -315,7 +315,7 @@ fun ErrorsScreen() { onClick = { tagSampleAction("capture_exception") Sentry.captureException( - Exception(Exception(Exception("Capture Exception button: nested exception"))) + Exception(Exception(Exception("Capture Exception button: nested exception"))), ) }, modifier = Modifier, @@ -386,16 +386,16 @@ fun ErrorsScreen() { onClick = { tagSampleAction("anr") Thread { - synchronized(mutex) { - while (true) { - try { - Thread.sleep(10000) - } catch (e: InterruptedException) { - e.printStackTrace() - } + synchronized(mutex) { + while (true) { + try { + Thread.sleep(10000) + } catch (e: InterruptedException) { + e.printStackTrace() } } } + } .start() Handler(Looper.getMainLooper()) @@ -445,16 +445,16 @@ fun ErrorsScreen() { val latch = CountDownLatch(1) for (i in 0 until 20) { Thread { - val data = ArrayList() - try { - latch.await() - for (j in 0 until 1_000_000) { - data.add(String(ByteArray(1024 * 8))) - } - } catch (e: InterruptedException) { - e.printStackTrace() + val data = ArrayList() + try { + latch.await() + for (j in 0 until 1_000_000) { + data.add(String(ByteArray(1024 * 8))) } + } catch (e: InterruptedException) { + e.printStackTrace() } + } .start() } latch.countDown() @@ -559,7 +559,7 @@ fun TracingScreen() { OutlinedButton( onClick = { activity.startActivity( - Intent(activity, io.sentry.samples.android.sqlite.SQLiteActivity::class.java) + Intent(activity, io.sentry.samples.android.sqlite.SQLiteActivity::class.java), ) }, modifier = Modifier, @@ -696,7 +696,7 @@ fun SessionReplayScreen() { } else { showDialog = false } - } + }, ) { Text("Close") } @@ -787,7 +787,7 @@ fun UserFeedbackScreen() { Icon( painter = painterResource( - id = io.sentry.compose.R.drawable.sentry_user_feedback_compose_button_logo_24 + id = io.sentry.compose.R.drawable.sentry_user_feedback_compose_button_logo_24, ), contentDescription = null, ) @@ -897,7 +897,7 @@ fun IntegrationsScreen() { OutlinedButton( onClick = { activity.startActivity( - Intent(activity, io.sentry.samples.android.compose.ComposeActivity::class.java) + Intent(activity, io.sentry.samples.android.compose.ComposeActivity::class.java), ) }, modifier = Modifier, @@ -914,7 +914,7 @@ fun IntegrationsScreen() { Intent( activity, io.sentry.samples.android.navigation.nav2.Nav2SetupActivity::class.java, - ) + ), ) }, modifier = Modifier, @@ -1051,37 +1051,36 @@ fun UpdatesScreen() { val future = Sentry.distribution().checkForUpdate() Thread { - try { - val result = future.get() - activity.runOnUiThread { - val message = - when (result) { - is UpdateStatus.NewRelease -> { - "Update available: ${result.info.buildVersion} " + - "(Build ${result.info.buildNumber})\n" + - "Download URL: ${result.info.downloadUrl}" - } + try { + val result = future.get() + activity.runOnUiThread { + val message = + when (result) { + is UpdateStatus.NewRelease -> { + "Update available: ${result.info.buildVersion} " + + "(Build ${result.info.buildNumber})\n" + + "Download URL: ${result.info.downloadUrl}" + } - is UpdateStatus.UpToDate -> "App is up to date!" - is UpdateStatus.NoNetwork -> "No network connection: ${result.message}" - is UpdateStatus.UpdateError -> - "Error checking for updates: ${result.message}" + is UpdateStatus.UpToDate -> "App is up to date!" + is UpdateStatus.NoNetwork -> "No network connection: ${result.message}" + is UpdateStatus.UpdateError -> "Error checking for updates: ${result.message}" - else -> "Unknown status" - } - Toast.makeText(activity, message, Toast.LENGTH_LONG).show() - } - } catch (e: Exception) { - activity.runOnUiThread { - Toast.makeText( - activity, - "Error checking for updates: ${e.message}", - Toast.LENGTH_LONG, - ) - .show() - } + else -> "Unknown status" + } + Toast.makeText(activity, message, Toast.LENGTH_LONG).show() + } + } catch (e: Exception) { + activity.runOnUiThread { + Toast.makeText( + activity, + "Error checking for updates: ${e.message}", + Toast.LENGTH_LONG, + ) + .show() } } + } .start() }, modifier = Modifier, diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/ProfilingActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/ProfilingActivity.kt index e24822b3e42..03789863737 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/ProfilingActivity.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/ProfilingActivity.kt @@ -91,11 +91,11 @@ class ProfilingActivity : ComponentActivity() { Toast.makeText(context, R.string.profiling_manual_stopped, Toast.LENGTH_SHORT).show() } - } + }, ) { Text( if (manualActive) stringResource(R.string.profiling_stop_manual) - else stringResource(R.string.profiling_start_manual) + else stringResource(R.string.profiling_start_manual), ) } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/ReplayAnimationsActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/ReplayAnimationsActivity.kt index 0fe6cda581f..f437eb719de 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/ReplayAnimationsActivity.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/ReplayAnimationsActivity.kt @@ -199,7 +199,9 @@ private fun ComposeCanvasAnimation() { Canvas( modifier = - Modifier.fillMaxWidth().height(160.dp).background(Color(0xFF101820), RoundedCornerShape(8.dp)) + Modifier.fillMaxWidth() + .height(160.dp) + .background(Color(0xFF101820), RoundedCornerShape(8.dp)), ) { val center = Offset(size.width / 2f, size.height / 2f) val orbitRadius = min(size.width, size.height) * 0.32f diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/SecondActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/SecondActivity.kt index b8dec7e1059..117b468abf4 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/SecondActivity.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/SecondActivity.kt @@ -89,7 +89,7 @@ class SecondActivity : AppCompatActivity() { Sentry.reportFullyDisplayed() } - } + }, ) } } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/ThirdFragment.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/ThirdFragment.kt index a99185eb48f..4e9df59e6b7 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/ThirdFragment.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/ThirdFragment.kt @@ -30,7 +30,7 @@ class ThirdFragment : Fragment(R.layout.third_fragment) { } child?.finish(SpanStatus.OK) } - } + }, ) } } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/TriggerHttpRequestActivity.java b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/TriggerHttpRequestActivity.java index 5671a044437..d8497ab59ab 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/TriggerHttpRequestActivity.java +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/TriggerHttpRequestActivity.java @@ -174,11 +174,10 @@ private void executeRequest(Request request) { @Override public void onFailure(Call call, IOException e) { Sentry.captureException(e); - runOnUiThread( - () -> { - showLoading(false); - displayResponse("ERROR", null, "Request failed: " + e.getMessage(), 0); - }); + runOnUiThread(() -> { + showLoading(false); + displayResponse("ERROR", null, "Request failed: " + e.getMessage(), 0); + }); } @Override @@ -213,12 +212,11 @@ public void onResponse(Call call, Response response) throws IOException { } final String finalResponseHeaders = responseHeaders.toString(); - runOnUiThread( - () -> { - showLoading(false); - displayResponse( - statusMessage, statusCode, finalBody, responseTime, finalResponseHeaders); - }); + runOnUiThread(() -> { + showLoading(false); + displayResponse( + statusMessage, statusCode, finalBody, responseTime, finalResponseHeaders); + }); response.close(); } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/WebViewActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/WebViewActivity.kt index b0feb66a0e6..aa46a032a27 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/WebViewActivity.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/WebViewActivity.kt @@ -57,7 +57,7 @@ class WebViewActivity : AppCompatActivity() { addView(receivedView) addView(statusView) addView(webView, LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1f)) - } + }, ) val assetLoader = diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/memory/MemoryLimiterActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/memory/MemoryLimiterActivity.kt index 087cfdbb8a1..b1080043a1e 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/memory/MemoryLimiterActivity.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/memory/MemoryLimiterActivity.kt @@ -73,7 +73,7 @@ private val cautionTint = Color(0xFFFFF1DB) private val failureTint = Color(0xFFFFE1E3) private enum class AllocationOutcome { - JAVA_OOM + JAVA_OOM, } /** @@ -164,7 +164,7 @@ class MemoryLimiterActivity : ComponentActivity() { private fun releaseBuffers() { resetAllocatorState( - status = "Released retained buffers and requested a fresh start for the next run." + status = "Released retained buffers and requested a fresh start for the next run.", ) } @@ -260,7 +260,7 @@ private fun MemoryLimiterScreen( StepText("2. Run the Apply limit command for this launch's PID.") StepText("3. Tap Start memory pressure and optionally send the app to the background.") StepText( - "4. Reopen the app after the process dies; Sentry should recover the kill on startup." + "4. Reopen the app after the process dies; Sentry should recover the kill on startup.", ) } } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/common/NavigationRouteWorkDialog.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/common/NavigationRouteWorkDialog.kt index bfddc3129e1..9bda017b3b9 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/common/NavigationRouteWorkDialog.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/common/NavigationRouteWorkDialog.kt @@ -41,7 +41,7 @@ private fun routeWorkDialogTitle(context: Context): View = textSize = 20f setTypeface(null, Typeface.BOLD) setTextColor(context.themeColor(R.attr.textColorPrimary)) - } + }, ) addView( TextView(context).apply { @@ -49,7 +49,7 @@ private fun routeWorkDialogTitle(context: Context): View = textSize = 14f setTextColor(context.themeColor(R.attr.textColorSecondary)) setPadding(0, context.dp(8), 0, 0) - } + }, ) } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/common/RouteWorkApi.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/common/RouteWorkApi.kt index 8b12ee51fa3..faefe542994 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/common/RouteWorkApi.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/common/RouteWorkApi.kt @@ -19,7 +19,7 @@ internal object RouteWorkApi { SentryOkHttpInterceptor( captureFailedRequests = true, failedRequestStatusCodes = listOf(HttpStatusCodeRange(400, 599)), - ) + ), ) .build() @@ -49,7 +49,7 @@ internal object RouteWorkApi { override fun onFailure(call: retrofit2.Call, t: Throwable) { onFailure(t) } - } + }, ) } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2Activity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2Activity.kt index 0cbd4ac14b3..77b6f7a9865 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2Activity.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2Activity.kt @@ -273,7 +273,7 @@ class Nav2Activity : AppCompatActivity() { currentRoute = "/${backStack.lastOrNull()?.routeName ?: RouteNames.HOME}", backStack = nav2PerformanceBackStackPreview( - backStack.map { destination -> "/${destination.routeName}" } + backStack.map { destination -> "/${destination.routeName}" }, ), state = performanceState, onBuildStack = { buildNav2PerformanceStack() }, @@ -318,12 +318,12 @@ class Nav2Activity : AppCompatActivity() { addView( sentryEventButton("Capture Exception", R.id.nav2_capture_exception) { captureSampleException("Nav2") - } + }, ) addView( - sentryEventButton("Crash App", R.id.nav2_crash_app) { showCrashConfirmation("Nav2") } + sentryEventButton("Crash App", R.id.nav2_crash_app) { showCrashConfirmation("Nav2") }, ) - } + }, ) } } @@ -411,7 +411,7 @@ class Nav2Activity : AppCompatActivity() { currentRoute = "/${backStack.lastOrNull()?.routeName ?: RouteNames.HOME}", backStack = nav2PerformanceBackStackPreview( - backStack.map { destination -> "/${destination.routeName}" } + backStack.map { destination -> "/${destination.routeName}" }, ), ) } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2ComposeRoutes.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2ComposeRoutes.kt index 9d083ef7431..8eff5d7803d 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2ComposeRoutes.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2ComposeRoutes.kt @@ -261,7 +261,7 @@ internal fun Nav2ComposeApp( productId = "42", source = "product-list", campaign = "summer-sale", - ) + ), ) }, onOpenProduct7 = { @@ -655,7 +655,7 @@ private fun Nav2ComposePromoDialogRoute( routeSpec.displayArguments(mapOf(NavArgs.PROMO_ID to promoId)).toDisplayString() Text( listOfNotNull(routeSpec.description, argumentText.takeIf { it.isNotEmpty() }) - .joinToString("\n\n") + .joinToString("\n\n"), ) }, confirmButton = { @@ -843,7 +843,7 @@ private fun nav2ComposeBackStackSaver() = restore = { savedDestinations -> mutableStateListOf().apply { addAll( - savedDestinations.map { savedDestination -> savedDestination.toNav2ComposeDestination() } + savedDestinations.map { savedDestination -> savedDestination.toNav2ComposeDestination() }, ) if (isEmpty()) { add(Home) diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2ModalFragments.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2ModalFragments.kt index dc1e593a68b..e4d54129f5b 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2ModalFragments.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2ModalFragments.kt @@ -35,7 +35,7 @@ class Nav2PromoDialogFragment : DialogFragment() { orientation = LinearLayout.VERTICAL setPadding(20.dp(requireContext())) addView(promoDialogContent(activity, promoId)) - } + }, ) } } @@ -62,13 +62,13 @@ class Nav2PromoDialogFragment : DialogFragment() { addView( primaryButton(context, R.id.nav2_modal_capture_exception, "Exception") { activity.captureSampleException("Nav2") - } + }, ) addView(spacer(context, height = 10.dp(context))) addView( secondaryButton(context, R.id.nav2_modal_crash_app, "Crash App") { activity.showCrashConfirmation("Nav2") - } + }, ) addView(spacer(context, height = 10.dp(context))) addView( @@ -77,9 +77,9 @@ class Nav2PromoDialogFragment : DialogFragment() { gravity = Gravity.END layoutParams = LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT) addView( - quietButton(context, R.id.nav2_modal_dismiss, "Dismiss") { activity.navigateBack() } + quietButton(context, R.id.nav2_modal_dismiss, "Dismiss") { activity.navigateBack() }, ) - } + }, ) } } @@ -98,7 +98,7 @@ class Nav2ShareSheetFragment : DialogFragment() { orientation = LinearLayout.VERTICAL setPadding(12.dp(requireContext()), 0, 12.dp(requireContext()), 12.dp(requireContext())) addView(shareSheetContent(activity, productId)) - } + }, ) } } @@ -128,13 +128,13 @@ class Nav2ShareSheetFragment : DialogFragment() { addView( primaryButton(context, R.id.nav2_modal_capture_exception, "Capture Exception") { activity.captureSampleException("Nav2") - } + }, ) addView(spacer(context, height = 10.dp(context))) addView( secondaryButton(context, R.id.nav2_modal_crash_app, "Crash App") { activity.showCrashConfirmation("Nav2") - } + }, ) addView(spacer(context, height = 10.dp(context))) addView( @@ -142,7 +142,7 @@ class Nav2ShareSheetFragment : DialogFragment() { .apply { backgroundTintList = ColorStateList.valueOf(0xFFE8E1F7.toInt()) setTextColor(0xFF4E4569.toInt()) - } + }, ) } } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2RouteFragment.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2RouteFragment.kt index 8a76d3eb301..f1aff222357 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2RouteFragment.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2RouteFragment.kt @@ -45,7 +45,7 @@ class Nav2RouteFragment : Fragment() { listOf( RouteButton(R.id.nav2_fragment_browse_products, "Browse Products") { activity.navigateTo(Nav2Destination.ProductList) - } + }, ), ) @@ -56,7 +56,7 @@ class Nav2RouteFragment : Fragment() { listOf( RouteButton(R.id.nav2_fragment_open_deep_link, "Go to deep link destination") { activity.openSyntheticProductDeepLink() - } + }, ), ) @@ -67,7 +67,7 @@ class Nav2RouteFragment : Fragment() { listOf( RouteButton(R.id.nav2_fragment_open_product_42, "Open Product 42") { activity.navigateTo( - Nav2Destination.ProductDetail("42", "product-list", "summer-sale") + Nav2Destination.ProductDetail("42", "product-list", "summer-sale"), ) }, RouteButton(R.id.nav2_fragment_open_product_7, "Open Product 7") { @@ -85,7 +85,7 @@ class Nav2RouteFragment : Fragment() { else -> routeLayout( - RouteSpec(routeName = routeName, title = "Unknown Route", description = routeName) + RouteSpec(routeName = routeName, title = "Unknown Route", description = routeName), ) } } @@ -151,7 +151,7 @@ class Nav2RouteFragment : Fragment() { listOf( RouteButton(R.id.nav2_fragment_complete_order, "Complete Order") { activity.navigateTo(Nav2Destination.Confirmation("order-$productId")) - } + }, ), ) } @@ -165,7 +165,7 @@ class Nav2RouteFragment : Fragment() { listOf( RouteButton(R.id.nav2_fragment_reset_backstack, "Reset Backstack") { activity.resetToHome() - } + }, ), ) } @@ -191,7 +191,7 @@ class Nav2RouteFragment : Fragment() { setBackgroundColor(context.themeColor(android.R.attr.colorBackgroundFloating)) info.forEach { (label, value) -> addView(infoRow(label, value)) } buttons.forEach { button -> addView(routeButton(button)) } - } + }, ) } trailingContent?.invoke(this) @@ -227,7 +227,7 @@ class Nav2RouteFragment : Fragment() { scrollView.visibility = if (itemsVisible) View.VISIBLE else View.GONE } layoutParams = LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT) - } + }, ) addView(scrollView) } @@ -299,13 +299,13 @@ class Nav2RouteFragment : Fragment() { textSize = 14f setTypeface(null, Typeface.BOLD) layoutParams = LinearLayout.LayoutParams(0, WRAP_CONTENT, 1f) - } + }, ) addView( TextView(context).apply { text = "SKU-$itemNumber" textSize = 14f - } + }, ) } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2SampleConfigAdapter.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2SampleConfigAdapter.kt index 13b97107e3f..a9ebe42002d 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2SampleConfigAdapter.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2SampleConfigAdapter.kt @@ -11,7 +11,7 @@ internal fun currentNav2SampleConfigSnapshot(): NavigationSampleConfigSnapshot = currentNavigationSampleConfigSnapshot() internal fun Intent.previousNav2SampleConfigSnapshot( - fallback: NavigationSampleConfigSnapshot + fallback: NavigationSampleConfigSnapshot, ): NavigationSampleConfigSnapshot = NavigationSampleConfigSnapshot( enableScreenTracking = diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2TopBar.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2TopBar.kt index 6cacd2959ab..e2a6723f72e 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2TopBar.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2TopBar.kt @@ -105,12 +105,12 @@ internal class Nav2TopBar( val selected = tabScenario == scenario tabView.label.setTextColor( if (selected) context.themeColor(androidx.appcompat.R.attr.colorPrimary) - else tabView.defaultTextColor + else tabView.defaultTextColor, ) tabView.label.setTypeface(null, if (selected) Typeface.BOLD else Typeface.NORMAL) tabView.indicator.setBackgroundColor( if (selected) context.themeColor(androidx.appcompat.R.attr.colorPrimary) - else color(android.R.color.transparent) + else color(android.R.color.transparent), ) } } @@ -129,11 +129,11 @@ internal class Nav2TopBar( textSize = 20f setTextColor(context.themeColor(android.R.attr.textColorPrimary)) layoutParams = LinearLayout.LayoutParams(0, WRAP_CONTENT, 1f) - } + }, ) addView(transactionHistoryIcon()) addView(routeWorkSettingsIcon()) - } + }, ) addView(View(context), LinearLayout.LayoutParams(MATCH_PARENT, 12.dp)) addView(currentRouteScroll) diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2TransactionHistory.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2TransactionHistory.kt index f64a78b051d..0c175bf9290 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2TransactionHistory.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2TransactionHistory.kt @@ -126,18 +126,18 @@ private fun SentrySpan.toNav2TraceSpan(transactionStartTimestamp: Double): Nav2T ) private fun List.withChildren( - spansByParentId: Map> + spansByParentId: Map>, ): List = map { span -> span.withChildren(spansByParentId) } private fun Nav2TraceSpan.withChildren( - spansByParentId: Map> + spansByParentId: Map>, ): Nav2TraceSpan = copy( children = spansByParentId[spanId] .orEmpty() .sortedBy { span -> span.startOffsetMillis } - .withChildren(spansByParentId) + .withChildren(spansByParentId), ) private fun sentryTransactionUrl( diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2TransactionHistorySheet.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2TransactionHistorySheet.kt index 878f7b5f6b5..4e7e433a5fb 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2TransactionHistorySheet.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2TransactionHistorySheet.kt @@ -259,7 +259,7 @@ private fun TraceRow( .height(12.dp) .align(Alignment.CenterStart) .clip(RoundedCornerShape(2.dp)) - .background(color) + .background(color), ) Text( durationMillis.formatMillis(), @@ -283,7 +283,7 @@ private fun TimelineGrid() { Modifier.width(1.dp) .height(24.dp) .align(Alignment.CenterEnd) - .background(MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.45f)) + .background(MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.45f)), ) } } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3Activity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3Activity.kt index 449ac2b2995..807fedad09a 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3Activity.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3Activity.kt @@ -356,7 +356,7 @@ private fun Nav3SampleApp( host.startActivity( Intent(host, Nav3FragmentsActivity::class.java) .putExtra(Nav3FragmentsActivity.EXTRA_MODE, mode.name) - .putExtras(Bundle().apply { putNav3SampleConfiguration(configuration) }) + .putExtras(Bundle().apply { putNav3SampleConfiguration(configuration) }), ) } } @@ -398,7 +398,7 @@ private fun Nav3SampleApp( modifier = Modifier.fillMaxSize() .padding(innerPadding) - .background(MaterialTheme.colorScheme.background) + .background(MaterialTheme.colorScheme.background), ) { NavDisplay( backStack = backStack, @@ -473,7 +473,7 @@ private fun Nav3SampleApp( MultiActivityRoute { activity?.startActivity( Intent(activity, Nav3ProductsActivity::class.java) - .putExtras(Bundle().apply { putNav3SampleConfiguration(configuration) }) + .putExtras(Bundle().apply { putNav3SampleConfiguration(configuration) }), ) } } @@ -610,7 +610,7 @@ private fun Nav3SampleApp( onClick = { onDismissCrashConfirmation() crashSampleApp("Nav3") - } + }, ) { Text("Crash") } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3BottomSheetSceneStrategy.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3BottomSheetSceneStrategy.kt index 2ff41d96845..f28c7e9f424 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3BottomSheetSceneStrategy.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3BottomSheetSceneStrategy.kt @@ -114,7 +114,7 @@ private fun AnimatedOverlayScrim( ) { Box( modifier = - Modifier.fillMaxSize().background(Color.Black.copy(alpha = 0.32f)).clickable { onBack() } + Modifier.fillMaxSize().background(Color.Black.copy(alpha = 0.32f)).clickable { onBack() }, ) } } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3MultiActivity.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3MultiActivity.kt index b15b1811687..4309cc66f08 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3MultiActivity.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3MultiActivity.kt @@ -121,7 +121,7 @@ class Nav3ProductsActivity : ComponentActivity() { onClick = { productId -> startActivity( checkoutIntent(productId, configuration) - .setClass(this, Nav3TranslucentCheckoutActivity::class.java) + .setClass(this, Nav3TranslucentCheckoutActivity::class.java), ) }, ), @@ -130,7 +130,7 @@ class Nav3ProductsActivity : ComponentActivity() { testTag = nav3TestTag("product_detail_go_to_checkout_for_result"), onClick = { productId -> checkoutForResult.launch( - checkoutIntent(productId, configuration).putExtra(EXTRA_RETURN_RESULT, true) + checkoutIntent(productId, configuration).putExtra(EXTRA_RETURN_RESULT, true), ) }, ), @@ -140,7 +140,7 @@ class Nav3ProductsActivity : ComponentActivity() { onClick = { productId -> startActivity( checkoutIntent(productId, configuration) - .putExtra(EXTRA_CRASH_ON_FIRST_COMPOSITION, true) + .putExtra(EXTRA_CRASH_ON_FIRST_COMPOSITION, true), ) }, ), @@ -373,7 +373,7 @@ internal fun MultiRootNavDisplay( val parentDispatcherOwner = LocalNavigationEventDispatcherOwner.current CompositionLocalProvider( LocalNavigationEventDispatcherOwner provides - rememberNavigationEventDispatcherOwner(enabled = isResumed, parent = parentDispatcherOwner) + rememberNavigationEventDispatcherOwner(enabled = isResumed, parent = parentDispatcherOwner), ) { NavDisplay( backStack = backStack, @@ -425,7 +425,7 @@ internal fun MultiRootNavDisplay( if (crashOnFirstComposition) { SideEffect { throw RuntimeException( - "Fatal Nav3 ${scenario.label} crash after first composition" + "Fatal Nav3 ${scenario.label} crash after first composition", ) } } @@ -460,7 +460,7 @@ internal fun MultiRootNavDisplay( onClick = { showCrashConfirmation = false crashSampleApp("Nav3 ${scenario.label}") - } + }, ) { Text("Crash") } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3MultiFragment.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3MultiFragment.kt index ca6321880b5..b50ff0d7c6d 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3MultiFragment.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3MultiFragment.kt @@ -108,7 +108,7 @@ class Nav3FragmentsActivity : FragmentActivity() { orientation = LinearLayout.VERTICAL addView(controls, LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT)) addView(container, LinearLayout.LayoutParams(MATCH_PARENT, 0, 1f)) - } + }, ) if (savedInstanceState == null) { @@ -330,7 +330,7 @@ class Nav3PagerFragment : Fragment() { override fun onPageSelected(position: Int) { currentPage = position } - } + }, ) } @@ -360,7 +360,7 @@ internal fun FragmentScenarioRoute( testTag = nav3TestTag( if (mode == Nav3FragmentMode.REPLACE) "multi_fragment_open_fragments" - else "${mode.name.lowercase()}_open_fragments" + else "${mode.name.lowercase()}_open_fragments", ), ) }, @@ -435,7 +435,7 @@ private fun PagerHeader(currentPage: Int, onSelectPage: (Int) -> Unit) { modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp).semantics { testTagsAsResourceId = true - } + }, ) { Text( "ViewPager2 page $currentPage (neighbors preloaded at STARTED)", diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3PerformanceControls.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3PerformanceControls.kt index 90f90dd2b3a..e923948060f 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3PerformanceControls.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3PerformanceControls.kt @@ -780,12 +780,12 @@ internal fun Nav3PerformancePanel( enabled = !state.performanceRunActive, onDecrement = { controls.onMaxCapturedBackStackEntriesChange( - (controls.maxCapturedBackStackEntries - 1).coerceAtLeast(0) + (controls.maxCapturedBackStackEntries - 1).coerceAtLeast(0), ) }, onIncrement = { controls.onMaxCapturedBackStackEntriesChange( - (controls.maxCapturedBackStackEntries + 1).coerceAtMost(100) + (controls.maxCapturedBackStackEntries + 1).coerceAtMost(100), ) }, ) diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3PlainScreens.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3PlainScreens.kt index 6d64c7da45f..d607f29508d 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3PlainScreens.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3PlainScreens.kt @@ -97,7 +97,7 @@ internal fun Nav3OpenPlainActivityButton(modifier: Modifier = Modifier) { .putExtra( EXTRA_ENABLE_USER_INTERACTION_BREADCRUMBS, options.enableUserInteractionBreadcrumbs, - ) + ), ) }, modifier = modifier, @@ -123,11 +123,11 @@ private fun PlainNav3Screen(title: String, onBack: (() -> Unit)? = null) { Column( Modifier.fillMaxSize().safeDrawingPadding().padding(16.dp).semantics { testTagsAsResourceId = true - } + }, ) { Text(title, modifier = Modifier.testTag(nav3TestTag("plain_title"))) Text( - "This screen has no SentryNavEffect. The previous root's Navigation context should be absent." + "This screen has no SentryNavEffect. The previous root's Navigation context should be absent.", ) Text(snapshot, modifier = Modifier.testTag(nav3TestTag("plain_scope_state"))) Text(result, modifier = Modifier.testTag(nav3TestTag("plain_result"))) diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3RouteScreens.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3RouteScreens.kt index 92a7cbbd6bb..dfdeb76ecb6 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3RouteScreens.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3RouteScreens.kt @@ -281,7 +281,7 @@ internal fun RouteScaffold( Modifier.fillMaxSize() .background(MaterialTheme.colorScheme.background) .padding(16.dp) - .testTag("${testTagPrefix}_screen") + .testTag("${testTagPrefix}_screen"), ) { Column( modifier = @@ -448,7 +448,7 @@ private fun Nav3CustomTransactionModeSelector( modifier = Modifier.fillMaxWidth() .testTag(nav3TestTag("custom_mode_selector")) - .testTag(nav3CustomModeSelectionTag(selected)) + .testTag(nav3CustomModeSelectionTag(selected)), ) { Nav3CustomTransactionMode.entries.forEachIndexed { index, mode -> SegmentedButton( @@ -526,7 +526,7 @@ internal fun ProductListRoute(backStack: SnapshotStateList) { productId = "42", source = "product-list", campaign = "summer-sale", - ) + ), ) }, testTag = nav3TestTag("product_list_open_product_42"), @@ -779,12 +779,12 @@ private fun nav3RouteTag(routeName: String): String = private fun nav3ButtonTag(label: String): String = nav3TestTag( - "button_${label.lowercase().replace(' ', '_').replace('/', '_').replace('.', '_').replace('-', '_')}" + "button_${label.lowercase().replace(' ', '_').replace('/', '_').replace('.', '_').replace('-', '_')}", ) private fun nav3InfoTag(label: String): String = nav3TestTag( - "info_${label.lowercase().replace(' ', '_').replace('/', '_').replace('.', '_').replace('-', '_')}" + "info_${label.lowercase().replace(' ', '_').replace('/', '_').replace('.', '_').replace('-', '_')}", ) private fun nav3CustomModeSelectionTag(mode: Nav3CustomTransactionMode): String = diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3SampleConfig.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3SampleConfig.kt index 45eadc367ca..88d752218cc 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3SampleConfig.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3SampleConfig.kt @@ -7,7 +7,7 @@ import io.sentry.samples.android.navigation.common.NavigationSampleConfig import io.sentry.samples.android.navigation.common.NavigationSampleConfigSnapshot internal fun Intent.previousNav3SampleConfigSnapshot( - fallback: NavigationSampleConfigSnapshot + fallback: NavigationSampleConfigSnapshot, ): NavigationSampleConfigSnapshot = NavigationSampleConfigSnapshot( enableScreenTracking = diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3TopBar.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3TopBar.kt index d2872f3c939..e4c72994cda 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3TopBar.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3TopBar.kt @@ -133,7 +133,7 @@ private fun ScenarioBar( Modifier.fillMaxWidth() .horizontalScroll(rememberScrollState()) .padding(start = 24.dp, end = 24.dp) - .testTag(nav3TestTag("scenario_bar")) + .testTag(nav3TestTag("scenario_bar")), ) { scenarios.forEach { scenario -> val selected = selectedScenario == scenario @@ -157,7 +157,7 @@ private fun ScenarioBar( .background( if (selected) selectedTabColor else Color.Transparent, RoundedCornerShape(topStart = 4.dp, topEnd = 4.dp), - ) + ), ) } } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3TransactionHistory.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3TransactionHistory.kt index c443c9a8bd5..80e6cfa9bf2 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3TransactionHistory.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3TransactionHistory.kt @@ -62,7 +62,7 @@ internal object NavigationTransactionHistory { } internal class NavigationTransactionHistoryStore( - private val transactionLimit: Int = TRANSACTION_HISTORY_LIMIT + private val transactionLimit: Int = TRANSACTION_HISTORY_LIMIT, ) { val transactions = mutableStateListOf() @@ -103,7 +103,7 @@ internal data class NavigationTraceSpan( ) internal fun SentryTransaction.toNavigationTransactionTrace( - dsn: String? + dsn: String?, ): NavigationTransactionTrace { val trace = contexts.trace val startTimestamp = startTimestamp @@ -140,7 +140,7 @@ internal fun SentryTransaction.toNavigationTransactionTrace( } private fun SentrySpan.toNavigationTraceSpan( - transactionStartTimestamp: Double + transactionStartTimestamp: Double, ): NavigationTraceSpan = NavigationTraceSpan( spanId = spanId.toString(), @@ -153,18 +153,18 @@ private fun SentrySpan.toNavigationTraceSpan( ) private fun List.withChildren( - spansByParentId: Map> + spansByParentId: Map>, ): List = map { span -> span.withChildren(spansByParentId) } private fun NavigationTraceSpan.withChildren( - spansByParentId: Map> + spansByParentId: Map>, ): NavigationTraceSpan = copy( children = spansByParentId[spanId] .orEmpty() .sortedBy { span -> span.startOffsetMillis } - .withChildren(spansByParentId) + .withChildren(spansByParentId), ) private fun sentryTransactionUrl( diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3TransactionHistorySheet.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3TransactionHistorySheet.kt index 94a643ba7ca..e401b42ecbe 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3TransactionHistorySheet.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav3/Nav3TransactionHistorySheet.kt @@ -140,7 +140,7 @@ private fun TransactionCard( verticalAlignment = Alignment.Top, ) { Column( - modifier = Modifier.weight(1f).testTag(historyTag(sampleName, "card_${index}_summary")) + modifier = Modifier.weight(1f).testTag(historyTag(sampleName, "card_${index}_summary")), ) { Text( transaction.name, @@ -308,7 +308,7 @@ private fun TraceRow( .height(12.dp) .align(Alignment.CenterStart) .clip(RoundedCornerShape(2.dp)) - .background(color) + .background(color), ) Text( durationMillis.formatMillis(), @@ -332,7 +332,7 @@ private fun TimelineGrid() { Modifier.width(1.dp) .height(24.dp) .align(Alignment.CenterEnd) - .background(MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.45f)) + .background(MaterialTheme.colorScheme.outlineVariant.copy(alpha = 0.45f)), ) } } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SampleDatabases.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SampleDatabases.kt index f01a529499d..25215301e0f 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SampleDatabases.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SampleDatabases.kt @@ -122,7 +122,7 @@ object SampleDatabases { "bridge_room2.db", ) .setDriver( - wrapDriver(SupportSQLiteDriver(buildBridgeRoom2Helper(context.applicationContext))) + wrapDriver(SupportSQLiteDriver(buildBridgeRoom2Helper(context.applicationContext))), ) .setQueryCoroutineContext(Dispatchers.IO) .fallbackToDestructiveMigration(true) @@ -223,7 +223,7 @@ object SampleDatabases { db.execSQL("PRAGMA user_version = 0") } } - } + }, ) .build() return wrapOpenHelper(FrameworkSQLiteOpenHelperFactory().create(configuration)) @@ -241,7 +241,7 @@ object SampleDatabases { override fun onUpgrade(db: SupportSQLiteDatabase, oldVersion: Int, newVersion: Int) = Unit - } + }, ) .build() return wrapOpenHelper(FrameworkSQLiteOpenHelperFactory().create(configuration)) diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SqlStatements.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SqlStatements.kt index 9bd2d624694..3015940c3b0 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SqlStatements.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/SqlStatements.kt @@ -179,7 +179,7 @@ object SqlStatements { // Batch insert: one insertAll() runs all rows in a single transaction, vs. a naive per-row // loop. dao.insertAll( - List(HEAVY_ROW_COUNT) { SongEntity3(title = "song $it", artist = "artist $it") } + List(HEAVY_ROW_COUNT) { SongEntity3(title = "song $it", artist = "artist $it") }, ) dao.getAll().forEach { appWork("${it.id}:${it.title}:${it.artist}") } } diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/UiLoadScreen.kt b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/UiLoadScreen.kt index 6495726448d..5065773106c 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/UiLoadScreen.kt +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/sqlite/UiLoadScreen.kt @@ -44,7 +44,8 @@ fun UiLoadScreen(status: String, onClose: () -> Unit) { MaterialTheme { Surface { Box( - modifier = Modifier.fillMaxSize().statusBarsPadding().navigationBarsPadding().padding(24.dp) + modifier = + Modifier.fillMaxSize().statusBarsPadding().navigationBarsPadding().padding(24.dp), ) { Column( modifier = Modifier.align(Alignment.Center).fillMaxWidth().offset(y = (-48).dp), diff --git a/sentry-samples/sentry-samples-console-opentelemetry-noagent/src/main/java/io/sentry/samples/console/Main.java b/sentry-samples/sentry-samples-console-opentelemetry-noagent/src/main/java/io/sentry/samples/console/Main.java index 21438ee496c..24fd08924a1 100644 --- a/sentry-samples/sentry-samples-console-opentelemetry-noagent/src/main/java/io/sentry/samples/console/Main.java +++ b/sentry-samples/sentry-samples-console-opentelemetry-noagent/src/main/java/io/sentry/samples/console/Main.java @@ -26,14 +26,13 @@ public class Main { public static void main(String[] args) throws InterruptedException { AutoConfiguredOpenTelemetrySdk.builder() .setResultAsGlobal() - .addPropertiesSupplier( - () -> { - final Map properties = new HashMap<>(); - properties.put("otel.logs.exporter", "none"); - properties.put("otel.metrics.exporter", "none"); - properties.put("otel.traces.exporter", "none"); - return properties; - }) + .addPropertiesSupplier(() -> { + final Map properties = new HashMap<>(); + properties.put("otel.logs.exporter", "none"); + properties.put("otel.metrics.exporter", "none"); + properties.put("otel.traces.exporter", "none"); + return properties; + }) .build(); Sentry.addBreadcrumb( @@ -41,22 +40,20 @@ public static void main(String[] args) throws InterruptedException { // Data added to the root scope (no PushScope called up to this point) // The modifications done here will affect all events sent and will propagate to child scopes. - Sentry.configureScope( - scope -> { - scope.addEventProcessor(new SomeEventProcessor()); + Sentry.configureScope(scope -> { + scope.addEventProcessor(new SomeEventProcessor()); - scope.setExtra("SomeExtraInfo", "Some value for extra info"); - }); + scope.setExtra("SomeExtraInfo", "Some value for extra info"); + }); // Configures a scope which is only valid within the callback - Sentry.withScope( - scope -> { - scope.setLevel(SentryLevel.FATAL); - scope.setTransaction("main"); - - // This message includes the data set to the scope in this block: - Sentry.captureMessage("Fatal message!"); - }); + Sentry.withScope(scope -> { + scope.setLevel(SentryLevel.FATAL); + scope.setTransaction("main"); + + // This message includes the data set to the scope in this block: + Sentry.captureMessage("Fatal message!"); + }); // Only data added to the scope on `configureScope` above is included. Sentry.captureMessage("Some warning!", SentryLevel.WARNING); diff --git a/sentry-samples/sentry-samples-console-otlp/src/main/java/io/sentry/samples/console/Main.java b/sentry-samples/sentry-samples-console-otlp/src/main/java/io/sentry/samples/console/Main.java index d973a68a907..ddc3ce62a00 100644 --- a/sentry-samples/sentry-samples-console-otlp/src/main/java/io/sentry/samples/console/Main.java +++ b/sentry-samples/sentry-samples-console-otlp/src/main/java/io/sentry/samples/console/Main.java @@ -22,141 +22,131 @@ public static void main(String[] args) throws InterruptedException { // Configure OpenTelemetry SDK with Sentry OTLP propagator AutoConfiguredOpenTelemetrySdk.builder() .setResultAsGlobal() - .addPropertiesSupplier( - () -> { - final Map properties = new HashMap<>(); - properties.put("otel.logs.exporter", "none"); - properties.put("otel.metrics.exporter", "none"); - // OTLP traces exporter configuration - properties.put("otel.traces.exporter", "otlp,logging"); - properties.put( - "otel.exporter.otlp.traces.endpoint", - "https://o447951.ingest.us.sentry.io/api/5428563/integration/otlp/v1/traces"); - properties.put("otel.exporter.otlp.traces.protocol", "http/protobuf"); - properties.put( - "otel.exporter.otlp.traces.headers", - "x-sentry-auth=sentry sentry_key=502f25099c204a2fbf4cb16edc5975d1"); - properties.put("otel.propagators", "tracecontext,baggage,sentry"); - return properties; - }) + .addPropertiesSupplier(() -> { + final Map properties = new HashMap<>(); + properties.put("otel.logs.exporter", "none"); + properties.put("otel.metrics.exporter", "none"); + // OTLP traces exporter configuration + properties.put("otel.traces.exporter", "otlp,logging"); + properties.put( + "otel.exporter.otlp.traces.endpoint", + "https://o447951.ingest.us.sentry.io/api/5428563/integration/otlp/v1/traces"); + properties.put("otel.exporter.otlp.traces.protocol", "http/protobuf"); + properties.put( + "otel.exporter.otlp.traces.headers", + "x-sentry-auth=sentry sentry_key=502f25099c204a2fbf4cb16edc5975d1"); + properties.put("otel.propagators", "tracecontext,baggage,sentry"); + return properties; + }) .build(); - Sentry.init( - options -> { - // NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in - // your Sentry project/dashboard - options.setEnableExternalConfiguration(true); - options.setDsn( - "https://502f25099c204a2fbf4cb16edc5975d1@o447951.ingest.sentry.io/5428563"); - - // All events get assigned to the release. See more at - // https://docs.sentry.io/workflow/releases/ - options.setRelease("io.sentry.samples.console@3.0.0+1"); - - // Link Sentry events to OpenTelemetry spans - options.addEventProcessor(new OpenTelemetryOtlpEventProcessor()); - - // Modifications to event before it goes out. Could replace the event altogether - options.setBeforeSend( - (event, hint) -> { - // Drop an event altogether: - if (event.getTag("SomeTag") != null) { - return null; - } - return event; - }); - - options.setBeforeSendTransaction( - (transaction, hint) -> { - // Drop a transaction: - if (transaction.getTag("SomeTransactionTag") != null) { - return null; - } - - return transaction; - }); - - // Allows inspecting and modifying, returning a new or simply rejecting (returning null) - options.setBeforeBreadcrumb( - (breadcrumb, hint) -> { - // Don't add breadcrumbs with message containing: - if (breadcrumb.getMessage() != null - && breadcrumb.getMessage().contains("bad breadcrumb")) { - return null; - } - return breadcrumb; - }); - - // Record data being discarded, including the reason, type of data, and the number of - // items dropped - options.setOnDiscard( - (reason, category, number) -> { - // Only record the number of lost spans due to overflow conditions - if ((reason.equals(DiscardReason.CACHE_OVERFLOW) - || reason.equals(DiscardReason.QUEUE_OVERFLOW)) - && category.equals(DataCategory.Span)) { - numberOfDiscardedSpansDueToOverflow += number; - } - }); - - // Configure the background worker which sends events to sentry: - // Wait up to 5 seconds before shutdown while there are events to send. - options.setShutdownTimeoutMillis(5000); - - // Enable SDK logging with Debug level - options.setDebug(true); - // To change the verbosity, use: - // By default it's DEBUG. - // options.setDiagnosticLevel(SentryLevel.ERROR); - // A good option to have SDK debug log in prod is to use only level ERROR here. - - // Exclude frames from some packages from being "inApp" so are hidden by default in Sentry - // UI: - options.addInAppExclude("org.jboss"); - - // Include frames from our package - options.addInAppInclude("io.sentry.samples"); - - // Performance configuration options - // Set what percentage of traces should be collected - // options.setTracesSampleRate(1.0); // set 0.5 to send 50% of traces - - // Determine traces sample rate based on the sampling context - // options.setTracesSampler( - // context -> { - // // only 10% of transactions with "/product" prefix will be collected - // if (!context.getTransactionContext().getName().startsWith("/products")) - // { - // return 0.1; - // } else { - // return 0.5; - // } - // }); - - options.getLogs().setEnabled(true); - }); + Sentry.init(options -> { + // NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in + // your Sentry project/dashboard + options.setEnableExternalConfiguration(true); + options.setDsn("https://502f25099c204a2fbf4cb16edc5975d1@o447951.ingest.sentry.io/5428563"); + + // All events get assigned to the release. See more at + // https://docs.sentry.io/workflow/releases/ + options.setRelease("io.sentry.samples.console@3.0.0+1"); + + // Link Sentry events to OpenTelemetry spans + options.addEventProcessor(new OpenTelemetryOtlpEventProcessor()); + + // Modifications to event before it goes out. Could replace the event altogether + options.setBeforeSend((event, hint) -> { + // Drop an event altogether: + if (event.getTag("SomeTag") != null) { + return null; + } + return event; + }); + + options.setBeforeSendTransaction((transaction, hint) -> { + // Drop a transaction: + if (transaction.getTag("SomeTransactionTag") != null) { + return null; + } + + return transaction; + }); + + // Allows inspecting and modifying, returning a new or simply rejecting (returning null) + options.setBeforeBreadcrumb((breadcrumb, hint) -> { + // Don't add breadcrumbs with message containing: + if (breadcrumb.getMessage() != null && breadcrumb.getMessage().contains("bad breadcrumb")) { + return null; + } + return breadcrumb; + }); + + // Record data being discarded, including the reason, type of data, and the number of + // items dropped + options.setOnDiscard((reason, category, number) -> { + // Only record the number of lost spans due to overflow conditions + if ((reason.equals(DiscardReason.CACHE_OVERFLOW) + || reason.equals(DiscardReason.QUEUE_OVERFLOW)) + && category.equals(DataCategory.Span)) { + numberOfDiscardedSpansDueToOverflow += number; + } + }); + + // Configure the background worker which sends events to sentry: + // Wait up to 5 seconds before shutdown while there are events to send. + options.setShutdownTimeoutMillis(5000); + + // Enable SDK logging with Debug level + options.setDebug(true); + // To change the verbosity, use: + // By default it's DEBUG. + // options.setDiagnosticLevel(SentryLevel.ERROR); + // A good option to have SDK debug log in prod is to use only level ERROR here. + + // Exclude frames from some packages from being "inApp" so are hidden by default in Sentry + // UI: + options.addInAppExclude("org.jboss"); + + // Include frames from our package + options.addInAppInclude("io.sentry.samples"); + + // Performance configuration options + // Set what percentage of traces should be collected + // options.setTracesSampleRate(1.0); // set 0.5 to send 50% of traces + + // Determine traces sample rate based on the sampling context + // options.setTracesSampler( + // context -> { + // // only 10% of transactions with "/product" prefix will be collected + // if (!context.getTransactionContext().getName().startsWith("/products")) + // { + // return 0.1; + // } else { + // return 0.5; + // } + // }); + + options.getLogs().setEnabled(true); + }); Sentry.addBreadcrumb( "A 'bad breadcrumb' that will be rejected because of 'BeforeBreadcrumb callback above.'"); // Data added to the root scope (no PushScope called up to this point) // The modifications done here will affect all events sent and will propagate to child scopes. - Sentry.configureScope( - scope -> { - scope.addEventProcessor(new SomeEventProcessor()); + Sentry.configureScope(scope -> { + scope.addEventProcessor(new SomeEventProcessor()); - scope.setExtra("SomeExtraInfo", "Some value for extra info"); - }); + scope.setExtra("SomeExtraInfo", "Some value for extra info"); + }); // Configures a scope which is only valid within the callback - Sentry.withScope( - scope -> { - scope.setLevel(SentryLevel.FATAL); - scope.setTransaction("main"); - - // This message includes the data set to the scope in this block: - Sentry.captureMessage("Fatal message!"); - }); + Sentry.withScope(scope -> { + scope.setLevel(SentryLevel.FATAL); + scope.setTransaction("main"); + + // This message includes the data set to the scope in this block: + Sentry.captureMessage("Fatal message!"); + }); // Only data added to the scope on `configureScope` above is included. Sentry.captureMessage("Some warning!", SentryLevel.WARNING); diff --git a/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/Main.java b/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/Main.java index 2a45ef6902c..2d4e30a3a6d 100644 --- a/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/Main.java +++ b/sentry-samples/sentry-samples-console/src/main/java/io/sentry/samples/console/Main.java @@ -21,121 +21,112 @@ public static void main(String[] args) throws InterruptedException { final boolean kafkaEnabled = kafkaBootstrapServers != null && !kafkaBootstrapServers.trim().isEmpty(); - Sentry.init( - options -> { - // NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in - // your Sentry project/dashboard - options.setEnableExternalConfiguration(true); - options.setDsn( - "https://502f25099c204a2fbf4cb16edc5975d1@o447951.ingest.sentry.io/5428563"); - - // All events get assigned to the release. See more at - // https://docs.sentry.io/workflow/releases/ - options.setRelease("io.sentry.samples.console@3.0.0+1"); - - // Modifications to event before it goes out. Could replace the event altogether - options.setBeforeSend( - (event, hint) -> { - // Drop an event altogether: - if (event.getTag("SomeTag") != null) { - return null; - } - return event; - }); - - options.setBeforeSendTransaction( - (transaction, hint) -> { - // Drop a transaction: - if (transaction.getTag("SomeTransactionTag") != null) { - return null; - } - - return transaction; - }); - - // Allows inspecting and modifying, returning a new or simply rejecting (returning null) - options.setBeforeBreadcrumb( - (breadcrumb, hint) -> { - // Don't add breadcrumbs with message containing: - if (breadcrumb.getMessage() != null - && breadcrumb.getMessage().contains("bad breadcrumb")) { - return null; - } - return breadcrumb; - }); - - // Record data being discarded, including the reason, type of data, and the number of - // items dropped - options.setOnDiscard( - (reason, category, number) -> { - // Only record the number of lost spans due to overflow conditions - if ((reason.equals(DiscardReason.CACHE_OVERFLOW) - || reason.equals(DiscardReason.QUEUE_OVERFLOW)) - && category.equals(DataCategory.Span)) { - numberOfDiscardedSpansDueToOverflow += number; - } - }); - - // Configure the background worker which sends events to sentry: - // Wait up to 5 seconds before shutdown while there are events to send. - options.setShutdownTimeoutMillis(5000); - - // Enable SDK logging with Debug level - options.setDebug(true); - // To change the verbosity, use: - // By default it's DEBUG. - // options.setDiagnosticLevel(SentryLevel.ERROR); - // A good option to have SDK debug log in prod is to use only level ERROR here. - - // Exclude frames from some packages from being "inApp" so are hidden by default in Sentry - // UI: - options.addInAppExclude("org.jboss"); - - // Include frames from our package - options.addInAppInclude("io.sentry.samples"); - - // Performance configuration options - // Set what percentage of traces should be collected - options.setTracesSampleRate(1.0); // set 0.5 to send 50% of traces - - // Enable cache tracing to create spans for cache operations - options.setEnableCacheTracing(true); - options.setEnableQueueTracing(kafkaEnabled); - - // Determine traces sample rate based on the sampling context - // options.setTracesSampler( - // context -> { - // // only 10% of transactions with "/product" prefix will be collected - // if (!context.getTransactionContext().getName().startsWith("/products")) - // { - // return 0.1; - // } else { - // return 0.5; - // } - // }); - }); + Sentry.init(options -> { + // NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in + // your Sentry project/dashboard + options.setEnableExternalConfiguration(true); + options.setDsn("https://502f25099c204a2fbf4cb16edc5975d1@o447951.ingest.sentry.io/5428563"); + + // All events get assigned to the release. See more at + // https://docs.sentry.io/workflow/releases/ + options.setRelease("io.sentry.samples.console@3.0.0+1"); + + // Modifications to event before it goes out. Could replace the event altogether + options.setBeforeSend((event, hint) -> { + // Drop an event altogether: + if (event.getTag("SomeTag") != null) { + return null; + } + return event; + }); + + options.setBeforeSendTransaction((transaction, hint) -> { + // Drop a transaction: + if (transaction.getTag("SomeTransactionTag") != null) { + return null; + } + + return transaction; + }); + + // Allows inspecting and modifying, returning a new or simply rejecting (returning null) + options.setBeforeBreadcrumb((breadcrumb, hint) -> { + // Don't add breadcrumbs with message containing: + if (breadcrumb.getMessage() != null && breadcrumb.getMessage().contains("bad breadcrumb")) { + return null; + } + return breadcrumb; + }); + + // Record data being discarded, including the reason, type of data, and the number of + // items dropped + options.setOnDiscard((reason, category, number) -> { + // Only record the number of lost spans due to overflow conditions + if ((reason.equals(DiscardReason.CACHE_OVERFLOW) + || reason.equals(DiscardReason.QUEUE_OVERFLOW)) + && category.equals(DataCategory.Span)) { + numberOfDiscardedSpansDueToOverflow += number; + } + }); + + // Configure the background worker which sends events to sentry: + // Wait up to 5 seconds before shutdown while there are events to send. + options.setShutdownTimeoutMillis(5000); + + // Enable SDK logging with Debug level + options.setDebug(true); + // To change the verbosity, use: + // By default it's DEBUG. + // options.setDiagnosticLevel(SentryLevel.ERROR); + // A good option to have SDK debug log in prod is to use only level ERROR here. + + // Exclude frames from some packages from being "inApp" so are hidden by default in Sentry + // UI: + options.addInAppExclude("org.jboss"); + + // Include frames from our package + options.addInAppInclude("io.sentry.samples"); + + // Performance configuration options + // Set what percentage of traces should be collected + options.setTracesSampleRate(1.0); // set 0.5 to send 50% of traces + + // Enable cache tracing to create spans for cache operations + options.setEnableCacheTracing(true); + options.setEnableQueueTracing(kafkaEnabled); + + // Determine traces sample rate based on the sampling context + // options.setTracesSampler( + // context -> { + // // only 10% of transactions with "/product" prefix will be collected + // if (!context.getTransactionContext().getName().startsWith("/products")) + // { + // return 0.1; + // } else { + // return 0.5; + // } + // }); + }); Sentry.addBreadcrumb( "A 'bad breadcrumb' that will be rejected because of 'BeforeBreadcrumb callback above.'"); // Data added to the root scope (no PushScope called up to this point) // The modifications done here will affect all events sent and will propagate to child scopes. - Sentry.configureScope( - scope -> { - scope.addEventProcessor(new SomeEventProcessor()); + Sentry.configureScope(scope -> { + scope.addEventProcessor(new SomeEventProcessor()); - scope.setExtra("SomeExtraInfo", "Some value for extra info"); - }); + scope.setExtra("SomeExtraInfo", "Some value for extra info"); + }); // Configures a scope which is only valid within the callback - Sentry.withScope( - scope -> { - scope.setLevel(SentryLevel.FATAL); - scope.setTransaction("main"); - - // This message includes the data set to the scope in this block: - Sentry.captureMessage("Fatal message!"); - }); + Sentry.withScope(scope -> { + scope.setLevel(SentryLevel.FATAL); + scope.setTransaction("main"); + + // This message includes the data set to the scope in this block: + Sentry.captureMessage("Fatal message!"); + }); // Only data added to the scope on `configureScope` above is included. Sentry.captureMessage("Some warning!", SentryLevel.WARNING); diff --git a/sentry-samples/sentry-samples-log4j2/build.gradle.kts b/sentry-samples/sentry-samples-log4j2/build.gradle.kts index ea8373c939f..6959418abc9 100644 --- a/sentry-samples/sentry-samples-log4j2/build.gradle.kts +++ b/sentry-samples/sentry-samples-log4j2/build.gradle.kts @@ -25,7 +25,7 @@ tasks.shadowJar { mergeServiceFiles() // Use Log4j2 cache transformer to properly handle plugin files transform( - com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer() + com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer(), ) } diff --git a/sentry-samples/sentry-samples-netflix-dgs/build.gradle.kts b/sentry-samples/sentry-samples-netflix-dgs/build.gradle.kts index 968feb5a1b7..58fcd73d189 100644 --- a/sentry-samples/sentry-samples-netflix-dgs/build.gradle.kts +++ b/sentry-samples/sentry-samples-netflix-dgs/build.gradle.kts @@ -50,7 +50,7 @@ tasks.shadowJar { MergeSpringMetadataAction( runtimeClasspath.get(), MergeSpringMetadataAction.DEFAULT_SPRING_METADATA_FILES, - ) + ), ) } diff --git a/sentry-samples/sentry-samples-netflix-dgs/src/main/java/io/sentry/samples/netflix/dgs/ActorsDataloader.java b/sentry-samples/sentry-samples-netflix-dgs/src/main/java/io/sentry/samples/netflix/dgs/ActorsDataloader.java index 89c2514fb59..572e51a4749 100644 --- a/sentry-samples/sentry-samples-netflix-dgs/src/main/java/io/sentry/samples/netflix/dgs/ActorsDataloader.java +++ b/sentry-samples/sentry-samples-netflix-dgs/src/main/java/io/sentry/samples/netflix/dgs/ActorsDataloader.java @@ -15,16 +15,15 @@ public class ActorsDataloader implements MappedBatchLoader { @Override public CompletionStage> load(Set keys) { - return CompletableFuture.supplyAsync( - () -> { - final @NotNull Map map = new HashMap<>(); - for (Integer key : keys) { - if (key != null && key == -1) { - throw new RuntimeException("Causing an error while loading actor"); - } - map.put(key, new Actor(key, "Name" + key)); - } - return map; - }); + return CompletableFuture.supplyAsync(() -> { + final @NotNull Map map = new HashMap<>(); + for (Integer key : keys) { + if (key != null && key == -1) { + throw new RuntimeException("Causing an error while loading actor"); + } + map.put(key, new Actor(key, "Name" + key)); + } + return map; + }); } } diff --git a/sentry-samples/sentry-samples-netflix-dgs/src/main/java/io/sentry/samples/netflix/dgs/ShowsDatafetcher.java b/sentry-samples/sentry-samples-netflix-dgs/src/main/java/io/sentry/samples/netflix/dgs/ShowsDatafetcher.java index bfd33364d65..ac8eee4235f 100644 --- a/sentry-samples/sentry-samples-netflix-dgs/src/main/java/io/sentry/samples/netflix/dgs/ShowsDatafetcher.java +++ b/sentry-samples/sentry-samples-netflix-dgs/src/main/java/io/sentry/samples/netflix/dgs/ShowsDatafetcher.java @@ -51,15 +51,13 @@ public Publisher notifyNewShow(Integer releaseYear) { } final @NotNull AtomicInteger counter = new AtomicInteger(2); return Flux.interval(Duration.ofSeconds(1)) - .map( - t -> { - int i = counter.incrementAndGet(); - if (releaseYear == -3 && i % 2 == 0) { - throw new RuntimeException( - "Causing error for subscription while producing an element"); - } - return new Show(i, "A new show has arrived " + i, releaseYear, 1); - }); + .map(t -> { + int i = counter.incrementAndGet(); + if (releaseYear == -3 && i % 2 == 0) { + throw new RuntimeException("Causing error for subscription while producing an element"); + } + return new Show(i, "A new show has arrived " + i, releaseYear, 1); + }); } @DgsData(parentType = "Show", field = "actor") diff --git a/sentry-samples/sentry-samples-openfeign/src/main/java/io/sentry/samples/openfeign/Main.java b/sentry-samples/sentry-samples-openfeign/src/main/java/io/sentry/samples/openfeign/Main.java index 2ce13a5263e..00bbb55a11f 100644 --- a/sentry-samples/sentry-samples-openfeign/src/main/java/io/sentry/samples/openfeign/Main.java +++ b/sentry-samples/sentry-samples-openfeign/src/main/java/io/sentry/samples/openfeign/Main.java @@ -14,29 +14,26 @@ public class Main { public static void main(String[] args) { - Sentry.init( - options -> { - // NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in - // your Sentry project/dashboard - options.setDsn( - "https://502f25099c204a2fbf4cb16edc5975d1@o447951.ingest.sentry.io/5428563"); - - // Performance configuration options - // Set what percentage of traces should be collected - options.setTracesSampleRate(1.0); // set 0.5 to send 50% of traces - }); + Sentry.init(options -> { + // NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in + // your Sentry project/dashboard + options.setDsn("https://502f25099c204a2fbf4cb16edc5975d1@o447951.ingest.sentry.io/5428563"); + + // Performance configuration options + // Set what percentage of traces should be collected + options.setTracesSampleRate(1.0); // set 0.5 to send 50% of traces + }); TodoApi todoApi = Feign.builder() .addCapability( - new SentryCapability( - (span, request, response) -> { - // attach tag to request with urls ending with /todos - if (request.url().endsWith("/todos")) { - span.setTag("tag-name", "tag-value"); - } - return span; - })) + new SentryCapability((span, request, response) -> { + // attach tag to request with urls ending with /todos + if (request.url().endsWith("/todos")) { + span.setTag("tag-name", "tag-value"); + } + return span; + })) .encoder(new GsonEncoder()) .decoder(new GsonDecoder()) .target(TodoApi.class, "https://jsonplaceholder.typicode.com/"); diff --git a/sentry-samples/sentry-samples-servlet/src/main/java/io/sentry/samples/servlet/SentryInitializer.java b/sentry-samples/sentry-samples-servlet/src/main/java/io/sentry/samples/servlet/SentryInitializer.java index 9f73b796e69..71932d18be6 100644 --- a/sentry-samples/sentry-samples-servlet/src/main/java/io/sentry/samples/servlet/SentryInitializer.java +++ b/sentry-samples/sentry-samples-servlet/src/main/java/io/sentry/samples/servlet/SentryInitializer.java @@ -15,74 +15,67 @@ public final class SentryInitializer implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent sce) { - Sentry.init( - options -> { - // NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in - // your Sentry project/dashboard - options.setDsn( - "https://502f25099c204a2fbf4cb16edc5975d1@o447951.ingest.sentry.io/5428563"); + Sentry.init(options -> { + // NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in + // your Sentry project/dashboard + options.setDsn("https://502f25099c204a2fbf4cb16edc5975d1@o447951.ingest.sentry.io/5428563"); - // disables shutdown hook, as Sentry has to be closed on application undeploy. - options.setEnableShutdownHook(false); + // disables shutdown hook, as Sentry has to be closed on application undeploy. + options.setEnableShutdownHook(false); - // All events get assigned to the release. See more at - // https://docs.sentry.io/workflow/releases/ - options.setRelease("io.sentry.samples.servlet@3.0.0+1"); + // All events get assigned to the release. See more at + // https://docs.sentry.io/workflow/releases/ + options.setRelease("io.sentry.samples.servlet@3.0.0+1"); - // Modifications to event before it goes out. Could replace the event altogether - options.setBeforeSend( - (event, hint) -> { - // Drop an event altogether: - if (event.getTag("SomeTag") != null) { - return null; - } - return event; - }); + // Modifications to event before it goes out. Could replace the event altogether + options.setBeforeSend((event, hint) -> { + // Drop an event altogether: + if (event.getTag("SomeTag") != null) { + return null; + } + return event; + }); - // Modifications to transaction before it goes out. Could replace the transaction - // altogether - options.setBeforeSendTransaction( - (transaction, hint) -> { - // Drop a transaction altogether: - if (transaction.getTag("SomeTag") != null) { - return null; - } - return transaction; - }); + // Modifications to transaction before it goes out. Could replace the transaction + // altogether + options.setBeforeSendTransaction((transaction, hint) -> { + // Drop a transaction altogether: + if (transaction.getTag("SomeTag") != null) { + return null; + } + return transaction; + }); - // Allows inspecting and modifying, returning a new or simply rejecting (returning null) - options.setBeforeBreadcrumb( - (breadcrumb, hint) -> { - // Don't add breadcrumbs with message containing: - if (breadcrumb.getMessage() != null - && breadcrumb.getMessage().contains("bad breadcrumb")) { - return null; - } - return breadcrumb; - }); + // Allows inspecting and modifying, returning a new or simply rejecting (returning null) + options.setBeforeBreadcrumb((breadcrumb, hint) -> { + // Don't add breadcrumbs with message containing: + if (breadcrumb.getMessage() != null && breadcrumb.getMessage().contains("bad breadcrumb")) { + return null; + } + return breadcrumb; + }); - // Record data being discarded, including the reason, type of data, and the number of - // items dropped - options.setOnDiscard( - (reason, category, number) -> { - // Only record the number of lost spans due to overflow conditions - if ((reason.equals(DiscardReason.CACHE_OVERFLOW) - || reason.equals(DiscardReason.QUEUE_OVERFLOW)) - && category.equals(DataCategory.Span)) { - numberOfDiscardedSpansDueToOverflow += number; - } - }); + // Record data being discarded, including the reason, type of data, and the number of + // items dropped + options.setOnDiscard((reason, category, number) -> { + // Only record the number of lost spans due to overflow conditions + if ((reason.equals(DiscardReason.CACHE_OVERFLOW) + || reason.equals(DiscardReason.QUEUE_OVERFLOW)) + && category.equals(DataCategory.Span)) { + numberOfDiscardedSpansDueToOverflow += number; + } + }); - // Configure the background worker which sends events to sentry: - // Wait up to 5 seconds before shutdown while there are events to send. - options.setShutdownTimeoutMillis(5000); + // Configure the background worker which sends events to sentry: + // Wait up to 5 seconds before shutdown while there are events to send. + options.setShutdownTimeoutMillis(5000); - // Enable SDK logging with Debug level - options.setDebug(true); + // Enable SDK logging with Debug level + options.setDebug(true); - // Include frames from our package - options.addInAppInclude("io.sentry.samples"); - }); + // Include frames from our package + options.addInAppInclude("io.sentry.samples"); + }); } @Override diff --git a/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/SecurityConfiguration.java b/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/SecurityConfiguration.java index 0f593a1b7c1..05e0102627c 100644 --- a/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/SecurityConfiguration.java +++ b/sentry-samples/sentry-samples-spring-7/src/main/java/io/sentry/samples/spring7/SecurityConfiguration.java @@ -20,9 +20,9 @@ public class SecurityConfiguration { @SuppressWarnings({"lgtm[java/spring-disabled-csrf-protection]", "removal"}) @Bean public SecurityFilterChain filterChain(final @NotNull HttpSecurity http) throws Exception { - return http.csrf((csrf) -> csrf.disable()) - .authorizeHttpRequests((r) -> r.anyRequest().authenticated()) - .httpBasic((h) -> {}) + return http.csrf(csrf -> csrf.disable()) + .authorizeHttpRequests(r -> r.anyRequest().authenticated()) + .httpBasic(h -> {}) .build(); } diff --git a/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/SecurityConfiguration.java b/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/SecurityConfiguration.java index d12a40fb51d..4d67323c805 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/SecurityConfiguration.java +++ b/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/SecurityConfiguration.java @@ -18,9 +18,9 @@ public class SecurityConfiguration { @SuppressWarnings({"lgtm[java/spring-disabled-csrf-protection]", "removal"}) @Bean public SecurityFilterChain filterChain(final @NotNull HttpSecurity http) throws Exception { - return http.csrf((csrf) -> csrf.disable()) - .authorizeHttpRequests((r) -> r.anyRequest().authenticated()) - .httpBasic((h) -> {}) + return http.csrf(csrf -> csrf.disable()) + .authorizeHttpRequests(r -> r.anyRequest().authenticated()) + .httpBasic(h -> {}) .build(); } diff --git a/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/TodoController.java b/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/TodoController.java index e5f395ec2b5..387c7519438 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/TodoController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/TodoController.java @@ -36,14 +36,13 @@ Todo todoWebClient(@PathVariable Long id) { return SentryReactorUtils.withSentry( Mono.just(true) .publishOn(Schedulers.boundedElastic()) - .flatMap( - x -> - webClient - .get() - .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) - .retrieve() - .bodyToMono(Todo.class) - .map(response -> response))) + .flatMap(x -> + webClient + .get() + .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) + .retrieve() + .bodyToMono(Todo.class) + .map(response -> response))) .block(); } diff --git a/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/graphql/AssigneeController.java b/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/graphql/AssigneeController.java index d43cde143d1..7e51d9e637d 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/graphql/AssigneeController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/graphql/AssigneeController.java @@ -14,21 +14,18 @@ public class AssigneeController { @BatchMapping(typeName = "Task", field = "assignee") public Mono> assignee( final @NotNull Set tasks) { - return Mono.fromCallable( - () -> { - final @NotNull Map map = - new HashMap<>(); - for (final @NotNull ProjectController.Task task : tasks) { - if ("Acrash".equalsIgnoreCase(task.assigneeId)) { - throw new RuntimeException("Causing an error while loading assignee"); - } - if (task.assigneeId != null) { - map.put( - task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); - } - } + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (final @NotNull ProjectController.Task task : tasks) { + if ("Acrash".equalsIgnoreCase(task.assigneeId)) { + throw new RuntimeException("Causing an error while loading assignee"); + } + if (task.assigneeId != null) { + map.put(task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); + } + } - return map; - }); + return map; + }); } } diff --git a/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/graphql/ProjectController.java b/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/graphql/ProjectController.java index 2e1725ea644..1bff0a5e4f8 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/graphql/ProjectController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/graphql/ProjectController.java @@ -76,14 +76,13 @@ public Flux notifyNewTask(@Argument String projectSlug) { final String creatorId = "creatorcrash".equalsIgnoreCase(projectSlug) ? "Ccrash" : "C1"; final @NotNull AtomicInteger counter = new AtomicInteger(1000); return Flux.interval(Duration.ofSeconds(1)) - .map( - num -> { - int i = counter.incrementAndGet(); - if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { - throw new RuntimeException("causing produce error for subscription"); - } - return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); - }); + .map(num -> { + int i = counter.incrementAndGet(); + if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { + throw new RuntimeException("causing produce error for subscription"); + } + return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); + }); } public static class Task { diff --git a/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/graphql/TaskCreatorController.java b/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/graphql/TaskCreatorController.java index 9ee0ef2c7a4..2fe87f66fe7 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/graphql/TaskCreatorController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-log4j2/src/main/java/io/sentry/samples/spring/boot4/graphql/TaskCreatorController.java @@ -20,22 +20,20 @@ public TaskCreatorController(final BatchLoaderRegistry batchLoaderRegistry) { // using mapped BatchLoader to not have to deal with correct ordering of items batchLoaderRegistry .forTypePair(String.class, ProjectController.Creator.class) - .withOptions((builder) -> builder.setBatchingEnabled(true)) - .registerMappedBatchLoader( - (Set keys, BatchLoaderEnvironment env) -> { - return Mono.fromCallable( - () -> { - final @NotNull Map map = new HashMap<>(); - for (String key : keys) { - if ("Ccrash".equalsIgnoreCase(key)) { - throw new RuntimeException("Causing an error while loading creator"); - } - map.put(key, new ProjectController.Creator(key, "Name" + key)); - } + .withOptions(builder -> builder.setBatchingEnabled(true)) + .registerMappedBatchLoader((Set keys, BatchLoaderEnvironment env) -> { + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (String key : keys) { + if ("Ccrash".equalsIgnoreCase(key)) { + throw new RuntimeException("Causing an error while loading creator"); + } + map.put(key, new ProjectController.Creator(key, "Name" + key)); + } - return map; - }); - }); + return map; + }); + }); } @SchemaMapping(typeName = "Task") diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/SecurityConfiguration.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/SecurityConfiguration.java index d12a40fb51d..4d67323c805 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/SecurityConfiguration.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/SecurityConfiguration.java @@ -18,9 +18,9 @@ public class SecurityConfiguration { @SuppressWarnings({"lgtm[java/spring-disabled-csrf-protection]", "removal"}) @Bean public SecurityFilterChain filterChain(final @NotNull HttpSecurity http) throws Exception { - return http.csrf((csrf) -> csrf.disable()) - .authorizeHttpRequests((r) -> r.anyRequest().authenticated()) - .httpBasic((h) -> {}) + return http.csrf(csrf -> csrf.disable()) + .authorizeHttpRequests(r -> r.anyRequest().authenticated()) + .httpBasic(h -> {}) .build(); } diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/TodoController.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/TodoController.java index c5093bc9cf5..fe3436122af 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/TodoController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/TodoController.java @@ -55,14 +55,13 @@ Todo todoWebClient(@PathVariable Long id) { return SentryReactorUtils.withSentry( Mono.just(true) .publishOn(Schedulers.boundedElastic()) - .flatMap( - x -> - webClient - .get() - .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) - .retrieve() - .bodyToMono(Todo.class) - .map(response -> response))) + .flatMap(x -> + webClient + .get() + .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) + .retrieve() + .bodyToMono(Todo.class) + .map(response -> response))) .block(); } diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/graphql/AssigneeController.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/graphql/AssigneeController.java index d43cde143d1..7e51d9e637d 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/graphql/AssigneeController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/graphql/AssigneeController.java @@ -14,21 +14,18 @@ public class AssigneeController { @BatchMapping(typeName = "Task", field = "assignee") public Mono> assignee( final @NotNull Set tasks) { - return Mono.fromCallable( - () -> { - final @NotNull Map map = - new HashMap<>(); - for (final @NotNull ProjectController.Task task : tasks) { - if ("Acrash".equalsIgnoreCase(task.assigneeId)) { - throw new RuntimeException("Causing an error while loading assignee"); - } - if (task.assigneeId != null) { - map.put( - task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); - } - } + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (final @NotNull ProjectController.Task task : tasks) { + if ("Acrash".equalsIgnoreCase(task.assigneeId)) { + throw new RuntimeException("Causing an error while loading assignee"); + } + if (task.assigneeId != null) { + map.put(task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); + } + } - return map; - }); + return map; + }); } } diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/graphql/ProjectController.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/graphql/ProjectController.java index 2e1725ea644..1bff0a5e4f8 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/graphql/ProjectController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/graphql/ProjectController.java @@ -76,14 +76,13 @@ public Flux notifyNewTask(@Argument String projectSlug) { final String creatorId = "creatorcrash".equalsIgnoreCase(projectSlug) ? "Ccrash" : "C1"; final @NotNull AtomicInteger counter = new AtomicInteger(1000); return Flux.interval(Duration.ofSeconds(1)) - .map( - num -> { - int i = counter.incrementAndGet(); - if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { - throw new RuntimeException("causing produce error for subscription"); - } - return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); - }); + .map(num -> { + int i = counter.incrementAndGet(); + if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { + throw new RuntimeException("causing produce error for subscription"); + } + return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); + }); } public static class Task { diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/graphql/TaskCreatorController.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/graphql/TaskCreatorController.java index f8824abd07f..876076d5cd2 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/graphql/TaskCreatorController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/graphql/TaskCreatorController.java @@ -20,21 +20,19 @@ public TaskCreatorController(final BatchLoaderRegistry batchLoaderRegistry) { // using mapped BatchLoader to not have to deal with correct ordering of items batchLoaderRegistry .forTypePair(String.class, ProjectController.Creator.class) - .registerMappedBatchLoader( - (Set keys, BatchLoaderEnvironment env) -> { - return Mono.fromCallable( - () -> { - final @NotNull Map map = new HashMap<>(); - for (String key : keys) { - if ("Ccrash".equalsIgnoreCase(key)) { - throw new RuntimeException("Causing an error while loading creator"); - } - map.put(key, new ProjectController.Creator(key, "Name" + key)); - } + .registerMappedBatchLoader((Set keys, BatchLoaderEnvironment env) -> { + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (String key : keys) { + if ("Ccrash".equalsIgnoreCase(key)) { + throw new RuntimeException("Causing an error while loading creator"); + } + map.put(key, new ProjectController.Creator(key, "Name" + key)); + } - return map; - }); - }); + return map; + }); + }); } @SchemaMapping(typeName = "Task") diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/SecurityConfiguration.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/SecurityConfiguration.java index d12a40fb51d..4d67323c805 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/SecurityConfiguration.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/SecurityConfiguration.java @@ -18,9 +18,9 @@ public class SecurityConfiguration { @SuppressWarnings({"lgtm[java/spring-disabled-csrf-protection]", "removal"}) @Bean public SecurityFilterChain filterChain(final @NotNull HttpSecurity http) throws Exception { - return http.csrf((csrf) -> csrf.disable()) - .authorizeHttpRequests((r) -> r.anyRequest().authenticated()) - .httpBasic((h) -> {}) + return http.csrf(csrf -> csrf.disable()) + .authorizeHttpRequests(r -> r.anyRequest().authenticated()) + .httpBasic(h -> {}) .build(); } diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/TodoController.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/TodoController.java index c5093bc9cf5..fe3436122af 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/TodoController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/TodoController.java @@ -55,14 +55,13 @@ Todo todoWebClient(@PathVariable Long id) { return SentryReactorUtils.withSentry( Mono.just(true) .publishOn(Schedulers.boundedElastic()) - .flatMap( - x -> - webClient - .get() - .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) - .retrieve() - .bodyToMono(Todo.class) - .map(response -> response))) + .flatMap(x -> + webClient + .get() + .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) + .retrieve() + .bodyToMono(Todo.class) + .map(response -> response))) .block(); } diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/graphql/AssigneeController.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/graphql/AssigneeController.java index d43cde143d1..7e51d9e637d 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/graphql/AssigneeController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/graphql/AssigneeController.java @@ -14,21 +14,18 @@ public class AssigneeController { @BatchMapping(typeName = "Task", field = "assignee") public Mono> assignee( final @NotNull Set tasks) { - return Mono.fromCallable( - () -> { - final @NotNull Map map = - new HashMap<>(); - for (final @NotNull ProjectController.Task task : tasks) { - if ("Acrash".equalsIgnoreCase(task.assigneeId)) { - throw new RuntimeException("Causing an error while loading assignee"); - } - if (task.assigneeId != null) { - map.put( - task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); - } - } + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (final @NotNull ProjectController.Task task : tasks) { + if ("Acrash".equalsIgnoreCase(task.assigneeId)) { + throw new RuntimeException("Causing an error while loading assignee"); + } + if (task.assigneeId != null) { + map.put(task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); + } + } - return map; - }); + return map; + }); } } diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/graphql/ProjectController.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/graphql/ProjectController.java index 2e1725ea644..1bff0a5e4f8 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/graphql/ProjectController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/graphql/ProjectController.java @@ -76,14 +76,13 @@ public Flux notifyNewTask(@Argument String projectSlug) { final String creatorId = "creatorcrash".equalsIgnoreCase(projectSlug) ? "Ccrash" : "C1"; final @NotNull AtomicInteger counter = new AtomicInteger(1000); return Flux.interval(Duration.ofSeconds(1)) - .map( - num -> { - int i = counter.incrementAndGet(); - if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { - throw new RuntimeException("causing produce error for subscription"); - } - return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); - }); + .map(num -> { + int i = counter.incrementAndGet(); + if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { + throw new RuntimeException("causing produce error for subscription"); + } + return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); + }); } public static class Task { diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/graphql/TaskCreatorController.java b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/graphql/TaskCreatorController.java index f8824abd07f..876076d5cd2 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/graphql/TaskCreatorController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/graphql/TaskCreatorController.java @@ -20,21 +20,19 @@ public TaskCreatorController(final BatchLoaderRegistry batchLoaderRegistry) { // using mapped BatchLoader to not have to deal with correct ordering of items batchLoaderRegistry .forTypePair(String.class, ProjectController.Creator.class) - .registerMappedBatchLoader( - (Set keys, BatchLoaderEnvironment env) -> { - return Mono.fromCallable( - () -> { - final @NotNull Map map = new HashMap<>(); - for (String key : keys) { - if ("Ccrash".equalsIgnoreCase(key)) { - throw new RuntimeException("Causing an error while loading creator"); - } - map.put(key, new ProjectController.Creator(key, "Name" + key)); - } + .registerMappedBatchLoader((Set keys, BatchLoaderEnvironment env) -> { + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (String key : keys) { + if ("Ccrash".equalsIgnoreCase(key)) { + throw new RuntimeException("Causing an error while loading creator"); + } + map.put(key, new ProjectController.Creator(key, "Name" + key)); + } - return map; - }); - }); + return map; + }); + }); } @SchemaMapping(typeName = "Task") diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SecurityConfiguration.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SecurityConfiguration.java index 69d578f2d89..97db4357d4b 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SecurityConfiguration.java +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/SecurityConfiguration.java @@ -18,9 +18,9 @@ public class SecurityConfiguration { @SuppressWarnings({"lgtm[java/spring-disabled-csrf-protection]", "removal"}) @Bean public SecurityFilterChain filterChain(final @NotNull HttpSecurity http) throws Exception { - return http.csrf((csrf) -> csrf.disable()) - .authorizeHttpRequests((r) -> r.anyRequest().authenticated()) - .httpBasic((h) -> {}) + return http.csrf(csrf -> csrf.disable()) + .authorizeHttpRequests(r -> r.anyRequest().authenticated()) + .httpBasic(h -> {}) .build(); } diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/TodoController.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/TodoController.java index 9a4dd98c90b..60e617787d9 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/TodoController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/TodoController.java @@ -36,14 +36,13 @@ Todo todoWebClient(@PathVariable Long id) { return SentryReactorUtils.withSentry( Mono.just(true) .publishOn(Schedulers.boundedElastic()) - .flatMap( - x -> - webClient - .get() - .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) - .retrieve() - .bodyToMono(Todo.class) - .map(response -> response))) + .flatMap(x -> + webClient + .get() + .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) + .retrieve() + .bodyToMono(Todo.class) + .map(response -> response))) .block(); } diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/AssigneeController.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/AssigneeController.java index ef4afb1a6f6..50feea99cc2 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/AssigneeController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/AssigneeController.java @@ -14,21 +14,18 @@ public class AssigneeController { @BatchMapping(typeName = "Task", field = "assignee") public Mono> assignee( final @NotNull Set tasks) { - return Mono.fromCallable( - () -> { - final @NotNull Map map = - new HashMap<>(); - for (final @NotNull ProjectController.Task task : tasks) { - if ("Acrash".equalsIgnoreCase(task.assigneeId)) { - throw new RuntimeException("Causing an error while loading assignee"); - } - if (task.assigneeId != null) { - map.put( - task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); - } - } + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (final @NotNull ProjectController.Task task : tasks) { + if ("Acrash".equalsIgnoreCase(task.assigneeId)) { + throw new RuntimeException("Causing an error while loading assignee"); + } + if (task.assigneeId != null) { + map.put(task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); + } + } - return map; - }); + return map; + }); } } diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/ProjectController.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/ProjectController.java index 7ec97bc12f2..9079965046a 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/ProjectController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/ProjectController.java @@ -76,14 +76,13 @@ public Flux notifyNewTask(@Argument String projectSlug) { final String creatorId = "creatorcrash".equalsIgnoreCase(projectSlug) ? "Ccrash" : "C1"; final @NotNull AtomicInteger counter = new AtomicInteger(1000); return Flux.interval(Duration.ofSeconds(1)) - .map( - num -> { - int i = counter.incrementAndGet(); - if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { - throw new RuntimeException("causing produce error for subscription"); - } - return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); - }); + .map(num -> { + int i = counter.incrementAndGet(); + if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { + throw new RuntimeException("causing produce error for subscription"); + } + return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); + }); } public static class Task { diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/TaskCreatorController.java b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/TaskCreatorController.java index 94314cbfcac..c70d30d34bd 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/TaskCreatorController.java +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/java/io/sentry/samples/spring/boot4/otlp/graphql/TaskCreatorController.java @@ -20,22 +20,20 @@ public TaskCreatorController(final BatchLoaderRegistry batchLoaderRegistry) { // using mapped BatchLoader to not have to deal with correct ordering of items batchLoaderRegistry .forTypePair(String.class, ProjectController.Creator.class) - .withOptions((builder) -> builder.setBatchingEnabled(true)) - .registerMappedBatchLoader( - (Set keys, BatchLoaderEnvironment env) -> { - return Mono.fromCallable( - () -> { - final @NotNull Map map = new HashMap<>(); - for (String key : keys) { - if ("Ccrash".equalsIgnoreCase(key)) { - throw new RuntimeException("Causing an error while loading creator"); - } - map.put(key, new ProjectController.Creator(key, "Name" + key)); - } + .withOptions(builder -> builder.setBatchingEnabled(true)) + .registerMappedBatchLoader((Set keys, BatchLoaderEnvironment env) -> { + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (String key : keys) { + if ("Ccrash".equalsIgnoreCase(key)) { + throw new RuntimeException("Causing an error while loading creator"); + } + map.put(key, new ProjectController.Creator(key, "Name" + key)); + } - return map; - }); - }); + return map; + }); + }); } @SchemaMapping(typeName = "Task") diff --git a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/PersonService.java b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/PersonService.java index a45b9fa85c3..04117cd5b10 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/PersonService.java +++ b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/PersonService.java @@ -12,10 +12,9 @@ public class PersonService { Mono create(Person person) { return Mono.delay(Duration.ofMillis(100)) .publishOn(Schedulers.boundedElastic()) - .doOnNext( - __ -> { - Sentry.captureMessage("Creating person"); - }) + .doOnNext(__ -> { + Sentry.captureMessage("Creating person"); + }) .map(__ -> person); } } diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/SecurityConfiguration.java b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/SecurityConfiguration.java index d12a40fb51d..4d67323c805 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/SecurityConfiguration.java +++ b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/SecurityConfiguration.java @@ -18,9 +18,9 @@ public class SecurityConfiguration { @SuppressWarnings({"lgtm[java/spring-disabled-csrf-protection]", "removal"}) @Bean public SecurityFilterChain filterChain(final @NotNull HttpSecurity http) throws Exception { - return http.csrf((csrf) -> csrf.disable()) - .authorizeHttpRequests((r) -> r.anyRequest().authenticated()) - .httpBasic((h) -> {}) + return http.csrf(csrf -> csrf.disable()) + .authorizeHttpRequests(r -> r.anyRequest().authenticated()) + .httpBasic(h -> {}) .build(); } diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/TodoController.java b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/TodoController.java index 0bbe0643495..5c458eb8f53 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/TodoController.java +++ b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/TodoController.java @@ -52,14 +52,13 @@ Todo todoWebClient(@PathVariable Long id) { return SentryReactorUtils.withSentry( Mono.just(true) .publishOn(Schedulers.boundedElastic()) - .flatMap( - x -> - webClient - .get() - .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) - .retrieve() - .bodyToMono(Todo.class) - .map(response -> response))) + .flatMap(x -> + webClient + .get() + .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) + .retrieve() + .bodyToMono(Todo.class) + .map(response -> response))) .block(); } diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/graphql/AssigneeController.java b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/graphql/AssigneeController.java index d43cde143d1..7e51d9e637d 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/graphql/AssigneeController.java +++ b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/graphql/AssigneeController.java @@ -14,21 +14,18 @@ public class AssigneeController { @BatchMapping(typeName = "Task", field = "assignee") public Mono> assignee( final @NotNull Set tasks) { - return Mono.fromCallable( - () -> { - final @NotNull Map map = - new HashMap<>(); - for (final @NotNull ProjectController.Task task : tasks) { - if ("Acrash".equalsIgnoreCase(task.assigneeId)) { - throw new RuntimeException("Causing an error while loading assignee"); - } - if (task.assigneeId != null) { - map.put( - task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); - } - } + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (final @NotNull ProjectController.Task task : tasks) { + if ("Acrash".equalsIgnoreCase(task.assigneeId)) { + throw new RuntimeException("Causing an error while loading assignee"); + } + if (task.assigneeId != null) { + map.put(task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); + } + } - return map; - }); + return map; + }); } } diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/graphql/ProjectController.java b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/graphql/ProjectController.java index 2e1725ea644..1bff0a5e4f8 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/graphql/ProjectController.java +++ b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/graphql/ProjectController.java @@ -76,14 +76,13 @@ public Flux notifyNewTask(@Argument String projectSlug) { final String creatorId = "creatorcrash".equalsIgnoreCase(projectSlug) ? "Ccrash" : "C1"; final @NotNull AtomicInteger counter = new AtomicInteger(1000); return Flux.interval(Duration.ofSeconds(1)) - .map( - num -> { - int i = counter.incrementAndGet(); - if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { - throw new RuntimeException("causing produce error for subscription"); - } - return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); - }); + .map(num -> { + int i = counter.incrementAndGet(); + if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { + throw new RuntimeException("causing produce error for subscription"); + } + return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); + }); } public static class Task { diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/graphql/TaskCreatorController.java b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/graphql/TaskCreatorController.java index 9ee0ef2c7a4..2fe87f66fe7 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/graphql/TaskCreatorController.java +++ b/sentry-samples/sentry-samples-spring-boot-4/src/main/java/io/sentry/samples/spring/boot4/graphql/TaskCreatorController.java @@ -20,22 +20,20 @@ public TaskCreatorController(final BatchLoaderRegistry batchLoaderRegistry) { // using mapped BatchLoader to not have to deal with correct ordering of items batchLoaderRegistry .forTypePair(String.class, ProjectController.Creator.class) - .withOptions((builder) -> builder.setBatchingEnabled(true)) - .registerMappedBatchLoader( - (Set keys, BatchLoaderEnvironment env) -> { - return Mono.fromCallable( - () -> { - final @NotNull Map map = new HashMap<>(); - for (String key : keys) { - if ("Ccrash".equalsIgnoreCase(key)) { - throw new RuntimeException("Causing an error while loading creator"); - } - map.put(key, new ProjectController.Creator(key, "Name" + key)); - } + .withOptions(builder -> builder.setBatchingEnabled(true)) + .registerMappedBatchLoader((Set keys, BatchLoaderEnvironment env) -> { + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (String key : keys) { + if ("Ccrash".equalsIgnoreCase(key)) { + throw new RuntimeException("Causing an error while loading creator"); + } + map.put(key, new ProjectController.Creator(key, "Name" + key)); + } - return map; - }); - }); + return map; + }); + }); } @SchemaMapping(typeName = "Task") diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-log4j2/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-log4j2/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoController.java index 987d516936b..74d03f8c4ce 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-log4j2/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-log4j2/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoController.java @@ -35,14 +35,13 @@ Todo todoWebClient(@PathVariable Long id) { return SentryReactorUtils.withSentry( Mono.just(true) .publishOn(Schedulers.boundedElastic()) - .flatMap( - x -> - webClient - .get() - .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) - .retrieve() - .bodyToMono(Todo.class) - .map(response -> response))) + .flatMap(x -> + webClient + .get() + .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) + .retrieve() + .bodyToMono(Todo.class) + .map(response -> response))) .block(); } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-log4j2/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/AssigneeController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-log4j2/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/AssigneeController.java index 6fdf96506c8..3d46d0f096a 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-log4j2/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/AssigneeController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-log4j2/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/AssigneeController.java @@ -14,21 +14,18 @@ public class AssigneeController { @BatchMapping(typeName = "Task", field = "assignee") public Mono> assignee( final @NotNull Set tasks) { - return Mono.fromCallable( - () -> { - final @NotNull Map map = - new HashMap<>(); - for (final @NotNull ProjectController.Task task : tasks) { - if ("Acrash".equalsIgnoreCase(task.assigneeId)) { - throw new RuntimeException("Causing an error while loading assignee"); - } - if (task.assigneeId != null) { - map.put( - task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); - } - } + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (final @NotNull ProjectController.Task task : tasks) { + if ("Acrash".equalsIgnoreCase(task.assigneeId)) { + throw new RuntimeException("Causing an error while loading assignee"); + } + if (task.assigneeId != null) { + map.put(task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); + } + } - return map; - }); + return map; + }); } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-log4j2/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/ProjectController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-log4j2/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/ProjectController.java index 63790bca628..5a8c38efb43 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-log4j2/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/ProjectController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-log4j2/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/ProjectController.java @@ -76,14 +76,13 @@ public Flux notifyNewTask(@Argument String projectSlug) { final String creatorId = "creatorcrash".equalsIgnoreCase(projectSlug) ? "Ccrash" : "C1"; final @NotNull AtomicInteger counter = new AtomicInteger(1000); return Flux.interval(Duration.ofSeconds(1)) - .map( - num -> { - int i = counter.incrementAndGet(); - if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { - throw new RuntimeException("causing produce error for subscription"); - } - return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); - }); + .map(num -> { + int i = counter.incrementAndGet(); + if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { + throw new RuntimeException("causing produce error for subscription"); + } + return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); + }); } public static class Task { diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-log4j2/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/TaskCreatorController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-log4j2/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/TaskCreatorController.java index 434a4822084..3968b2ed26c 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-log4j2/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/TaskCreatorController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-log4j2/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/TaskCreatorController.java @@ -20,22 +20,20 @@ public TaskCreatorController(final BatchLoaderRegistry batchLoaderRegistry) { // using mapped BatchLoader to not have to deal with correct ordering of items batchLoaderRegistry .forTypePair(String.class, ProjectController.Creator.class) - .withOptions((builder) -> builder.setBatchingEnabled(true)) - .registerMappedBatchLoader( - (Set keys, BatchLoaderEnvironment env) -> { - return Mono.fromCallable( - () -> { - final @NotNull Map map = new HashMap<>(); - for (String key : keys) { - if ("Ccrash".equalsIgnoreCase(key)) { - throw new RuntimeException("Causing an error while loading creator"); - } - map.put(key, new ProjectController.Creator(key, "Name" + key)); - } + .withOptions(builder -> builder.setBatchingEnabled(true)) + .registerMappedBatchLoader((Set keys, BatchLoaderEnvironment env) -> { + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (String key : keys) { + if ("Ccrash".equalsIgnoreCase(key)) { + throw new RuntimeException("Causing an error while loading creator"); + } + map.put(key, new ProjectController.Creator(key, "Name" + key)); + } - return map; - }); - }); + return map; + }); + }); } @SchemaMapping(typeName = "Task") diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoController.java index 0fa450a879c..4aa57377b28 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoController.java @@ -54,14 +54,13 @@ Todo todoWebClient(@PathVariable Long id) { return SentryReactorUtils.withSentry( Mono.just(true) .publishOn(Schedulers.boundedElastic()) - .flatMap( - x -> - webClient - .get() - .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) - .retrieve() - .bodyToMono(Todo.class) - .map(response -> response))) + .flatMap(x -> + webClient + .get() + .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) + .retrieve() + .bodyToMono(Todo.class) + .map(response -> response))) .block(); } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/AssigneeController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/AssigneeController.java index 6fdf96506c8..3d46d0f096a 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/AssigneeController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/AssigneeController.java @@ -14,21 +14,18 @@ public class AssigneeController { @BatchMapping(typeName = "Task", field = "assignee") public Mono> assignee( final @NotNull Set tasks) { - return Mono.fromCallable( - () -> { - final @NotNull Map map = - new HashMap<>(); - for (final @NotNull ProjectController.Task task : tasks) { - if ("Acrash".equalsIgnoreCase(task.assigneeId)) { - throw new RuntimeException("Causing an error while loading assignee"); - } - if (task.assigneeId != null) { - map.put( - task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); - } - } + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (final @NotNull ProjectController.Task task : tasks) { + if ("Acrash".equalsIgnoreCase(task.assigneeId)) { + throw new RuntimeException("Causing an error while loading assignee"); + } + if (task.assigneeId != null) { + map.put(task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); + } + } - return map; - }); + return map; + }); } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/ProjectController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/ProjectController.java index 63790bca628..5a8c38efb43 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/ProjectController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/ProjectController.java @@ -76,14 +76,13 @@ public Flux notifyNewTask(@Argument String projectSlug) { final String creatorId = "creatorcrash".equalsIgnoreCase(projectSlug) ? "Ccrash" : "C1"; final @NotNull AtomicInteger counter = new AtomicInteger(1000); return Flux.interval(Duration.ofSeconds(1)) - .map( - num -> { - int i = counter.incrementAndGet(); - if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { - throw new RuntimeException("causing produce error for subscription"); - } - return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); - }); + .map(num -> { + int i = counter.incrementAndGet(); + if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { + throw new RuntimeException("causing produce error for subscription"); + } + return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); + }); } public static class Task { diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/TaskCreatorController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/TaskCreatorController.java index cb6677c0c37..dd930f5566b 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/TaskCreatorController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/TaskCreatorController.java @@ -20,21 +20,19 @@ public TaskCreatorController(final BatchLoaderRegistry batchLoaderRegistry) { // using mapped BatchLoader to not have to deal with correct ordering of items batchLoaderRegistry .forTypePair(String.class, ProjectController.Creator.class) - .registerMappedBatchLoader( - (Set keys, BatchLoaderEnvironment env) -> { - return Mono.fromCallable( - () -> { - final @NotNull Map map = new HashMap<>(); - for (String key : keys) { - if ("Ccrash".equalsIgnoreCase(key)) { - throw new RuntimeException("Causing an error while loading creator"); - } - map.put(key, new ProjectController.Creator(key, "Name" + key)); - } + .registerMappedBatchLoader((Set keys, BatchLoaderEnvironment env) -> { + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (String key : keys) { + if ("Ccrash".equalsIgnoreCase(key)) { + throw new RuntimeException("Causing an error while loading creator"); + } + map.put(key, new ProjectController.Creator(key, "Name" + key)); + } - return map; - }); - }); + return map; + }); + }); } @SchemaMapping(typeName = "Task") diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoController.java index 0fa450a879c..4aa57377b28 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoController.java @@ -54,14 +54,13 @@ Todo todoWebClient(@PathVariable Long id) { return SentryReactorUtils.withSentry( Mono.just(true) .publishOn(Schedulers.boundedElastic()) - .flatMap( - x -> - webClient - .get() - .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) - .retrieve() - .bodyToMono(Todo.class) - .map(response -> response))) + .flatMap(x -> + webClient + .get() + .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) + .retrieve() + .bodyToMono(Todo.class) + .map(response -> response))) .block(); } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/AssigneeController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/AssigneeController.java index 6fdf96506c8..3d46d0f096a 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/AssigneeController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/AssigneeController.java @@ -14,21 +14,18 @@ public class AssigneeController { @BatchMapping(typeName = "Task", field = "assignee") public Mono> assignee( final @NotNull Set tasks) { - return Mono.fromCallable( - () -> { - final @NotNull Map map = - new HashMap<>(); - for (final @NotNull ProjectController.Task task : tasks) { - if ("Acrash".equalsIgnoreCase(task.assigneeId)) { - throw new RuntimeException("Causing an error while loading assignee"); - } - if (task.assigneeId != null) { - map.put( - task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); - } - } + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (final @NotNull ProjectController.Task task : tasks) { + if ("Acrash".equalsIgnoreCase(task.assigneeId)) { + throw new RuntimeException("Causing an error while loading assignee"); + } + if (task.assigneeId != null) { + map.put(task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); + } + } - return map; - }); + return map; + }); } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/ProjectController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/ProjectController.java index 63790bca628..5a8c38efb43 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/ProjectController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/ProjectController.java @@ -76,14 +76,13 @@ public Flux notifyNewTask(@Argument String projectSlug) { final String creatorId = "creatorcrash".equalsIgnoreCase(projectSlug) ? "Ccrash" : "C1"; final @NotNull AtomicInteger counter = new AtomicInteger(1000); return Flux.interval(Duration.ofSeconds(1)) - .map( - num -> { - int i = counter.incrementAndGet(); - if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { - throw new RuntimeException("causing produce error for subscription"); - } - return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); - }); + .map(num -> { + int i = counter.incrementAndGet(); + if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { + throw new RuntimeException("causing produce error for subscription"); + } + return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); + }); } public static class Task { diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/TaskCreatorController.java b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/TaskCreatorController.java index cb6677c0c37..dd930f5566b 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/TaskCreatorController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/TaskCreatorController.java @@ -20,21 +20,19 @@ public TaskCreatorController(final BatchLoaderRegistry batchLoaderRegistry) { // using mapped BatchLoader to not have to deal with correct ordering of items batchLoaderRegistry .forTypePair(String.class, ProjectController.Creator.class) - .registerMappedBatchLoader( - (Set keys, BatchLoaderEnvironment env) -> { - return Mono.fromCallable( - () -> { - final @NotNull Map map = new HashMap<>(); - for (String key : keys) { - if ("Ccrash".equalsIgnoreCase(key)) { - throw new RuntimeException("Causing an error while loading creator"); - } - map.put(key, new ProjectController.Creator(key, "Name" + key)); - } + .registerMappedBatchLoader((Set keys, BatchLoaderEnvironment env) -> { + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (String key : keys) { + if ("Ccrash".equalsIgnoreCase(key)) { + throw new RuntimeException("Causing an error while loading creator"); + } + map.put(key, new ProjectController.Creator(key, "Name" + key)); + } - return map; - }); - }); + return map; + }); + }); } @SchemaMapping(typeName = "Task") diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoController.java b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoController.java index db0e42e4ab1..f279cadfbe4 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/TodoController.java @@ -51,14 +51,13 @@ Todo todoWebClient(@PathVariable Long id) { return SentryReactorUtils.withSentry( Mono.just(true) .publishOn(Schedulers.boundedElastic()) - .flatMap( - x -> - webClient - .get() - .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) - .retrieve() - .bodyToMono(Todo.class) - .map(response -> response))) + .flatMap(x -> + webClient + .get() + .uri("https://jsonplaceholder.typicode.com/todos/{id}", id) + .retrieve() + .bodyToMono(Todo.class) + .map(response -> response))) .block(); } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/AssigneeController.java b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/AssigneeController.java index 6fdf96506c8..3d46d0f096a 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/AssigneeController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/AssigneeController.java @@ -14,21 +14,18 @@ public class AssigneeController { @BatchMapping(typeName = "Task", field = "assignee") public Mono> assignee( final @NotNull Set tasks) { - return Mono.fromCallable( - () -> { - final @NotNull Map map = - new HashMap<>(); - for (final @NotNull ProjectController.Task task : tasks) { - if ("Acrash".equalsIgnoreCase(task.assigneeId)) { - throw new RuntimeException("Causing an error while loading assignee"); - } - if (task.assigneeId != null) { - map.put( - task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); - } - } + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (final @NotNull ProjectController.Task task : tasks) { + if ("Acrash".equalsIgnoreCase(task.assigneeId)) { + throw new RuntimeException("Causing an error while loading assignee"); + } + if (task.assigneeId != null) { + map.put(task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); + } + } - return map; - }); + return map; + }); } } diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/ProjectController.java b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/ProjectController.java index 63790bca628..5a8c38efb43 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/ProjectController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/ProjectController.java @@ -76,14 +76,13 @@ public Flux notifyNewTask(@Argument String projectSlug) { final String creatorId = "creatorcrash".equalsIgnoreCase(projectSlug) ? "Ccrash" : "C1"; final @NotNull AtomicInteger counter = new AtomicInteger(1000); return Flux.interval(Duration.ofSeconds(1)) - .map( - num -> { - int i = counter.incrementAndGet(); - if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { - throw new RuntimeException("causing produce error for subscription"); - } - return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); - }); + .map(num -> { + int i = counter.incrementAndGet(); + if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { + throw new RuntimeException("causing produce error for subscription"); + } + return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); + }); } public static class Task { diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/TaskCreatorController.java b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/TaskCreatorController.java index 434a4822084..3968b2ed26c 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/TaskCreatorController.java +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/graphql/TaskCreatorController.java @@ -20,22 +20,20 @@ public TaskCreatorController(final BatchLoaderRegistry batchLoaderRegistry) { // using mapped BatchLoader to not have to deal with correct ordering of items batchLoaderRegistry .forTypePair(String.class, ProjectController.Creator.class) - .withOptions((builder) -> builder.setBatchingEnabled(true)) - .registerMappedBatchLoader( - (Set keys, BatchLoaderEnvironment env) -> { - return Mono.fromCallable( - () -> { - final @NotNull Map map = new HashMap<>(); - for (String key : keys) { - if ("Ccrash".equalsIgnoreCase(key)) { - throw new RuntimeException("Causing an error while loading creator"); - } - map.put(key, new ProjectController.Creator(key, "Name" + key)); - } + .withOptions(builder -> builder.setBatchingEnabled(true)) + .registerMappedBatchLoader((Set keys, BatchLoaderEnvironment env) -> { + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (String key : keys) { + if ("Ccrash".equalsIgnoreCase(key)) { + throw new RuntimeException("Causing an error while loading creator"); + } + map.put(key, new ProjectController.Creator(key, "Name" + key)); + } - return map; - }); - }); + return map; + }); + }); } @SchemaMapping(typeName = "Task") diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts index 9234da89f4c..84b6f95d75f 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/build.gradle.kts @@ -78,7 +78,7 @@ tasks.shadowJar { MergeSpringMetadataAction( runtimeClasspath.get(), MergeSpringMetadataAction.DEFAULT_SPRING_METADATA_FILES, - ) + ), ) } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/graphql/AssigneeController.java b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/graphql/AssigneeController.java index c88984c261f..f9e6607aa8d 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/graphql/AssigneeController.java +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/graphql/AssigneeController.java @@ -14,21 +14,18 @@ public class AssigneeController { @BatchMapping(typeName = "Task", field = "assignee") public Mono> assignee( final @NotNull Set tasks) { - return Mono.fromCallable( - () -> { - final @NotNull Map map = - new HashMap<>(); - for (final @NotNull ProjectController.Task task : tasks) { - if ("Acrash".equalsIgnoreCase(task.assigneeId)) { - throw new RuntimeException("Causing an error while loading assignee"); - } - if (task.assigneeId != null) { - map.put( - task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); - } - } + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (final @NotNull ProjectController.Task task : tasks) { + if ("Acrash".equalsIgnoreCase(task.assigneeId)) { + throw new RuntimeException("Causing an error while loading assignee"); + } + if (task.assigneeId != null) { + map.put(task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); + } + } - return map; - }); + return map; + }); } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/graphql/ProjectController.java b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/graphql/ProjectController.java index 70e65ad7e5e..4abfc4483db 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/graphql/ProjectController.java +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/graphql/ProjectController.java @@ -76,14 +76,13 @@ public Flux notifyNewTask(@Argument String projectSlug) { final String creatorId = "creatorcrash".equalsIgnoreCase(projectSlug) ? "Ccrash" : "C1"; final @NotNull AtomicInteger counter = new AtomicInteger(1000); return Flux.interval(Duration.ofSeconds(1)) - .map( - num -> { - int i = counter.incrementAndGet(); - if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { - throw new RuntimeException("causing produce error for subscription"); - } - return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); - }); + .map(num -> { + int i = counter.incrementAndGet(); + if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { + throw new RuntimeException("causing produce error for subscription"); + } + return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); + }); } public static class Task { diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/graphql/TaskCreatorController.java b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/graphql/TaskCreatorController.java index bbf123f84c3..3de1434c00e 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/graphql/TaskCreatorController.java +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot/graphql/TaskCreatorController.java @@ -20,21 +20,19 @@ public TaskCreatorController(final BatchLoaderRegistry batchLoaderRegistry) { // using mapped BatchLoader to not have to deal with correct ordering of items batchLoaderRegistry .forTypePair(String.class, ProjectController.Creator.class) - .registerMappedBatchLoader( - (Set keys, BatchLoaderEnvironment env) -> { - return Mono.fromCallable( - () -> { - final @NotNull Map map = new HashMap<>(); - for (String key : keys) { - if ("Ccrash".equalsIgnoreCase(key)) { - throw new RuntimeException("Causing an error while loading creator"); - } - map.put(key, new ProjectController.Creator(key, "Name" + key)); - } + .registerMappedBatchLoader((Set keys, BatchLoaderEnvironment env) -> { + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (String key : keys) { + if ("Ccrash".equalsIgnoreCase(key)) { + throw new RuntimeException("Causing an error while loading creator"); + } + map.put(key, new ProjectController.Creator(key, "Name" + key)); + } - return map; - }); - }); + return map; + }); + }); } @SchemaMapping(typeName = "Task") diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts index c67bdbb33fe..87495ef2ebf 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/build.gradle.kts @@ -77,7 +77,7 @@ tasks.shadowJar { MergeSpringMetadataAction( runtimeClasspath.get(), MergeSpringMetadataAction.DEFAULT_SPRING_METADATA_FILES, - ) + ), ) } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/graphql/AssigneeController.java b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/graphql/AssigneeController.java index c88984c261f..f9e6607aa8d 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/graphql/AssigneeController.java +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/graphql/AssigneeController.java @@ -14,21 +14,18 @@ public class AssigneeController { @BatchMapping(typeName = "Task", field = "assignee") public Mono> assignee( final @NotNull Set tasks) { - return Mono.fromCallable( - () -> { - final @NotNull Map map = - new HashMap<>(); - for (final @NotNull ProjectController.Task task : tasks) { - if ("Acrash".equalsIgnoreCase(task.assigneeId)) { - throw new RuntimeException("Causing an error while loading assignee"); - } - if (task.assigneeId != null) { - map.put( - task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); - } - } + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (final @NotNull ProjectController.Task task : tasks) { + if ("Acrash".equalsIgnoreCase(task.assigneeId)) { + throw new RuntimeException("Causing an error while loading assignee"); + } + if (task.assigneeId != null) { + map.put(task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); + } + } - return map; - }); + return map; + }); } } diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/graphql/ProjectController.java b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/graphql/ProjectController.java index 70e65ad7e5e..4abfc4483db 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/graphql/ProjectController.java +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/graphql/ProjectController.java @@ -76,14 +76,13 @@ public Flux notifyNewTask(@Argument String projectSlug) { final String creatorId = "creatorcrash".equalsIgnoreCase(projectSlug) ? "Ccrash" : "C1"; final @NotNull AtomicInteger counter = new AtomicInteger(1000); return Flux.interval(Duration.ofSeconds(1)) - .map( - num -> { - int i = counter.incrementAndGet(); - if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { - throw new RuntimeException("causing produce error for subscription"); - } - return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); - }); + .map(num -> { + int i = counter.incrementAndGet(); + if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { + throw new RuntimeException("causing produce error for subscription"); + } + return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); + }); } public static class Task { diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/graphql/TaskCreatorController.java b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/graphql/TaskCreatorController.java index bbf123f84c3..3de1434c00e 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/graphql/TaskCreatorController.java +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/java/io/sentry/samples/spring/boot/graphql/TaskCreatorController.java @@ -20,21 +20,19 @@ public TaskCreatorController(final BatchLoaderRegistry batchLoaderRegistry) { // using mapped BatchLoader to not have to deal with correct ordering of items batchLoaderRegistry .forTypePair(String.class, ProjectController.Creator.class) - .registerMappedBatchLoader( - (Set keys, BatchLoaderEnvironment env) -> { - return Mono.fromCallable( - () -> { - final @NotNull Map map = new HashMap<>(); - for (String key : keys) { - if ("Ccrash".equalsIgnoreCase(key)) { - throw new RuntimeException("Causing an error while loading creator"); - } - map.put(key, new ProjectController.Creator(key, "Name" + key)); - } + .registerMappedBatchLoader((Set keys, BatchLoaderEnvironment env) -> { + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (String key : keys) { + if ("Ccrash".equalsIgnoreCase(key)) { + throw new RuntimeException("Causing an error while loading creator"); + } + map.put(key, new ProjectController.Creator(key, "Name" + key)); + } - return map; - }); - }); + return map; + }); + }); } @SchemaMapping(typeName = "Task") diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonService.java b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonService.java index 75b0e38b125..23999d48775 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonService.java +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonService.java @@ -12,10 +12,9 @@ public class PersonService { Mono create(Person person) { return Mono.delay(Duration.ofMillis(100)) .publishOn(Schedulers.boundedElastic()) - .doOnNext( - __ -> { - Sentry.captureMessage("Creating person"); - }) + .doOnNext(__ -> { + Sentry.captureMessage("Creating person"); + }) .map(__ -> person); } } diff --git a/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts index 07eca851939..d5eacc41c64 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot-webflux/build.gradle.kts @@ -54,7 +54,7 @@ tasks.shadowJar { MergeSpringMetadataAction( runtimeClasspath.get(), MergeSpringMetadataAction.DEFAULT_SPRING_METADATA_FILES, - ) + ), ) } diff --git a/sentry-samples/sentry-samples-spring-boot/build.gradle.kts b/sentry-samples/sentry-samples-spring-boot/build.gradle.kts index 13e91956a2d..14d69f3bfd4 100644 --- a/sentry-samples/sentry-samples-spring-boot/build.gradle.kts +++ b/sentry-samples/sentry-samples-spring-boot/build.gradle.kts @@ -85,7 +85,7 @@ tasks.shadowJar { MergeSpringMetadataAction( runtimeClasspath.get(), MergeSpringMetadataAction.DEFAULT_SPRING_METADATA_FILES, - ) + ), ) } diff --git a/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/graphql/AssigneeController.java b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/graphql/AssigneeController.java index c88984c261f..f9e6607aa8d 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/graphql/AssigneeController.java +++ b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/graphql/AssigneeController.java @@ -14,21 +14,18 @@ public class AssigneeController { @BatchMapping(typeName = "Task", field = "assignee") public Mono> assignee( final @NotNull Set tasks) { - return Mono.fromCallable( - () -> { - final @NotNull Map map = - new HashMap<>(); - for (final @NotNull ProjectController.Task task : tasks) { - if ("Acrash".equalsIgnoreCase(task.assigneeId)) { - throw new RuntimeException("Causing an error while loading assignee"); - } - if (task.assigneeId != null) { - map.put( - task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); - } - } + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (final @NotNull ProjectController.Task task : tasks) { + if ("Acrash".equalsIgnoreCase(task.assigneeId)) { + throw new RuntimeException("Causing an error while loading assignee"); + } + if (task.assigneeId != null) { + map.put(task, new ProjectController.Assignee(task.assigneeId, "Name" + task.assigneeId)); + } + } - return map; - }); + return map; + }); } } diff --git a/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/graphql/ProjectController.java b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/graphql/ProjectController.java index 70e65ad7e5e..4abfc4483db 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/graphql/ProjectController.java +++ b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/graphql/ProjectController.java @@ -76,14 +76,13 @@ public Flux notifyNewTask(@Argument String projectSlug) { final String creatorId = "creatorcrash".equalsIgnoreCase(projectSlug) ? "Ccrash" : "C1"; final @NotNull AtomicInteger counter = new AtomicInteger(1000); return Flux.interval(Duration.ofSeconds(1)) - .map( - num -> { - int i = counter.incrementAndGet(); - if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { - throw new RuntimeException("causing produce error for subscription"); - } - return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); - }); + .map(num -> { + int i = counter.incrementAndGet(); + if ("produceerror".equalsIgnoreCase(projectSlug) && i % 2 == 0) { + throw new RuntimeException("causing produce error for subscription"); + } + return new Task("T" + i, "A new task arrived ", assigneeId, creatorId); + }); } public static class Task { diff --git a/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/graphql/TaskCreatorController.java b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/graphql/TaskCreatorController.java index bbf123f84c3..3de1434c00e 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/graphql/TaskCreatorController.java +++ b/sentry-samples/sentry-samples-spring-boot/src/main/java/io/sentry/samples/spring/boot/graphql/TaskCreatorController.java @@ -20,21 +20,19 @@ public TaskCreatorController(final BatchLoaderRegistry batchLoaderRegistry) { // using mapped BatchLoader to not have to deal with correct ordering of items batchLoaderRegistry .forTypePair(String.class, ProjectController.Creator.class) - .registerMappedBatchLoader( - (Set keys, BatchLoaderEnvironment env) -> { - return Mono.fromCallable( - () -> { - final @NotNull Map map = new HashMap<>(); - for (String key : keys) { - if ("Ccrash".equalsIgnoreCase(key)) { - throw new RuntimeException("Causing an error while loading creator"); - } - map.put(key, new ProjectController.Creator(key, "Name" + key)); - } + .registerMappedBatchLoader((Set keys, BatchLoaderEnvironment env) -> { + return Mono.fromCallable(() -> { + final @NotNull Map map = new HashMap<>(); + for (String key : keys) { + if ("Ccrash".equalsIgnoreCase(key)) { + throw new RuntimeException("Causing an error while loading creator"); + } + map.put(key, new ProjectController.Creator(key, "Name" + key)); + } - return map; - }); - }); + return map; + }); + }); } @SchemaMapping(typeName = "Task") diff --git a/sentry-servlet-jakarta/src/main/java/io/sentry/servlet/jakarta/SentryServletRequestListener.java b/sentry-servlet-jakarta/src/main/java/io/sentry/servlet/jakarta/SentryServletRequestListener.java index 909aee9b003..6c0d5821f8f 100644 --- a/sentry-servlet-jakarta/src/main/java/io/sentry/servlet/jakarta/SentryServletRequestListener.java +++ b/sentry-servlet-jakarta/src/main/java/io/sentry/servlet/jakarta/SentryServletRequestListener.java @@ -57,11 +57,10 @@ public void requestInitialized(@NotNull ServletRequestEvent servletRequestEvent) scopes.addBreadcrumb( Breadcrumb.http(httpRequest.getRequestURI(), httpRequest.getMethod()), hint); - scopes.configureScope( - scope -> { - scope.addEventProcessor( - new SentryRequestHttpServletRequestProcessor(httpRequest, scopes.getOptions())); - }); + scopes.configureScope(scope -> { + scope.addEventProcessor( + new SentryRequestHttpServletRequestProcessor(httpRequest, scopes.getOptions())); + }); } } } diff --git a/sentry-servlet-jakarta/src/test/kotlin/io/sentry/servlet/jakarta/SentryServletContainerInitializerTest.kt b/sentry-servlet-jakarta/src/test/kotlin/io/sentry/servlet/jakarta/SentryServletContainerInitializerTest.kt index 3cd7fcab15c..aded31fc379 100644 --- a/sentry-servlet-jakarta/src/test/kotlin/io/sentry/servlet/jakarta/SentryServletContainerInitializerTest.kt +++ b/sentry-servlet-jakarta/src/test/kotlin/io/sentry/servlet/jakarta/SentryServletContainerInitializerTest.kt @@ -19,7 +19,7 @@ class SentryServletContainerInitializerTest { .addListener( check { it: Class -> assertEquals(SentryServletRequestListener::class.java, it) - } + }, ) } } diff --git a/sentry-servlet/src/main/java/io/sentry/servlet/SentryServletRequestListener.java b/sentry-servlet/src/main/java/io/sentry/servlet/SentryServletRequestListener.java index 1874cacc66b..d2abd13bb21 100644 --- a/sentry-servlet/src/main/java/io/sentry/servlet/SentryServletRequestListener.java +++ b/sentry-servlet/src/main/java/io/sentry/servlet/SentryServletRequestListener.java @@ -57,11 +57,10 @@ public void requestInitialized(@NotNull ServletRequestEvent servletRequestEvent) scopes.addBreadcrumb( Breadcrumb.http(httpRequest.getRequestURI(), httpRequest.getMethod()), hint); - scopes.configureScope( - scope -> { - scope.addEventProcessor( - new SentryRequestHttpServletRequestProcessor(httpRequest, scopes.getOptions())); - }); + scopes.configureScope(scope -> { + scope.addEventProcessor( + new SentryRequestHttpServletRequestProcessor(httpRequest, scopes.getOptions())); + }); } } } diff --git a/sentry-servlet/src/test/kotlin/io/sentry/servlet/SentryServletContainerInitializerTest.kt b/sentry-servlet/src/test/kotlin/io/sentry/servlet/SentryServletContainerInitializerTest.kt index 5000e4f2411..5000e8f874e 100644 --- a/sentry-servlet/src/test/kotlin/io/sentry/servlet/SentryServletContainerInitializerTest.kt +++ b/sentry-servlet/src/test/kotlin/io/sentry/servlet/SentryServletContainerInitializerTest.kt @@ -19,7 +19,7 @@ class SentryServletContainerInitializerTest { .addListener( check { it: Class -> assertThat(it).isEqualTo(SentryServletRequestListener::class.java) - } + }, ) } } diff --git a/sentry-spring-7/src/integrationTest/kotlin/io/sentry/spring7/integrationtest/MetricsIntegrationTest.kt b/sentry-spring-7/src/integrationTest/kotlin/io/sentry/spring7/integrationtest/MetricsIntegrationTest.kt index c3178cb1188..b1a0f7e7dd7 100644 --- a/sentry-spring-7/src/integrationTest/kotlin/io/sentry/spring7/integrationtest/MetricsIntegrationTest.kt +++ b/sentry-spring-7/src/integrationTest/kotlin/io/sentry/spring7/integrationtest/MetricsIntegrationTest.kt @@ -35,7 +35,7 @@ class MetricsIntegrationTest : IntegrationTest() { .isEqualTo("distribution metric tracked") assertThat( - awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0) + awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0), ) .isTrue() } diff --git a/sentry-spring-7/src/main/java/io/sentry/spring7/SentrySpringFilter.java b/sentry-spring-7/src/main/java/io/sentry/spring7/SentrySpringFilter.java index 869eb1e3f5b..6abb989637e 100644 --- a/sentry-spring-7/src/main/java/io/sentry/spring7/SentrySpringFilter.java +++ b/sentry-spring-7/src/main/java/io/sentry/spring7/SentrySpringFilter.java @@ -84,23 +84,22 @@ protected void doFilterInternal( private void configureScope( final @NotNull IScopes scopes, final @NotNull HttpServletRequest request) { try { - scopes.configureScope( - scope -> { - // set basic request information on the scope - scope.setRequest(requestResolver.resolveSentryRequest(request)); - // transaction name is known at the later stage of request processing, thus it cannot - // be set on the scope - scope.addEventProcessor( - new SentryRequestHttpServletRequestProcessor( - transactionNameProvider, request, scopes.getOptions().getLogger())); - // only if request caches body, add an event processor that sets body on the event - // body is not on the scope, to avoid using memory when no event is triggered during - // request processing - if (request instanceof ContentCachingRequestWrapper) { - scope.addEventProcessor( - new RequestBodyExtractingEventProcessor(request, scopes.getOptions())); - } - }); + scopes.configureScope(scope -> { + // set basic request information on the scope + scope.setRequest(requestResolver.resolveSentryRequest(request)); + // transaction name is known at the later stage of request processing, thus it cannot + // be set on the scope + scope.addEventProcessor( + new SentryRequestHttpServletRequestProcessor( + transactionNameProvider, request, scopes.getOptions().getLogger())); + // only if request caches body, add an event processor that sets body on the event + // body is not on the scope, to avoid using memory when no event is triggered during + // request processing + if (request instanceof ContentCachingRequestWrapper) { + scope.addEventProcessor( + new RequestBodyExtractingEventProcessor(request, scopes.getOptions())); + } + }); } catch (Throwable e) { scopes .getOptions() diff --git a/sentry-spring-7/src/main/java/io/sentry/spring7/cache/SentryCacheWrapper.java b/sentry-spring-7/src/main/java/io/sentry/spring7/cache/SentryCacheWrapper.java index e5cb9ce87e9..7d5b9b7392b 100644 --- a/sentry-spring-7/src/main/java/io/sentry/spring7/cache/SentryCacheWrapper.java +++ b/sentry-spring-7/src/main/java/io/sentry/spring7/cache/SentryCacheWrapper.java @@ -128,17 +128,16 @@ public SentryCacheWrapper(final @NotNull Cache delegate, final @NotNull IScopes span.finish(); return null; } - return result.whenComplete( - (value, throwable) -> { - if (throwable != null) { - span.setStatus(SpanStatus.INTERNAL_ERROR); - span.setThrowable(throwable); - } else { - span.setData(SpanDataConvention.CACHE_HIT, value != null); - span.setStatus(SpanStatus.OK); - } - span.finish(); - }); + return result.whenComplete((value, throwable) -> { + if (throwable != null) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(throwable); + } else { + span.setData(SpanDataConvention.CACHE_HIT, value != null); + span.setStatus(SpanStatus.OK); + } + span.finish(); + }); } @Override @@ -164,18 +163,17 @@ public CompletableFuture retrieve( span.finish(); throw e; } - return result.whenComplete( - (value, throwable) -> { - if (throwable != null) { - span.setStatus(SpanStatus.INTERNAL_ERROR); - span.setThrowable(throwable); - } else { - span.setData(SpanDataConvention.CACHE_HIT, !loaderInvoked.get()); - span.setData(SpanDataConvention.CACHE_WRITE, loaderInvoked.get()); - span.setStatus(SpanStatus.OK); - } - span.finish(); - }); + return result.whenComplete((value, throwable) -> { + if (throwable != null) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(throwable); + } else { + span.setData(SpanDataConvention.CACHE_HIT, !loaderInvoked.get()); + span.setData(SpanDataConvention.CACHE_WRITE, loaderInvoked.get()); + span.setStatus(SpanStatus.OK); + } + span.finish(); + }); } @Override diff --git a/sentry-spring-7/src/main/java/io/sentry/spring7/graphql/SentryBatchLoaderRegistry.java b/sentry-spring-7/src/main/java/io/sentry/spring7/graphql/SentryBatchLoaderRegistry.java index 647da383818..461082dbad1 100644 --- a/sentry-spring-7/src/main/java/io/sentry/spring7/graphql/SentryBatchLoaderRegistry.java +++ b/sentry-spring-7/src/main/java/io/sentry/spring7/graphql/SentryBatchLoaderRegistry.java @@ -87,23 +87,21 @@ public BatchLoaderRegistry.RegistrationSpec withOptions(DataLoaderOptions @Override public void registerBatchLoader(BiFunction, BatchLoaderEnvironment, Flux> loader) { - delegate.registerBatchLoader( - (keys, batchLoaderEnvironment) -> { - scopesFromContext(batchLoaderEnvironment) - .addBreadcrumb(Breadcrumb.graphqlDataLoader(keys, keyType, valueType, name)); - return loader.apply(keys, batchLoaderEnvironment); - }); + delegate.registerBatchLoader((keys, batchLoaderEnvironment) -> { + scopesFromContext(batchLoaderEnvironment) + .addBreadcrumb(Breadcrumb.graphqlDataLoader(keys, keyType, valueType, name)); + return loader.apply(keys, batchLoaderEnvironment); + }); } @Override public void registerMappedBatchLoader( BiFunction, BatchLoaderEnvironment, Mono>> loader) { - delegate.registerMappedBatchLoader( - (keys, batchLoaderEnvironment) -> { - scopesFromContext(batchLoaderEnvironment) - .addBreadcrumb(Breadcrumb.graphqlDataLoader(keys, keyType, valueType, name)); - return loader.apply(keys, batchLoaderEnvironment); - }); + delegate.registerMappedBatchLoader((keys, batchLoaderEnvironment) -> { + scopesFromContext(batchLoaderEnvironment) + .addBreadcrumb(Breadcrumb.graphqlDataLoader(keys, keyType, valueType, name)); + return loader.apply(keys, batchLoaderEnvironment); + }); } private @NotNull IScopes scopesFromContext(final @NotNull BatchLoaderEnvironment environment) { diff --git a/sentry-spring-7/src/main/java/io/sentry/spring7/graphql/SentryDgsSubscriptionHandler.java b/sentry-spring-7/src/main/java/io/sentry/spring7/graphql/SentryDgsSubscriptionHandler.java index baf16ec71bc..46ffd401d71 100644 --- a/sentry-spring-7/src/main/java/io/sentry/spring7/graphql/SentryDgsSubscriptionHandler.java +++ b/sentry-spring-7/src/main/java/io/sentry/spring7/graphql/SentryDgsSubscriptionHandler.java @@ -22,12 +22,11 @@ public SentryDgsSubscriptionHandler() { final @NotNull InstrumentationFieldFetchParameters parameters) { if (result instanceof Flux) { final @NotNull Flux flux = (Flux) result; - return flux.doOnError( - throwable -> { - final @NotNull ExceptionReporter.ExceptionDetails exceptionDetails = - new ExceptionReporter.ExceptionDetails(scopes, parameters.getEnvironment(), true); - exceptionReporter.captureThrowable(throwable, exceptionDetails, null); - }); + return flux.doOnError(throwable -> { + final @NotNull ExceptionReporter.ExceptionDetails exceptionDetails = + new ExceptionReporter.ExceptionDetails(scopes, parameters.getEnvironment(), true); + exceptionReporter.captureThrowable(throwable, exceptionDetails, null); + }); } return result; } diff --git a/sentry-spring-7/src/main/java/io/sentry/spring7/graphql/SentrySpringSubscriptionHandler.java b/sentry-spring-7/src/main/java/io/sentry/spring7/graphql/SentrySpringSubscriptionHandler.java index e0b091d494e..d6eebbffc09 100644 --- a/sentry-spring-7/src/main/java/io/sentry/spring7/graphql/SentrySpringSubscriptionHandler.java +++ b/sentry-spring-7/src/main/java/io/sentry/spring7/graphql/SentrySpringSubscriptionHandler.java @@ -18,17 +18,15 @@ public final class SentrySpringSubscriptionHandler implements SentrySubscription final @NotNull InstrumentationFieldFetchParameters parameters) { if (result instanceof Flux) { final @NotNull Flux flux = (Flux) result; - return flux.doOnError( - throwable -> { - final @NotNull ExceptionReporter.ExceptionDetails exceptionDetails = - new ExceptionReporter.ExceptionDetails(scopes, parameters.getEnvironment(), true); - if (throwable instanceof SubscriptionPublisherException - && throwable.getCause() != null) { - exceptionReporter.captureThrowable(throwable.getCause(), exceptionDetails, null); - } else { - exceptionReporter.captureThrowable(throwable, exceptionDetails, null); - } - }); + return flux.doOnError(throwable -> { + final @NotNull ExceptionReporter.ExceptionDetails exceptionDetails = + new ExceptionReporter.ExceptionDetails(scopes, parameters.getEnvironment(), true); + if (throwable instanceof SubscriptionPublisherException && throwable.getCause() != null) { + exceptionReporter.captureThrowable(throwable.getCause(), exceptionDetails, null); + } else { + exceptionReporter.captureThrowable(throwable, exceptionDetails, null); + } + }); } return result; } diff --git a/sentry-spring-7/src/main/java/io/sentry/spring7/tracing/SentrySpanClientWebRequestFilter.java b/sentry-spring-7/src/main/java/io/sentry/spring7/tracing/SentrySpanClientWebRequestFilter.java index df3cd548218..270b1da4bdc 100644 --- a/sentry-spring-7/src/main/java/io/sentry/spring7/tracing/SentrySpanClientWebRequestFilter.java +++ b/sentry-spring-7/src/main/java/io/sentry/spring7/tracing/SentrySpanClientWebRequestFilter.java @@ -58,22 +58,20 @@ public SentrySpanClientWebRequestFilter(final @NotNull IScopes scopes) { final @NotNull ClientRequest modifiedRequest = maybeAddTracingHeaders(request, span); return next.exchange(modifiedRequest) - .flatMap( - response -> { - span.setData(SpanDataConvention.HTTP_STATUS_CODE_KEY, response.statusCode().value()); - span.setStatus(SpanStatus.fromHttpStatusCode(response.statusCode().value())); - addBreadcrumb(request, response); - span.finish(); - return Mono.just(response); - }) - .onErrorMap( - throwable -> { - span.setThrowable(throwable); - span.setStatus(SpanStatus.INTERNAL_ERROR); - addBreadcrumb(request, null); - span.finish(); - return throwable; - }); + .flatMap(response -> { + span.setData(SpanDataConvention.HTTP_STATUS_CODE_KEY, response.statusCode().value()); + span.setStatus(SpanStatus.fromHttpStatusCode(response.statusCode().value())); + addBreadcrumb(request, response); + span.finish(); + return Mono.just(response); + }) + .onErrorMap(throwable -> { + span.setThrowable(throwable); + span.setStatus(SpanStatus.INTERNAL_ERROR); + addBreadcrumb(request, null); + span.finish(); + return throwable; + }); } private @NotNull ClientRequest maybeAddTracingHeaders( @@ -98,11 +96,10 @@ public SentrySpanClientWebRequestFilter(final @NotNull IScopes scopes) { final @Nullable BaggageHeader baggageHeader = tracingHeaders.getBaggageHeader(); if (baggageHeader != null) { - requestBuilder.headers( - httpHeaders -> { - httpHeaders.remove(BaggageHeader.BAGGAGE_HEADER); - httpHeaders.add(baggageHeader.getName(), baggageHeader.getValue()); - }); + requestBuilder.headers(httpHeaders -> { + httpHeaders.remove(BaggageHeader.BAGGAGE_HEADER); + httpHeaders.add(baggageHeader.getName(), baggageHeader.getValue()); + }); } } diff --git a/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/AbstractSentryWebFilter.java b/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/AbstractSentryWebFilter.java index 4dd05110bbf..f2ef9ed1195 100644 --- a/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/AbstractSentryWebFilter.java +++ b/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/AbstractSentryWebFilter.java @@ -133,10 +133,9 @@ private void finishTransaction(ServerWebExchange exchange, ITransaction transact if (statusCode != null) { transaction .getContexts() - .withResponse( - (sentryResponse) -> { - sentryResponse.setStatusCode(statusCode.value()); - }); + .withResponse(sentryResponse -> { + sentryResponse.setStatusCode(statusCode.value()); + }); if (transaction.getStatus() == null) { transaction.setStatus(SpanStatus.fromHttpStatusCode(statusCode.value())); } diff --git a/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/SentryWebExceptionHandler.java b/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/SentryWebExceptionHandler.java index 421cb7a2a90..6716a1d1272 100644 --- a/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/SentryWebExceptionHandler.java +++ b/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/SentryWebExceptionHandler.java @@ -43,30 +43,28 @@ public SentryWebExceptionHandler(final @NotNull IScopes scopes) { return SentryReactorUtils.withSentryScopes( Mono.just(ex) - .map( - it -> { - if (!(ex instanceof ResponseStatusException)) { - final Mechanism mechanism = new Mechanism(); - mechanism.setType(MECHANISM_TYPE); - mechanism.setHandled(false); - final Throwable throwable = - new ExceptionMechanismException(mechanism, ex, Thread.currentThread()); - final SentryEvent event = new SentryEvent(throwable); - event.setLevel(SentryLevel.FATAL); - event.setTransaction( - TransactionNameProvider.provideTransactionName(serverWebExchange)); + .map(it -> { + if (!(ex instanceof ResponseStatusException)) { + final Mechanism mechanism = new Mechanism(); + mechanism.setType(MECHANISM_TYPE); + mechanism.setHandled(false); + final Throwable throwable = + new ExceptionMechanismException(mechanism, ex, Thread.currentThread()); + final SentryEvent event = new SentryEvent(throwable); + event.setLevel(SentryLevel.FATAL); + event.setTransaction( + TransactionNameProvider.provideTransactionName(serverWebExchange)); - final Hint hint = new Hint(); - hint.set(WEBFLUX_EXCEPTION_HANDLER_REQUEST, serverWebExchange.getRequest()); - hint.set( - WEBFLUX_EXCEPTION_HANDLER_RESPONSE, serverWebExchange.getResponse()); - hint.set(WEBFLUX_EXCEPTION_HANDLER_EXCHANGE, serverWebExchange); + final Hint hint = new Hint(); + hint.set(WEBFLUX_EXCEPTION_HANDLER_REQUEST, serverWebExchange.getRequest()); + hint.set(WEBFLUX_EXCEPTION_HANDLER_RESPONSE, serverWebExchange.getResponse()); + hint.set(WEBFLUX_EXCEPTION_HANDLER_EXCHANGE, serverWebExchange); - scopes.captureEvent(event, hint); - } + scopes.captureEvent(event, hint); + } - return it; - }), + return it; + }), scopesToUse) .flatMap(it -> Mono.error(ex)); } diff --git a/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/SentryWebFilter.java b/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/SentryWebFilter.java index 508ddbaf7ce..721ce06bb64 100644 --- a/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/SentryWebFilter.java +++ b/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/SentryWebFilter.java @@ -36,10 +36,9 @@ public Mono filter( .filter(serverWebExchange) .doFinally(__ -> doFinally(serverWebExchange, requestScopes, transaction)) .doOnError(e -> doOnError(transaction, e)) - .doFirst( - () -> { - Sentry.setCurrentScopes(requestScopes); - doFirst(serverWebExchange, requestScopes); - }); + .doFirst(() -> { + Sentry.setCurrentScopes(requestScopes); + doFirst(serverWebExchange, requestScopes); + }); } } diff --git a/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/SentryWebFilterWithThreadLocalAccessor.java b/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/SentryWebFilterWithThreadLocalAccessor.java index ff6c61353a9..4fd67cf876b 100644 --- a/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/SentryWebFilterWithThreadLocalAccessor.java +++ b/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/SentryWebFilterWithThreadLocalAccessor.java @@ -30,21 +30,17 @@ public Mono filter( return SentryReactorUtils.withSentryForkedRoots( webFilterChain .filter(serverWebExchange) - .doFinally( - __ -> - doFinally( - serverWebExchange, - Sentry.getCurrentScopes(), - transactionContainer.transaction)) + .doFinally(__ -> + doFinally( + serverWebExchange, Sentry.getCurrentScopes(), transactionContainer.transaction)) .doOnError(e -> doOnError(transactionContainer.transaction, e)) - .doFirst( - () -> { - doFirst(serverWebExchange, Sentry.getCurrentScopes()); - final ITransaction transaction = - maybeStartTransaction( - Sentry.getCurrentScopes(), serverWebExchange.getRequest(), TRACE_ORIGIN); - transactionContainer.transaction = transaction; - })); + .doFirst(() -> { + doFirst(serverWebExchange, Sentry.getCurrentScopes()); + final ITransaction transaction = + maybeStartTransaction( + Sentry.getCurrentScopes(), serverWebExchange.getRequest(), TRACE_ORIGIN); + transactionContainer.transaction = transaction; + })); } private static class TransactionContainer { diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/EnableSentryTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/EnableSentryTest.kt index d6588ad4013..4c782ef7a64 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/EnableSentryTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/EnableSentryTest.kt @@ -84,7 +84,7 @@ class EnableSentryTest { fun `creates SentryExceptionResolver with order set in the @EnableSentry annotation`() { ApplicationContextRunner() .withConfiguration( - UserConfigurations.of(AppConfigWithExceptionResolverOrderIntegerMaxValue::class.java) + UserConfigurations.of(AppConfigWithExceptionResolverOrderIntegerMaxValue::class.java), ) .run { assertThat(it).hasSingleBean(SentryExceptionResolver::class.java) @@ -98,7 +98,7 @@ class EnableSentryTest { fun `configures custom TracesSamplerCallback`() { ApplicationContextRunner() .withConfiguration( - UserConfigurations.of(AppConfigWithCustomTracesSamplerCallback::class.java) + UserConfigurations.of(AppConfigWithCustomTracesSamplerCallback::class.java), ) .run { val options = it.getBean(SentryOptions::class.java) @@ -143,7 +143,7 @@ class EnableSentryTest { fun `configures custom before breadcrumb callback`() { ApplicationContextRunner() .withConfiguration( - UserConfigurations.of(AppConfigWithCustomBeforeBreadcrumbCallback::class.java) + UserConfigurations.of(AppConfigWithCustomBeforeBreadcrumbCallback::class.java), ) .run { val beforeBreadcrumbCallback = diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/SentryCheckInAdviceTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/SentryCheckInAdviceTest.kt index 22e02b0b297..6a941e3f52d 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/SentryCheckInAdviceTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/SentryCheckInAdviceTest.kt @@ -53,7 +53,7 @@ import org.springframework.util.StringValueResolver "my.cron.schedule = 0 30 2 * * *", "my.cron.zone = America/New_York", "my.cron.empty.zone = ", - ] + ], ) class SentryCheckInAdviceTest { diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/SentrySpringFilterTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/SentrySpringFilterTest.kt index 37c97e99d89..dd23bd933f4 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/SentrySpringFilterTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/SentrySpringFilterTest.kt @@ -133,7 +133,7 @@ class SentrySpringFilterTest { MockMvcRequestBuilders.get(URI.create("http://example.com?param1=xyz")) .header("some-header", "some-header value") .accept(MediaType.APPLICATION_JSON) - .buildRequest(MockServletContext()) + .buildRequest(MockServletContext()), ) listener.doFilter(fixture.request, fixture.response, fixture.chain) @@ -157,7 +157,7 @@ class SentrySpringFilterTest { MockMvcRequestBuilders.get(URI.create("http://example.com?param1=xyz")) .header("another-header", "another value") .header("another-header", "another value2") - .buildRequest(MockServletContext()) + .buildRequest(MockServletContext()), ) listener.doFilter(fixture.request, fixture.response, fixture.chain) diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/SentryTaskDecoratorTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/SentryTaskDecoratorTest.kt index d589537d59c..777a03c3b19 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/SentryTaskDecoratorTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/SentryTaskDecoratorTest.kt @@ -43,7 +43,7 @@ class SentryTaskDecoratorTest { sut.decorate { assertNotEquals(mainScopes, Sentry.getCurrentScopes()) assertNotEquals(threadedScopes, Sentry.getCurrentScopes()) - } + }, ) callableFuture.get() diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/SentryUserFilterTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/SentryUserFilterTest.kt index 8d6a2fbcf69..36fb28c5717 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/SentryUserFilterTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/SentryUserFilterTest.kt @@ -63,7 +63,7 @@ class SentryUserFilterTest { fun `when processor returns empty User, user data is not changed`() { val filter = fixture.getSut( - userProviders = listOf(SentryUserProvider { sampleUser }, SentryUserProvider { User() }) + userProviders = listOf(SentryUserProvider { sampleUser }, SentryUserProvider { User() }), ) filter.doFilter(fixture.request, fixture.response, fixture.chain) @@ -75,7 +75,7 @@ class SentryUserFilterTest { fun `when processor returns null, user data is not changed`() { val filter = fixture.getSut( - userProviders = listOf(SentryUserProvider { sampleUser }, SentryUserProvider { null }) + userProviders = listOf(SentryUserProvider { sampleUser }, SentryUserProvider { null }), ) filter.doFilter(fixture.request, fixture.response, fixture.chain) @@ -91,7 +91,7 @@ class SentryUserFilterTest { listOf( SentryUserProvider { User().apply { data = mapOf("key" to "value") } }, SentryUserProvider { User().apply { data = mapOf("new-key" to "new-value") } }, - ) + ), ) filter.doFilter(fixture.request, fixture.response, fixture.chain) @@ -166,7 +166,7 @@ class SentryUserFilterTest { SentryUserProvider { sampleUser }, SentryUserProvider { throw failure }, laterProvider, - ) + ), ) filter.doFilter(fixture.request, fixture.response, fixture.chain) @@ -184,7 +184,7 @@ class SentryUserFilterTest { assertThat( assertFailsWith { filter.doFilter(fixture.request, fixture.response, fixture.chain) - } + }, ) .isSameAs(failure) verify(fixture.chain, never()).doFilter(fixture.request, fixture.response) diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/TransactionNameProviderUtilsTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/TransactionNameProviderUtilsTest.kt index 80b275d8cca..386ffaae108 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/TransactionNameProviderUtilsTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/TransactionNameProviderUtilsTest.kt @@ -31,7 +31,7 @@ class TransactionNameProviderUtilsTest { assertThat( assertFailsWith { TransactionNameProviderUtils.provideTransactionName(provider, request, logger) - } + }, ) .isSameAs(failure) } diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/checkin/SentryScheduledCheckInTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/checkin/SentryScheduledCheckInTest.kt index 2e60dbcc556..132ec0ca9a1 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/checkin/SentryScheduledCheckInTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/checkin/SentryScheduledCheckInTest.kt @@ -177,11 +177,11 @@ class SentryScheduledCheckInTest { assertEquals("outer-inner-run2-fa", SentryCheckInAdvice.scheduledTaskSlug("Outer.Inner.run2FA")) val first = SentryCheckInAdvice.scheduledTaskSlug( - "AVeryLongScheduledJobClassNameForReporting.firstMethod" + "AVeryLongScheduledJobClassNameForReporting.firstMethod", ) val second = SentryCheckInAdvice.scheduledTaskSlug( - "AVeryLongScheduledJobClassNameForReporting.secondMethod" + "AVeryLongScheduledJobClassNameForReporting.secondMethod", ) assertTrue(first.length <= 50) assertTrue(first.startsWith("a-very-long-scheduled-job-class-name-for-")) @@ -189,7 +189,7 @@ class SentryScheduledCheckInTest { assertEquals( first, SentryCheckInAdvice.scheduledTaskSlug( - "AVeryLongScheduledJobClassNameForReporting.firstMethod" + "AVeryLongScheduledJobClassNameForReporting.firstMethod", ), ) } @@ -292,11 +292,11 @@ class SentryScheduledCheckInTest { @Bean open fun sentryScheduledCheckInAdvisor( - @Qualifier("sentryScheduledCheckInAdvice") advice: SentryCheckInAdvice + @Qualifier("sentryScheduledCheckInAdvice") advice: SentryCheckInAdvice, ): Advisor = DefaultPointcutAdvisor( SentryScheduledCheckInPointcut( - listOf("SentryScheduledCheckInTest.Jobs.excluded", ".*\\.ExcludedJobs\\..*", " ") + listOf("SentryScheduledCheckInTest.Jobs.excluded", ".*\\.ExcludedJobs\\..*", " "), ), advice, ) diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/graphql/SentrySpringSubscriptionHandlerTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/graphql/SentrySpringSubscriptionHandlerTest.kt index 24f32e77f88..ac2e44a859d 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/graphql/SentrySpringSubscriptionHandlerTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/graphql/SentrySpringSubscriptionHandlerTest.kt @@ -29,9 +29,9 @@ class SentrySpringSubscriptionHandlerTest { .operation(OperationDefinition.Operation.QUERY) .name("testQuery") .selectionSet( - SelectionSet.newSelectionSet().selection(Field.newField("test").build()).build() + SelectionSet.newSelectionSet().selection(Field.newField("test").build()).build(), ) - .build() + .build(), ) .build() diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/kafka/SentryKafkaProducerBeanPostProcessorTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/kafka/SentryKafkaProducerBeanPostProcessorTest.kt index d11ac1e6c1b..bf307366e48 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/kafka/SentryKafkaProducerBeanPostProcessorTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/kafka/SentryKafkaProducerBeanPostProcessorTest.kt @@ -42,7 +42,7 @@ class SentryKafkaProducerBeanPostProcessorTest { val captor = argumentCaptor>() verify(factory).addPostProcessor(captor.capture()) assertTrue( - captor.firstValue is SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor<*, *> + captor.firstValue is SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor<*, *>, ) } @@ -103,7 +103,7 @@ class SentryKafkaProducerBeanPostProcessorTest { assertEquals(1, factory.postProcessors.size) assertTrue( factory.postProcessors.first() - is SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor<*, *> + is SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor<*, *>, ) } } diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/tracing/SentrySpanClientHttpRequestInterceptorTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/tracing/SentrySpanClientHttpRequestInterceptorTest.kt index 267477df6e8..3be29d43929 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/tracing/SentrySpanClientHttpRequestInterceptorTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/tracing/SentrySpanClientHttpRequestInterceptorTest.kt @@ -54,7 +54,7 @@ class SentrySpanClientHttpRequestInterceptorTest { } fun create( - config: Sentry.OptionsConfiguration + config: Sentry.OptionsConfiguration, ): SentrySpanClientHttpRequestInterceptor { config.configure(options) return SentrySpanClientHttpRequestInterceptor(scopes) diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/tracing/SentryTracingFilterTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/tracing/SentryTracingFilterTest.kt index fae0f19ebe6..f3ed0769cd5 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/tracing/SentryTracingFilterTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/tracing/SentryTracingFilterTest.kt @@ -87,7 +87,10 @@ class SentryTracingFilterTest { } response.status = status whenever( - scopes.startTransaction(any(), check { assertTrue(it.isBindToScope) }) + scopes.startTransaction( + any(), + check { assertTrue(it.isBindToScope) }, + ), ) .thenAnswer { SentryTracer(it.arguments[0] as TransactionContext, scopes) } whenever(scopes.isEnabled).thenReturn(isEnabled) @@ -98,7 +101,7 @@ class SentryTracingFilterTest { it.arguments[0] as String?, it.arguments[1] as List?, null, - ) + ), ) } return SentryTracingFilter(scopes, transactionNameProvider, isAsyncSupportEnabled) @@ -313,7 +316,7 @@ class SentryTracingFilterTest { val sentryTraceHeaderString = "2722d9f6ec019ade60c776169d9a8904-$parentSpanId-1" val baggageHeaderStrings = listOf( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET", ) fixture.options.tracesSampleRate = null val filter = @@ -343,7 +346,7 @@ class SentryTracingFilterTest { val sentryTraceHeaderString = "2722d9f6ec019ade60c776169d9a8904-$parentSpanId-1" val baggageHeaderStrings = listOf( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET", ) fixture.options.tracesSampleRate = null fixture.options.setIgnoredSpanOrigins(listOf("auto.http.spring7.webmvc")) @@ -373,7 +376,7 @@ class SentryTracingFilterTest { val sentryTrace = "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1" val baggage = listOf( - "baggage: sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d" + "baggage: sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", ) val filter = fixture.getSut( @@ -442,7 +445,7 @@ class SentryTracingFilterTest { val sentryTrace = "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1" val baggage = listOf( - "baggage: sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d" + "baggage: sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", ) val filter = fixture.getSut( diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/tracing/SentryTransactionAdviceTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/tracing/SentryTransactionAdviceTest.kt index 1c2359d4489..7fad4a8aa71 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/tracing/SentryTransactionAdviceTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/tracing/SentryTransactionAdviceTest.kt @@ -55,7 +55,7 @@ class SentryTransactionAdviceTest { assertTrue(it.isBindToScope) assertThat(it.origin).isEqualTo("auto.function.spring7.advice") }, - ) + ), ) .thenAnswer { SentryTracer(it.arguments[0] as TransactionContext, scopes) } whenever(scopes.options) diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryScheduleHookTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryScheduleHookTest.kt index 189acf89d52..e8796452f18 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryScheduleHookTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryScheduleHookTest.kt @@ -45,7 +45,7 @@ class SentryScheduleHookTest { sut.apply { assertNotEquals(mainScopes, Sentry.getCurrentScopes()) assertNotEquals(threadedScopes, Sentry.getCurrentScopes()) - } + }, ) callableFuture.get() diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryWebFluxTracingFilterTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryWebFluxTracingFilterTest.kt index c6c65b560db..d1a3459abad 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryWebFluxTracingFilterTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryWebFluxTracingFilterTest.kt @@ -87,7 +87,10 @@ class SentryWebFluxTracingFilterTest { ) exchange.response.statusCode = status whenever( - scopes.startTransaction(any(), check { assertTrue(it.isBindToScope) }) + scopes.startTransaction( + any(), + check { assertTrue(it.isBindToScope) }, + ), ) .thenAnswer { SentryTracer(it.arguments[0] as TransactionContext, scopes) } whenever(scopes.isEnabled).thenReturn(isEnabled) @@ -99,7 +102,7 @@ class SentryWebFluxTracingFilterTest { it.arguments[0] as String?, it.arguments[1] as List?, null, - ) + ), ) } return SentryWebFilter(scopes) @@ -326,7 +329,7 @@ class SentryWebFluxTracingFilterTest { val sentryTraceHeaderString = "2722d9f6ec019ade60c776169d9a8904-$parentSpanId-1" val baggageHeaderStrings = listOf( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET", ) fixture.options.tracesSampleRate = null val filter = @@ -358,7 +361,7 @@ class SentryWebFluxTracingFilterTest { val sentryTraceHeaderString = "2722d9f6ec019ade60c776169d9a8904-$parentSpanId-1" val baggageHeaderStrings = listOf( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET", ) fixture.options.tracesSampleRate = null fixture.options.setIgnoredSpanOrigins(listOf("auto.spring7.webflux")) diff --git a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryWebfluxIntegrationTest.kt b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryWebfluxIntegrationTest.kt index 56a7c07df41..f965c81ffd8 100644 --- a/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryWebfluxIntegrationTest.kt +++ b/sentry-spring-7/src/test/kotlin/io/sentry/spring7/webflux/SentryWebfluxIntegrationTest.kt @@ -139,7 +139,7 @@ class SentryWebfluxIntegrationTest { } @SpringBootApplication( - exclude = [ReactiveWebSecurityAutoConfiguration::class, SecurityAutoConfiguration::class] + exclude = [ReactiveWebSecurityAutoConfiguration::class, SecurityAutoConfiguration::class], ) open class App { private val transport = mock().also { whenever(it.isHealthy).thenReturn(true) } diff --git a/sentry-spring-boot-4/src/agentFixture/kotlin/io/sentry/spring/boot4/agentfixture/TodoController.kt b/sentry-spring-boot-4/src/agentFixture/kotlin/io/sentry/spring/boot4/agentfixture/TodoController.kt index 1b5b51d248f..0bbd4f4e121 100644 --- a/sentry-spring-boot-4/src/agentFixture/kotlin/io/sentry/spring/boot4/agentfixture/TodoController.kt +++ b/sentry-spring-boot-4/src/agentFixture/kotlin/io/sentry/spring/boot4/agentfixture/TodoController.kt @@ -37,7 +37,7 @@ class TodoController( return SentryReactorUtils.withSentry( Mono.just(true).publishOn(Schedulers.boundedElastic()).flatMap { webClient.get().uri(url).retrieve().bodyToMono(Todo::class.java) - } + }, ) .block() } diff --git a/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/GraphqlIntegrationTest.kt b/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/GraphqlIntegrationTest.kt index c50dca2ec1e..8c27919d43a 100644 --- a/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/GraphqlIntegrationTest.kt +++ b/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/GraphqlIntegrationTest.kt @@ -60,7 +60,7 @@ class GraphqlIntegrationTest : IntegrationTest() { fun `batch loaded fields are traced`() { val response = graphql( - """query { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""" + """query { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""", ) assertThat(response.has("errors")).isFalse() diff --git a/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/MetricsIntegrationTest.kt b/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/MetricsIntegrationTest.kt index 784cddfa2f9..7f02dce8e49 100644 --- a/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/MetricsIntegrationTest.kt +++ b/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/MetricsIntegrationTest.kt @@ -35,7 +35,7 @@ class MetricsIntegrationTest : IntegrationTest() { .isEqualTo("distribution metric tracked") assertThat( - awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0) + awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0), ) .isTrue() } diff --git a/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/PersonIntegrationTest.kt b/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/PersonIntegrationTest.kt index 30543274d5d..48a17e7337d 100644 --- a/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/PersonIntegrationTest.kt +++ b/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/PersonIntegrationTest.kt @@ -49,14 +49,14 @@ class PersonIntegrationTest : IntegrationTest() { transaction.hasOp( "http.server", FeatureFlag("flag.evaluation.transaction-feature-flag", true), - ) + ), ) .isTrue() assertThat( transaction.hasSpanWithOp( "spanCreatedThroughSentryApi", FeatureFlag("flag.evaluation.my-feature-flag", true), - ) + ), ) .isTrue() @@ -88,7 +88,7 @@ class PersonIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "db.query", "insert into person (firstName, lastName) values (?, ?)", - ) + ), ) .isTrue() } diff --git a/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/TodoController.kt b/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/TodoController.kt index e554718ff26..39b773f280a 100644 --- a/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/TodoController.kt +++ b/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/TodoController.kt @@ -37,7 +37,7 @@ class TodoController( return SentryReactorUtils.withSentry( Mono.just(true).publishOn(Schedulers.boundedElastic()).flatMap { webClient.get().uri(url).retrieve().bodyToMono(Todo::class.java) - } + }, ) .block() } diff --git a/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/TodoIntegrationTest.kt b/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/TodoIntegrationTest.kt index 5e0bc317552..d4c627df5a4 100644 --- a/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/TodoIntegrationTest.kt +++ b/sentry-spring-boot-4/src/integrationTest/kotlin/io/sentry/spring/boot4/integrationtest/TodoIntegrationTest.kt @@ -40,7 +40,7 @@ class TodoIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "http.client", "GET http://localhost:$port/stub/todos/1", - ) + ), ) .isTrue() } diff --git a/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/AgentApp.kt b/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/AgentApp.kt index 24496ee290a..58c097de2c7 100644 --- a/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/AgentApp.kt +++ b/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/AgentApp.kt @@ -57,13 +57,13 @@ object AgentApp { app.close() kafka.destroy() server.close() - } + }, ) } // The agent instruments classes as they load, which on a busy CI runner has taken over a minute. val restTemplate = TestRestTemplate( - RestTemplateBuilder().rootUri("http://localhost:${app.awaitPort(timeoutSeconds = 180)}") + RestTemplateBuilder().rootUri("http://localhost:${app.awaitPort(timeoutSeconds = 180)}"), ) } diff --git a/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/GraphqlIntegrationTest.kt b/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/GraphqlIntegrationTest.kt index 6ee2118dfce..60a49d0f943 100644 --- a/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/GraphqlIntegrationTest.kt +++ b/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/GraphqlIntegrationTest.kt @@ -65,7 +65,7 @@ class GraphqlIntegrationTest : IntegrationTest() { fun `query with batch loaded fields is traced`() { val response = graphql( - """query TasksAndAssigneesQuery { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""" + """query TasksAndAssigneesQuery { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""", ) assertThat(response.has("errors")).isFalse() diff --git a/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/MetricsIntegrationTest.kt b/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/MetricsIntegrationTest.kt index 1d32a9e2350..7d6c87779ee 100644 --- a/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/MetricsIntegrationTest.kt +++ b/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/MetricsIntegrationTest.kt @@ -34,7 +34,7 @@ class MetricsIntegrationTest : IntegrationTest() { .isEqualTo("distribution metric tracked") assertThat( - awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0) + awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0), ) .isTrue() } diff --git a/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/PersonIntegrationTest.kt b/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/PersonIntegrationTest.kt index 09d7aecda14..cf2f5a4490f 100644 --- a/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/PersonIntegrationTest.kt +++ b/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/PersonIntegrationTest.kt @@ -47,21 +47,21 @@ class PersonIntegrationTest : IntegrationTest() { // Whichever initializes Sentry names the SDK, which shows that each mode takes its own path. assertThat(transactionEnvelope.header.sdkVersion!!.name) .isEqualTo( - if (AgentApp.autoInit) "sentry.java.opentelemetry.agent" else "sentry.java.spring-boot-4" + if (AgentApp.autoInit) "sentry.java.opentelemetry.agent" else "sentry.java.spring-boot-4", ) val transaction = transactionEnvelope.transaction()!! assertThat( transaction.hasOp( "http.server", FeatureFlag("flag.evaluation.transaction-feature-flag", true), - ) + ), ) .isTrue() assertThat( transaction.hasSpanWithOp( "spanCreatedThroughOtelApi", FeatureFlag("flag.evaluation.my-feature-flag", true), - ) + ), ) .isTrue() assertThat(transaction.hasSpanWithOp("spanCreatedThroughSentryApi")).isTrue() @@ -127,7 +127,7 @@ class PersonIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "db", "insert into person (firstName, lastName) values (?, ?)", - ) + ), ) .isTrue() } diff --git a/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/TodoIntegrationTest.kt b/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/TodoIntegrationTest.kt index b40e5f4bd3a..48393201e8a 100644 --- a/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/TodoIntegrationTest.kt +++ b/sentry-spring-boot-4/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot4/otelagentintegrationtest/TodoIntegrationTest.kt @@ -39,7 +39,7 @@ class TodoIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "http.client", "GET ${restTemplate.rootUri}/stub/todos/1", - ) + ), ) .isTrue() return transaction diff --git a/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/GraphqlIntegrationTest.kt b/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/GraphqlIntegrationTest.kt index 8825ea803c3..55283ffdff0 100644 --- a/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/GraphqlIntegrationTest.kt +++ b/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/GraphqlIntegrationTest.kt @@ -61,7 +61,7 @@ class GraphqlIntegrationTest : IntegrationTest() { fun `query with batch loaded fields is traced`() { val response = graphql( - """query { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""" + """query { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""", ) assertThat(response.has("errors")).isFalse() diff --git a/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/MetricsIntegrationTest.kt b/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/MetricsIntegrationTest.kt index 19b2b362db6..75029fe68f3 100644 --- a/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/MetricsIntegrationTest.kt +++ b/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/MetricsIntegrationTest.kt @@ -35,7 +35,7 @@ class MetricsIntegrationTest : IntegrationTest() { .isEqualTo("distribution metric tracked") assertThat( - awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0) + awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0), ) .isTrue() } diff --git a/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/PersonIntegrationTest.kt b/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/PersonIntegrationTest.kt index 6e0359c459b..8ee19218dc2 100644 --- a/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/PersonIntegrationTest.kt +++ b/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/PersonIntegrationTest.kt @@ -54,14 +54,14 @@ class PersonIntegrationTest : IntegrationTest() { transaction.hasSpanWithOp( "personSpanThroughOtelAnnotation", FeatureFlag("flag.evaluation.outer-feature-flag", true), - ) + ), ) .isTrue() assertThat( transaction.hasSpanWithOp( "spanCreatedThroughOtelApi", FeatureFlag("flag.evaluation.inner-feature-flag", true), - ) + ), ) .isTrue() assertThat(transaction.hasSpanWithOp("spanCreatedThroughSentryApi", noFeatureFlags = true)) @@ -128,7 +128,7 @@ class PersonIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "db", "insert into person (firstName, lastName) values (?, ?)", - ) + ), ) .isTrue() } diff --git a/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/TodoController.kt b/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/TodoController.kt index cc341620922..c994a0ee6e5 100644 --- a/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/TodoController.kt +++ b/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/TodoController.kt @@ -37,7 +37,7 @@ class TodoController( return SentryReactorUtils.withSentry( Mono.just(true).publishOn(Schedulers.boundedElastic()).flatMap { webClient.get().uri(url).retrieve().bodyToMono(Todo::class.java) - } + }, ) .block() } diff --git a/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/TodoIntegrationTest.kt b/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/TodoIntegrationTest.kt index 7ca243955f7..2196a33d8cb 100644 --- a/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/TodoIntegrationTest.kt +++ b/sentry-spring-boot-4/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot4/otelnoagentintegrationtest/TodoIntegrationTest.kt @@ -42,7 +42,7 @@ class TodoIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "http.client", "GET http://localhost:$port/stub/todos/1", - ) + ), ) .isTrue() return transaction diff --git a/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/GraphqlIntegrationTest.kt b/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/GraphqlIntegrationTest.kt index b6ebc1e18f6..6b58e2a243f 100644 --- a/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/GraphqlIntegrationTest.kt +++ b/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/GraphqlIntegrationTest.kt @@ -60,7 +60,7 @@ class GraphqlIntegrationTest : IntegrationTest() { fun `batch loaded fields are traced`() { val response = graphql( - """query { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""" + """query { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""", ) assertThat(response.has("errors")).isFalse() diff --git a/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/MetricsIntegrationTest.kt b/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/MetricsIntegrationTest.kt index 074f4e022cb..106a80b1374 100644 --- a/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/MetricsIntegrationTest.kt +++ b/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/MetricsIntegrationTest.kt @@ -35,7 +35,7 @@ class MetricsIntegrationTest : IntegrationTest() { .isEqualTo("distribution metric tracked") assertThat( - awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0) + awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0), ) .isTrue() } diff --git a/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/PersonIntegrationTest.kt b/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/PersonIntegrationTest.kt index 50b1c660bb0..5cf00447acb 100644 --- a/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/PersonIntegrationTest.kt +++ b/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/PersonIntegrationTest.kt @@ -78,14 +78,14 @@ class PersonIntegrationTest : IntegrationTest() { transaction.hasOp( "http.server", FeatureFlag("flag.evaluation.transaction-feature-flag", true), - ) + ), ) .isTrue() assertThat( transaction.hasSpanWithOp( "spanCreatedThroughSentryApi", FeatureFlag("flag.evaluation.my-feature-flag", true), - ) + ), ) .isTrue() @@ -117,7 +117,7 @@ class PersonIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "db.query", "insert into person (firstName, lastName) values (?, ?)", - ) + ), ) .isTrue() } diff --git a/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/TodoController.kt b/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/TodoController.kt index 08c23022f73..8e053a78c91 100644 --- a/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/TodoController.kt +++ b/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/TodoController.kt @@ -32,7 +32,7 @@ class TodoController( return SentryReactorUtils.withSentry( Mono.just(true).publishOn(Schedulers.boundedElastic()).flatMap { webClient.get().uri(url).retrieve().bodyToMono(Todo::class.java) - } + }, ) .block() } diff --git a/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/TodoIntegrationTest.kt b/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/TodoIntegrationTest.kt index b2a158aa13c..001f600f843 100644 --- a/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/TodoIntegrationTest.kt +++ b/sentry-spring-boot-4/src/integrationTestOtlp/kotlin/io/sentry/spring/boot4/otlpintegrationtest/TodoIntegrationTest.kt @@ -35,7 +35,7 @@ class TodoIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "http.client", "GET http://localhost:$port/stub/todos/1", - ) + ), ) .isTrue() } diff --git a/sentry-spring-boot-4/src/integrationTestWebflux/kotlin/io/sentry/spring/boot4/webfluxintegrationtest/MetricsWebfluxIntegrationTest.kt b/sentry-spring-boot-4/src/integrationTestWebflux/kotlin/io/sentry/spring/boot4/webfluxintegrationtest/MetricsWebfluxIntegrationTest.kt index dde8a6d6f87..1681b82cafc 100644 --- a/sentry-spring-boot-4/src/integrationTestWebflux/kotlin/io/sentry/spring/boot4/webfluxintegrationtest/MetricsWebfluxIntegrationTest.kt +++ b/sentry-spring-boot-4/src/integrationTestWebflux/kotlin/io/sentry/spring/boot4/webfluxintegrationtest/MetricsWebfluxIntegrationTest.kt @@ -35,7 +35,7 @@ class MetricsWebfluxIntegrationTest : WebfluxIntegrationTest() { .isEqualTo("distribution metric tracked") assertThat( - awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0) + awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0), ) .isTrue() } diff --git a/sentry-spring-boot-4/src/integrationTestWebflux/kotlin/io/sentry/spring/boot4/webfluxintegrationtest/TodoWebfluxIntegrationTest.kt b/sentry-spring-boot-4/src/integrationTestWebflux/kotlin/io/sentry/spring/boot4/webfluxintegrationtest/TodoWebfluxIntegrationTest.kt index eb79a9c1c98..17b3e917dbb 100644 --- a/sentry-spring-boot-4/src/integrationTestWebflux/kotlin/io/sentry/spring/boot4/webfluxintegrationtest/TodoWebfluxIntegrationTest.kt +++ b/sentry-spring-boot-4/src/integrationTestWebflux/kotlin/io/sentry/spring/boot4/webfluxintegrationtest/TodoWebfluxIntegrationTest.kt @@ -23,7 +23,7 @@ class TodoWebfluxIntegrationTest : WebfluxIntegrationTest() { transaction.hasSpanWithOpAndDescription( "http.client", "GET http://localhost:$port/stub/todos/1", - ) + ), ) .isTrue() } diff --git a/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java b/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java index 734bd5d8a5c..78721b478e1 100644 --- a/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java +++ b/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java @@ -174,12 +174,11 @@ static class OpenTelemetryNoAgentConfiguration {} final @NotNull ObjectProvider gitProperties) { optionsConfigurations.forEach( optionsConfiguration -> optionsConfiguration.configure(options)); - gitProperties.ifAvailable( - git -> { - if (options.getRelease() == null && options.isUseGitCommitIdAsRelease()) { - options.setRelease(git.getCommitId()); - } - }); + gitProperties.ifAvailable(git -> { + if (options.getRelease() == null && options.isUseGitCommitIdAsRelease()) { + options.setRelease(git.getCommitId()); + } + }); spanFactory.ifAvailable(options::setSpanFactory); options.setSentryClientName( diff --git a/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryLogbackInitializer.java b/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryLogbackInitializer.java index 58de0bc4b26..64c7d98f23f 100644 --- a/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryLogbackInitializer.java +++ b/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryLogbackInitializer.java @@ -39,26 +39,25 @@ public boolean supportsEventType(final @NotNull ResolvableType eventType) { @Override public void onApplicationEvent(final @NotNull ApplicationEvent event) { - this.loggers.forEach( - loggerName -> { - final Logger logger = (Logger) LoggerFactory.getLogger(loggerName); - if (!isSentryAppenderRegistered(logger)) { - final SentryAppender sentryAppender = getSentryAppender(); + this.loggers.forEach(loggerName -> { + final Logger logger = (Logger) LoggerFactory.getLogger(loggerName); + if (!isSentryAppenderRegistered(logger)) { + final SentryAppender sentryAppender = getSentryAppender(); - Optional.ofNullable(sentryProperties.getLogging().getMinimumBreadcrumbLevel()) - .map(slf4jLevel -> Level.toLevel(slf4jLevel.name())) - .ifPresent(sentryAppender::setMinimumBreadcrumbLevel); - Optional.ofNullable(sentryProperties.getLogging().getMinimumEventLevel()) - .map(slf4jLevel -> Level.toLevel(slf4jLevel.name())) - .ifPresent(sentryAppender::setMinimumEventLevel); - Optional.ofNullable(sentryProperties.getLogging().getMinimumLevel()) - .map(slf4jLevel -> Level.toLevel(slf4jLevel.name())) - .ifPresent(sentryAppender::setMinimumLevel); + Optional.ofNullable(sentryProperties.getLogging().getMinimumBreadcrumbLevel()) + .map(slf4jLevel -> Level.toLevel(slf4jLevel.name())) + .ifPresent(sentryAppender::setMinimumBreadcrumbLevel); + Optional.ofNullable(sentryProperties.getLogging().getMinimumEventLevel()) + .map(slf4jLevel -> Level.toLevel(slf4jLevel.name())) + .ifPresent(sentryAppender::setMinimumEventLevel); + Optional.ofNullable(sentryProperties.getLogging().getMinimumLevel()) + .map(slf4jLevel -> Level.toLevel(slf4jLevel.name())) + .ifPresent(sentryAppender::setMinimumLevel); - sentryAppender.start(); - logger.addAppender(sentryAppender); - } - }); + sentryAppender.start(); + logger.addAppender(sentryAppender); + } + }); } @NotNull diff --git a/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentrySpanRestClientCustomizer.java b/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentrySpanRestClientCustomizer.java index 4611a3be51a..db6a6f2c0f2 100644 --- a/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentrySpanRestClientCustomizer.java +++ b/sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentrySpanRestClientCustomizer.java @@ -17,14 +17,13 @@ public SentrySpanRestClientCustomizer(final @NotNull IScopes scopes) { @Override public void customize(final @NotNull RestClient.Builder restClientBuilder) { - restClientBuilder.requestInterceptors( - clientHttpRequestInterceptors -> { - // As the SentrySpanClientHttpRequestInterceptor is being created in this class, this - // might not work - // if somebody registers it from an outside. - if (!clientHttpRequestInterceptors.contains(interceptor)) { - clientHttpRequestInterceptors.add(interceptor); - } - }); + restClientBuilder.requestInterceptors(clientHttpRequestInterceptors -> { + // As the SentrySpanClientHttpRequestInterceptor is being created in this class, this + // might not work + // if somebody registers it from an outside. + if (!clientHttpRequestInterceptors.contains(interceptor)) { + clientHttpRequestInterceptors.add(interceptor); + } + }); } } diff --git a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt index 334153d4e86..5885635578f 100644 --- a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt +++ b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt @@ -107,7 +107,7 @@ class SentryAutoConfigurationTest { SentryAutoConfiguration::class.java, WebMvcAutoConfiguration::class.java, SentryProfilerAutoConfiguration::class.java, - ) + ), ) .withPropertyValues( // Speed up tests by reducing timeouts and disabling expensive operations @@ -128,7 +128,7 @@ class SentryAutoConfigurationTest { // Use the optimized base runner by default private val contextRunner = baseContextRunner.withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls // Specialized context runners for different test categories @@ -136,14 +136,14 @@ class SentryAutoConfigurationTest { baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls private val tracingEnabledRunner = baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") .withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls @Test @@ -197,7 +197,7 @@ class SentryAutoConfigurationTest { .run { assertThat(it).hasSingleBean(Sentry.OptionsConfiguration::class.java) assertThat( - it.getBean(Sentry.OptionsConfiguration::class.java, "customOptionsConfiguration") + it.getBean(Sentry.OptionsConfiguration::class.java, "customOptionsConfiguration"), ) .isNotNull } @@ -207,7 +207,7 @@ class SentryAutoConfigurationTest { fun `GraphQL specification error type filtering is disabled by default`() { dsnEnabledRunner.run { assertThat( - it.getBean(SentryProperties::class.java).graphql.isEnableSpecificationErrorTypeFiltering + it.getBean(SentryProperties::class.java).graphql.isEnableSpecificationErrorTypeFiltering, ) .isFalse() } @@ -223,7 +223,7 @@ class SentryAutoConfigurationTest { it .getBean(SentryProperties::class.java) .graphql - .isEnableSpecificationErrorTypeFiltering + .isEnableSpecificationErrorTypeFiltering, ) .isEqualTo(enabled) } @@ -604,7 +604,7 @@ class SentryAutoConfigurationTest { contextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.send-default-pii=true") .withConfiguration( - UserConfigurations.of(SentryHighestOrderUserProviderConfiguration::class.java) + UserConfigurations.of(SentryHighestOrderUserProviderConfiguration::class.java), ) .run { val userProviders = it.getSentryUserProviders() @@ -917,7 +917,7 @@ class SentryAutoConfigurationTest { assertTrue( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBoot4OpenTelemetryAgentWithoutAutoInit") + .contains("SpringBoot4OpenTelemetryAgentWithoutAutoInit"), ) } } @@ -929,7 +929,7 @@ class SentryAutoConfigurationTest { assertFalse( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBoot4OpenTelemetryAgentWithoutAutoInit") + .contains("SpringBoot4OpenTelemetryAgentWithoutAutoInit"), ) } } @@ -944,7 +944,7 @@ class SentryAutoConfigurationTest { assertFalse( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBoot4OpenTelemetryAgentWithoutAutoInit") + .contains("SpringBoot4OpenTelemetryAgentWithoutAutoInit"), ) } } @@ -960,7 +960,7 @@ class SentryAutoConfigurationTest { assertTrue( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBoot4OpenTelemetryNoAgent") + .contains("SpringBoot4OpenTelemetryNoAgent"), ) } } @@ -975,7 +975,7 @@ class SentryAutoConfigurationTest { assertFalse( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBoot4OpenTelemetryNoAgent") + .contains("SpringBoot4OpenTelemetryNoAgent"), ) } } @@ -989,14 +989,14 @@ class SentryAutoConfigurationTest { FilteredClassLoader( AgentMarker::class.java, SentryAutoConfigurationCustomizerProvider::class.java, - ) + ), ) .withUserConfiguration(OtelBeanConfig::class.java) .run { assertFalse( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBoot4OpenTelemetryNoAgent") + .contains("SpringBoot4OpenTelemetryNoAgent"), ) } } @@ -1011,7 +1011,7 @@ class SentryAutoConfigurationTest { assertFalse( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBoot4OpenTelemetryAgentWithoutAutoInit") + .contains("SpringBoot4OpenTelemetryAgentWithoutAutoInit"), ) } } @@ -1067,7 +1067,7 @@ class SentryAutoConfigurationTest { FilteredClassLoader( io.sentry.graphql.SentryInstrumentation::class.java, io.sentry.graphql22.SentryInstrumentation::class.java, - ) + ), ) .run { assertThat(it).doesNotHaveBean(io.sentry.graphql.SentryInstrumentation::class.java) @@ -1135,7 +1135,7 @@ class SentryAutoConfigurationTest { captor.allValues.map { envelope -> String(envelope.items.first().data, Charsets.UTF_8) } assertThat(payloads).allMatch { payload -> payload.contains( - "\"monitor_slug\":\"sentry-auto-configuration-test-scheduled-jobs-sync\"" + "\"monitor_slug\":\"sentry-auto-configuration-test-scheduled-jobs-sync\"", ) } assertThat(payloads[0]).contains("\"value\":1,\"unit\":\"hour\"") @@ -1201,7 +1201,7 @@ class SentryAutoConfigurationTest { assertThat(it) .getBean(IProfileConverter::class.java) .isInstanceOf( - AsyncProfilerProfileConverterProvider.AsyncProfilerProfileConverter::class.java + AsyncProfilerProfileConverterProvider.AsyncProfilerProfileConverter::class.java, ) assertThat(it) .getBean(IContinuousProfiler::class.java) diff --git a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryLog4j2AppenderAutoConfigurationTest.kt b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryLog4j2AppenderAutoConfigurationTest.kt index bc6d8c88ca3..06fd6d1f83d 100644 --- a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryLog4j2AppenderAutoConfigurationTest.kt +++ b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryLog4j2AppenderAutoConfigurationTest.kt @@ -32,7 +32,7 @@ class SentryLog4j2AppenderAutoConfigurationTest { AutoConfigurations.of( SentryLog4j2AppenderAutoConfiguration::class.java, SentryAutoConfiguration::class.java, - ) + ), ) .withPropertyValues( "sentry.shutdownTimeoutMillis=0", @@ -138,7 +138,7 @@ class SentryLog4j2AppenderAutoConfigurationTest { .run { assertThat(rootLogger.getAppenders(SentryAppender::class.java)).hasSize(1) assertThat( - configuration.getLoggerConfig("com.example").getAppenders(SentryAppender::class.java) + configuration.getLoggerConfig("com.example").getAppenders(SentryAppender::class.java), ) .hasSize(1) } @@ -264,7 +264,7 @@ class SentryLog4j2AppenderAutoConfigurationTest { } fun org.apache.logging.log4j.core.config.LoggerConfig.getAppenders( - clazz: Class + clazz: Class, ): List { return this.appenders.values.filter { it.javaClass == clazz } } diff --git a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryLogbackAppenderAutoConfigurationTest.kt b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryLogbackAppenderAutoConfigurationTest.kt index 681932e6f89..8667c8177c3 100644 --- a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryLogbackAppenderAutoConfigurationTest.kt +++ b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryLogbackAppenderAutoConfigurationTest.kt @@ -27,7 +27,7 @@ class SentryLogbackAppenderAutoConfigurationTest { AutoConfigurations.of( SentryLogbackAppenderAutoConfiguration::class.java, SentryAutoConfiguration::class.java, - ) + ), ) .withPropertyValues( // Speed up tests by reducing timeouts and disabling expensive operations @@ -48,7 +48,7 @@ class SentryLogbackAppenderAutoConfigurationTest { // Use the optimized base runner by default private val contextRunner = baseContextRunner.withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls // Specialized context runner for tests requiring DSN @@ -56,7 +56,7 @@ class SentryLogbackAppenderAutoConfigurationTest { baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls private val rootLogger = LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME) as Logger diff --git a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryOkHttpAutoConfigurationTest.kt b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryOkHttpAutoConfigurationTest.kt index 20172470d0b..42dfa94f46b 100644 --- a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryOkHttpAutoConfigurationTest.kt +++ b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryOkHttpAutoConfigurationTest.kt @@ -254,7 +254,7 @@ class SentryOkHttpAutoConfigurationTest { SentryOkHttpInterceptor::class.java, SentryAutoConfigurationCustomizerProvider::class.java, AgentMarker::class.java, - ) + ), ) .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration(OkHttpClientConfiguration::class.java) diff --git a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentrySpanRestClientCustomizerTest.kt b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentrySpanRestClientCustomizerTest.kt index 9b35c0e2abc..3d6756133f3 100644 --- a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentrySpanRestClientCustomizerTest.kt +++ b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentrySpanRestClientCustomizerTest.kt @@ -80,7 +80,7 @@ class SentrySpanRestClientCustomizerTest { sentryOptions.isTraceSampling = true mockServer.enqueue( - MockResponse().setBody("OK").setSocketPolicy(socketPolicy).setResponseCode(status.value()) + MockResponse().setBody("OK").setSocketPolicy(socketPolicy).setResponseCode(status.value()), ) if (isTransactionActive) { @@ -156,8 +156,8 @@ class SentrySpanRestClientCustomizerTest { assertEquals(baggageHeaderValues.size, 1) assertTrue( baggageHeaderValues[0].startsWith( - "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue" - ) + "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue", + ), ) assertTrue(baggageHeaderValues[0].contains("sentry-public_key=key")) assertTrue(baggageHeaderValues[0].contains("sentry-transaction=aTransaction")) @@ -271,8 +271,8 @@ class SentrySpanRestClientCustomizerTest { assertEquals(baggageHeaderValues.size, 1) assertTrue( baggageHeaderValues[0].startsWith( - "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue" - ) + "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue", + ), ) assertTrue(baggageHeaderValues[0].contains("sentry-public_key=key")) assertTrue(baggageHeaderValues[0].contains("sentry-trace_id")) diff --git a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentrySpanRestTemplateCustomizerTest.kt b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentrySpanRestTemplateCustomizerTest.kt index 381a10975f6..f63be76a8b3 100644 --- a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentrySpanRestTemplateCustomizerTest.kt +++ b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentrySpanRestTemplateCustomizerTest.kt @@ -84,7 +84,7 @@ class SentrySpanRestTemplateCustomizerTest { sentryOptions.isTraceSampling = true mockServer.enqueue( - MockResponse().setBody("OK").setSocketPolicy(socketPolicy).setResponseCode(status.value()) + MockResponse().setBody("OK").setSocketPolicy(socketPolicy).setResponseCode(status.value()), ) if (isTransactionActive) { @@ -142,8 +142,8 @@ class SentrySpanRestTemplateCustomizerTest { assertEquals(baggageHeaderValues.size, 1) assertTrue( baggageHeaderValues[0].startsWith( - "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue" - ) + "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue", + ), ) assertTrue(baggageHeaderValues[0].contains("sentry-public_key=key")) assertTrue(baggageHeaderValues[0].contains("sentry-transaction=aTransaction")) @@ -230,8 +230,8 @@ class SentrySpanRestTemplateCustomizerTest { assertEquals(baggageHeaderValues.size, 1) assertTrue( baggageHeaderValues[0].startsWith( - "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue" - ) + "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue", + ), ) assertTrue(baggageHeaderValues[0].contains("sentry-public_key=key")) assertTrue(baggageHeaderValues[0].contains("sentry-trace_id")) diff --git a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryWebfluxAutoConfigurationTest.kt b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryWebfluxAutoConfigurationTest.kt index a338208d8e4..bf92eddd8ab 100644 --- a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryWebfluxAutoConfigurationTest.kt +++ b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryWebfluxAutoConfigurationTest.kt @@ -25,7 +25,7 @@ class SentryWebfluxAutoConfigurationTest { WebFluxAutoConfiguration::class.java, SentryWebfluxAutoConfiguration::class.java, SentryAutoConfiguration::class.java, - ) + ), ) .withPropertyValues( // Speed up tests by reducing timeouts and disabling expensive operations @@ -46,7 +46,7 @@ class SentryWebfluxAutoConfigurationTest { // Use the optimized base runner by default private val contextRunner = baseContextRunner.withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls // Specialized context runner for tests requiring DSN @@ -54,7 +54,7 @@ class SentryWebfluxAutoConfigurationTest { baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls @Test diff --git a/sentry-spring-boot-jakarta/src/agentFixture/kotlin/io/sentry/spring/boot/jakarta/agentfixture/TodoController.kt b/sentry-spring-boot-jakarta/src/agentFixture/kotlin/io/sentry/spring/boot/jakarta/agentfixture/TodoController.kt index 396b4aa4a14..ec1c94ff4ef 100644 --- a/sentry-spring-boot-jakarta/src/agentFixture/kotlin/io/sentry/spring/boot/jakarta/agentfixture/TodoController.kt +++ b/sentry-spring-boot-jakarta/src/agentFixture/kotlin/io/sentry/spring/boot/jakarta/agentfixture/TodoController.kt @@ -37,7 +37,7 @@ open class TodoController( return SentryReactorUtils.withSentry( Mono.just(true).publishOn(Schedulers.boundedElastic()).flatMap { webClient.get().uri(url).retrieve().bodyToMono(Todo::class.java) - } + }, ) .block() } diff --git a/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/FeatureFlagController.kt b/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/FeatureFlagController.kt index 808d89cb184..2a555b6dd48 100644 --- a/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/FeatureFlagController.kt +++ b/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/FeatureFlagController.kt @@ -42,8 +42,8 @@ open class OpenFeatureConfig { "new-checkout-flow" to booleanFlag(true), "experimental-feature" to booleanFlag(false), "beta-features" to booleanFlag(true), - ) - ) + ), + ), ) addHooks(SentryOpenFeatureHook()) } diff --git a/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/FeatureFlagIntegrationTest.kt b/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/FeatureFlagIntegrationTest.kt index 421bad16d3a..e8c93a146e8 100644 --- a/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/FeatureFlagIntegrationTest.kt +++ b/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/FeatureFlagIntegrationTest.kt @@ -17,7 +17,7 @@ class FeatureFlagIntegrationTest : IntegrationTest() { assertThat( awaitTransaction("new-checkout-flow") - .hasOp("http.server", FeatureFlag("flag.evaluation.new-checkout-flow", true)) + .hasOp("http.server", FeatureFlag("flag.evaluation.new-checkout-flow", true)), ) .isTrue() } @@ -28,7 +28,7 @@ class FeatureFlagIntegrationTest : IntegrationTest() { assertThat( awaitTransaction("experimental-feature") - .hasOp("http.server", FeatureFlag("flag.evaluation.experimental-feature", false)) + .hasOp("http.server", FeatureFlag("flag.evaluation.experimental-feature", false)), ) .isTrue() } diff --git a/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/GraphqlIntegrationTest.kt b/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/GraphqlIntegrationTest.kt index b3b68405c07..1d53b8ae00b 100644 --- a/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/GraphqlIntegrationTest.kt +++ b/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/GraphqlIntegrationTest.kt @@ -60,7 +60,7 @@ class GraphqlIntegrationTest : IntegrationTest() { fun `batch loaded fields are traced`() { val response = graphql( - """query { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""" + """query { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""", ) assertThat(response.has("errors")).isFalse() diff --git a/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/MetricsIntegrationTest.kt b/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/MetricsIntegrationTest.kt index 8feb647f4dd..23a85483e6e 100644 --- a/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/MetricsIntegrationTest.kt +++ b/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/MetricsIntegrationTest.kt @@ -35,7 +35,7 @@ class MetricsIntegrationTest : IntegrationTest() { .isEqualTo("distribution metric tracked") assertThat( - awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0) + awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0), ) .isTrue() } diff --git a/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/PersonIntegrationTest.kt b/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/PersonIntegrationTest.kt index 3f8ba722099..cde6542b294 100644 --- a/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/PersonIntegrationTest.kt +++ b/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/PersonIntegrationTest.kt @@ -49,14 +49,14 @@ class PersonIntegrationTest : IntegrationTest() { transaction.hasOp( "http.server", FeatureFlag("flag.evaluation.transaction-feature-flag", true), - ) + ), ) .isTrue() assertThat( transaction.hasSpanWithOp( "spanCreatedThroughSentryApi", FeatureFlag("flag.evaluation.my-feature-flag", true), - ) + ), ) .isTrue() @@ -88,7 +88,7 @@ class PersonIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "db.query", "insert into person (firstName, lastName) values (?, ?)", - ) + ), ) .isTrue() } diff --git a/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/TodoController.kt b/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/TodoController.kt index 5edb7bc6aa1..69afbeb4ede 100644 --- a/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/TodoController.kt +++ b/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/TodoController.kt @@ -37,7 +37,7 @@ open class TodoController( return SentryReactorUtils.withSentry( Mono.just(true).publishOn(Schedulers.boundedElastic()).flatMap { webClient.get().uri(url).retrieve().bodyToMono(Todo::class.java) - } + }, ) .block() } diff --git a/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/TodoIntegrationTest.kt b/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/TodoIntegrationTest.kt index bb3e2d6a99a..bd966e3e370 100644 --- a/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/TodoIntegrationTest.kt +++ b/sentry-spring-boot-jakarta/src/integrationTest/kotlin/io/sentry/spring/boot/jakarta/integrationtest/TodoIntegrationTest.kt @@ -40,7 +40,7 @@ class TodoIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "http.client", "GET http://localhost:$port/stub/todos/1", - ) + ), ) .isTrue() } diff --git a/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/AgentApp.kt b/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/AgentApp.kt index 6864d4d55c9..87e28ead08b 100644 --- a/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/AgentApp.kt +++ b/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/AgentApp.kt @@ -57,13 +57,13 @@ object AgentApp { app.close() kafka.destroy() server.close() - } + }, ) } // The agent instruments classes as they load, which on a busy CI runner has taken over a minute. val restTemplate = TestRestTemplate( - RestTemplateBuilder().rootUri("http://localhost:${app.awaitPort(timeoutSeconds = 180)}") + RestTemplateBuilder().rootUri("http://localhost:${app.awaitPort(timeoutSeconds = 180)}"), ) } diff --git a/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/GraphqlIntegrationTest.kt b/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/GraphqlIntegrationTest.kt index 8d54574b613..c05183b940c 100644 --- a/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/GraphqlIntegrationTest.kt +++ b/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/GraphqlIntegrationTest.kt @@ -65,7 +65,7 @@ class GraphqlIntegrationTest : IntegrationTest() { fun `query with batch loaded fields is traced`() { val response = graphql( - """query TasksAndAssigneesQuery { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""" + """query TasksAndAssigneesQuery { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""", ) assertThat(response.has("errors")).isFalse() diff --git a/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/MetricsIntegrationTest.kt b/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/MetricsIntegrationTest.kt index 3ac6b4d2f0c..535396ef5fa 100644 --- a/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/MetricsIntegrationTest.kt +++ b/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/MetricsIntegrationTest.kt @@ -34,7 +34,7 @@ class MetricsIntegrationTest : IntegrationTest() { .isEqualTo("distribution metric tracked") assertThat( - awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0) + awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0), ) .isTrue() } diff --git a/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/PersonIntegrationTest.kt b/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/PersonIntegrationTest.kt index 62b2012163a..720af739ed6 100644 --- a/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/PersonIntegrationTest.kt +++ b/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/PersonIntegrationTest.kt @@ -48,21 +48,21 @@ class PersonIntegrationTest : IntegrationTest() { assertThat(transactionEnvelope.header.sdkVersion!!.name) .isEqualTo( if (AgentApp.autoInit) "sentry.java.opentelemetry.agent" - else "sentry.java.spring-boot.jakarta" + else "sentry.java.spring-boot.jakarta", ) val transaction = transactionEnvelope.transaction()!! assertThat( transaction.hasOp( "http.server", FeatureFlag("flag.evaluation.transaction-feature-flag", true), - ) + ), ) .isTrue() assertThat( transaction.hasSpanWithOp( "spanCreatedThroughOtelApi", FeatureFlag("flag.evaluation.my-feature-flag", true), - ) + ), ) .isTrue() assertThat(transaction.hasSpanWithOp("spanCreatedThroughSentryApi")).isTrue() @@ -128,7 +128,7 @@ class PersonIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "db", "insert into person (firstName, lastName) values (?, ?)", - ) + ), ) .isTrue() } diff --git a/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/TodoIntegrationTest.kt b/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/TodoIntegrationTest.kt index 0f5e7042b67..c45248c8d60 100644 --- a/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/TodoIntegrationTest.kt +++ b/sentry-spring-boot-jakarta/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/jakarta/otelagentintegrationtest/TodoIntegrationTest.kt @@ -39,7 +39,7 @@ class TodoIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "http.client", "GET ${restTemplate.rootUri}/stub/todos/1", - ) + ), ) .isTrue() return transaction diff --git a/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/GraphqlIntegrationTest.kt b/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/GraphqlIntegrationTest.kt index d733939e1d4..446ed60bd28 100644 --- a/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/GraphqlIntegrationTest.kt +++ b/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/GraphqlIntegrationTest.kt @@ -61,7 +61,7 @@ class GraphqlIntegrationTest : IntegrationTest() { fun `query with batch loaded fields is traced`() { val response = graphql( - """query { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""" + """query { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""", ) assertThat(response.has("errors")).isFalse() diff --git a/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/MetricsIntegrationTest.kt b/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/MetricsIntegrationTest.kt index f3c52653001..98e40a30724 100644 --- a/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/MetricsIntegrationTest.kt +++ b/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/MetricsIntegrationTest.kt @@ -35,7 +35,7 @@ class MetricsIntegrationTest : IntegrationTest() { .isEqualTo("distribution metric tracked") assertThat( - awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0) + awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0), ) .isTrue() } diff --git a/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/PersonIntegrationTest.kt b/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/PersonIntegrationTest.kt index e2ca6eb7b56..2a84acf328b 100644 --- a/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/PersonIntegrationTest.kt +++ b/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/PersonIntegrationTest.kt @@ -54,14 +54,14 @@ class PersonIntegrationTest : IntegrationTest() { transaction.hasSpanWithOp( "personSpanThroughOtelAnnotation", FeatureFlag("flag.evaluation.outer-feature-flag", true), - ) + ), ) .isTrue() assertThat( transaction.hasSpanWithOp( "spanCreatedThroughOtelApi", FeatureFlag("flag.evaluation.inner-feature-flag", true), - ) + ), ) .isTrue() assertThat(transaction.hasSpanWithOp("spanCreatedThroughSentryApi", noFeatureFlags = true)) @@ -128,7 +128,7 @@ class PersonIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "db", "insert into person (firstName, lastName) values (?, ?)", - ) + ), ) .isTrue() } diff --git a/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/TodoController.kt b/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/TodoController.kt index 8a8d8bb1d6c..1d2511d7324 100644 --- a/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/TodoController.kt +++ b/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/TodoController.kt @@ -37,7 +37,7 @@ open class TodoController( return SentryReactorUtils.withSentry( Mono.just(true).publishOn(Schedulers.boundedElastic()).flatMap { webClient.get().uri(url).retrieve().bodyToMono(Todo::class.java) - } + }, ) .block() } diff --git a/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/TodoIntegrationTest.kt b/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/TodoIntegrationTest.kt index 08cb9cdf69d..1c2cf3f62f1 100644 --- a/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/TodoIntegrationTest.kt +++ b/sentry-spring-boot-jakarta/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/jakarta/otelnoagentintegrationtest/TodoIntegrationTest.kt @@ -42,7 +42,7 @@ class TodoIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "http.client", "GET http://localhost:$port/stub/todos/1", - ) + ), ) .isTrue() return transaction diff --git a/sentry-spring-boot-jakarta/src/integrationTestWebflux/kotlin/io/sentry/spring/boot/jakarta/webfluxintegrationtest/MetricsWebfluxIntegrationTest.kt b/sentry-spring-boot-jakarta/src/integrationTestWebflux/kotlin/io/sentry/spring/boot/jakarta/webfluxintegrationtest/MetricsWebfluxIntegrationTest.kt index 5d5cfb3f732..4decb92942b 100644 --- a/sentry-spring-boot-jakarta/src/integrationTestWebflux/kotlin/io/sentry/spring/boot/jakarta/webfluxintegrationtest/MetricsWebfluxIntegrationTest.kt +++ b/sentry-spring-boot-jakarta/src/integrationTestWebflux/kotlin/io/sentry/spring/boot/jakarta/webfluxintegrationtest/MetricsWebfluxIntegrationTest.kt @@ -35,7 +35,7 @@ class MetricsWebfluxIntegrationTest : WebfluxIntegrationTest() { .isEqualTo("distribution metric tracked") assertThat( - awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0) + awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0), ) .isTrue() } diff --git a/sentry-spring-boot-jakarta/src/integrationTestWebflux/kotlin/io/sentry/spring/boot/jakarta/webfluxintegrationtest/TodoWebfluxIntegrationTest.kt b/sentry-spring-boot-jakarta/src/integrationTestWebflux/kotlin/io/sentry/spring/boot/jakarta/webfluxintegrationtest/TodoWebfluxIntegrationTest.kt index 57d51eb41bd..b2022186115 100644 --- a/sentry-spring-boot-jakarta/src/integrationTestWebflux/kotlin/io/sentry/spring/boot/jakarta/webfluxintegrationtest/TodoWebfluxIntegrationTest.kt +++ b/sentry-spring-boot-jakarta/src/integrationTestWebflux/kotlin/io/sentry/spring/boot/jakarta/webfluxintegrationtest/TodoWebfluxIntegrationTest.kt @@ -21,7 +21,7 @@ class TodoWebfluxIntegrationTest : WebfluxIntegrationTest() { transaction.hasSpanWithOpAndDescription( "http.client", "GET ${restTemplate.rootUri}/stub/todos/1", - ) + ), ) .isTrue() } diff --git a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java index aaa91afa424..b42a9070b5a 100644 --- a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java +++ b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java @@ -176,12 +176,11 @@ static class OpenTelemetryNoAgentConfiguration {} final @NotNull ObjectProvider gitProperties) { optionsConfigurations.forEach( optionsConfiguration -> optionsConfiguration.configure(options)); - gitProperties.ifAvailable( - git -> { - if (options.getRelease() == null && options.isUseGitCommitIdAsRelease()) { - options.setRelease(git.getCommitId()); - } - }); + gitProperties.ifAvailable(git -> { + if (options.getRelease() == null && options.isUseGitCommitIdAsRelease()) { + options.setRelease(git.getCommitId()); + } + }); spanFactory.ifAvailable(options::setSpanFactory); options.setSentryClientName( diff --git a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryLogbackInitializer.java b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryLogbackInitializer.java index be222eae1bf..8379df4d214 100644 --- a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryLogbackInitializer.java +++ b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryLogbackInitializer.java @@ -39,26 +39,25 @@ public boolean supportsEventType(final @NotNull ResolvableType eventType) { @Override public void onApplicationEvent(final @NotNull ApplicationEvent event) { - this.loggers.forEach( - loggerName -> { - final Logger logger = (Logger) LoggerFactory.getLogger(loggerName); - if (!isSentryAppenderRegistered(logger)) { - final SentryAppender sentryAppender = getSentryAppender(); + this.loggers.forEach(loggerName -> { + final Logger logger = (Logger) LoggerFactory.getLogger(loggerName); + if (!isSentryAppenderRegistered(logger)) { + final SentryAppender sentryAppender = getSentryAppender(); - Optional.ofNullable(sentryProperties.getLogging().getMinimumBreadcrumbLevel()) - .map(slf4jLevel -> Level.toLevel(slf4jLevel.name())) - .ifPresent(sentryAppender::setMinimumBreadcrumbLevel); - Optional.ofNullable(sentryProperties.getLogging().getMinimumEventLevel()) - .map(slf4jLevel -> Level.toLevel(slf4jLevel.name())) - .ifPresent(sentryAppender::setMinimumEventLevel); - Optional.ofNullable(sentryProperties.getLogging().getMinimumLevel()) - .map(slf4jLevel -> Level.toLevel(slf4jLevel.name())) - .ifPresent(sentryAppender::setMinimumLevel); + Optional.ofNullable(sentryProperties.getLogging().getMinimumBreadcrumbLevel()) + .map(slf4jLevel -> Level.toLevel(slf4jLevel.name())) + .ifPresent(sentryAppender::setMinimumBreadcrumbLevel); + Optional.ofNullable(sentryProperties.getLogging().getMinimumEventLevel()) + .map(slf4jLevel -> Level.toLevel(slf4jLevel.name())) + .ifPresent(sentryAppender::setMinimumEventLevel); + Optional.ofNullable(sentryProperties.getLogging().getMinimumLevel()) + .map(slf4jLevel -> Level.toLevel(slf4jLevel.name())) + .ifPresent(sentryAppender::setMinimumLevel); - sentryAppender.start(); - logger.addAppender(sentryAppender); - } - }); + sentryAppender.start(); + logger.addAppender(sentryAppender); + } + }); } @NotNull diff --git a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentrySpanRestClientCustomizer.java b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentrySpanRestClientCustomizer.java index 304fb6911e9..9f2439ddaf7 100644 --- a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentrySpanRestClientCustomizer.java +++ b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentrySpanRestClientCustomizer.java @@ -17,14 +17,13 @@ public SentrySpanRestClientCustomizer(final @NotNull IScopes scopes) { @Override public void customize(final @NotNull RestClient.Builder restClientBuilder) { - restClientBuilder.requestInterceptors( - clientHttpRequestInterceptors -> { - // As the SentrySpanClientHttpRequestInterceptor is being created in this class, this - // might not work - // if somebody registers it from an outside. - if (!clientHttpRequestInterceptors.contains(interceptor)) { - clientHttpRequestInterceptors.add(interceptor); - } - }); + restClientBuilder.requestInterceptors(clientHttpRequestInterceptors -> { + // As the SentrySpanClientHttpRequestInterceptor is being created in this class, this + // might not work + // if somebody registers it from an outside. + if (!clientHttpRequestInterceptors.contains(interceptor)) { + clientHttpRequestInterceptors.add(interceptor); + } + }); } } diff --git a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt index 4f602db34f4..0674b908a94 100644 --- a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt +++ b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt @@ -110,7 +110,7 @@ class SentryAutoConfigurationTest { SentryAutoConfiguration::class.java, WebMvcAutoConfiguration::class.java, SentryProfilerAutoConfiguration::class.java, - ) + ), ) .withPropertyValues( // Speed up tests by reducing timeouts and disabling expensive operations @@ -131,7 +131,7 @@ class SentryAutoConfigurationTest { // Use the optimized base runner by default private val contextRunner = baseContextRunner.withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls // Specialized context runners for different test categories @@ -139,14 +139,14 @@ class SentryAutoConfigurationTest { baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls private val tracingEnabledRunner = baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") .withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls @Test @@ -200,7 +200,7 @@ class SentryAutoConfigurationTest { .run { assertThat(it).hasSingleBean(Sentry.OptionsConfiguration::class.java) assertThat( - it.getBean(Sentry.OptionsConfiguration::class.java, "customOptionsConfiguration") + it.getBean(Sentry.OptionsConfiguration::class.java, "customOptionsConfiguration"), ) .isNotNull } @@ -210,7 +210,7 @@ class SentryAutoConfigurationTest { fun `GraphQL specification error type filtering is disabled by default`() { dsnEnabledRunner.run { assertThat( - it.getBean(SentryProperties::class.java).graphql.isEnableSpecificationErrorTypeFiltering + it.getBean(SentryProperties::class.java).graphql.isEnableSpecificationErrorTypeFiltering, ) .isFalse() } @@ -226,7 +226,7 @@ class SentryAutoConfigurationTest { it .getBean(SentryProperties::class.java) .graphql - .isEnableSpecificationErrorTypeFiltering + .isEnableSpecificationErrorTypeFiltering, ) .isEqualTo(enabled) } @@ -623,7 +623,7 @@ class SentryAutoConfigurationTest { contextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.send-default-pii=true") .withConfiguration( - UserConfigurations.of(SentryHighestOrderUserProviderConfiguration::class.java) + UserConfigurations.of(SentryHighestOrderUserProviderConfiguration::class.java), ) .run { val userProviders = it.getSentryUserProviders() @@ -936,7 +936,7 @@ class SentryAutoConfigurationTest { assertTrue( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBoot3OpenTelemetryAgentWithoutAutoInit") + .contains("SpringBoot3OpenTelemetryAgentWithoutAutoInit"), ) } } @@ -948,7 +948,7 @@ class SentryAutoConfigurationTest { assertFalse( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBoot3OpenTelemetryAgentWithoutAutoInit") + .contains("SpringBoot3OpenTelemetryAgentWithoutAutoInit"), ) } } @@ -963,7 +963,7 @@ class SentryAutoConfigurationTest { assertFalse( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBoot3OpenTelemetryAgentWithoutAutoInit") + .contains("SpringBoot3OpenTelemetryAgentWithoutAutoInit"), ) } } @@ -979,7 +979,7 @@ class SentryAutoConfigurationTest { assertTrue( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBoot3OpenTelemetryNoAgent") + .contains("SpringBoot3OpenTelemetryNoAgent"), ) } } @@ -994,7 +994,7 @@ class SentryAutoConfigurationTest { assertFalse( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBoot3OpenTelemetryNoAgent") + .contains("SpringBoot3OpenTelemetryNoAgent"), ) } } @@ -1008,14 +1008,14 @@ class SentryAutoConfigurationTest { FilteredClassLoader( AgentMarker::class.java, SentryAutoConfigurationCustomizerProvider::class.java, - ) + ), ) .withUserConfiguration(OtelBeanConfig::class.java) .run { assertFalse( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBoot3OpenTelemetryNoAgent") + .contains("SpringBoot3OpenTelemetryNoAgent"), ) } } @@ -1030,7 +1030,7 @@ class SentryAutoConfigurationTest { assertFalse( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBoot3OpenTelemetryAgentWithoutAutoInit") + .contains("SpringBoot3OpenTelemetryAgentWithoutAutoInit"), ) } } @@ -1086,7 +1086,7 @@ class SentryAutoConfigurationTest { FilteredClassLoader( io.sentry.graphql.SentryInstrumentation::class.java, io.sentry.graphql22.SentryInstrumentation::class.java, - ) + ), ) .run { assertThat(it).doesNotHaveBean(io.sentry.graphql.SentryInstrumentation::class.java) @@ -1154,7 +1154,7 @@ class SentryAutoConfigurationTest { captor.allValues.map { envelope -> String(envelope.items.first().data, Charsets.UTF_8) } assertThat(payloads).allMatch { payload -> payload.contains( - "\"monitor_slug\":\"sentry-auto-configuration-test-scheduled-jobs-sync\"" + "\"monitor_slug\":\"sentry-auto-configuration-test-scheduled-jobs-sync\"", ) } assertThat(payloads[0]).contains("\"value\":1,\"unit\":\"hour\"") @@ -1220,7 +1220,7 @@ class SentryAutoConfigurationTest { assertThat(it) .getBean(IProfileConverter::class.java) .isInstanceOf( - AsyncProfilerProfileConverterProvider.AsyncProfilerProfileConverter::class.java + AsyncProfilerProfileConverterProvider.AsyncProfilerProfileConverter::class.java, ) assertThat(it) .getBean(IContinuousProfiler::class.java) diff --git a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryLog4j2AppenderAutoConfigurationTest.kt b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryLog4j2AppenderAutoConfigurationTest.kt index 7cdb97cfc9a..7a1859601c0 100644 --- a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryLog4j2AppenderAutoConfigurationTest.kt +++ b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryLog4j2AppenderAutoConfigurationTest.kt @@ -32,7 +32,7 @@ class SentryLog4j2AppenderAutoConfigurationTest { AutoConfigurations.of( SentryLog4j2AppenderAutoConfiguration::class.java, SentryAutoConfiguration::class.java, - ) + ), ) .withPropertyValues( "sentry.shutdownTimeoutMillis=0", @@ -138,7 +138,7 @@ class SentryLog4j2AppenderAutoConfigurationTest { .run { assertThat(rootLogger.getAppenders(SentryAppender::class.java)).hasSize(1) assertThat( - configuration.getLoggerConfig("com.example").getAppenders(SentryAppender::class.java) + configuration.getLoggerConfig("com.example").getAppenders(SentryAppender::class.java), ) .hasSize(1) } @@ -264,7 +264,7 @@ class SentryLog4j2AppenderAutoConfigurationTest { } fun org.apache.logging.log4j.core.config.LoggerConfig.getAppenders( - clazz: Class + clazz: Class, ): List { return this.appenders.values.filter { it.javaClass == clazz } } diff --git a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryLogbackAppenderAutoConfigurationTest.kt b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryLogbackAppenderAutoConfigurationTest.kt index d8982d995c1..5ede217a526 100644 --- a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryLogbackAppenderAutoConfigurationTest.kt +++ b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryLogbackAppenderAutoConfigurationTest.kt @@ -27,7 +27,7 @@ class SentryLogbackAppenderAutoConfigurationTest { AutoConfigurations.of( SentryLogbackAppenderAutoConfiguration::class.java, SentryAutoConfiguration::class.java, - ) + ), ) .withPropertyValues( // Speed up tests by reducing timeouts and disabling expensive operations @@ -48,7 +48,7 @@ class SentryLogbackAppenderAutoConfigurationTest { // Use the optimized base runner by default private val contextRunner = baseContextRunner.withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls // Specialized context runner for tests requiring DSN @@ -56,7 +56,7 @@ class SentryLogbackAppenderAutoConfigurationTest { baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls private val rootLogger = LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME) as Logger diff --git a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryOkHttpAutoConfigurationTest.kt b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryOkHttpAutoConfigurationTest.kt index d53f4ce0a1b..98168c4aa8c 100644 --- a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryOkHttpAutoConfigurationTest.kt +++ b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryOkHttpAutoConfigurationTest.kt @@ -250,7 +250,7 @@ class SentryOkHttpAutoConfigurationTest { SentryOkHttpInterceptor::class.java, SentryAutoConfigurationCustomizerProvider::class.java, AgentMarker::class.java, - ) + ), ) .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration(OkHttpClientConfiguration::class.java) diff --git a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentrySpanRestClientCustomizerTest.kt b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentrySpanRestClientCustomizerTest.kt index ac38f48047a..0849a619e37 100644 --- a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentrySpanRestClientCustomizerTest.kt +++ b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentrySpanRestClientCustomizerTest.kt @@ -80,7 +80,7 @@ class SentrySpanRestClientCustomizerTest { sentryOptions.isTraceSampling = true mockServer.enqueue( - MockResponse().setBody("OK").setSocketPolicy(socketPolicy).setResponseCode(status.value()) + MockResponse().setBody("OK").setSocketPolicy(socketPolicy).setResponseCode(status.value()), ) if (isTransactionActive) { @@ -157,8 +157,8 @@ class SentrySpanRestClientCustomizerTest { assertEquals(baggageHeaderValues.size, 1) assertTrue( baggageHeaderValues[0].startsWith( - "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue" - ) + "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue", + ), ) assertTrue(baggageHeaderValues[0].contains("sentry-public_key=key")) assertTrue(baggageHeaderValues[0].contains("sentry-transaction=aTransaction")) @@ -272,8 +272,8 @@ class SentrySpanRestClientCustomizerTest { assertEquals(baggageHeaderValues.size, 1) assertTrue( baggageHeaderValues[0].startsWith( - "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue" - ) + "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue", + ), ) assertTrue(baggageHeaderValues[0].contains("sentry-public_key=key")) assertTrue(baggageHeaderValues[0].contains("sentry-trace_id")) diff --git a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentrySpanRestTemplateCustomizerTest.kt b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentrySpanRestTemplateCustomizerTest.kt index e30c2e99d72..6fab71f5847 100644 --- a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentrySpanRestTemplateCustomizerTest.kt +++ b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentrySpanRestTemplateCustomizerTest.kt @@ -84,7 +84,7 @@ class SentrySpanRestTemplateCustomizerTest { sentryOptions.isTraceSampling = true mockServer.enqueue( - MockResponse().setBody("OK").setSocketPolicy(socketPolicy).setResponseCode(status.value()) + MockResponse().setBody("OK").setSocketPolicy(socketPolicy).setResponseCode(status.value()), ) if (isTransactionActive) { @@ -142,8 +142,8 @@ class SentrySpanRestTemplateCustomizerTest { assertEquals(baggageHeaderValues.size, 1) assertTrue( baggageHeaderValues[0].startsWith( - "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue" - ) + "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue", + ), ) assertTrue(baggageHeaderValues[0].contains("sentry-public_key=key")) assertTrue(baggageHeaderValues[0].contains("sentry-transaction=aTransaction")) @@ -230,8 +230,8 @@ class SentrySpanRestTemplateCustomizerTest { assertEquals(baggageHeaderValues.size, 1) assertTrue( baggageHeaderValues[0].startsWith( - "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue" - ) + "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue", + ), ) assertTrue(baggageHeaderValues[0].contains("sentry-public_key=key")) assertTrue(baggageHeaderValues[0].contains("sentry-trace_id")) diff --git a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryWebfluxAutoConfigurationTest.kt b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryWebfluxAutoConfigurationTest.kt index 6b67f2d6e91..4955cde8be2 100644 --- a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryWebfluxAutoConfigurationTest.kt +++ b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryWebfluxAutoConfigurationTest.kt @@ -25,7 +25,7 @@ class SentryWebfluxAutoConfigurationTest { WebFluxAutoConfiguration::class.java, SentryWebfluxAutoConfiguration::class.java, SentryAutoConfiguration::class.java, - ) + ), ) .withPropertyValues( // Speed up tests by reducing timeouts and disabling expensive operations @@ -46,7 +46,7 @@ class SentryWebfluxAutoConfigurationTest { // Use the optimized base runner by default private val contextRunner = baseContextRunner.withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls // Specialized context runner for tests requiring DSN @@ -54,7 +54,7 @@ class SentryWebfluxAutoConfigurationTest { baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls @Test diff --git a/sentry-spring-boot/src/integrationTest/kotlin/io/sentry/spring/boot/integrationtest/GraphqlIntegrationTest.kt b/sentry-spring-boot/src/integrationTest/kotlin/io/sentry/spring/boot/integrationtest/GraphqlIntegrationTest.kt index 9265ad457c0..30f901be230 100644 --- a/sentry-spring-boot/src/integrationTest/kotlin/io/sentry/spring/boot/integrationtest/GraphqlIntegrationTest.kt +++ b/sentry-spring-boot/src/integrationTest/kotlin/io/sentry/spring/boot/integrationtest/GraphqlIntegrationTest.kt @@ -60,7 +60,7 @@ class GraphqlIntegrationTest : IntegrationTest() { fun `batch loaded fields are traced`() { val response = graphql( - """query { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""" + """query { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""", ) assertThat(response.has("errors")).isFalse() diff --git a/sentry-spring-boot/src/integrationTest/kotlin/io/sentry/spring/boot/integrationtest/MetricsIntegrationTest.kt b/sentry-spring-boot/src/integrationTest/kotlin/io/sentry/spring/boot/integrationtest/MetricsIntegrationTest.kt index edfc5459e7e..c7246a1ef6b 100644 --- a/sentry-spring-boot/src/integrationTest/kotlin/io/sentry/spring/boot/integrationtest/MetricsIntegrationTest.kt +++ b/sentry-spring-boot/src/integrationTest/kotlin/io/sentry/spring/boot/integrationtest/MetricsIntegrationTest.kt @@ -35,7 +35,7 @@ class MetricsIntegrationTest : IntegrationTest() { .isEqualTo("distribution metric tracked") assertThat( - awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0) + awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0), ) .isTrue() } diff --git a/sentry-spring-boot/src/integrationTest/kotlin/io/sentry/spring/boot/integrationtest/PersonIntegrationTest.kt b/sentry-spring-boot/src/integrationTest/kotlin/io/sentry/spring/boot/integrationtest/PersonIntegrationTest.kt index 5a15d818166..d6b7d8c1f55 100644 --- a/sentry-spring-boot/src/integrationTest/kotlin/io/sentry/spring/boot/integrationtest/PersonIntegrationTest.kt +++ b/sentry-spring-boot/src/integrationTest/kotlin/io/sentry/spring/boot/integrationtest/PersonIntegrationTest.kt @@ -49,14 +49,14 @@ class PersonIntegrationTest : IntegrationTest() { transaction.hasOp( "http.server", FeatureFlag("flag.evaluation.transaction-feature-flag", true), - ) + ), ) .isTrue() assertThat( transaction.hasSpanWithOp( "spanCreatedThroughSentryApi", FeatureFlag("flag.evaluation.my-feature-flag", true), - ) + ), ) .isTrue() @@ -88,7 +88,7 @@ class PersonIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "db.query", "insert into person (firstName, lastName) values (?, ?)", - ) + ), ) .isTrue() } diff --git a/sentry-spring-boot/src/integrationTest/kotlin/io/sentry/spring/boot/integrationtest/TodoIntegrationTest.kt b/sentry-spring-boot/src/integrationTest/kotlin/io/sentry/spring/boot/integrationtest/TodoIntegrationTest.kt index efe6a0562b0..5a21f1c1d40 100644 --- a/sentry-spring-boot/src/integrationTest/kotlin/io/sentry/spring/boot/integrationtest/TodoIntegrationTest.kt +++ b/sentry-spring-boot/src/integrationTest/kotlin/io/sentry/spring/boot/integrationtest/TodoIntegrationTest.kt @@ -32,7 +32,7 @@ class TodoIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "http.client", "GET ${restTemplate.rootUri}/stub/todos/1", - ) + ), ) .isTrue() } diff --git a/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/AgentApp.kt b/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/AgentApp.kt index 32dd96a86d5..9d63b216e73 100644 --- a/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/AgentApp.kt +++ b/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/AgentApp.kt @@ -74,7 +74,7 @@ class AgentApp(args: List = emptyList()) : Closeable { private val sharedApp: Result by lazy { try { Result.success( - AgentApp().also { app -> Runtime.getRuntime().addShutdownHook(Thread { app.close() }) } + AgentApp().also { app -> Runtime.getRuntime().addShutdownHook(Thread { app.close() }) }, ) } catch (e: IllegalStateException) { Result.failure(e) diff --git a/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/GraphqlIntegrationTest.kt b/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/GraphqlIntegrationTest.kt index 14efac1fdbd..e881a8af4d0 100644 --- a/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/GraphqlIntegrationTest.kt +++ b/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/GraphqlIntegrationTest.kt @@ -65,7 +65,7 @@ class GraphqlIntegrationTest : IntegrationTest() { fun `query with batch loaded fields is traced`() { val response = graphql( - """query TasksAndAssigneesQuery { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""" + """query TasksAndAssigneesQuery { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""", ) assertThat(response.has("errors")).isFalse() diff --git a/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/KafkaOtelCoexistenceIntegrationTest.kt b/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/KafkaOtelCoexistenceIntegrationTest.kt index 6913a908fa2..d3f2aa6f4ba 100644 --- a/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/KafkaOtelCoexistenceIntegrationTest.kt +++ b/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/KafkaOtelCoexistenceIntegrationTest.kt @@ -68,7 +68,7 @@ class KafkaOtelCoexistenceIntegrationTest : IntegrationTest() { listOf( "--spring.profiles.active=kafka", "--spring.kafka.bootstrap-servers=${kafka.brokersAsString}", - ) + ), ) } diff --git a/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/MetricsIntegrationTest.kt b/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/MetricsIntegrationTest.kt index cc2d771b5d7..6cbe99453d8 100644 --- a/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/MetricsIntegrationTest.kt +++ b/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/MetricsIntegrationTest.kt @@ -34,7 +34,7 @@ class MetricsIntegrationTest : IntegrationTest() { .isEqualTo("distribution metric tracked") assertThat( - awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0) + awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0), ) .isTrue() } diff --git a/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/PersonIntegrationTest.kt b/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/PersonIntegrationTest.kt index 53a52f77412..4b341af6f64 100644 --- a/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/PersonIntegrationTest.kt +++ b/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/PersonIntegrationTest.kt @@ -47,21 +47,21 @@ class PersonIntegrationTest : IntegrationTest() { // Whichever initializes Sentry names the SDK, which shows that each mode takes its own path. assertThat(transactionEnvelope.header.sdkVersion!!.name) .isEqualTo( - if (AgentApp.autoInit) "sentry.java.opentelemetry.agent" else "sentry.java.spring-boot" + if (AgentApp.autoInit) "sentry.java.opentelemetry.agent" else "sentry.java.spring-boot", ) val transaction = transactionEnvelope.transaction()!! assertThat( transaction.hasOp( "http.server", FeatureFlag("flag.evaluation.transaction-feature-flag", true), - ) + ), ) .isTrue() assertThat( transaction.hasSpanWithOp( "spanCreatedThroughOtelApi", FeatureFlag("flag.evaluation.my-feature-flag", true), - ) + ), ) .isTrue() assertThat(transaction.hasSpanWithOp("spanCreatedThroughSentryApi")).isTrue() @@ -127,7 +127,7 @@ class PersonIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "db", "insert into person (firstName, lastName) values (?, ?)", - ) + ), ) .isTrue() } diff --git a/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/TodoIntegrationTest.kt b/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/TodoIntegrationTest.kt index ca3890e38f6..c2fbd826704 100644 --- a/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/TodoIntegrationTest.kt +++ b/sentry-spring-boot/src/integrationTestOtelAgent/kotlin/io/sentry/spring/boot/otelagentintegrationtest/TodoIntegrationTest.kt @@ -32,7 +32,7 @@ class TodoIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "http.client", "GET ${restTemplate.rootUri}/stub/todos/1", - ) + ), ) .isTrue() return transaction diff --git a/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/GraphqlIntegrationTest.kt b/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/GraphqlIntegrationTest.kt index 052da122bd9..dfd19e1fbb2 100644 --- a/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/GraphqlIntegrationTest.kt +++ b/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/GraphqlIntegrationTest.kt @@ -61,7 +61,7 @@ class GraphqlIntegrationTest : IntegrationTest() { fun `query with batch loaded fields is traced`() { val response = graphql( - """query { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""" + """query { tasks(projectSlug: "project-slug") { id assigneeId assignee { id } creatorId creator { id } } }""", ) assertThat(response.has("errors")).isFalse() diff --git a/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/KafkaOtelCoexistenceIntegrationTest.kt b/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/KafkaOtelCoexistenceIntegrationTest.kt index 5efef8875b1..4a6b3ca2937 100644 --- a/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/KafkaOtelCoexistenceIntegrationTest.kt +++ b/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/KafkaOtelCoexistenceIntegrationTest.kt @@ -18,7 +18,7 @@ import org.springframework.test.context.TestPropertySource @EmbeddedKafka(topics = [KAFKA_TOPIC], bootstrapServersProperty = "spring.kafka.bootstrap-servers") @TestPropertySource( properties = - ["sentry.enable-queue-tracing=true", "spring.kafka.consumer.auto-offset-reset=earliest"] + ["sentry.enable-queue-tracing=true", "spring.kafka.consumer.auto-offset-reset=earliest"], ) class KafkaOtelCoexistenceIntegrationTest : IntegrationTest() { diff --git a/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/MetricsIntegrationTest.kt b/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/MetricsIntegrationTest.kt index e7087c7b377..e39d332b6db 100644 --- a/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/MetricsIntegrationTest.kt +++ b/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/MetricsIntegrationTest.kt @@ -35,7 +35,7 @@ class MetricsIntegrationTest : IntegrationTest() { .isEqualTo("distribution metric tracked") assertThat( - awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0) + awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0), ) .isTrue() } diff --git a/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/PersonIntegrationTest.kt b/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/PersonIntegrationTest.kt index 6e9b1c1038b..2ca952969b9 100644 --- a/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/PersonIntegrationTest.kt +++ b/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/PersonIntegrationTest.kt @@ -54,14 +54,14 @@ class PersonIntegrationTest : IntegrationTest() { transaction.hasSpanWithOp( "personSpanThroughOtelAnnotation", FeatureFlag("flag.evaluation.outer-feature-flag", true), - ) + ), ) .isTrue() assertThat( transaction.hasSpanWithOp( "spanCreatedThroughOtelApi", FeatureFlag("flag.evaluation.inner-feature-flag", true), - ) + ), ) .isTrue() assertThat(transaction.hasSpanWithOp("spanCreatedThroughSentryApi", noFeatureFlags = true)) @@ -128,7 +128,7 @@ class PersonIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "db", "insert into person (firstName, lastName) values (?, ?)", - ) + ), ) .isTrue() } diff --git a/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/TodoIntegrationTest.kt b/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/TodoIntegrationTest.kt index 4b87dc571c9..9a65e54ed65 100644 --- a/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/TodoIntegrationTest.kt +++ b/sentry-spring-boot/src/integrationTestOtelNoAgent/kotlin/io/sentry/spring/boot/otelnoagentintegrationtest/TodoIntegrationTest.kt @@ -32,7 +32,7 @@ class TodoIntegrationTest : IntegrationTest() { transaction.hasSpanWithOpAndDescription( "http.client", "GET ${restTemplate.rootUri}/stub/todos/1", - ) + ), ) .isTrue() return transaction diff --git a/sentry-spring-boot/src/integrationTestWebflux/kotlin/io/sentry/spring/boot/webfluxintegrationtest/MetricsWebfluxIntegrationTest.kt b/sentry-spring-boot/src/integrationTestWebflux/kotlin/io/sentry/spring/boot/webfluxintegrationtest/MetricsWebfluxIntegrationTest.kt index 1b3eb4775df..f61b022a95c 100644 --- a/sentry-spring-boot/src/integrationTestWebflux/kotlin/io/sentry/spring/boot/webfluxintegrationtest/MetricsWebfluxIntegrationTest.kt +++ b/sentry-spring-boot/src/integrationTestWebflux/kotlin/io/sentry/spring/boot/webfluxintegrationtest/MetricsWebfluxIntegrationTest.kt @@ -35,7 +35,7 @@ class MetricsWebfluxIntegrationTest : WebfluxIntegrationTest() { .isEqualTo("distribution metric tracked") assertThat( - awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0) + awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0), ) .isTrue() } diff --git a/sentry-spring-boot/src/integrationTestWebflux/kotlin/io/sentry/spring/boot/webfluxintegrationtest/TodoWebfluxIntegrationTest.kt b/sentry-spring-boot/src/integrationTestWebflux/kotlin/io/sentry/spring/boot/webfluxintegrationtest/TodoWebfluxIntegrationTest.kt index de7314d0e66..a19fc61d810 100644 --- a/sentry-spring-boot/src/integrationTestWebflux/kotlin/io/sentry/spring/boot/webfluxintegrationtest/TodoWebfluxIntegrationTest.kt +++ b/sentry-spring-boot/src/integrationTestWebflux/kotlin/io/sentry/spring/boot/webfluxintegrationtest/TodoWebfluxIntegrationTest.kt @@ -21,7 +21,7 @@ class TodoWebfluxIntegrationTest : WebfluxIntegrationTest() { transaction.hasSpanWithOpAndDescription( "http.client", "GET ${restTemplate.rootUri}/stub/todos/1", - ) + ), ) .isTrue() } diff --git a/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java b/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java index 744fa9d739a..2fb4437aaad 100644 --- a/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java +++ b/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java @@ -171,12 +171,11 @@ static class OpenTelemetryNoAgentConfiguration {} final @NotNull ObjectProvider gitProperties) { optionsConfigurations.forEach( optionsConfiguration -> optionsConfiguration.configure(options)); - gitProperties.ifAvailable( - git -> { - if (options.getRelease() == null && options.isUseGitCommitIdAsRelease()) { - options.setRelease(git.getCommitId()); - } - }); + gitProperties.ifAvailable(git -> { + if (options.getRelease() == null && options.isUseGitCommitIdAsRelease()) { + options.setRelease(git.getCommitId()); + } + }); spanFactory.ifAvailable(options::setSpanFactory); options.setSentryClientName( diff --git a/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryLogbackInitializer.java b/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryLogbackInitializer.java index 94ba7b743fe..d475dabb8b0 100644 --- a/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryLogbackInitializer.java +++ b/sentry-spring-boot/src/main/java/io/sentry/spring/boot/SentryLogbackInitializer.java @@ -39,26 +39,25 @@ public boolean supportsEventType(final @NotNull ResolvableType eventType) { @Override public void onApplicationEvent(final @NotNull ApplicationEvent event) { - this.loggers.forEach( - loggerName -> { - final Logger logger = (Logger) LoggerFactory.getLogger(loggerName); - if (!isSentryAppenderRegistered(logger)) { - final SentryAppender sentryAppender = getSentryAppender(); + this.loggers.forEach(loggerName -> { + final Logger logger = (Logger) LoggerFactory.getLogger(loggerName); + if (!isSentryAppenderRegistered(logger)) { + final SentryAppender sentryAppender = getSentryAppender(); - Optional.ofNullable(sentryProperties.getLogging().getMinimumBreadcrumbLevel()) - .map(slf4jLevel -> Level.toLevel(slf4jLevel.name())) - .ifPresent(sentryAppender::setMinimumBreadcrumbLevel); - Optional.ofNullable(sentryProperties.getLogging().getMinimumEventLevel()) - .map(slf4jLevel -> Level.toLevel(slf4jLevel.name())) - .ifPresent(sentryAppender::setMinimumEventLevel); - Optional.ofNullable(sentryProperties.getLogging().getMinimumLevel()) - .map(slf4jLevel -> Level.toLevel(slf4jLevel.name())) - .ifPresent(sentryAppender::setMinimumLevel); + Optional.ofNullable(sentryProperties.getLogging().getMinimumBreadcrumbLevel()) + .map(slf4jLevel -> Level.toLevel(slf4jLevel.name())) + .ifPresent(sentryAppender::setMinimumBreadcrumbLevel); + Optional.ofNullable(sentryProperties.getLogging().getMinimumEventLevel()) + .map(slf4jLevel -> Level.toLevel(slf4jLevel.name())) + .ifPresent(sentryAppender::setMinimumEventLevel); + Optional.ofNullable(sentryProperties.getLogging().getMinimumLevel()) + .map(slf4jLevel -> Level.toLevel(slf4jLevel.name())) + .ifPresent(sentryAppender::setMinimumLevel); - sentryAppender.start(); - logger.addAppender(sentryAppender); - } - }); + sentryAppender.start(); + logger.addAppender(sentryAppender); + } + }); } @NotNull diff --git a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt index f4f14c6a85e..acce51df8cb 100644 --- a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt +++ b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt @@ -109,7 +109,7 @@ class SentryAutoConfigurationTest { SentryAutoConfiguration::class.java, WebMvcAutoConfiguration::class.java, SentryProfilerAutoConfiguration::class.java, - ) + ), ) .withPropertyValues( // Speed up tests by reducing timeouts and disabling expensive operations @@ -130,7 +130,7 @@ class SentryAutoConfigurationTest { // Use the optimized base runner by default private val contextRunner = baseContextRunner.withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls // Specialized context runners for different test categories @@ -138,14 +138,14 @@ class SentryAutoConfigurationTest { baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls private val tracingEnabledRunner = baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.traces-sample-rate=1.0") .withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls @Test @@ -198,7 +198,7 @@ class SentryAutoConfigurationTest { .run { assertThat(it).hasSingleBean(Sentry.OptionsConfiguration::class.java) assertThat( - it.getBean(Sentry.OptionsConfiguration::class.java, "customOptionsConfiguration") + it.getBean(Sentry.OptionsConfiguration::class.java, "customOptionsConfiguration"), ) .isNotNull } @@ -208,7 +208,7 @@ class SentryAutoConfigurationTest { fun `GraphQL specification error type filtering is disabled by default`() { dsnEnabledRunner.run { assertThat( - it.getBean(SentryProperties::class.java).graphql.isEnableSpecificationErrorTypeFiltering + it.getBean(SentryProperties::class.java).graphql.isEnableSpecificationErrorTypeFiltering, ) .isFalse() } @@ -224,7 +224,7 @@ class SentryAutoConfigurationTest { it .getBean(SentryProperties::class.java) .graphql - .isEnableSpecificationErrorTypeFiltering + .isEnableSpecificationErrorTypeFiltering, ) .isEqualTo(enabled) } @@ -621,7 +621,7 @@ class SentryAutoConfigurationTest { contextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj", "sentry.send-default-pii=true") .withConfiguration( - UserConfigurations.of(SentryHighestOrderUserProviderConfiguration::class.java) + UserConfigurations.of(SentryHighestOrderUserProviderConfiguration::class.java), ) .run { val userProviders = it.getSentryUserProviders() @@ -927,7 +927,7 @@ class SentryAutoConfigurationTest { assertTrue( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBootOpenTelemetryAgentWithoutAutoInit") + .contains("SpringBootOpenTelemetryAgentWithoutAutoInit"), ) } } @@ -939,7 +939,7 @@ class SentryAutoConfigurationTest { assertFalse( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBootOpenTelemetryAgentWithoutAutoInit") + .contains("SpringBootOpenTelemetryAgentWithoutAutoInit"), ) } } @@ -954,7 +954,7 @@ class SentryAutoConfigurationTest { assertFalse( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBootOpenTelemetryAgentWithoutAutoInit") + .contains("SpringBootOpenTelemetryAgentWithoutAutoInit"), ) } } @@ -970,7 +970,7 @@ class SentryAutoConfigurationTest { assertTrue( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBootOpenTelemetryNoAgent") + .contains("SpringBootOpenTelemetryNoAgent"), ) } } @@ -985,7 +985,7 @@ class SentryAutoConfigurationTest { assertFalse( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBootOpenTelemetryNoAgent") + .contains("SpringBootOpenTelemetryNoAgent"), ) } } @@ -999,14 +999,14 @@ class SentryAutoConfigurationTest { FilteredClassLoader( AgentMarker::class.java, SentryAutoConfigurationCustomizerProvider::class.java, - ) + ), ) .withUserConfiguration(OtelBeanConfig::class.java) .run { assertFalse( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBootOpenTelemetryNoAgent") + .contains("SpringBootOpenTelemetryNoAgent"), ) } } @@ -1021,7 +1021,7 @@ class SentryAutoConfigurationTest { assertFalse( SentryIntegrationPackageStorage.getInstance() .integrations - .contains("SpringBootOpenTelemetryAgentWithoutAutoInit") + .contains("SpringBootOpenTelemetryAgentWithoutAutoInit"), ) } } @@ -1040,7 +1040,7 @@ class SentryAutoConfigurationTest { assertThat(it) .getBean(IProfileConverter::class.java) .isInstanceOf( - AsyncProfilerProfileConverterProvider.AsyncProfilerProfileConverter::class.java + AsyncProfilerProfileConverterProvider.AsyncProfilerProfileConverter::class.java, ) assertThat(it) .getBean(IContinuousProfiler::class.java) @@ -1191,7 +1191,7 @@ class SentryAutoConfigurationTest { captor.allValues.map { envelope -> String(envelope.items.first().data, Charsets.UTF_8) } assertThat(payloads).allMatch { payload -> payload.contains( - "\"monitor_slug\":\"sentry-auto-configuration-test-scheduled-jobs-sync\"" + "\"monitor_slug\":\"sentry-auto-configuration-test-scheduled-jobs-sync\"", ) } assertThat(payloads[0]).contains("\"value\":1,\"unit\":\"hour\"") diff --git a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryLogbackAppenderAutoConfigurationTest.kt b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryLogbackAppenderAutoConfigurationTest.kt index f68cad0ff90..ed11b016fe4 100644 --- a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryLogbackAppenderAutoConfigurationTest.kt +++ b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryLogbackAppenderAutoConfigurationTest.kt @@ -27,7 +27,7 @@ class SentryLogbackAppenderAutoConfigurationTest { AutoConfigurations.of( SentryLogbackAppenderAutoConfiguration::class.java, SentryAutoConfiguration::class.java, - ) + ), ) .withPropertyValues( // Speed up tests by reducing timeouts and disabling expensive operations @@ -48,7 +48,7 @@ class SentryLogbackAppenderAutoConfigurationTest { // Use the optimized base runner by default private val contextRunner = baseContextRunner.withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls // Specialized context runner for tests requiring DSN @@ -56,7 +56,7 @@ class SentryLogbackAppenderAutoConfigurationTest { baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls private val rootLogger = LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME) as Logger diff --git a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryOkHttpAutoConfigurationTest.kt b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryOkHttpAutoConfigurationTest.kt index 92fa6024713..2225ee81d66 100644 --- a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryOkHttpAutoConfigurationTest.kt +++ b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryOkHttpAutoConfigurationTest.kt @@ -250,7 +250,7 @@ class SentryOkHttpAutoConfigurationTest { SentryOkHttpInterceptor::class.java, SentryAutoConfigurationCustomizerProvider::class.java, AgentMarker::class.java, - ) + ), ) .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration(OkHttpClientConfiguration::class.java) diff --git a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentrySpanRestTemplateCustomizerTest.kt b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentrySpanRestTemplateCustomizerTest.kt index 7fcba218af4..dea5a175bb4 100644 --- a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentrySpanRestTemplateCustomizerTest.kt +++ b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentrySpanRestTemplateCustomizerTest.kt @@ -84,7 +84,7 @@ class SentrySpanRestTemplateCustomizerTest { sentryOptions.isTraceSampling = true mockServer.enqueue( - MockResponse().setBody("OK").setSocketPolicy(socketPolicy).setResponseCode(status.value()) + MockResponse().setBody("OK").setSocketPolicy(socketPolicy).setResponseCode(status.value()), ) if (isTransactionActive) { @@ -142,8 +142,8 @@ class SentrySpanRestTemplateCustomizerTest { assertEquals(baggageHeaderValues.size, 1) assertTrue( baggageHeaderValues[0].startsWith( - "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue" - ) + "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue", + ), ) assertTrue(baggageHeaderValues[0].contains("sentry-public_key=key")) assertTrue(baggageHeaderValues[0].contains("sentry-transaction=aTransaction")) @@ -230,8 +230,8 @@ class SentrySpanRestTemplateCustomizerTest { assertEquals(baggageHeaderValues.size, 1) assertTrue( baggageHeaderValues[0].startsWith( - "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue" - ) + "thirdPartyBaggage=someValue,secondThirdPartyBaggage=secondValue; property;propertyKey=propertyValue,anotherThirdPartyBaggage=anotherValue", + ), ) assertTrue(baggageHeaderValues[0].contains("sentry-public_key=key")) assertTrue(baggageHeaderValues[0].contains("sentry-trace_id")) diff --git a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryWebfluxAutoConfigurationTest.kt b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryWebfluxAutoConfigurationTest.kt index dea2c005881..2f448015cf8 100644 --- a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryWebfluxAutoConfigurationTest.kt +++ b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryWebfluxAutoConfigurationTest.kt @@ -23,7 +23,7 @@ class SentryWebfluxAutoConfigurationTest { WebFluxAutoConfiguration::class.java, SentryWebfluxAutoConfiguration::class.java, SentryAutoConfiguration::class.java, - ) + ), ) .withPropertyValues( // Speed up tests by reducing timeouts and disabling expensive operations @@ -44,7 +44,7 @@ class SentryWebfluxAutoConfigurationTest { // Use the optimized base runner by default private val contextRunner = baseContextRunner.withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls // Specialized context runner for tests requiring DSN @@ -52,7 +52,7 @@ class SentryWebfluxAutoConfigurationTest { baseContextRunner .withPropertyValues("sentry.dsn=http://key@localhost/proj") .withUserConfiguration( - NoOpTransportConfiguration::class.java + NoOpTransportConfiguration::class.java, ) // Use no-op transport to avoid network calls @Test diff --git a/sentry-spring-jakarta/src/integrationTest/kotlin/io/sentry/spring/jakarta/integrationtest/MetricsIntegrationTest.kt b/sentry-spring-jakarta/src/integrationTest/kotlin/io/sentry/spring/jakarta/integrationtest/MetricsIntegrationTest.kt index 57188f421e7..87c3d8936ca 100644 --- a/sentry-spring-jakarta/src/integrationTest/kotlin/io/sentry/spring/jakarta/integrationtest/MetricsIntegrationTest.kt +++ b/sentry-spring-jakarta/src/integrationTest/kotlin/io/sentry/spring/jakarta/integrationtest/MetricsIntegrationTest.kt @@ -35,7 +35,7 @@ class MetricsIntegrationTest : IntegrationTest() { .isEqualTo("distribution metric tracked") assertThat( - awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0) + awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0), ) .isTrue() } diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/SentrySpringFilter.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/SentrySpringFilter.java index ae26af643ad..a710116896c 100644 --- a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/SentrySpringFilter.java +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/SentrySpringFilter.java @@ -84,23 +84,22 @@ protected void doFilterInternal( private void configureScope( final @NotNull IScopes scopes, final @NotNull HttpServletRequest request) { try { - scopes.configureScope( - scope -> { - // set basic request information on the scope - scope.setRequest(requestResolver.resolveSentryRequest(request)); - // transaction name is known at the later stage of request processing, thus it cannot - // be set on the scope - scope.addEventProcessor( - new SentryRequestHttpServletRequestProcessor( - transactionNameProvider, request, scopes.getOptions().getLogger())); - // only if request caches body, add an event processor that sets body on the event - // body is not on the scope, to avoid using memory when no event is triggered during - // request processing - if (request instanceof ContentCachingRequestWrapper) { - scope.addEventProcessor( - new RequestBodyExtractingEventProcessor(request, scopes.getOptions())); - } - }); + scopes.configureScope(scope -> { + // set basic request information on the scope + scope.setRequest(requestResolver.resolveSentryRequest(request)); + // transaction name is known at the later stage of request processing, thus it cannot + // be set on the scope + scope.addEventProcessor( + new SentryRequestHttpServletRequestProcessor( + transactionNameProvider, request, scopes.getOptions().getLogger())); + // only if request caches body, add an event processor that sets body on the event + // body is not on the scope, to avoid using memory when no event is triggered during + // request processing + if (request instanceof ContentCachingRequestWrapper) { + scope.addEventProcessor( + new RequestBodyExtractingEventProcessor(request, scopes.getOptions())); + } + }); } catch (Throwable e) { scopes .getOptions() diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/cache/SentryCacheWrapper.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/cache/SentryCacheWrapper.java index 9b7c551a2d2..1bb201584f0 100644 --- a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/cache/SentryCacheWrapper.java +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/cache/SentryCacheWrapper.java @@ -128,17 +128,16 @@ public SentryCacheWrapper(final @NotNull Cache delegate, final @NotNull IScopes span.finish(); return null; } - return result.whenComplete( - (value, throwable) -> { - if (throwable != null) { - span.setStatus(SpanStatus.INTERNAL_ERROR); - span.setThrowable(throwable); - } else { - span.setData(SpanDataConvention.CACHE_HIT, value != null); - span.setStatus(SpanStatus.OK); - } - span.finish(); - }); + return result.whenComplete((value, throwable) -> { + if (throwable != null) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(throwable); + } else { + span.setData(SpanDataConvention.CACHE_HIT, value != null); + span.setStatus(SpanStatus.OK); + } + span.finish(); + }); } @Override @@ -164,18 +163,17 @@ public CompletableFuture retrieve( span.finish(); throw e; } - return result.whenComplete( - (value, throwable) -> { - if (throwable != null) { - span.setStatus(SpanStatus.INTERNAL_ERROR); - span.setThrowable(throwable); - } else { - span.setData(SpanDataConvention.CACHE_HIT, !loaderInvoked.get()); - span.setData(SpanDataConvention.CACHE_WRITE, loaderInvoked.get()); - span.setStatus(SpanStatus.OK); - } - span.finish(); - }); + return result.whenComplete((value, throwable) -> { + if (throwable != null) { + span.setStatus(SpanStatus.INTERNAL_ERROR); + span.setThrowable(throwable); + } else { + span.setData(SpanDataConvention.CACHE_HIT, !loaderInvoked.get()); + span.setData(SpanDataConvention.CACHE_WRITE, loaderInvoked.get()); + span.setStatus(SpanStatus.OK); + } + span.finish(); + }); } @Override diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/graphql/SentryBatchLoaderRegistry.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/graphql/SentryBatchLoaderRegistry.java index 6a9f33e65f1..8d61a3948f5 100644 --- a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/graphql/SentryBatchLoaderRegistry.java +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/graphql/SentryBatchLoaderRegistry.java @@ -87,23 +87,21 @@ public BatchLoaderRegistry.RegistrationSpec withOptions(DataLoaderOptions @Override public void registerBatchLoader(BiFunction, BatchLoaderEnvironment, Flux> loader) { - delegate.registerBatchLoader( - (keys, batchLoaderEnvironment) -> { - scopesFromContext(batchLoaderEnvironment) - .addBreadcrumb(Breadcrumb.graphqlDataLoader(keys, keyType, valueType, name)); - return loader.apply(keys, batchLoaderEnvironment); - }); + delegate.registerBatchLoader((keys, batchLoaderEnvironment) -> { + scopesFromContext(batchLoaderEnvironment) + .addBreadcrumb(Breadcrumb.graphqlDataLoader(keys, keyType, valueType, name)); + return loader.apply(keys, batchLoaderEnvironment); + }); } @Override public void registerMappedBatchLoader( BiFunction, BatchLoaderEnvironment, Mono>> loader) { - delegate.registerMappedBatchLoader( - (keys, batchLoaderEnvironment) -> { - scopesFromContext(batchLoaderEnvironment) - .addBreadcrumb(Breadcrumb.graphqlDataLoader(keys, keyType, valueType, name)); - return loader.apply(keys, batchLoaderEnvironment); - }); + delegate.registerMappedBatchLoader((keys, batchLoaderEnvironment) -> { + scopesFromContext(batchLoaderEnvironment) + .addBreadcrumb(Breadcrumb.graphqlDataLoader(keys, keyType, valueType, name)); + return loader.apply(keys, batchLoaderEnvironment); + }); } private @NotNull IScopes scopesFromContext(final @NotNull BatchLoaderEnvironment environment) { diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/graphql/SentryDgsSubscriptionHandler.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/graphql/SentryDgsSubscriptionHandler.java index 3d5b7fe3764..95b20a8ee3f 100644 --- a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/graphql/SentryDgsSubscriptionHandler.java +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/graphql/SentryDgsSubscriptionHandler.java @@ -22,12 +22,11 @@ public SentryDgsSubscriptionHandler() { final @NotNull InstrumentationFieldFetchParameters parameters) { if (result instanceof Flux) { final @NotNull Flux flux = (Flux) result; - return flux.doOnError( - throwable -> { - final @NotNull ExceptionReporter.ExceptionDetails exceptionDetails = - new ExceptionReporter.ExceptionDetails(scopes, parameters.getEnvironment(), true); - exceptionReporter.captureThrowable(throwable, exceptionDetails, null); - }); + return flux.doOnError(throwable -> { + final @NotNull ExceptionReporter.ExceptionDetails exceptionDetails = + new ExceptionReporter.ExceptionDetails(scopes, parameters.getEnvironment(), true); + exceptionReporter.captureThrowable(throwable, exceptionDetails, null); + }); } return result; } diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/graphql/SentrySpringSubscriptionHandler.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/graphql/SentrySpringSubscriptionHandler.java index eec86f5e8b7..654c509ade1 100644 --- a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/graphql/SentrySpringSubscriptionHandler.java +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/graphql/SentrySpringSubscriptionHandler.java @@ -18,17 +18,15 @@ public final class SentrySpringSubscriptionHandler implements SentrySubscription final @NotNull InstrumentationFieldFetchParameters parameters) { if (result instanceof Flux) { final @NotNull Flux flux = (Flux) result; - return flux.doOnError( - throwable -> { - final @NotNull ExceptionReporter.ExceptionDetails exceptionDetails = - new ExceptionReporter.ExceptionDetails(scopes, parameters.getEnvironment(), true); - if (throwable instanceof SubscriptionPublisherException - && throwable.getCause() != null) { - exceptionReporter.captureThrowable(throwable.getCause(), exceptionDetails, null); - } else { - exceptionReporter.captureThrowable(throwable, exceptionDetails, null); - } - }); + return flux.doOnError(throwable -> { + final @NotNull ExceptionReporter.ExceptionDetails exceptionDetails = + new ExceptionReporter.ExceptionDetails(scopes, parameters.getEnvironment(), true); + if (throwable instanceof SubscriptionPublisherException && throwable.getCause() != null) { + exceptionReporter.captureThrowable(throwable.getCause(), exceptionDetails, null); + } else { + exceptionReporter.captureThrowable(throwable, exceptionDetails, null); + } + }); } return result; } diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/tracing/SentrySpanClientWebRequestFilter.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/tracing/SentrySpanClientWebRequestFilter.java index 1920a8f6ea2..3ffa721c0c8 100644 --- a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/tracing/SentrySpanClientWebRequestFilter.java +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/tracing/SentrySpanClientWebRequestFilter.java @@ -58,22 +58,20 @@ public SentrySpanClientWebRequestFilter(final @NotNull IScopes scopes) { final @NotNull ClientRequest modifiedRequest = maybeAddTracingHeaders(request, span); return next.exchange(modifiedRequest) - .flatMap( - response -> { - span.setData(SpanDataConvention.HTTP_STATUS_CODE_KEY, response.statusCode().value()); - span.setStatus(SpanStatus.fromHttpStatusCode(response.statusCode().value())); - addBreadcrumb(request, response); - span.finish(); - return Mono.just(response); - }) - .onErrorMap( - throwable -> { - span.setThrowable(throwable); - span.setStatus(SpanStatus.INTERNAL_ERROR); - addBreadcrumb(request, null); - span.finish(); - return throwable; - }); + .flatMap(response -> { + span.setData(SpanDataConvention.HTTP_STATUS_CODE_KEY, response.statusCode().value()); + span.setStatus(SpanStatus.fromHttpStatusCode(response.statusCode().value())); + addBreadcrumb(request, response); + span.finish(); + return Mono.just(response); + }) + .onErrorMap(throwable -> { + span.setThrowable(throwable); + span.setStatus(SpanStatus.INTERNAL_ERROR); + addBreadcrumb(request, null); + span.finish(); + return throwable; + }); } private @NotNull ClientRequest maybeAddTracingHeaders( @@ -98,11 +96,10 @@ public SentrySpanClientWebRequestFilter(final @NotNull IScopes scopes) { final @Nullable BaggageHeader baggageHeader = tracingHeaders.getBaggageHeader(); if (baggageHeader != null) { - requestBuilder.headers( - httpHeaders -> { - httpHeaders.remove(BaggageHeader.BAGGAGE_HEADER); - httpHeaders.add(baggageHeader.getName(), baggageHeader.getValue()); - }); + requestBuilder.headers(httpHeaders -> { + httpHeaders.remove(BaggageHeader.BAGGAGE_HEADER); + httpHeaders.add(baggageHeader.getName(), baggageHeader.getValue()); + }); } } diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/AbstractSentryWebFilter.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/AbstractSentryWebFilter.java index 84af5a708e0..6e3b0457e0f 100644 --- a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/AbstractSentryWebFilter.java +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/AbstractSentryWebFilter.java @@ -133,10 +133,9 @@ private void finishTransaction(ServerWebExchange exchange, ITransaction transact if (statusCode != null) { transaction .getContexts() - .withResponse( - (sentryResponse) -> { - sentryResponse.setStatusCode(statusCode.value()); - }); + .withResponse(sentryResponse -> { + sentryResponse.setStatusCode(statusCode.value()); + }); if (transaction.getStatus() == null) { transaction.setStatus(SpanStatus.fromHttpStatusCode(statusCode.value())); } diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/SentryWebExceptionHandler.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/SentryWebExceptionHandler.java index 1e1e387eb21..60e3f7693b6 100644 --- a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/SentryWebExceptionHandler.java +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/SentryWebExceptionHandler.java @@ -43,30 +43,28 @@ public SentryWebExceptionHandler(final @NotNull IScopes scopes) { return SentryReactorUtils.withSentryScopes( Mono.just(ex) - .map( - it -> { - if (!(ex instanceof ResponseStatusException)) { - final Mechanism mechanism = new Mechanism(); - mechanism.setType(MECHANISM_TYPE); - mechanism.setHandled(false); - final Throwable throwable = - new ExceptionMechanismException(mechanism, ex, Thread.currentThread()); - final SentryEvent event = new SentryEvent(throwable); - event.setLevel(SentryLevel.FATAL); - event.setTransaction( - TransactionNameProvider.provideTransactionName(serverWebExchange)); + .map(it -> { + if (!(ex instanceof ResponseStatusException)) { + final Mechanism mechanism = new Mechanism(); + mechanism.setType(MECHANISM_TYPE); + mechanism.setHandled(false); + final Throwable throwable = + new ExceptionMechanismException(mechanism, ex, Thread.currentThread()); + final SentryEvent event = new SentryEvent(throwable); + event.setLevel(SentryLevel.FATAL); + event.setTransaction( + TransactionNameProvider.provideTransactionName(serverWebExchange)); - final Hint hint = new Hint(); - hint.set(WEBFLUX_EXCEPTION_HANDLER_REQUEST, serverWebExchange.getRequest()); - hint.set( - WEBFLUX_EXCEPTION_HANDLER_RESPONSE, serverWebExchange.getResponse()); - hint.set(WEBFLUX_EXCEPTION_HANDLER_EXCHANGE, serverWebExchange); + final Hint hint = new Hint(); + hint.set(WEBFLUX_EXCEPTION_HANDLER_REQUEST, serverWebExchange.getRequest()); + hint.set(WEBFLUX_EXCEPTION_HANDLER_RESPONSE, serverWebExchange.getResponse()); + hint.set(WEBFLUX_EXCEPTION_HANDLER_EXCHANGE, serverWebExchange); - scopes.captureEvent(event, hint); - } + scopes.captureEvent(event, hint); + } - return it; - }), + return it; + }), scopesToUse) .flatMap(it -> Mono.error(ex)); } diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/SentryWebFilter.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/SentryWebFilter.java index 0ec4b44a0e5..b97cd11e0e6 100644 --- a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/SentryWebFilter.java +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/SentryWebFilter.java @@ -36,10 +36,9 @@ public Mono filter( .filter(serverWebExchange) .doFinally(__ -> doFinally(serverWebExchange, requestScopes, transaction)) .doOnError(e -> doOnError(transaction, e)) - .doFirst( - () -> { - Sentry.setCurrentScopes(requestScopes); - doFirst(serverWebExchange, requestScopes); - }); + .doFirst(() -> { + Sentry.setCurrentScopes(requestScopes); + doFirst(serverWebExchange, requestScopes); + }); } } diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/SentryWebFilterWithThreadLocalAccessor.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/SentryWebFilterWithThreadLocalAccessor.java index 7748d43a012..c4ac2bdf652 100644 --- a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/SentryWebFilterWithThreadLocalAccessor.java +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/SentryWebFilterWithThreadLocalAccessor.java @@ -30,21 +30,17 @@ public Mono filter( return SentryReactorUtils.withSentryForkedRoots( webFilterChain .filter(serverWebExchange) - .doFinally( - __ -> - doFinally( - serverWebExchange, - Sentry.getCurrentScopes(), - transactionContainer.transaction)) + .doFinally(__ -> + doFinally( + serverWebExchange, Sentry.getCurrentScopes(), transactionContainer.transaction)) .doOnError(e -> doOnError(transactionContainer.transaction, e)) - .doFirst( - () -> { - doFirst(serverWebExchange, Sentry.getCurrentScopes()); - final ITransaction transaction = - maybeStartTransaction( - Sentry.getCurrentScopes(), serverWebExchange.getRequest(), TRACE_ORIGIN); - transactionContainer.transaction = transaction; - })); + .doFirst(() -> { + doFirst(serverWebExchange, Sentry.getCurrentScopes()); + final ITransaction transaction = + maybeStartTransaction( + Sentry.getCurrentScopes(), serverWebExchange.getRequest(), TRACE_ORIGIN); + transactionContainer.transaction = transaction; + })); } private static class TransactionContainer { diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/EnableSentryTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/EnableSentryTest.kt index 52a626d4642..879f30d558b 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/EnableSentryTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/EnableSentryTest.kt @@ -84,7 +84,7 @@ class EnableSentryTest { fun `creates SentryExceptionResolver with order set in the @EnableSentry annotation`() { ApplicationContextRunner() .withConfiguration( - UserConfigurations.of(AppConfigWithExceptionResolverOrderIntegerMaxValue::class.java) + UserConfigurations.of(AppConfigWithExceptionResolverOrderIntegerMaxValue::class.java), ) .run { assertThat(it).hasSingleBean(SentryExceptionResolver::class.java) @@ -98,7 +98,7 @@ class EnableSentryTest { fun `configures custom TracesSamplerCallback`() { ApplicationContextRunner() .withConfiguration( - UserConfigurations.of(AppConfigWithCustomTracesSamplerCallback::class.java) + UserConfigurations.of(AppConfigWithCustomTracesSamplerCallback::class.java), ) .run { val options = it.getBean(SentryOptions::class.java) @@ -143,7 +143,7 @@ class EnableSentryTest { fun `configures custom before breadcrumb callback`() { ApplicationContextRunner() .withConfiguration( - UserConfigurations.of(AppConfigWithCustomBeforeBreadcrumbCallback::class.java) + UserConfigurations.of(AppConfigWithCustomBeforeBreadcrumbCallback::class.java), ) .run { val beforeBreadcrumbCallback = diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentryCheckInAdviceTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentryCheckInAdviceTest.kt index 84f6e2a8118..aa92ce52128 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentryCheckInAdviceTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentryCheckInAdviceTest.kt @@ -53,7 +53,7 @@ import org.springframework.util.StringValueResolver "my.cron.schedule = 0 30 2 * * *", "my.cron.zone = America/New_York", "my.cron.empty.zone = ", - ] + ], ) class SentryCheckInAdviceTest { diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentrySpringFilterTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentrySpringFilterTest.kt index 1c30ca58445..2adf22799f0 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentrySpringFilterTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentrySpringFilterTest.kt @@ -133,7 +133,7 @@ class SentrySpringFilterTest { MockMvcRequestBuilders.get(URI.create("http://example.com?param1=xyz")) .header("some-header", "some-header value") .accept(MediaType.APPLICATION_JSON) - .buildRequest(MockServletContext()) + .buildRequest(MockServletContext()), ) listener.doFilter(fixture.request, fixture.response, fixture.chain) @@ -157,7 +157,7 @@ class SentrySpringFilterTest { MockMvcRequestBuilders.get(URI.create("http://example.com?param1=xyz")) .header("another-header", "another value") .header("another-header", "another value2") - .buildRequest(MockServletContext()) + .buildRequest(MockServletContext()), ) listener.doFilter(fixture.request, fixture.response, fixture.chain) diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentryTaskDecoratorTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentryTaskDecoratorTest.kt index 1f0f74d25cf..949df61d412 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentryTaskDecoratorTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentryTaskDecoratorTest.kt @@ -43,7 +43,7 @@ class SentryTaskDecoratorTest { sut.decorate { assertNotEquals(mainScopes, Sentry.getCurrentScopes()) assertNotEquals(threadedScopes, Sentry.getCurrentScopes()) - } + }, ) callableFuture.get() diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentryUserFilterTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentryUserFilterTest.kt index 1cb91b1445f..d54772071a7 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentryUserFilterTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/SentryUserFilterTest.kt @@ -63,7 +63,7 @@ class SentryUserFilterTest { fun `when processor returns empty User, user data is not changed`() { val filter = fixture.getSut( - userProviders = listOf(SentryUserProvider { sampleUser }, SentryUserProvider { User() }) + userProviders = listOf(SentryUserProvider { sampleUser }, SentryUserProvider { User() }), ) filter.doFilter(fixture.request, fixture.response, fixture.chain) @@ -75,7 +75,7 @@ class SentryUserFilterTest { fun `when processor returns null, user data is not changed`() { val filter = fixture.getSut( - userProviders = listOf(SentryUserProvider { sampleUser }, SentryUserProvider { null }) + userProviders = listOf(SentryUserProvider { sampleUser }, SentryUserProvider { null }), ) filter.doFilter(fixture.request, fixture.response, fixture.chain) @@ -91,7 +91,7 @@ class SentryUserFilterTest { listOf( SentryUserProvider { User().apply { data = mapOf("key" to "value") } }, SentryUserProvider { User().apply { data = mapOf("new-key" to "new-value") } }, - ) + ), ) filter.doFilter(fixture.request, fixture.response, fixture.chain) @@ -166,7 +166,7 @@ class SentryUserFilterTest { SentryUserProvider { sampleUser }, SentryUserProvider { throw failure }, laterProvider, - ) + ), ) filter.doFilter(fixture.request, fixture.response, fixture.chain) @@ -184,7 +184,7 @@ class SentryUserFilterTest { assertThat( assertFailsWith { filter.doFilter(fixture.request, fixture.response, fixture.chain) - } + }, ) .isSameAs(failure) verify(fixture.chain, never()).doFilter(fixture.request, fixture.response) diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/TransactionNameProviderUtilsTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/TransactionNameProviderUtilsTest.kt index c1a91c15503..e6fda8e0c50 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/TransactionNameProviderUtilsTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/TransactionNameProviderUtilsTest.kt @@ -31,7 +31,7 @@ class TransactionNameProviderUtilsTest { assertThat( assertFailsWith { TransactionNameProviderUtils.provideTransactionName(provider, request, logger) - } + }, ) .isSameAs(failure) } diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/checkin/SentryScheduledCheckInTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/checkin/SentryScheduledCheckInTest.kt index 00a2864b3f3..8312264b730 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/checkin/SentryScheduledCheckInTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/checkin/SentryScheduledCheckInTest.kt @@ -177,11 +177,11 @@ class SentryScheduledCheckInTest { assertEquals("outer-inner-run2-fa", SentryCheckInAdvice.scheduledTaskSlug("Outer.Inner.run2FA")) val first = SentryCheckInAdvice.scheduledTaskSlug( - "AVeryLongScheduledJobClassNameForReporting.firstMethod" + "AVeryLongScheduledJobClassNameForReporting.firstMethod", ) val second = SentryCheckInAdvice.scheduledTaskSlug( - "AVeryLongScheduledJobClassNameForReporting.secondMethod" + "AVeryLongScheduledJobClassNameForReporting.secondMethod", ) assertTrue(first.length <= 50) assertTrue(first.startsWith("a-very-long-scheduled-job-class-name-for-")) @@ -189,7 +189,7 @@ class SentryScheduledCheckInTest { assertEquals( first, SentryCheckInAdvice.scheduledTaskSlug( - "AVeryLongScheduledJobClassNameForReporting.firstMethod" + "AVeryLongScheduledJobClassNameForReporting.firstMethod", ), ) } @@ -292,11 +292,11 @@ class SentryScheduledCheckInTest { @Bean open fun sentryScheduledCheckInAdvisor( - @Qualifier("sentryScheduledCheckInAdvice") advice: SentryCheckInAdvice + @Qualifier("sentryScheduledCheckInAdvice") advice: SentryCheckInAdvice, ): Advisor = DefaultPointcutAdvisor( SentryScheduledCheckInPointcut( - listOf("SentryScheduledCheckInTest.Jobs.excluded", ".*\\.ExcludedJobs\\..*", " ") + listOf("SentryScheduledCheckInTest.Jobs.excluded", ".*\\.ExcludedJobs\\..*", " "), ), advice, ) diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/graphql/SentrySpringSubscriptionHandlerTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/graphql/SentrySpringSubscriptionHandlerTest.kt index a8039ff7660..f0eb86f3e46 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/graphql/SentrySpringSubscriptionHandlerTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/graphql/SentrySpringSubscriptionHandlerTest.kt @@ -33,7 +33,7 @@ class SentrySpringSubscriptionHandlerTest { OperationDefinition.newOperationDefinition() .operation(OperationDefinition.Operation.QUERY) .name("testQuery") - .build() + .build(), ) .build() whenever(dataFetchingEnvironment.document).thenReturn(document) @@ -69,7 +69,7 @@ class SentrySpringSubscriptionHandlerTest { OperationDefinition.newOperationDefinition() .operation(OperationDefinition.Operation.QUERY) .name("testQuery") - .build() + .build(), ) .build() whenever(dataFetchingEnvironment.document).thenReturn(document) diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/kafka/SentryKafkaProducerBeanPostProcessorTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/kafka/SentryKafkaProducerBeanPostProcessorTest.kt index b3a1a268682..903f949f74b 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/kafka/SentryKafkaProducerBeanPostProcessorTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/kafka/SentryKafkaProducerBeanPostProcessorTest.kt @@ -42,7 +42,7 @@ class SentryKafkaProducerBeanPostProcessorTest { val captor = argumentCaptor>() verify(factory).addPostProcessor(captor.capture()) assertTrue( - captor.firstValue is SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor<*, *> + captor.firstValue is SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor<*, *>, ) } @@ -103,7 +103,7 @@ class SentryKafkaProducerBeanPostProcessorTest { assertEquals(1, factory.postProcessors.size) assertTrue( factory.postProcessors.first() - is SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor<*, *> + is SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor<*, *>, ) } } diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/tracing/SentrySpanClientHttpRequestInterceptorTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/tracing/SentrySpanClientHttpRequestInterceptorTest.kt index 504b6d7bd12..fd7a2f8882e 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/tracing/SentrySpanClientHttpRequestInterceptorTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/tracing/SentrySpanClientHttpRequestInterceptorTest.kt @@ -54,7 +54,7 @@ class SentrySpanClientHttpRequestInterceptorTest { } fun create( - config: Sentry.OptionsConfiguration + config: Sentry.OptionsConfiguration, ): SentrySpanClientHttpRequestInterceptor { config.configure(options) return SentrySpanClientHttpRequestInterceptor(scopes) diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/tracing/SentryTracingFilterTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/tracing/SentryTracingFilterTest.kt index 61fabb6d478..a13911b3f88 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/tracing/SentryTracingFilterTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/tracing/SentryTracingFilterTest.kt @@ -87,7 +87,10 @@ class SentryTracingFilterTest { } response.status = status whenever( - scopes.startTransaction(any(), check { assertTrue(it.isBindToScope) }) + scopes.startTransaction( + any(), + check { assertTrue(it.isBindToScope) }, + ), ) .thenAnswer { SentryTracer(it.arguments[0] as TransactionContext, scopes) } whenever(scopes.isEnabled).thenReturn(isEnabled) @@ -98,7 +101,7 @@ class SentryTracingFilterTest { it.arguments[0] as String?, it.arguments[1] as List?, null, - ) + ), ) } return SentryTracingFilter(scopes, transactionNameProvider, isAsyncSupportEnabled) @@ -313,7 +316,7 @@ class SentryTracingFilterTest { val sentryTraceHeaderString = "2722d9f6ec019ade60c776169d9a8904-$parentSpanId-1" val baggageHeaderStrings = listOf( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET", ) fixture.options.tracesSampleRate = null val filter = @@ -343,7 +346,7 @@ class SentryTracingFilterTest { val sentryTraceHeaderString = "2722d9f6ec019ade60c776169d9a8904-$parentSpanId-1" val baggageHeaderStrings = listOf( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET", ) fixture.options.tracesSampleRate = null fixture.options.setIgnoredSpanOrigins(listOf("auto.http.spring_jakarta.webmvc")) @@ -373,7 +376,7 @@ class SentryTracingFilterTest { val sentryTrace = "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1" val baggage = listOf( - "baggage: sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d" + "baggage: sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", ) val filter = fixture.getSut( @@ -442,7 +445,7 @@ class SentryTracingFilterTest { val sentryTrace = "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1" val baggage = listOf( - "baggage: sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d" + "baggage: sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", ) val filter = fixture.getSut( diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/tracing/SentryTransactionAdviceTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/tracing/SentryTransactionAdviceTest.kt index ed9c1f9abb4..87bbb64fc47 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/tracing/SentryTransactionAdviceTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/tracing/SentryTransactionAdviceTest.kt @@ -55,7 +55,7 @@ class SentryTransactionAdviceTest { assertTrue(it.isBindToScope) assertThat(it.origin).isEqualTo("auto.function.spring_jakarta.advice") }, - ) + ), ) .thenAnswer { SentryTracer(it.arguments[0] as TransactionContext, scopes) } whenever(scopes.options) diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/webflux/SentryScheduleHookTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/webflux/SentryScheduleHookTest.kt index 07249866a7e..53251df10bb 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/webflux/SentryScheduleHookTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/webflux/SentryScheduleHookTest.kt @@ -45,7 +45,7 @@ class SentryScheduleHookTest { sut.apply { assertNotEquals(mainScopes, Sentry.getCurrentScopes()) assertNotEquals(threadedScopes, Sentry.getCurrentScopes()) - } + }, ) callableFuture.get() diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/webflux/SentryWebFluxTracingFilterTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/webflux/SentryWebFluxTracingFilterTest.kt index 0a01b4cbcc4..035a5266ef4 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/webflux/SentryWebFluxTracingFilterTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/webflux/SentryWebFluxTracingFilterTest.kt @@ -87,7 +87,10 @@ class SentryWebFluxTracingFilterTest { ) exchange.response.statusCode = status whenever( - scopes.startTransaction(any(), check { assertTrue(it.isBindToScope) }) + scopes.startTransaction( + any(), + check { assertTrue(it.isBindToScope) }, + ), ) .thenAnswer { SentryTracer(it.arguments[0] as TransactionContext, scopes) } whenever(scopes.isEnabled).thenReturn(isEnabled) @@ -99,7 +102,7 @@ class SentryWebFluxTracingFilterTest { it.arguments[0] as String?, it.arguments[1] as List?, null, - ) + ), ) } return SentryWebFilter(scopes) @@ -326,7 +329,7 @@ class SentryWebFluxTracingFilterTest { val sentryTraceHeaderString = "2722d9f6ec019ade60c776169d9a8904-$parentSpanId-1" val baggageHeaderStrings = listOf( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET", ) fixture.options.tracesSampleRate = null val filter = @@ -358,7 +361,7 @@ class SentryWebFluxTracingFilterTest { val sentryTraceHeaderString = "2722d9f6ec019ade60c776169d9a8904-$parentSpanId-1" val baggageHeaderStrings = listOf( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET", ) fixture.options.tracesSampleRate = null fixture.options.setIgnoredSpanOrigins(listOf("auto.spring_jakarta.webflux")) diff --git a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/webflux/SentryWebfluxIntegrationTest.kt b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/webflux/SentryWebfluxIntegrationTest.kt index e3b3ed55a7c..f3ef34984fc 100644 --- a/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/webflux/SentryWebfluxIntegrationTest.kt +++ b/sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/webflux/SentryWebfluxIntegrationTest.kt @@ -136,7 +136,7 @@ class SentryWebfluxIntegrationTest { } @SpringBootApplication( - exclude = [ReactiveSecurityAutoConfiguration::class, SecurityAutoConfiguration::class] + exclude = [ReactiveSecurityAutoConfiguration::class, SecurityAutoConfiguration::class], ) open class App { private val transport = mock().also { whenever(it.isHealthy).thenReturn(true) } diff --git a/sentry-spring/src/integrationTest/kotlin/io/sentry/spring/integrationtest/MetricsIntegrationTest.kt b/sentry-spring/src/integrationTest/kotlin/io/sentry/spring/integrationtest/MetricsIntegrationTest.kt index d2e524a3bb3..65b829d3543 100644 --- a/sentry-spring/src/integrationTest/kotlin/io/sentry/spring/integrationtest/MetricsIntegrationTest.kt +++ b/sentry-spring/src/integrationTest/kotlin/io/sentry/spring/integrationtest/MetricsIntegrationTest.kt @@ -35,7 +35,7 @@ class MetricsIntegrationTest : IntegrationTest() { .isEqualTo("distribution metric tracked") assertThat( - awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0) + awaitMetric("distributionMetric").hasMetric("distributionMetric", "distribution", 23.0), ) .isTrue() } diff --git a/sentry-spring/src/main/java/io/sentry/spring/SentrySpringFilter.java b/sentry-spring/src/main/java/io/sentry/spring/SentrySpringFilter.java index 5108238f4ad..4718ee982b1 100644 --- a/sentry-spring/src/main/java/io/sentry/spring/SentrySpringFilter.java +++ b/sentry-spring/src/main/java/io/sentry/spring/SentrySpringFilter.java @@ -84,23 +84,22 @@ protected void doFilterInternal( private void configureScope( final @NotNull IScopes scopes, final @NotNull HttpServletRequest request) { try { - scopes.configureScope( - scope -> { - // set basic request information on the scope - scope.setRequest(requestResolver.resolveSentryRequest(request)); - // transaction name is known at the later stage of request processing, thus it cannot - // be set on the scope - scope.addEventProcessor( - new SentryRequestHttpServletRequestProcessor( - transactionNameProvider, request, scopes.getOptions().getLogger())); - // only if request caches body, add an event processor that sets body on the event - // body is not on the scope, to avoid using memory when no event is triggered during - // request processing - if (request instanceof ContentCachingRequestWrapper) { - scope.addEventProcessor( - new RequestBodyExtractingEventProcessor(request, scopes.getOptions())); - } - }); + scopes.configureScope(scope -> { + // set basic request information on the scope + scope.setRequest(requestResolver.resolveSentryRequest(request)); + // transaction name is known at the later stage of request processing, thus it cannot + // be set on the scope + scope.addEventProcessor( + new SentryRequestHttpServletRequestProcessor( + transactionNameProvider, request, scopes.getOptions().getLogger())); + // only if request caches body, add an event processor that sets body on the event + // body is not on the scope, to avoid using memory when no event is triggered during + // request processing + if (request instanceof ContentCachingRequestWrapper) { + scope.addEventProcessor( + new RequestBodyExtractingEventProcessor(request, scopes.getOptions())); + } + }); } catch (Throwable e) { scopes .getOptions() diff --git a/sentry-spring/src/main/java/io/sentry/spring/graphql/SentryBatchLoaderRegistry.java b/sentry-spring/src/main/java/io/sentry/spring/graphql/SentryBatchLoaderRegistry.java index 5fe8eb265a7..e28ea6f4752 100644 --- a/sentry-spring/src/main/java/io/sentry/spring/graphql/SentryBatchLoaderRegistry.java +++ b/sentry-spring/src/main/java/io/sentry/spring/graphql/SentryBatchLoaderRegistry.java @@ -87,23 +87,21 @@ public BatchLoaderRegistry.RegistrationSpec withOptions(DataLoaderOptions @Override public void registerBatchLoader(BiFunction, BatchLoaderEnvironment, Flux> loader) { - delegate.registerBatchLoader( - (keys, batchLoaderEnvironment) -> { - scopesFromContext(batchLoaderEnvironment) - .addBreadcrumb(Breadcrumb.graphqlDataLoader(keys, keyType, valueType, name)); - return loader.apply(keys, batchLoaderEnvironment); - }); + delegate.registerBatchLoader((keys, batchLoaderEnvironment) -> { + scopesFromContext(batchLoaderEnvironment) + .addBreadcrumb(Breadcrumb.graphqlDataLoader(keys, keyType, valueType, name)); + return loader.apply(keys, batchLoaderEnvironment); + }); } @Override public void registerMappedBatchLoader( BiFunction, BatchLoaderEnvironment, Mono>> loader) { - delegate.registerMappedBatchLoader( - (keys, batchLoaderEnvironment) -> { - scopesFromContext(batchLoaderEnvironment) - .addBreadcrumb(Breadcrumb.graphqlDataLoader(keys, keyType, valueType, name)); - return loader.apply(keys, batchLoaderEnvironment); - }); + delegate.registerMappedBatchLoader((keys, batchLoaderEnvironment) -> { + scopesFromContext(batchLoaderEnvironment) + .addBreadcrumb(Breadcrumb.graphqlDataLoader(keys, keyType, valueType, name)); + return loader.apply(keys, batchLoaderEnvironment); + }); } private @NotNull IScopes scopesFromContext(final @NotNull BatchLoaderEnvironment environment) { diff --git a/sentry-spring/src/main/java/io/sentry/spring/graphql/SentryDgsSubscriptionHandler.java b/sentry-spring/src/main/java/io/sentry/spring/graphql/SentryDgsSubscriptionHandler.java index 5a003ade2d7..62156749bfa 100644 --- a/sentry-spring/src/main/java/io/sentry/spring/graphql/SentryDgsSubscriptionHandler.java +++ b/sentry-spring/src/main/java/io/sentry/spring/graphql/SentryDgsSubscriptionHandler.java @@ -22,12 +22,11 @@ public SentryDgsSubscriptionHandler() { final @NotNull InstrumentationFieldFetchParameters parameters) { if (result instanceof Flux) { final @NotNull Flux flux = (Flux) result; - return flux.doOnError( - throwable -> { - final @NotNull ExceptionReporter.ExceptionDetails exceptionDetails = - new ExceptionReporter.ExceptionDetails(scopes, parameters.getEnvironment(), true); - exceptionReporter.captureThrowable(throwable, exceptionDetails, null); - }); + return flux.doOnError(throwable -> { + final @NotNull ExceptionReporter.ExceptionDetails exceptionDetails = + new ExceptionReporter.ExceptionDetails(scopes, parameters.getEnvironment(), true); + exceptionReporter.captureThrowable(throwable, exceptionDetails, null); + }); } return result; } diff --git a/sentry-spring/src/main/java/io/sentry/spring/graphql/SentrySpringSubscriptionHandler.java b/sentry-spring/src/main/java/io/sentry/spring/graphql/SentrySpringSubscriptionHandler.java index b3f0b9830ee..b10502f7154 100644 --- a/sentry-spring/src/main/java/io/sentry/spring/graphql/SentrySpringSubscriptionHandler.java +++ b/sentry-spring/src/main/java/io/sentry/spring/graphql/SentrySpringSubscriptionHandler.java @@ -18,17 +18,15 @@ public final class SentrySpringSubscriptionHandler implements SentrySubscription final @NotNull InstrumentationFieldFetchParameters parameters) { if (result instanceof Flux) { final @NotNull Flux flux = (Flux) result; - return flux.doOnError( - throwable -> { - final @NotNull ExceptionReporter.ExceptionDetails exceptionDetails = - new ExceptionReporter.ExceptionDetails(scopes, parameters.getEnvironment(), true); - if (throwable instanceof SubscriptionPublisherException - && throwable.getCause() != null) { - exceptionReporter.captureThrowable(throwable.getCause(), exceptionDetails, null); - } else { - exceptionReporter.captureThrowable(throwable, exceptionDetails, null); - } - }); + return flux.doOnError(throwable -> { + final @NotNull ExceptionReporter.ExceptionDetails exceptionDetails = + new ExceptionReporter.ExceptionDetails(scopes, parameters.getEnvironment(), true); + if (throwable instanceof SubscriptionPublisherException && throwable.getCause() != null) { + exceptionReporter.captureThrowable(throwable.getCause(), exceptionDetails, null); + } else { + exceptionReporter.captureThrowable(throwable, exceptionDetails, null); + } + }); } return result; } diff --git a/sentry-spring/src/main/java/io/sentry/spring/tracing/SentrySpanClientWebRequestFilter.java b/sentry-spring/src/main/java/io/sentry/spring/tracing/SentrySpanClientWebRequestFilter.java index eda50c41af2..f650ee4c053 100644 --- a/sentry-spring/src/main/java/io/sentry/spring/tracing/SentrySpanClientWebRequestFilter.java +++ b/sentry-spring/src/main/java/io/sentry/spring/tracing/SentrySpanClientWebRequestFilter.java @@ -55,22 +55,20 @@ public SentrySpanClientWebRequestFilter(final @NotNull IScopes scopes) { final ClientRequest clientRequestWithSentryTraceHeader = maybeAddHeaders(request, span); return next.exchange(clientRequestWithSentryTraceHeader) - .flatMap( - response -> { - span.setData(SpanDataConvention.HTTP_STATUS_CODE_KEY, response.statusCode().value()); - span.setStatus(SpanStatus.fromHttpStatusCode(response.statusCode().value())); - addBreadcrumb(request, response); - span.finish(); - return Mono.just(response); - }) - .onErrorMap( - throwable -> { - span.setThrowable(throwable); - span.setStatus(SpanStatus.INTERNAL_ERROR); - addBreadcrumb(request, null); - span.finish(); - return throwable; - }); + .flatMap(response -> { + span.setData(SpanDataConvention.HTTP_STATUS_CODE_KEY, response.statusCode().value()); + span.setStatus(SpanStatus.fromHttpStatusCode(response.statusCode().value())); + addBreadcrumb(request, response); + span.finish(); + return Mono.just(response); + }) + .onErrorMap(throwable -> { + span.setThrowable(throwable); + span.setStatus(SpanStatus.INTERNAL_ERROR); + addBreadcrumb(request, null); + span.finish(); + return throwable; + }); } private ClientRequest maybeAddHeaders( @@ -95,11 +93,10 @@ private ClientRequest maybeAddHeaders( final @Nullable BaggageHeader baggageHeader = tracingHeaders.getBaggageHeader(); if (baggageHeader != null) { - requestBuilder.headers( - httpHeaders -> { - httpHeaders.remove(BaggageHeader.BAGGAGE_HEADER); - httpHeaders.add(baggageHeader.getName(), baggageHeader.getValue()); - }); + requestBuilder.headers(httpHeaders -> { + httpHeaders.remove(BaggageHeader.BAGGAGE_HEADER); + httpHeaders.add(baggageHeader.getName(), baggageHeader.getValue()); + }); } } diff --git a/sentry-spring/src/main/java/io/sentry/spring/webflux/SentryWebFilter.java b/sentry-spring/src/main/java/io/sentry/spring/webflux/SentryWebFilter.java index 30d1152b88a..a592dde46a2 100644 --- a/sentry-spring/src/main/java/io/sentry/spring/webflux/SentryWebFilter.java +++ b/sentry-spring/src/main/java/io/sentry/spring/webflux/SentryWebFilter.java @@ -77,41 +77,38 @@ isTracingEnabled && shouldTraceRequest(requestScopes, request) return webFilterChain .filter(serverWebExchange) - .doFinally( - __ -> { - if (transaction != null) { - finishTransaction(serverWebExchange, transaction); - } - Sentry.setCurrentScopes(NoOpScopes.getInstance()); - }) - .doOnError( - e -> { - if (transaction != null) { - transaction.setStatus(SpanStatus.INTERNAL_ERROR); - transaction.setThrowable(e); - } - }) - .doFirst( - () -> { - serverWebExchange.getAttributes().put(SENTRY_SCOPES_KEY, requestScopes); - Sentry.setCurrentScopes(requestScopes); - final ServerHttpResponse response = serverWebExchange.getResponse(); - - final Hint hint = new Hint(); - hint.set(WEBFLUX_FILTER_REQUEST, request); - hint.set(WEBFLUX_FILTER_RESPONSE, response); - final String methodName = - request.getMethod() != null ? request.getMethod().name() : "unknown"; - final @NotNull Breadcrumb breadcrumb = - Breadcrumb.http( - request.getURI().toString(), - methodName, - null, - requestScopes.getOptions().getDataCollectionResolver()); - requestScopes.addBreadcrumb(breadcrumb, hint); - requestScopes.configureScope( - scope -> scope.setRequest(sentryRequestResolver.resolveSentryRequest(request))); - }); + .doFinally(__ -> { + if (transaction != null) { + finishTransaction(serverWebExchange, transaction); + } + Sentry.setCurrentScopes(NoOpScopes.getInstance()); + }) + .doOnError(e -> { + if (transaction != null) { + transaction.setStatus(SpanStatus.INTERNAL_ERROR); + transaction.setThrowable(e); + } + }) + .doFirst(() -> { + serverWebExchange.getAttributes().put(SENTRY_SCOPES_KEY, requestScopes); + Sentry.setCurrentScopes(requestScopes); + final ServerHttpResponse response = serverWebExchange.getResponse(); + + final Hint hint = new Hint(); + hint.set(WEBFLUX_FILTER_REQUEST, request); + hint.set(WEBFLUX_FILTER_RESPONSE, response); + final String methodName = + request.getMethod() != null ? request.getMethod().name() : "unknown"; + final @NotNull Breadcrumb breadcrumb = + Breadcrumb.http( + request.getURI().toString(), + methodName, + null, + requestScopes.getOptions().getDataCollectionResolver()); + requestScopes.addBreadcrumb(breadcrumb, hint); + requestScopes.configureScope( + scope -> scope.setRequest(sentryRequestResolver.resolveSentryRequest(request))); + }); } private boolean isIgnored(final @NotNull IScopes scopes) { @@ -162,10 +159,9 @@ private void finishTransaction(ServerWebExchange exchange, ITransaction transact if (rawStatusCode != null) { transaction .getContexts() - .withResponse( - (sentryResponse) -> { - sentryResponse.setStatusCode(rawStatusCode); - }); + .withResponse(sentryResponse -> { + sentryResponse.setStatusCode(rawStatusCode); + }); if (transaction.getStatus() == null) { transaction.setStatus(SpanStatus.fromHttpStatusCode(rawStatusCode)); } diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/EnableSentryTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/EnableSentryTest.kt index f2277128ec8..a54799d89d6 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/EnableSentryTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/EnableSentryTest.kt @@ -84,7 +84,7 @@ class EnableSentryTest { fun `creates SentryExceptionResolver with order set in the @EnableSentry annotation`() { ApplicationContextRunner() .withConfiguration( - UserConfigurations.of(AppConfigWithExceptionResolverOrderIntegerMaxValue::class.java) + UserConfigurations.of(AppConfigWithExceptionResolverOrderIntegerMaxValue::class.java), ) .run { assertThat(it).hasSingleBean(SentryExceptionResolver::class.java) @@ -98,7 +98,7 @@ class EnableSentryTest { fun `configures custom TracesSamplerCallback`() { ApplicationContextRunner() .withConfiguration( - UserConfigurations.of(AppConfigWithCustomTracesSamplerCallback::class.java) + UserConfigurations.of(AppConfigWithCustomTracesSamplerCallback::class.java), ) .run { val options = it.getBean(SentryOptions::class.java) @@ -143,7 +143,7 @@ class EnableSentryTest { fun `configures custom before breadcrumb callback`() { ApplicationContextRunner() .withConfiguration( - UserConfigurations.of(AppConfigWithCustomBeforeBreadcrumbCallback::class.java) + UserConfigurations.of(AppConfigWithCustomBeforeBreadcrumbCallback::class.java), ) .run { val beforeBreadcrumbCallback = diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/SentryCheckInAdviceTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/SentryCheckInAdviceTest.kt index 0bac0df528c..7b687e90377 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/SentryCheckInAdviceTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/SentryCheckInAdviceTest.kt @@ -54,7 +54,7 @@ import org.springframework.util.StringValueResolver "my.cron.schedule = 0 30 2 * * *", "my.cron.zone = America/New_York", "my.cron.empty.zone = ", - ] + ], ) class SentryCheckInAdviceTest { diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/SentrySpringFilterTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/SentrySpringFilterTest.kt index 8a265eea8a7..c38da356b7f 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/SentrySpringFilterTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/SentrySpringFilterTest.kt @@ -133,7 +133,7 @@ class SentrySpringFilterTest { MockMvcRequestBuilders.get(URI.create("http://example.com?param1=xyz")) .header("some-header", "some-header value") .accept(MediaType.APPLICATION_JSON) - .buildRequest(MockServletContext()) + .buildRequest(MockServletContext()), ) listener.doFilter(fixture.request, fixture.response, fixture.chain) @@ -157,7 +157,7 @@ class SentrySpringFilterTest { MockMvcRequestBuilders.get(URI.create("http://example.com?param1=xyz")) .header("another-header", "another value") .header("another-header", "another value2") - .buildRequest(MockServletContext()) + .buildRequest(MockServletContext()), ) listener.doFilter(fixture.request, fixture.response, fixture.chain) diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/SentryTaskDecoratorTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/SentryTaskDecoratorTest.kt index 5fc955d0031..ee6bd57bd69 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/SentryTaskDecoratorTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/SentryTaskDecoratorTest.kt @@ -43,7 +43,7 @@ class SentryTaskDecoratorTest { sut.decorate { assertNotEquals(mainScopes, Sentry.getCurrentScopes()) assertNotEquals(threadedScopes, Sentry.getCurrentScopes()) - } + }, ) callableFuture.get() diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/SentryUserFilterTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/SentryUserFilterTest.kt index 8c0ed0f2f92..21730ea451f 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/SentryUserFilterTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/SentryUserFilterTest.kt @@ -63,7 +63,7 @@ class SentryUserFilterTest { fun `when processor returns empty User, user data is not changed`() { val filter = fixture.getSut( - userProviders = listOf(SentryUserProvider { sampleUser }, SentryUserProvider { User() }) + userProviders = listOf(SentryUserProvider { sampleUser }, SentryUserProvider { User() }), ) filter.doFilter(fixture.request, fixture.response, fixture.chain) @@ -75,7 +75,7 @@ class SentryUserFilterTest { fun `when processor returns null, user data is not changed`() { val filter = fixture.getSut( - userProviders = listOf(SentryUserProvider { sampleUser }, SentryUserProvider { null }) + userProviders = listOf(SentryUserProvider { sampleUser }, SentryUserProvider { null }), ) filter.doFilter(fixture.request, fixture.response, fixture.chain) @@ -91,7 +91,7 @@ class SentryUserFilterTest { listOf( SentryUserProvider { User().apply { data = mapOf("key" to "value") } }, SentryUserProvider { User().apply { data = mapOf("new-key" to "new-value") } }, - ) + ), ) filter.doFilter(fixture.request, fixture.response, fixture.chain) @@ -166,7 +166,7 @@ class SentryUserFilterTest { SentryUserProvider { sampleUser }, SentryUserProvider { throw failure }, laterProvider, - ) + ), ) filter.doFilter(fixture.request, fixture.response, fixture.chain) @@ -184,7 +184,7 @@ class SentryUserFilterTest { assertThat( assertFailsWith { filter.doFilter(fixture.request, fixture.response, fixture.chain) - } + }, ) .isSameAs(failure) verify(fixture.chain, never()).doFilter(fixture.request, fixture.response) diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/TransactionNameProviderUtilsTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/TransactionNameProviderUtilsTest.kt index 550a1438e82..da440fee291 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/TransactionNameProviderUtilsTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/TransactionNameProviderUtilsTest.kt @@ -31,7 +31,7 @@ class TransactionNameProviderUtilsTest { assertThat( assertFailsWith { TransactionNameProviderUtils.provideTransactionName(provider, request, logger) - } + }, ) .isSameAs(failure) } diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/checkin/SentryScheduledCheckInTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/checkin/SentryScheduledCheckInTest.kt index 1af18fe95f0..08d45e47943 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/checkin/SentryScheduledCheckInTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/checkin/SentryScheduledCheckInTest.kt @@ -177,11 +177,11 @@ class SentryScheduledCheckInTest { assertEquals("outer-inner-run2-fa", SentryCheckInAdvice.scheduledTaskSlug("Outer.Inner.run2FA")) val first = SentryCheckInAdvice.scheduledTaskSlug( - "AVeryLongScheduledJobClassNameForReporting.firstMethod" + "AVeryLongScheduledJobClassNameForReporting.firstMethod", ) val second = SentryCheckInAdvice.scheduledTaskSlug( - "AVeryLongScheduledJobClassNameForReporting.secondMethod" + "AVeryLongScheduledJobClassNameForReporting.secondMethod", ) assertTrue(first.length <= 50) assertTrue(first.startsWith("a-very-long-scheduled-job-class-name-for-")) @@ -189,7 +189,7 @@ class SentryScheduledCheckInTest { assertEquals( first, SentryCheckInAdvice.scheduledTaskSlug( - "AVeryLongScheduledJobClassNameForReporting.firstMethod" + "AVeryLongScheduledJobClassNameForReporting.firstMethod", ), ) } @@ -292,11 +292,11 @@ class SentryScheduledCheckInTest { @Bean open fun sentryScheduledCheckInAdvisor( - @Qualifier("sentryScheduledCheckInAdvice") advice: SentryCheckInAdvice + @Qualifier("sentryScheduledCheckInAdvice") advice: SentryCheckInAdvice, ): Advisor = DefaultPointcutAdvisor( SentryScheduledCheckInPointcut( - listOf("SentryScheduledCheckInTest.Jobs.excluded", ".*\\.ExcludedJobs\\..*", " ") + listOf("SentryScheduledCheckInTest.Jobs.excluded", ".*\\.ExcludedJobs\\..*", " "), ), advice, ) diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/graphql/SentrySpringSubscriptionHandlerTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/graphql/SentrySpringSubscriptionHandlerTest.kt index 03b11629fb4..bc4e8033e0c 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/graphql/SentrySpringSubscriptionHandlerTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/graphql/SentrySpringSubscriptionHandlerTest.kt @@ -32,7 +32,7 @@ class SentrySpringSubscriptionHandlerTest { OperationDefinition.newOperationDefinition() .operation(OperationDefinition.Operation.QUERY) .name("testQuery") - .build() + .build(), ) .build() whenever(dataFetchingEnvironment.document).thenReturn(document) @@ -68,7 +68,7 @@ class SentrySpringSubscriptionHandlerTest { OperationDefinition.newOperationDefinition() .operation(OperationDefinition.Operation.QUERY) .name("testQuery") - .build() + .build(), ) .build() whenever(dataFetchingEnvironment.document).thenReturn(document) diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/kafka/SentryKafkaProducerBeanPostProcessorTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/kafka/SentryKafkaProducerBeanPostProcessorTest.kt index 11a943307c8..75a68b3a1b1 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/kafka/SentryKafkaProducerBeanPostProcessorTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/kafka/SentryKafkaProducerBeanPostProcessorTest.kt @@ -28,7 +28,7 @@ class SentryKafkaProducerBeanPostProcessorTest { val captor = argumentCaptor>() verify(factory).addPostProcessor(captor.capture()) assertTrue( - captor.firstValue is SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor<*, *> + captor.firstValue is SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor<*, *>, ) } @@ -89,7 +89,7 @@ class SentryKafkaProducerBeanPostProcessorTest { assertEquals(1, factory.postProcessors.size) assertTrue( factory.postProcessors.first() - is SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor<*, *> + is SentryKafkaProducerBeanPostProcessor.SentryProducerPostProcessor<*, *>, ) } } diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/tracing/SentrySpanClientHttpRequestInterceptorTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/tracing/SentrySpanClientHttpRequestInterceptorTest.kt index 6531cd7fd04..efe9a1ca12f 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/tracing/SentrySpanClientHttpRequestInterceptorTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/tracing/SentrySpanClientHttpRequestInterceptorTest.kt @@ -54,7 +54,7 @@ class SentrySpanClientHttpRequestInterceptorTest { } fun create( - config: Sentry.OptionsConfiguration + config: Sentry.OptionsConfiguration, ): SentrySpanClientHttpRequestInterceptor { config.configure(options) return SentrySpanClientHttpRequestInterceptor(scopes) diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/tracing/SentryTracingFilterTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/tracing/SentryTracingFilterTest.kt index acfcdb4ebab..9039fa01e33 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/tracing/SentryTracingFilterTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/tracing/SentryTracingFilterTest.kt @@ -87,7 +87,10 @@ class SentryTracingFilterTest { } response.status = status whenever( - scopes.startTransaction(any(), check { assertTrue(it.isBindToScope) }) + scopes.startTransaction( + any(), + check { assertTrue(it.isBindToScope) }, + ), ) .thenAnswer { SentryTracer(it.arguments[0] as TransactionContext, scopes) } whenever(scopes.isEnabled).thenReturn(isEnabled) @@ -98,7 +101,7 @@ class SentryTracingFilterTest { it.arguments[0] as String?, it.arguments[1] as List?, null, - ) + ), ) } return SentryTracingFilter(scopes, transactionNameProvider, isAsyncSupportEnabled) @@ -313,7 +316,7 @@ class SentryTracingFilterTest { val sentryTraceHeaderString = "2722d9f6ec019ade60c776169d9a8904-$parentSpanId-1" val baggageHeaderStrings = listOf( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET", ) fixture.options.tracesSampleRate = null val filter = @@ -343,7 +346,7 @@ class SentryTracingFilterTest { val sentryTraceHeaderString = "2722d9f6ec019ade60c776169d9a8904-$parentSpanId-1" val baggageHeaderStrings = listOf( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET", ) fixture.options.tracesSampleRate = null fixture.options.setIgnoredSpanOrigins(listOf("auto.http.spring.webmvc")) @@ -373,7 +376,7 @@ class SentryTracingFilterTest { val sentryTrace = "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1" val baggage = listOf( - "baggage: sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d" + "baggage: sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", ) val filter = fixture.getSut( @@ -442,7 +445,7 @@ class SentryTracingFilterTest { val sentryTrace = "f9118105af4a2d42b4124532cd1065ff-424cffc8f94feeee-1" val baggage = listOf( - "baggage: sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d" + "baggage: sentry-environment=production,sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rand=0.456789,sentry-sample_rate=0.5,sentry-sampled=true,sentry-trace_id=df71f5972f754b4c85af13ff5c07017d", ) val filter = fixture.getSut( diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/tracing/SentryTransactionAdviceTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/tracing/SentryTransactionAdviceTest.kt index e398290a966..a7fb87afb0a 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/tracing/SentryTransactionAdviceTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/tracing/SentryTransactionAdviceTest.kt @@ -55,7 +55,7 @@ class SentryTransactionAdviceTest { assertTrue(it.isBindToScope) assertThat(it.origin).isEqualTo("auto.function.spring.advice") }, - ) + ), ) .thenAnswer { SentryTracer(it.arguments[0] as TransactionContext, scopes) } whenever(scopes.options) diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/webflux/SentryScheduleHookTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/webflux/SentryScheduleHookTest.kt index 2c45bf1daa8..511fcdbe826 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/webflux/SentryScheduleHookTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/webflux/SentryScheduleHookTest.kt @@ -45,7 +45,7 @@ class SentryScheduleHookTest { sut.apply { assertNotEquals(mainScopes, Sentry.getCurrentScopes()) assertNotEquals(threadedScopes, Sentry.getCurrentScopes()) - } + }, ) callableFuture.get() diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/webflux/SentryWebFluxTracingFilterTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/webflux/SentryWebFluxTracingFilterTest.kt index 326b5979991..c72506e7e90 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/webflux/SentryWebFluxTracingFilterTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/webflux/SentryWebFluxTracingFilterTest.kt @@ -87,7 +87,10 @@ class SentryWebFluxTracingFilterTest { ) exchange.response.statusCode = status whenever( - scopes.startTransaction(any(), check { assertTrue(it.isBindToScope) }) + scopes.startTransaction( + any(), + check { assertTrue(it.isBindToScope) }, + ), ) .thenAnswer { SentryTracer(it.arguments[0] as TransactionContext, scopes) } whenever(scopes.isEnabled).thenReturn(isEnabled) @@ -99,7 +102,7 @@ class SentryWebFluxTracingFilterTest { it.arguments[0] as String?, it.arguments[1] as List?, null, - ) + ), ) } return SentryWebFilter(scopes) @@ -327,7 +330,7 @@ class SentryWebFluxTracingFilterTest { val sentryTraceHeaderString = "2722d9f6ec019ade60c776169d9a8904-$parentSpanId-1" val baggageHeaderStrings = listOf( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET", ) fixture.options.tracesSampleRate = null val filter = @@ -359,7 +362,7 @@ class SentryWebFluxTracingFilterTest { val sentryTraceHeaderString = "2722d9f6ec019ade60c776169d9a8904-$parentSpanId-1" val baggageHeaderStrings = listOf( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET", ) fixture.options.tracesSampleRate = null fixture.options.setIgnoredSpanOrigins(listOf("auto.spring.webflux")) diff --git a/sentry-spring/src/test/kotlin/io/sentry/spring/webflux/SentryWebfluxIntegrationTest.kt b/sentry-spring/src/test/kotlin/io/sentry/spring/webflux/SentryWebfluxIntegrationTest.kt index f1ace818f6d..8c026dfabc7 100644 --- a/sentry-spring/src/test/kotlin/io/sentry/spring/webflux/SentryWebfluxIntegrationTest.kt +++ b/sentry-spring/src/test/kotlin/io/sentry/spring/webflux/SentryWebfluxIntegrationTest.kt @@ -139,7 +139,7 @@ class SentryWebfluxIntegrationTest { } @SpringBootApplication( - exclude = [ReactiveSecurityAutoConfiguration::class, SecurityAutoConfiguration::class] + exclude = [ReactiveSecurityAutoConfiguration::class, SecurityAutoConfiguration::class], ) open class App { private val transport = mock().also { whenever(it.isHealthy).thenReturn(true) } diff --git a/sentry-test-support/src/main/kotlin/io/sentry/Assertions.kt b/sentry-test-support/src/main/kotlin/io/sentry/Assertions.kt index 43b083d50e9..4520dc063b7 100644 --- a/sentry-test-support/src/main/kotlin/io/sentry/Assertions.kt +++ b/sentry-test-support/src/main/kotlin/io/sentry/Assertions.kt @@ -59,7 +59,7 @@ inline fun assertEnvelopeItem( SentryOptions().apply { isDebug = true setLogger(logger) - } + }, ) .deserialize(it.data.inputStream().reader(), T::class.java) deserialized?.let { Pair(index, it) } @@ -123,7 +123,7 @@ private inline fun check(noinline predicate: (T) -> Unit): T = If you are trying to verify an argument to be null, use `isNull()`. If you are using `check` as part of a stubbing, use `argThat` or `argForWhich` instead. """ - .trimIndent() + .trimIndent(), ) } diff --git a/sentry-test-support/src/main/kotlin/io/sentry/test/MockSentryServer.kt b/sentry-test-support/src/main/kotlin/io/sentry/test/MockSentryServer.kt index 0275036526a..d6667eb6d06 100644 --- a/sentry-test-support/src/main/kotlin/io/sentry/test/MockSentryServer.kt +++ b/sentry-test-support/src/main/kotlin/io/sentry/test/MockSentryServer.kt @@ -56,7 +56,7 @@ class MockSentryServer(private val beforeEachCheck: () -> Unit = {}) : Closeable } if (deadline.hasPassed()) { throw AssertionError( - "No matching envelope within ${timeoutMillis}ms, received ${received.size} envelopes" + "No matching envelope within ${timeoutMillis}ms, received ${received.size} envelopes", ) } Thread.sleep(POLL_INTERVAL_MILLIS) diff --git a/sentry/src/main/java/io/sentry/EnvelopeSender.java b/sentry/src/main/java/io/sentry/EnvelopeSender.java index 9f630fc2602..0aed2d62614 100644 --- a/sentry/src/main/java/io/sentry/EnvelopeSender.java +++ b/sentry/src/main/java/io/sentry/EnvelopeSender.java @@ -67,7 +67,7 @@ protected void processFile(final @NotNull File file, final @NotNull Hint hint) { hint, Flushable.class, logger, - (flushable) -> { + flushable -> { if (!flushable.waitFlush()) { logger.log(SentryLevel.WARNING, "Timed out waiting for envelope submission."); } @@ -83,7 +83,7 @@ protected void processFile(final @NotNull File file, final @NotNull Hint hint) { hint, Retryable.class, logger, - (retryable) -> { + retryable -> { retryable.setRetry(false); logger.log(SentryLevel.INFO, e, "File '%s' won't retry.", file.getAbsolutePath()); }); @@ -93,7 +93,7 @@ protected void processFile(final @NotNull File file, final @NotNull Hint hint) { hint, Retryable.class, logger, - (retryable) -> { + retryable -> { if (!retryable.isRetry()) { safeDelete(file, "after trying to capture it"); logger.log(SentryLevel.DEBUG, "Deleted file %s.", file.getAbsolutePath()); diff --git a/sentry/src/main/java/io/sentry/OutboxSender.java b/sentry/src/main/java/io/sentry/OutboxSender.java index cbe4f6ee007..21952dc0c5a 100644 --- a/sentry/src/main/java/io/sentry/OutboxSender.java +++ b/sentry/src/main/java/io/sentry/OutboxSender.java @@ -82,7 +82,7 @@ protected void processFile(final @NotNull File file, @NotNull Hint hint) { hint, Retryable.class, logger, - (retryable) -> { + retryable -> { if (!retryable.isRetry()) { try { if (!file.delete()) { @@ -227,7 +227,7 @@ private void processEnvelope(final @NotNull SentryEnvelope envelope, final @NotN } // reset the Hint to its initial state as we use it multiple times. - HintUtils.runIfHasType(hint, Resettable.class, (resettable) -> resettable.reset()); + HintUtils.runIfHasType(hint, Resettable.class, resettable -> resettable.reset()); } } diff --git a/sentry/src/main/java/io/sentry/Scopes.java b/sentry/src/main/java/io/sentry/Scopes.java index 2ac8178d655..30df2538699 100644 --- a/sentry/src/main/java/io/sentry/Scopes.java +++ b/sentry/src/main/java/io/sentry/Scopes.java @@ -1149,13 +1149,11 @@ public void reportFullyDisplayed() { PropagationContext propagationContext = PropagationContext.fromHeaders( getOptions().getLogger(), sentryTrace, baggageHeaders, getOptions()); - configureScope( - (scope) -> { - scope.withPropagationContext( - oldPropagationContext -> { - scope.setPropagationContext(propagationContext); - }); - }); + configureScope(scope -> { + scope.withPropagationContext(oldPropagationContext -> { + scope.setPropagationContext(propagationContext); + }); + }); if (getOptions().isTracingEnabled()) { return TransactionContext.fromPropagationContext(propagationContext); } else { diff --git a/sentry/src/main/java/io/sentry/SendCachedEnvelopeFireAndForgetIntegration.java b/sentry/src/main/java/io/sentry/SendCachedEnvelopeFireAndForgetIntegration.java index b08e140392c..586a9d6c831 100644 --- a/sentry/src/main/java/io/sentry/SendCachedEnvelopeFireAndForgetIntegration.java +++ b/sentry/src/main/java/io/sentry/SendCachedEnvelopeFireAndForgetIntegration.java @@ -110,62 +110,57 @@ private void sendCachedEnvelopes( try (final @NotNull ISentryLifecycleToken ignored = lock.acquire()) { options .getExecutorService() - .submit( - () -> { - try { - if (isClosed.get()) { - options - .getLogger() - .log( - SentryLevel.INFO, - "SendCachedEnvelopeFireAndForgetIntegration, not trying to send after closing."); - return; - } - - if (!isInitialized.getAndSet(true)) { - connectionStatusProvider = options.getConnectionStatusProvider(); - connectionStatusProvider.addConnectionStatusObserver(this); - - sender = factory.create(scopes, options); - } - - // skip run only if we're certainly disconnected - if (connectionStatusProvider != null - && connectionStatusProvider.getConnectionStatus() - == IConnectionStatusProvider.ConnectionStatus.DISCONNECTED) { - options - .getLogger() - .log( - SentryLevel.INFO, - "SendCachedEnvelopeFireAndForgetIntegration, no connection."); - return; - } - - // in case there's rate limiting active, skip processing - final @Nullable RateLimiter rateLimiter = scopes.getRateLimiter(); - if (rateLimiter != null && rateLimiter.isActiveForCategory(DataCategory.All)) { - options - .getLogger() - .log( - SentryLevel.INFO, - "SendCachedEnvelopeFireAndForgetIntegration, rate limiting active."); - return; - } - - if (sender == null) { - options - .getLogger() - .log(SentryLevel.ERROR, "SendFireAndForget factory is null."); - return; - } - - sender.send(); - } catch (Throwable e) { - options - .getLogger() - .log(SentryLevel.ERROR, "Failed trying to send cached events.", e); - } - }); + .submit(() -> { + try { + if (isClosed.get()) { + options + .getLogger() + .log( + SentryLevel.INFO, + "SendCachedEnvelopeFireAndForgetIntegration, not trying to send after closing."); + return; + } + + if (!isInitialized.getAndSet(true)) { + connectionStatusProvider = options.getConnectionStatusProvider(); + connectionStatusProvider.addConnectionStatusObserver(this); + + sender = factory.create(scopes, options); + } + + // skip run only if we're certainly disconnected + if (connectionStatusProvider != null + && connectionStatusProvider.getConnectionStatus() + == IConnectionStatusProvider.ConnectionStatus.DISCONNECTED) { + options + .getLogger() + .log( + SentryLevel.INFO, + "SendCachedEnvelopeFireAndForgetIntegration, no connection."); + return; + } + + // in case there's rate limiting active, skip processing + final @Nullable RateLimiter rateLimiter = scopes.getRateLimiter(); + if (rateLimiter != null && rateLimiter.isActiveForCategory(DataCategory.All)) { + options + .getLogger() + .log( + SentryLevel.INFO, + "SendCachedEnvelopeFireAndForgetIntegration, rate limiting active."); + return; + } + + if (sender == null) { + options.getLogger().log(SentryLevel.ERROR, "SendFireAndForget factory is null."); + return; + } + + sender.send(); + } catch (Throwable e) { + options.getLogger().log(SentryLevel.ERROR, "Failed trying to send cached events.", e); + } + }); } catch (RejectedExecutionException e) { options .getLogger() diff --git a/sentry/src/main/java/io/sentry/Sentry.java b/sentry/src/main/java/io/sentry/Sentry.java index 00f5729535a..8112cf0ee8b 100644 --- a/sentry/src/main/java/io/sentry/Sentry.java +++ b/sentry/src/main/java/io/sentry/Sentry.java @@ -468,62 +468,60 @@ private static void handleAppStartProfilingConfig( final @NotNull SentryOptions options, final @NotNull ISentryExecutorService sentryExecutorService) { try { - sentryExecutorService.submit( - () -> { - final String cacheDirPath = options.getCacheDirPathWithoutDsn(); - if (cacheDirPath != null) { - final @NotNull File cacheDir = new File(cacheDirPath); - final @NotNull File appStartProfilingConfigFile = - new File(cacheDir, APP_START_PROFILING_CONFIG_FILE_NAME); - try { - // We always delete the config file for app start profiling - FileUtils.deleteRecursively(appStartProfilingConfigFile); - if (!options.isEnableAppStartProfiling() && !options.isStartProfilerOnAppStart()) { - return; - } - // isStartProfilerOnAppStart doesn't need tracing, as it can be started/stopped - // manually - if (!options.isStartProfilerOnAppStart() && !options.isTracingEnabled()) { - options - .getLogger() - .log( - SentryLevel.INFO, - "Tracing is disabled and app start profiling will not start."); - return; - } - // The cache dir is no longer created during init, so create it here before writing: - // createNewFile() fails if the parent is missing. - if (!FileUtils.createDirectory(cacheDir)) { - options - .getLogger() - .log(SentryLevel.ERROR, "Failed to create cache dir %s", cacheDirPath); - return; - } - if (appStartProfilingConfigFile.createNewFile()) { - // If old app start profiling is false, it means the transaction will not be - // sampled, but we create the file anyway to allow continuous profiling on app - // start - final @NotNull TracesSamplingDecision appStartSamplingDecision = - options.isEnableAppStartProfiling() - ? sampleAppStartProfiling(options) - : new TracesSamplingDecision(false); - final @NotNull SentryAppStartProfilingOptions appStartProfilingOptions = - new SentryAppStartProfilingOptions(options, appStartSamplingDecision); - try (final OutputStream outputStream = - new FileOutputStream(appStartProfilingConfigFile); - final Writer writer = - new BufferedWriter(new OutputStreamWriter(outputStream, UTF_8))) { - options.getSerializer().serialize(appStartProfilingOptions, writer); - } - } - } catch (Throwable e) { - options - .getLogger() - .log( - SentryLevel.ERROR, "Unable to create app start profiling config file. ", e); + sentryExecutorService.submit(() -> { + final String cacheDirPath = options.getCacheDirPathWithoutDsn(); + if (cacheDirPath != null) { + final @NotNull File cacheDir = new File(cacheDirPath); + final @NotNull File appStartProfilingConfigFile = + new File(cacheDir, APP_START_PROFILING_CONFIG_FILE_NAME); + try { + // We always delete the config file for app start profiling + FileUtils.deleteRecursively(appStartProfilingConfigFile); + if (!options.isEnableAppStartProfiling() && !options.isStartProfilerOnAppStart()) { + return; + } + // isStartProfilerOnAppStart doesn't need tracing, as it can be started/stopped + // manually + if (!options.isStartProfilerOnAppStart() && !options.isTracingEnabled()) { + options + .getLogger() + .log( + SentryLevel.INFO, + "Tracing is disabled and app start profiling will not start."); + return; + } + // The cache dir is no longer created during init, so create it here before writing: + // createNewFile() fails if the parent is missing. + if (!FileUtils.createDirectory(cacheDir)) { + options + .getLogger() + .log(SentryLevel.ERROR, "Failed to create cache dir %s", cacheDirPath); + return; + } + if (appStartProfilingConfigFile.createNewFile()) { + // If old app start profiling is false, it means the transaction will not be + // sampled, but we create the file anyway to allow continuous profiling on app + // start + final @NotNull TracesSamplingDecision appStartSamplingDecision = + options.isEnableAppStartProfiling() + ? sampleAppStartProfiling(options) + : new TracesSamplingDecision(false); + final @NotNull SentryAppStartProfilingOptions appStartProfilingOptions = + new SentryAppStartProfilingOptions(options, appStartSamplingDecision); + try (final OutputStream outputStream = + new FileOutputStream(appStartProfilingConfigFile); + final Writer writer = + new BufferedWriter(new OutputStreamWriter(outputStream, UTF_8))) { + options.getSerializer().serialize(appStartProfilingOptions, writer); } } - }); + } catch (Throwable e) { + options + .getLogger() + .log(SentryLevel.ERROR, "Unable to create app start profiling config file. ", e); + } + } + }); } catch (Throwable e) { options .getLogger() @@ -575,36 +573,34 @@ private static void notifyOptionsObservers(final @NotNull SentryOptions options) try { options .getExecutorService() - .submit( - () -> { - // for static things like sentry options we can immediately trigger observers - for (final IOptionsObserver observer : options.getOptionsObservers()) { - observer.setRelease(options.getRelease()); - observer.setProguardUuid(options.getProguardUuid()); - observer.setSdkVersion(options.getSdkVersion()); - observer.setDist(options.getDist()); - observer.setEnvironment(options.getEnvironment()); - observer.setTags(options.getTags()); - observer.setReplayErrorSampleRate( - options.getSessionReplay().getOnErrorSampleRate()); - } + .submit(() -> { + // for static things like sentry options we can immediately trigger observers + for (final IOptionsObserver observer : options.getOptionsObservers()) { + observer.setRelease(options.getRelease()); + observer.setProguardUuid(options.getProguardUuid()); + observer.setSdkVersion(options.getSdkVersion()); + observer.setDist(options.getDist()); + observer.setEnvironment(options.getEnvironment()); + observer.setTags(options.getTags()); + observer.setReplayErrorSampleRate(options.getSessionReplay().getOnErrorSampleRate()); + } - // since it's a new SDK init we clean up persisted scope values before serializing - // new ones, so they are not making it to the new events if they were e.g. disabled - // (e.g. replayId) or are simply irrelevant (e.g. breadcrumbs). NOTE: this happens - // after the integrations relying on those values are done with processing them. - final @Nullable PersistingScopeObserver scopeCache = - options.findPersistingScopeObserver(); - if (scopeCache != null) { - scopeCache.resetCache(); - // the scope environment is configuration, not telemetry state, so we persist it - // again after the reset to keep it available for the next app launch - final @Nullable String environment = globalScope.getEnvironment(); - if (environment != null) { - scopeCache.setEnvironment(environment); - } - } - }); + // since it's a new SDK init we clean up persisted scope values before serializing + // new ones, so they are not making it to the new events if they were e.g. disabled + // (e.g. replayId) or are simply irrelevant (e.g. breadcrumbs). NOTE: this happens + // after the integrations relying on those values are done with processing them. + final @Nullable PersistingScopeObserver scopeCache = + options.findPersistingScopeObserver(); + if (scopeCache != null) { + scopeCache.resetCache(); + // the scope environment is configuration, not telemetry state, so we persist it + // again after the reset to keep it available for the next app launch + final @Nullable String environment = globalScope.getEnvironment(); + if (environment != null) { + scopeCache.setEnvironment(environment); + } + } + }); } catch (Throwable e) { options.getLogger().log(SentryLevel.DEBUG, "Failed to notify options observers.", e); } @@ -665,20 +661,19 @@ private static void initConfigurations(final @NotNull SentryOptions options) { try { options .getExecutorService() - .submit( - () -> { - final File[] oldTracesDirContent = profilingTracesDir.listFiles(); - if (oldTracesDirContent == null) return; - // Method trace files are normally deleted at the end of traces, but if that fails - // for some reason we try to clear any old files here. - for (File f : oldTracesDirContent) { - // We delete files 5 minutes older than class creation to account for app - // start profiles, as an app start profile could have a lower creation date. - if (f.lastModified() < classCreationTimestamp - TimeUnit.MINUTES.toMillis(5)) { - FileUtils.deleteRecursively(f); - } - } - }); + .submit(() -> { + final File[] oldTracesDirContent = profilingTracesDir.listFiles(); + if (oldTracesDirContent == null) return; + // Method trace files are normally deleted at the end of traces, but if that fails + // for some reason we try to clear any old files here. + for (File f : oldTracesDirContent) { + // We delete files 5 minutes older than class creation to account for app + // start profiles, as an app start profile could have a lower creation date. + if (f.lastModified() < classCreationTimestamp - TimeUnit.MINUTES.toMillis(5)) { + FileUtils.deleteRecursively(f); + } + } + }); } catch (RejectedExecutionException e) { options .getLogger() diff --git a/sentry/src/main/java/io/sentry/SentryClient.java b/sentry/src/main/java/io/sentry/SentryClient.java index 2b0a97ff5c3..9e8b49b169b 100644 --- a/sentry/src/main/java/io/sentry/SentryClient.java +++ b/sentry/src/main/java/io/sentry/SentryClient.java @@ -892,45 +892,42 @@ Session updateSessionData( if (HintUtils.shouldApplyScopeData(hint)) { if (scope != null) { clonedSession = - scope.withSession( - session -> { - if (session != null) { - Session.State status = null; - if (event.isCrashed()) { - status = Session.State.Crashed; - } - - boolean crashedOrErrored = false; - if (Session.State.Crashed == status || event.isErrored()) { - crashedOrErrored = true; - } - - String userAgent = null; - if (event.getRequest() != null && event.getRequest().getHeaders() != null) { - if (event.getRequest().getHeaders().containsKey("user-agent")) { - userAgent = event.getRequest().getHeaders().get("user-agent"); - } - } - - final Object sentrySdkHint = HintUtils.getSentrySdkHint(hint); - @Nullable String abnormalMechanism = null; - if (sentrySdkHint instanceof AbnormalExit) { - abnormalMechanism = ((AbnormalExit) sentrySdkHint).mechanism(); - status = Session.State.Abnormal; - } - - if (session.update(status, userAgent, crashedOrErrored, abnormalMechanism)) { - // if session terminated we can end it. - if (session.isTerminated()) { - session.end(); - } - } - } else { - options - .getLogger() - .log(SentryLevel.INFO, "Session is null on scope.withSession"); + scope.withSession(session -> { + if (session != null) { + Session.State status = null; + if (event.isCrashed()) { + status = Session.State.Crashed; + } + + boolean crashedOrErrored = false; + if (Session.State.Crashed == status || event.isErrored()) { + crashedOrErrored = true; + } + + String userAgent = null; + if (event.getRequest() != null && event.getRequest().getHeaders() != null) { + if (event.getRequest().getHeaders().containsKey("user-agent")) { + userAgent = event.getRequest().getHeaders().get("user-agent"); } - }); + } + + final Object sentrySdkHint = HintUtils.getSentrySdkHint(hint); + @Nullable String abnormalMechanism = null; + if (sentrySdkHint instanceof AbnormalExit) { + abnormalMechanism = ((AbnormalExit) sentrySdkHint).mechanism(); + status = Session.State.Abnormal; + } + + if (session.update(status, userAgent, crashedOrErrored, abnormalMechanism)) { + // if session terminated we can end it. + if (session.isTerminated()) { + session.end(); + } + } + } else { + options.getLogger().log(SentryLevel.INFO, "Session is null on scope.withSession"); + } + }); } else { options.getLogger().log(SentryLevel.INFO, "Scope is null on client.captureEvent"); } diff --git a/sentry/src/main/java/io/sentry/SentryEnvelopeItem.java b/sentry/src/main/java/io/sentry/SentryEnvelopeItem.java index d1858c02767..e3fcc16ae0b 100644 --- a/sentry/src/main/java/io/sentry/SentryEnvelopeItem.java +++ b/sentry/src/main/java/io/sentry/SentryEnvelopeItem.java @@ -85,16 +85,14 @@ public final class SentryEnvelopeItem { Objects.requireNonNull(session, "Session is required."); final CachedItem cachedItem = - new CachedItem( - () -> { - try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = - new BufferedWriter( - new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { - serializer.serialize(session, writer); - return stream.toByteArray(); - } - }); + new CachedItem(() -> { + try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); + final Writer writer = + new BufferedWriter(new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { + serializer.serialize(session, writer); + return stream.toByteArray(); + } + }); SentryEnvelopeItemHeader itemHeader = new SentryEnvelopeItemHeader( @@ -121,16 +119,14 @@ public final class SentryEnvelopeItem { Objects.requireNonNull(event, "SentryEvent is required."); final CachedItem cachedItem = - new CachedItem( - () -> { - try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = - new BufferedWriter( - new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { - serializer.serialize(event, writer); - return stream.toByteArray(); - } - }); + new CachedItem(() -> { + try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); + final Writer writer = + new BufferedWriter(new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { + serializer.serialize(event, writer); + return stream.toByteArray(); + } + }); SentryEnvelopeItemHeader itemHeader = new SentryEnvelopeItemHeader( @@ -183,16 +179,14 @@ public static SentryEnvelopeItem fromUserFeedback( Objects.requireNonNull(userFeedback, "UserFeedback is required."); final CachedItem cachedItem = - new CachedItem( - () -> { - try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = - new BufferedWriter( - new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { - serializer.serialize(userFeedback, writer); - return stream.toByteArray(); - } - }); + new CachedItem(() -> { + try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); + final Writer writer = + new BufferedWriter(new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { + serializer.serialize(userFeedback, writer); + return stream.toByteArray(); + } + }); SentryEnvelopeItemHeader itemHeader = new SentryEnvelopeItemHeader( @@ -212,16 +206,14 @@ public static SentryEnvelopeItem fromCheckIn( Objects.requireNonNull(checkIn, "CheckIn is required."); final CachedItem cachedItem = - new CachedItem( - () -> { - try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = - new BufferedWriter( - new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { - serializer.serialize(checkIn, writer); - return stream.toByteArray(); - } - }); + new CachedItem(() -> { + try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); + final Writer writer = + new BufferedWriter(new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { + serializer.serialize(checkIn, writer); + return stream.toByteArray(); + } + }); SentryEnvelopeItemHeader itemHeader = new SentryEnvelopeItemHeader( @@ -239,40 +231,37 @@ public static SentryEnvelopeItem fromAttachment( final long maxAttachmentSize) { final CachedItem cachedItem = - new CachedItem( - () -> { - if (attachment.getBytes() != null) { - final byte[] data = attachment.getBytes(); - ensureAttachmentSizeLimit(data.length, maxAttachmentSize, attachment.getFilename()); - return data; - } else if (attachment.getSerializable() != null) { - final JsonSerializable serializable = attachment.getSerializable(); - @SuppressWarnings("NullableProblems") - final @Nullable byte[] data = - JsonSerializationUtils.bytesFrom(serializer, logger, serializable); - - if (data != null) { - ensureAttachmentSizeLimit( - data.length, maxAttachmentSize, attachment.getFilename()); - return data; - } - } else if (attachment.getPathname() != null) { - return readBytesFromFile(attachment.getPathname(), maxAttachmentSize); - } else if (attachment.getByteProvider() != null) { - @SuppressWarnings("NullableProblems") - final @Nullable byte[] data = attachment.getByteProvider().call(); - if (data != null) { - ensureAttachmentSizeLimit( - data.length, maxAttachmentSize, attachment.getFilename()); - return data; - } - } - throw new SentryEnvelopeException( - String.format( - "Couldn't attach the attachment %s.\n" - + "Please check that either bytes, serializable, path or provider is set.", - attachment.getFilename())); - }); + new CachedItem(() -> { + if (attachment.getBytes() != null) { + final byte[] data = attachment.getBytes(); + ensureAttachmentSizeLimit(data.length, maxAttachmentSize, attachment.getFilename()); + return data; + } else if (attachment.getSerializable() != null) { + final JsonSerializable serializable = attachment.getSerializable(); + @SuppressWarnings("NullableProblems") + final @Nullable byte[] data = + JsonSerializationUtils.bytesFrom(serializer, logger, serializable); + + if (data != null) { + ensureAttachmentSizeLimit(data.length, maxAttachmentSize, attachment.getFilename()); + return data; + } + } else if (attachment.getPathname() != null) { + return readBytesFromFile(attachment.getPathname(), maxAttachmentSize); + } else if (attachment.getByteProvider() != null) { + @SuppressWarnings("NullableProblems") + final @Nullable byte[] data = attachment.getByteProvider().call(); + if (data != null) { + ensureAttachmentSizeLimit(data.length, maxAttachmentSize, attachment.getFilename()); + return data; + } + } + throw new SentryEnvelopeException( + String.format( + "Couldn't attach the attachment %s.\n" + + "Please check that either bytes, serializable, path or provider is set.", + attachment.getFilename())); + }); SentryEnvelopeItemHeader itemHeader = new SentryEnvelopeItemHeader( @@ -317,59 +306,56 @@ private static void ensureAttachmentSizeLimit( final @Nullable File traceFile = profileChunk.getTraceFile(); // Using CachedItem, so we read the trace file in the background final CachedItem cachedItem = - new CachedItem( - () -> { - if (traceFile != null) { - if (!traceFile.exists()) { - throw new SentryEnvelopeException( - String.format( - "Dropping profile chunk, because the file '%s' doesn't exists", - traceFile.getName())); - } - - if (ProfileChunk.PLATFORM_JAVA.equals(profileChunk.getPlatform())) { - if (!NoOpProfileConverter.getInstance().equals(profileConverter)) { - try { - final SentryProfile profile = - profileConverter.convertFromFile(traceFile.getAbsolutePath()); - profileChunk.setSentryProfile(profile); - } catch (Exception e) { - throw new SentryEnvelopeException("Profile conversion failed", e); - } - } else { - throw new SentryEnvelopeException( - "No ProfileConverter available, dropping chunk."); - } - } else { - // The payload of the profile item is a json including the trace file encoded with - // base64 - final byte[] traceFileBytes = - readBytesFromFile(traceFile.getPath(), MAX_PROFILE_CHUNK_SIZE); - final @NotNull String base64Trace = - Base64.encodeToString(traceFileBytes, NO_WRAP | NO_PADDING); - if (base64Trace.isEmpty()) { - throw new SentryEnvelopeException("Profiling trace file is empty"); - } - profileChunk.setSampledProfile(base64Trace); + new CachedItem(() -> { + if (traceFile != null) { + if (!traceFile.exists()) { + throw new SentryEnvelopeException( + String.format( + "Dropping profile chunk, because the file '%s' doesn't exists", + traceFile.getName())); + } + + if (ProfileChunk.PLATFORM_JAVA.equals(profileChunk.getPlatform())) { + if (!NoOpProfileConverter.getInstance().equals(profileConverter)) { + try { + final SentryProfile profile = + profileConverter.convertFromFile(traceFile.getAbsolutePath()); + profileChunk.setSentryProfile(profile); + } catch (Exception e) { + throw new SentryEnvelopeException("Profile conversion failed", e); } + } else { + throw new SentryEnvelopeException("No ProfileConverter available, dropping chunk."); } - - try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = - new BufferedWriter( - new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { - serializer.serialize(profileChunk, writer); - return stream.toByteArray(); - } catch (IOException e) { - throw new SentryEnvelopeException( - String.format("Failed to serialize profile chunk\n%s", e.getMessage())); - } finally { - // In any case we delete the trace file - if (traceFile != null) { - traceFile.delete(); - } + } else { + // The payload of the profile item is a json including the trace file encoded with + // base64 + final byte[] traceFileBytes = + readBytesFromFile(traceFile.getPath(), MAX_PROFILE_CHUNK_SIZE); + final @NotNull String base64Trace = + Base64.encodeToString(traceFileBytes, NO_WRAP | NO_PADDING); + if (base64Trace.isEmpty()) { + throw new SentryEnvelopeException("Profiling trace file is empty"); } - }); + profileChunk.setSampledProfile(base64Trace); + } + } + + try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); + final Writer writer = + new BufferedWriter(new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { + serializer.serialize(profileChunk, writer); + return stream.toByteArray(); + } catch (IOException e) { + throw new SentryEnvelopeException( + String.format("Failed to serialize profile chunk\n%s", e.getMessage())); + } finally { + // In any case we delete the trace file + if (traceFile != null) { + traceFile.delete(); + } + } + }); SentryEnvelopeItemHeader itemHeader = new SentryEnvelopeItemHeader( @@ -406,40 +392,38 @@ private static void ensureAttachmentSizeLimit( final AtomicReference metaLength = new AtomicReference<>(null); final CachedItem cachedItem = - new CachedItem( - () -> { - // Serialize JSON metadata - final byte[] metadataBytes; - try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = new BufferedWriter(new OutputStreamWriter(stream, UTF_8))) { - serializer.serialize(profileChunk, writer); - writer.flush(); - metadataBytes = stream.toByteArray(); - metaLength.set(metadataBytes.length); - } catch (IOException e) { - throw new SentryEnvelopeException( - String.format( - "Failed to serialize perfetto profile chunk\n%s", e.getMessage())); - } - - // Read binary Perfetto trace - final byte[] traceBytes; - try { - traceBytes = readBytesFromFile(traceFile.getPath(), MAX_PROFILE_CHUNK_SIZE); - } catch (IOException e) { - throw new SentryEnvelopeException( - String.format("Failed to read perfetto trace file\n%s", e.getMessage())); - } finally { - traceFile.delete(); - } - - // Concatenate: [JSON metadata bytes][raw .pftrace binary bytes] - final byte[] payload = new byte[metadataBytes.length + traceBytes.length]; - System.arraycopy(metadataBytes, 0, payload, 0, metadataBytes.length); - System.arraycopy(traceBytes, 0, payload, metadataBytes.length, traceBytes.length); - - return payload; - }); + new CachedItem(() -> { + // Serialize JSON metadata + final byte[] metadataBytes; + try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); + final Writer writer = new BufferedWriter(new OutputStreamWriter(stream, UTF_8))) { + serializer.serialize(profileChunk, writer); + writer.flush(); + metadataBytes = stream.toByteArray(); + metaLength.set(metadataBytes.length); + } catch (IOException e) { + throw new SentryEnvelopeException( + String.format("Failed to serialize perfetto profile chunk\n%s", e.getMessage())); + } + + // Read binary Perfetto trace + final byte[] traceBytes; + try { + traceBytes = readBytesFromFile(traceFile.getPath(), MAX_PROFILE_CHUNK_SIZE); + } catch (IOException e) { + throw new SentryEnvelopeException( + String.format("Failed to read perfetto trace file\n%s", e.getMessage())); + } finally { + traceFile.delete(); + } + + // Concatenate: [JSON metadata bytes][raw .pftrace binary bytes] + final byte[] payload = new byte[metadataBytes.length + traceBytes.length]; + System.arraycopy(metadataBytes, 0, payload, 0, metadataBytes.length); + System.arraycopy(traceBytes, 0, payload, metadataBytes.length, traceBytes.length); + + return payload; + }); SentryEnvelopeItemHeader itemHeader = new SentryEnvelopeItemHeader( @@ -468,40 +452,37 @@ private static void ensureAttachmentSizeLimit( final @NotNull File traceFile = profilingTraceData.getTraceFile(); // Using CachedItem, so we read the trace file in the background final CachedItem cachedItem = - new CachedItem( - () -> { - if (!traceFile.exists()) { - throw new SentryEnvelopeException( - String.format( - "Dropping profiling trace data, because the file '%s' doesn't exists", - traceFile.getName())); - } - // The payload of the profile item is a json including the trace file encoded with - // base64 - final byte[] traceFileBytes = - readBytesFromFile(traceFile.getPath(), maxTraceFileSize); - final @NotNull String base64Trace = - Base64.encodeToString(traceFileBytes, NO_WRAP | NO_PADDING); - if (base64Trace.isEmpty()) { - throw new SentryEnvelopeException("Profiling trace file is empty"); - } - profilingTraceData.setSampledProfile(base64Trace); - profilingTraceData.readDeviceCpuFrequencies(); - - try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = - new BufferedWriter( - new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { - serializer.serialize(profilingTraceData, writer); - return stream.toByteArray(); - } catch (IOException e) { - throw new SentryEnvelopeException( - String.format("Failed to serialize profiling trace data\n%s", e.getMessage())); - } finally { - // In any case we delete the trace file - traceFile.delete(); - } - }); + new CachedItem(() -> { + if (!traceFile.exists()) { + throw new SentryEnvelopeException( + String.format( + "Dropping profiling trace data, because the file '%s' doesn't exists", + traceFile.getName())); + } + // The payload of the profile item is a json including the trace file encoded with + // base64 + final byte[] traceFileBytes = readBytesFromFile(traceFile.getPath(), maxTraceFileSize); + final @NotNull String base64Trace = + Base64.encodeToString(traceFileBytes, NO_WRAP | NO_PADDING); + if (base64Trace.isEmpty()) { + throw new SentryEnvelopeException("Profiling trace file is empty"); + } + profilingTraceData.setSampledProfile(base64Trace); + profilingTraceData.readDeviceCpuFrequencies(); + + try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); + final Writer writer = + new BufferedWriter(new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { + serializer.serialize(profilingTraceData, writer); + return stream.toByteArray(); + } catch (IOException e) { + throw new SentryEnvelopeException( + String.format("Failed to serialize profiling trace data\n%s", e.getMessage())); + } finally { + // In any case we delete the trace file + traceFile.delete(); + } + }); SentryEnvelopeItemHeader itemHeader = new SentryEnvelopeItemHeader( @@ -522,16 +503,14 @@ private static void ensureAttachmentSizeLimit( Objects.requireNonNull(clientReport, "ClientReport is required."); final CachedItem cachedItem = - new CachedItem( - () -> { - try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = - new BufferedWriter( - new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { - serializer.serialize(clientReport, writer); - return stream.toByteArray(); - } - }); + new CachedItem(() -> { + try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); + final Writer writer = + new BufferedWriter(new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { + serializer.serialize(clientReport, writer); + return stream.toByteArray(); + } + }); SentryEnvelopeItemHeader itemHeader = new SentryEnvelopeItemHeader( @@ -566,53 +545,51 @@ public static SentryEnvelopeItem fromReplay( final File replayVideo = replayEvent.getVideoFile(); final CachedItem cachedItem = - new CachedItem( - () -> { - try { - try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = - new BufferedWriter( - new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { - // relay expects the payload to be in this exact order: [event,rrweb,video] - final Map replayPayload = new LinkedHashMap<>(); - // first serialize replay event json bytes - serializer.serialize(replayEvent, writer); - replayPayload.put(SentryItemType.ReplayEvent.getItemType(), stream.toByteArray()); - stream.reset(); - - // next serialize replay recording - if (replayRecording != null) { - serializer.serialize(replayRecording, writer); - replayPayload.put( - SentryItemType.ReplayRecording.getItemType(), stream.toByteArray()); - stream.reset(); - } - - // next serialize replay video bytes from given file - if (replayVideo != null && replayVideo.exists()) { - final byte[] videoBytes = - readBytesFromFile( - replayVideo.getPath(), SentryReplayEvent.REPLAY_VIDEO_MAX_SIZE); - if (videoBytes.length > 0) { - replayPayload.put(SentryItemType.ReplayVideo.getItemType(), videoBytes); - } - } - - return serializeToMsgpack(replayPayload); - } - } catch (Throwable t) { - logger.log(SentryLevel.ERROR, "Could not serialize replay recording", t); - return null; - } finally { - if (replayVideo != null) { - if (cleanupReplayFolder) { - FileUtils.deleteRecursively(replayVideo.getParentFile()); - } else { - replayVideo.delete(); - } + new CachedItem(() -> { + try { + try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); + final Writer writer = + new BufferedWriter(new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { + // relay expects the payload to be in this exact order: [event,rrweb,video] + final Map replayPayload = new LinkedHashMap<>(); + // first serialize replay event json bytes + serializer.serialize(replayEvent, writer); + replayPayload.put(SentryItemType.ReplayEvent.getItemType(), stream.toByteArray()); + stream.reset(); + + // next serialize replay recording + if (replayRecording != null) { + serializer.serialize(replayRecording, writer); + replayPayload.put( + SentryItemType.ReplayRecording.getItemType(), stream.toByteArray()); + stream.reset(); + } + + // next serialize replay video bytes from given file + if (replayVideo != null && replayVideo.exists()) { + final byte[] videoBytes = + readBytesFromFile( + replayVideo.getPath(), SentryReplayEvent.REPLAY_VIDEO_MAX_SIZE); + if (videoBytes.length > 0) { + replayPayload.put(SentryItemType.ReplayVideo.getItemType(), videoBytes); } } - }); + + return serializeToMsgpack(replayPayload); + } + } catch (Throwable t) { + logger.log(SentryLevel.ERROR, "Could not serialize replay recording", t); + return null; + } finally { + if (replayVideo != null) { + if (cleanupReplayFolder) { + FileUtils.deleteRecursively(replayVideo.getParentFile()); + } else { + replayVideo.delete(); + } + } + } + }); final SentryEnvelopeItemHeader itemHeader = new SentryEnvelopeItemHeader( @@ -629,16 +606,14 @@ public static SentryEnvelopeItem fromLogs( Objects.requireNonNull(logEvents, "SentryLogEvents is required."); final CachedItem cachedItem = - new CachedItem( - () -> { - try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = - new BufferedWriter( - new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { - serializer.serialize(logEvents, writer); - return stream.toByteArray(); - } - }); + new CachedItem(() -> { + try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); + final Writer writer = + new BufferedWriter(new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { + serializer.serialize(logEvents, writer); + return stream.toByteArray(); + } + }); SentryEnvelopeItemHeader itemHeader = new SentryEnvelopeItemHeader( @@ -661,16 +636,14 @@ public static SentryEnvelopeItem fromMetrics( Objects.requireNonNull(metricsEvents, "SentryMetricsEvents is required."); final CachedItem cachedItem = - new CachedItem( - () -> { - try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final Writer writer = - new BufferedWriter( - new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { - serializer.serialize(metricsEvents, writer); - return stream.toByteArray(); - } - }); + new CachedItem(() -> { + try (final ByteArrayOutputStream stream = new ByteArrayOutputStream(); + final Writer writer = + new BufferedWriter(new OutputStreamWriter(stream, UTF_8), WRITER_BUFFER_SIZE)) { + serializer.serialize(metricsEvents, writer); + return stream.toByteArray(); + } + }); SentryEnvelopeItemHeader itemHeader = new SentryEnvelopeItemHeader( diff --git a/sentry/src/main/java/io/sentry/SentryStackTraceFactory.java b/sentry/src/main/java/io/sentry/SentryStackTraceFactory.java index 3a36228784d..611be4fc418 100644 --- a/sentry/src/main/java/io/sentry/SentryStackTraceFactory.java +++ b/sentry/src/main/java/io/sentry/SentryStackTraceFactory.java @@ -130,7 +130,7 @@ List getInAppCallStack(final @NotNull Throwable exception) { } final List inAppFrames = - CollectionUtils.filterListEntries(frames, (frame) -> Boolean.TRUE.equals(frame.isInApp())); + CollectionUtils.filterListEntries(frames, frame -> Boolean.TRUE.equals(frame.isInApp())); if (!inAppFrames.isEmpty()) { return inAppFrames; @@ -140,7 +140,7 @@ List getInAppCallStack(final @NotNull Throwable exception) { // fallback to all the frames that are not system frames return CollectionUtils.filterListEntries( frames, - (frame) -> { + frame -> { final String module = frame.getModule(); boolean isSystemFrame = false; if (module != null) { diff --git a/sentry/src/main/java/io/sentry/SentryTracer.java b/sentry/src/main/java/io/sentry/SentryTracer.java index cc1ce8e22ac..acc35f742ae 100644 --- a/sentry/src/main/java/io/sentry/SentryTracer.java +++ b/sentry/src/main/java/io/sentry/SentryTracer.java @@ -211,24 +211,23 @@ public void finish( // We set the new spanFinishedCallback here instead of creation time, calling the old one to // avoid the user overwrites it by setting a custom spanFinishedCallback on the root span final @Nullable SpanFinishedCallback oldCallback = this.root.getSpanFinishedCallback(); - this.root.setSpanFinishedCallback( - span -> { - if (oldCallback != null) { - oldCallback.execute(span); - } - - // Let's call the finishCallback here, when the root span has a finished date but it's - // not finished, yet - final @Nullable TransactionFinishedCallback finishedCallback = - transactionOptions.getTransactionFinishedCallback(); - if (finishedCallback != null) { - finishedCallback.execute(this); - } - - if (compositePerformanceCollector != null) { - performanceCollectionData.set(compositePerformanceCollector.stop(this)); - } - }); + this.root.setSpanFinishedCallback(span -> { + if (oldCallback != null) { + oldCallback.execute(span); + } + + // Let's call the finishCallback here, when the root span has a finished date but it's + // not finished, yet + final @Nullable TransactionFinishedCallback finishedCallback = + transactionOptions.getTransactionFinishedCallback(); + if (finishedCallback != null) { + finishedCallback.execute(this); + } + + if (compositePerformanceCollector != null) { + performanceCollectionData.set(compositePerformanceCollector.stop(this)); + } + }); // any un-finished children will remain unfinished // as relay takes care of setting the end-timestamp + deadline_exceeded @@ -253,15 +252,13 @@ public void finish( performanceCollectionData.get().clear(); } - scopes.configureScope( - scope -> { - scope.withTransaction( - transaction -> { - if (transaction == this) { - scope.clearTransaction(); - } - }); - }); + scopes.configureScope(scope -> { + scope.withTransaction(transaction -> { + if (transaction == this) { + scope.clearTransaction(); + } + }); + }); dropUnrecordedProfilerIds(finishTimestamp); final SentryTransaction transaction = new SentryTransaction(this); @@ -1036,10 +1033,9 @@ public void setName(@NotNull String name, @NotNull TransactionNameSource transac @ApiStatus.Internal @Override public @NotNull ISentryLifecycleToken makeCurrent() { - scopes.configureScope( - (scope) -> { - scope.setTransaction(this); - }); + scopes.configureScope(scope -> { + scope.setTransaction(this); + }); return NoOpScopesLifecycleToken.getInstance(); } diff --git a/sentry/src/main/java/io/sentry/ShutdownHookIntegration.java b/sentry/src/main/java/io/sentry/ShutdownHookIntegration.java index 9a70e31cee6..6cb1260c88f 100644 --- a/sentry/src/main/java/io/sentry/ShutdownHookIntegration.java +++ b/sentry/src/main/java/io/sentry/ShutdownHookIntegration.java @@ -34,12 +34,11 @@ public void register(final @NotNull IScopes scopes, final @NotNull SentryOptions if (options.isEnableShutdownHook()) { thread = new Thread(() -> scopes.flush(options.getFlushTimeoutMillis()), "sentry-shutdownhook"); - handleShutdownInProgress( - () -> { - runtime.addShutdownHook(thread); - options.getLogger().log(SentryLevel.DEBUG, "ShutdownHookIntegration installed."); - addIntegrationToSdkVersion("ShutdownHook"); - }); + handleShutdownInProgress(() -> { + runtime.addShutdownHook(thread); + options.getLogger().log(SentryLevel.DEBUG, "ShutdownHookIntegration installed."); + addIntegrationToSdkVersion("ShutdownHook"); + }); } else { options.getLogger().log(SentryLevel.INFO, "enableShutdownHook is disabled."); } diff --git a/sentry/src/main/java/io/sentry/cache/PersistingScopeObserver.java b/sentry/src/main/java/io/sentry/cache/PersistingScopeObserver.java index 756f36f65da..cf3bfcb3d15 100644 --- a/sentry/src/main/java/io/sentry/cache/PersistingScopeObserver.java +++ b/sentry/src/main/java/io/sentry/cache/PersistingScopeObserver.java @@ -65,66 +65,65 @@ public final class PersistingScopeObserver extends ScopeObserverAdapter { private @NotNull SentryOptions options; private final @NotNull LazyEvaluator> breadcrumbsQueue = - new LazyEvaluator<>( - () -> { - final File cacheDir = ensureCacheDir(options, SCOPE_CACHE); - if (cacheDir == null) { - options.getLogger().log(INFO, "Cache dir is not set, cannot store in scope cache"); - return ObjectQueue.createEmpty(); - } - - QueueFile queueFile = null; - final File file = new File(cacheDir, BREADCRUMBS_FILENAME); - try { - try { - queueFile = - new QueueFile.Builder(file) - .size(options.getMaxBreadcrumbs()) - .synchronousWrites(false) - .build(); - } catch (IOException e) { - // if file is corrupted we simply delete it and try to create it again. We accept - // the trade - // off of losing breadcrumbs for ANRs that happened right before the app has - // received an - // update where the new format was introduced - file.delete(); - - queueFile = - new QueueFile.Builder(file) - .size(options.getMaxBreadcrumbs()) - .synchronousWrites(false) - .build(); + new LazyEvaluator<>(() -> { + final File cacheDir = ensureCacheDir(options, SCOPE_CACHE); + if (cacheDir == null) { + options.getLogger().log(INFO, "Cache dir is not set, cannot store in scope cache"); + return ObjectQueue.createEmpty(); + } + + QueueFile queueFile = null; + final File file = new File(cacheDir, BREADCRUMBS_FILENAME); + try { + try { + queueFile = + new QueueFile.Builder(file) + .size(options.getMaxBreadcrumbs()) + .synchronousWrites(false) + .build(); + } catch (IOException e) { + // if file is corrupted we simply delete it and try to create it again. We accept + // the trade + // off of losing breadcrumbs for ANRs that happened right before the app has + // received an + // update where the new format was introduced + file.delete(); + + queueFile = + new QueueFile.Builder(file) + .size(options.getMaxBreadcrumbs()) + .synchronousWrites(false) + .build(); + } + } catch (IOException e) { + options.getLogger().log(ERROR, "Failed to create breadcrumbs queue", e); + return ObjectQueue.createEmpty(); + } + return ObjectQueue.create( + queueFile, + new ObjectQueue.Converter() { + @Override + @Nullable + public Breadcrumb from(byte[] source) { + try (final Reader reader = + new BufferedReader( + new InputStreamReader(new ByteArrayInputStream(source), UTF_8))) { + return options.getSerializer().deserialize(reader, Breadcrumb.class); + } catch (Throwable e) { + options.getLogger().log(ERROR, e, "Error reading entity from scope cache"); + } + return null; + } + + @Override + public void toStream(Breadcrumb value, OutputStream sink) throws IOException { + try (final Writer writer = + new BufferedWriter(new OutputStreamWriter(sink, UTF_8))) { + options.getSerializer().serialize(value, writer); + } } - } catch (IOException e) { - options.getLogger().log(ERROR, "Failed to create breadcrumbs queue", e); - return ObjectQueue.createEmpty(); - } - return ObjectQueue.create( - queueFile, - new ObjectQueue.Converter() { - @Override - @Nullable - public Breadcrumb from(byte[] source) { - try (final Reader reader = - new BufferedReader( - new InputStreamReader(new ByteArrayInputStream(source), UTF_8))) { - return options.getSerializer().deserialize(reader, Breadcrumb.class); - } catch (Throwable e) { - options.getLogger().log(ERROR, e, "Error reading entity from scope cache"); - } - return null; - } - - @Override - public void toStream(Breadcrumb value, OutputStream sink) throws IOException { - try (final Writer writer = - new BufferedWriter(new OutputStreamWriter(sink, UTF_8))) { - options.getSerializer().serialize(value, writer); - } - } - }); - }); + }); + }); // Latest pending value per file (or DELETE_MARKER), coalesced until the next flush. private final @NotNull Map pendingWrites = new ConcurrentHashMap<>(); diff --git a/sentry/src/main/java/io/sentry/clientreport/AtomicClientReportStorage.java b/sentry/src/main/java/io/sentry/clientreport/AtomicClientReportStorage.java index fd1f9a9de99..41d36adf75b 100644 --- a/sentry/src/main/java/io/sentry/clientreport/AtomicClientReportStorage.java +++ b/sentry/src/main/java/io/sentry/clientreport/AtomicClientReportStorage.java @@ -17,21 +17,20 @@ final class AtomicClientReportStorage implements IClientReportStorage { private final @NotNull LazyEvaluator> lostEventCounts = - new LazyEvaluator<>( - () -> { - final Map modifyableEventCountsForInit = - new ConcurrentHashMap<>(); - - for (final DiscardReason discardReason : DiscardReason.values()) { - for (final DataCategory category : DataCategory.values()) { - modifyableEventCountsForInit.put( - new ClientReportKey(discardReason.getReason(), category.getCategory()), - new AtomicLong(0)); - } - } - - return Collections.unmodifiableMap(modifyableEventCountsForInit); - }); + new LazyEvaluator<>(() -> { + final Map modifyableEventCountsForInit = + new ConcurrentHashMap<>(); + + for (final DiscardReason discardReason : DiscardReason.values()) { + for (final DataCategory category : DataCategory.values()) { + modifyableEventCountsForInit.put( + new ClientReportKey(discardReason.getReason(), category.getCategory()), + new AtomicLong(0)); + } + } + + return Collections.unmodifiableMap(modifyableEventCountsForInit); + }); public AtomicClientReportStorage() {} diff --git a/sentry/src/main/java/io/sentry/instrumentation/file/SentryFileInputStream.java b/sentry/src/main/java/io/sentry/instrumentation/file/SentryFileInputStream.java index 3119b50b5ed..d32642180e6 100644 --- a/sentry/src/main/java/io/sentry/instrumentation/file/SentryFileInputStream.java +++ b/sentry/src/main/java/io/sentry/instrumentation/file/SentryFileInputStream.java @@ -86,12 +86,11 @@ public int read() throws IOException { // this is the only case, when the read() operation returns the byte value, and not the count // hence we need this special handling AtomicInteger result = new AtomicInteger(0); - spanManager.performIO( - () -> { - final int res = delegate.read(); - result.set(res); - return res != -1 ? 1 : 0; - }); + spanManager.performIO(() -> { + final int res = delegate.read(); + result.set(res); + return res != -1 ? 1 : 0; + }); return result.get(); } diff --git a/sentry/src/main/java/io/sentry/instrumentation/file/SentryFileOutputStream.java b/sentry/src/main/java/io/sentry/instrumentation/file/SentryFileOutputStream.java index 76f4cd68cba..15baad00d69 100644 --- a/sentry/src/main/java/io/sentry/instrumentation/file/SentryFileOutputStream.java +++ b/sentry/src/main/java/io/sentry/instrumentation/file/SentryFileOutputStream.java @@ -92,29 +92,26 @@ private static FileOutputStreamInitData init( @Override public void write(final int b) throws IOException { - spanManager.performIO( - () -> { - delegate.write(b); - return 1; - }); + spanManager.performIO(() -> { + delegate.write(b); + return 1; + }); } @Override public void write(final byte @NotNull [] b) throws IOException { - spanManager.performIO( - () -> { - delegate.write(b); - return b.length; - }); + spanManager.performIO(() -> { + delegate.write(b); + return b.length; + }); } @Override public void write(final byte @NotNull [] b, final int off, final int len) throws IOException { - spanManager.performIO( - () -> { - delegate.write(b, off, len); - return len; - }); + spanManager.performIO(() -> { + delegate.write(b, off, len); + return len; + }); } @Override diff --git a/sentry/src/main/java/io/sentry/protocol/TransactionNameSource.java b/sentry/src/main/java/io/sentry/protocol/TransactionNameSource.java index ef2f3d0532d..9b19d7a980c 100644 --- a/sentry/src/main/java/io/sentry/protocol/TransactionNameSource.java +++ b/sentry/src/main/java/io/sentry/protocol/TransactionNameSource.java @@ -74,11 +74,11 @@ public enum TransactionNameSource { */ TASK -// /** -// * This is the default value set by Relay for legacy SDKs. -// */ -// UNKNOWN -; + // /** + // * This is the default value set by Relay for legacy SDKs. + // */ + // UNKNOWN + ; public String apiName() { return name().toLowerCase(Locale.ROOT); diff --git a/sentry/src/main/java/io/sentry/transport/AsyncHttpTransport.java b/sentry/src/main/java/io/sentry/transport/AsyncHttpTransport.java index c4d54c173ef..adf9f749d5c 100644 --- a/sentry/src/main/java/io/sentry/transport/AsyncHttpTransport.java +++ b/sentry/src/main/java/io/sentry/transport/AsyncHttpTransport.java @@ -254,7 +254,7 @@ public void run() { HintUtils.runIfHasType( hint, SubmissionResult.class, - (submissionResult) -> { + submissionResult -> { options .getLogger() .log( @@ -276,7 +276,7 @@ public void run() { HintUtils.runIfHasType( hint, DiskFlushNotification.class, - (diskFlushNotification) -> { + diskFlushNotification -> { if (diskFlushNotification.isFlushable(envelope.getHeader().getEventId())) { diskFlushNotification.markFlushed(); options.getLogger().log(SentryLevel.DEBUG, "Disk flush envelope fired"); @@ -326,7 +326,7 @@ public void run() { HintUtils.runIfHasType( hint, Retryable.class, - (retryable) -> { + retryable -> { retryable.setRetry(true); }, (hint, clazz) -> { @@ -344,7 +344,7 @@ public void run() { HintUtils.runIfHasType( hint, Retryable.class, - (retryable) -> { + retryable -> { retryable.setRetry(true); }, (hint, clazz) -> { diff --git a/sentry/src/main/java/io/sentry/transport/RateLimiter.java b/sentry/src/main/java/io/sentry/transport/RateLimiter.java index 9b15cb6fefe..35a543745d8 100644 --- a/sentry/src/main/java/io/sentry/transport/RateLimiter.java +++ b/sentry/src/main/java/io/sentry/transport/RateLimiter.java @@ -181,7 +181,7 @@ private void markHintWhenSendingFailed(final @NotNull Hint hint, final boolean r HintUtils.runIfHasType( hint, DiskFlushNotification.class, - (diskFlushNotification) -> { + diskFlushNotification -> { diskFlushNotification.markFlushed(); config.getLogger().log(SentryLevel.DEBUG, "Disk flush envelope fired due to rate limit"); }); diff --git a/sentry/src/main/java/io/sentry/util/HintUtils.java b/sentry/src/main/java/io/sentry/util/HintUtils.java index 4ccbce3c33f..ac44d3d68ae 100644 --- a/sentry/src/main/java/io/sentry/util/HintUtils.java +++ b/sentry/src/main/java/io/sentry/util/HintUtils.java @@ -85,7 +85,7 @@ public static void runIfDoesNotHaveType( runIfHasType( hint, clazz, - (ignored) -> {}, + ignored -> {}, (value, clazz2) -> { lambda.accept(value); }); diff --git a/sentry/src/main/java/io/sentry/util/Random.java b/sentry/src/main/java/io/sentry/util/Random.java index aec6063dcb2..d455fe91792 100644 --- a/sentry/src/main/java/io/sentry/util/Random.java +++ b/sentry/src/main/java/io/sentry/util/Random.java @@ -180,7 +180,6 @@ public int nextInt(int n) { } return r; } - ; /** * Returns the next pseudorandom, uniformly distributed {@code boolean} value from this random diff --git a/sentry/src/main/java/io/sentry/util/TracingUtils.java b/sentry/src/main/java/io/sentry/util/TracingUtils.java index 8a1aa0ac660..4e6d29a29b7 100644 --- a/sentry/src/main/java/io/sentry/util/TracingUtils.java +++ b/sentry/src/main/java/io/sentry/util/TracingUtils.java @@ -22,24 +22,20 @@ public final class TracingUtils { public static void startNewTrace(final @NotNull IScopes scopes) { - scopes.configureScope( - scope -> { - scope.withPropagationContext( - propagationContext -> { - scope.setPropagationContext(new PropagationContext()); - }); - }); + scopes.configureScope(scope -> { + scope.withPropagationContext(propagationContext -> { + scope.setPropagationContext(new PropagationContext()); + }); + }); } public static void setTrace( final @NotNull IScopes scopes, final @NotNull PropagationContext propagationContext) { - scopes.configureScope( - scope -> { - scope.withPropagationContext( - oldPropagationContext -> { - scope.setPropagationContext(propagationContext); - }); - }); + scopes.configureScope(scope -> { + scope.withPropagationContext(oldPropagationContext -> { + scope.setPropagationContext(propagationContext); + }); + }); } public static @Nullable TracingHeaders traceIfAllowed( @@ -80,7 +76,7 @@ public static void setTrace( // reads scope data such as the environment across current -> isolation -> global scopes.configureScope( ScopeType.COMBINED, - (scope) -> { + scope -> { returnValue.propagationContext = maybeUpdateBaggage(scope, sentryOptions); }); @@ -114,14 +110,13 @@ public static void setTrace( public static @NotNull PropagationContext maybeUpdateBaggage( final @NotNull IScope scope, final @NotNull SentryOptions sentryOptions) { - return scope.withPropagationContext( - propagationContext -> { - @NotNull Baggage baggage = propagationContext.getBaggage(); - if (baggage.isMutable()) { - baggage.setValuesFromScope(scope, sentryOptions); - baggage.freeze(); - } - }); + return scope.withPropagationContext(propagationContext -> { + @NotNull Baggage baggage = propagationContext.getBaggage(); + if (baggage.isMutable()) { + baggage.setValuesFromScope(scope, sentryOptions); + baggage.freeze(); + } + }); } private static boolean shouldAttachTracingHeaders( diff --git a/sentry/src/test/java/io/sentry/BaggageTest.kt b/sentry/src/test/java/io/sentry/BaggageTest.kt index 1a5ca8da418..15a4f4d7a14 100644 --- a/sentry/src/test/java/io/sentry/BaggageTest.kt +++ b/sentry/src/test/java/io/sentry/BaggageTest.kt @@ -134,7 +134,7 @@ class BaggageTest { Faker.instance() .random() .hex( - MAX_BAGGAGE_STRING_LENGTH - 16 - 12 - 1 + MAX_BAGGAGE_STRING_LENGTH - 16 - 12 - 1, ) // 8192 - "large-value=" - "otherValue=value" - "," val incomingHeaderValues = @@ -327,7 +327,7 @@ class BaggageTest { Faker.instance() .random() .hex( - MAX_BAGGAGE_STRING_LENGTH - 19 - 22 - 1 + MAX_BAGGAGE_STRING_LENGTH - 19 - 22 - 1, ) // 8192 - "sentry-mediumValue=" - "sentry-otherValue=kept" - "," val baggage = Baggage.fromHeader( @@ -352,7 +352,7 @@ class BaggageTest { Faker.instance() .random() .hex( - MAX_BAGGAGE_STRING_LENGTH - 19 - 22 + MAX_BAGGAGE_STRING_LENGTH - 19 - 22, ) // 8192 - "sentry-mediumValue=" - "sentry-otherValue=lost" val baggage = Baggage.fromHeader( @@ -642,7 +642,7 @@ class BaggageTest { listOf( "sentry-trace_id=${SentryId()},sentry-public_key=b, sentry-replay_id=${SentryId()}", "sentry-transaction=sentryTransaction, sentry-anewkey=abc", - ) + ), ) val unknown = baggage.unknown assertEquals(1, unknown.size) diff --git a/sentry/src/test/java/io/sentry/CheckInSerializationTest.kt b/sentry/src/test/java/io/sentry/CheckInSerializationTest.kt index 69c65a64c62..73f162df55b 100644 --- a/sentry/src/test/java/io/sentry/CheckInSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/CheckInSerializationTest.kt @@ -26,12 +26,12 @@ class CheckInSerializationTest { PropagationContext().also { it.traceId = SentryId("f382e3180c714217a81371f8c644aefe") it.spanId = SpanId("85694b9f567145a6") - } + }, ) .apply { data[SpanDataConvention.THREAD_ID] = 10 data[SpanDataConvention.THREAD_NAME] = "test" - } + }, ) duration = 12.3 environment = "env" diff --git a/sentry/src/test/java/io/sentry/CombinedContextsViewTest.kt b/sentry/src/test/java/io/sentry/CombinedContextsViewTest.kt index 0fb7d07c0a0..3a13ce7372c 100644 --- a/sentry/src/test/java/io/sentry/CombinedContextsViewTest.kt +++ b/sentry/src/test/java/io/sentry/CombinedContextsViewTest.kt @@ -411,10 +411,10 @@ class CombinedContextsViewTest { fun `prefers spring from current context`() { val combined = fixture.getSut() fixture.current.setSpring( - Spring().also { it.activeProfiles = listOf("current").toTypedArray() } + Spring().also { it.activeProfiles = listOf("current").toTypedArray() }, ) fixture.isolation.setSpring( - Spring().also { it.activeProfiles = listOf("isolation").toTypedArray() } + Spring().also { it.activeProfiles = listOf("isolation").toTypedArray() }, ) fixture.global.setSpring(Spring().also { it.activeProfiles = listOf("global").toTypedArray() }) @@ -425,7 +425,7 @@ class CombinedContextsViewTest { fun `uses isolation spring if current context does not have it`() { val combined = fixture.getSut() fixture.isolation.setSpring( - Spring().also { it.activeProfiles = listOf("isolation").toTypedArray() } + Spring().also { it.activeProfiles = listOf("isolation").toTypedArray() }, ) fixture.global.setSpring(Spring().also { it.activeProfiles = listOf("global").toTypedArray() }) diff --git a/sentry/src/test/java/io/sentry/CombinedScopeViewTest.kt b/sentry/src/test/java/io/sentry/CombinedScopeViewTest.kt index 9439306eec5..450711eadfd 100644 --- a/sentry/src/test/java/io/sentry/CombinedScopeViewTest.kt +++ b/sentry/src/test/java/io/sentry/CombinedScopeViewTest.kt @@ -187,7 +187,7 @@ class CombinedScopeViewTest { capturedHint = hint breadcrumb } - } + }, ) combined.addBreadcrumb( @@ -817,7 +817,7 @@ class CombinedScopeViewTest { assertEquals(ScopeType.ISOLATION, fixture.options.defaultScopeType) assertNull(fixture.scope.attachments.firstOrNull { it.filename == "someAttachment.png" }) assertNotNull( - fixture.isolationScope.attachments.firstOrNull { it.filename == "someAttachment.png" } + fixture.isolationScope.attachments.firstOrNull { it.filename == "someAttachment.png" }, ) assertNull(fixture.globalScope.attachments.firstOrNull { it.filename == "someAttachment.png" }) } @@ -835,10 +835,10 @@ class CombinedScopeViewTest { assertEquals(ScopeType.ISOLATION, fixture.options.defaultScopeType) assertNotNull(fixture.scope.attachments.firstOrNull { it.filename == "scopeAttachment.png" }) assertNull( - fixture.isolationScope.attachments.firstOrNull { it.filename == "isolationAttachment.png" } + fixture.isolationScope.attachments.firstOrNull { it.filename == "isolationAttachment.png" }, ) assertNotNull( - fixture.globalScope.attachments.firstOrNull { it.filename == "globalAttachment.png" } + fixture.globalScope.attachments.firstOrNull { it.filename == "globalAttachment.png" }, ) } diff --git a/sentry/src/test/java/io/sentry/DateUtilsTest.kt b/sentry/src/test/java/io/sentry/DateUtilsTest.kt index 97882198e62..b04d18ed197 100644 --- a/sentry/src/test/java/io/sentry/DateUtilsTest.kt +++ b/sentry/src/test/java/io/sentry/DateUtilsTest.kt @@ -330,7 +330,7 @@ class DateUtilsTest { val threshold = 0.000001 if (diff > threshold) { throw RuntimeException( - "Expected $actual to be within $threshold of $expected but was $diff off" + "Expected $actual to be within $threshold of $expected but was $diff off", ) } } diff --git a/sentry/src/test/java/io/sentry/DeduplicateMultithreadedEventProcessorTest.kt b/sentry/src/test/java/io/sentry/DeduplicateMultithreadedEventProcessorTest.kt index eaa8f178612..e5279605e2a 100644 --- a/sentry/src/test/java/io/sentry/DeduplicateMultithreadedEventProcessorTest.kt +++ b/sentry/src/test/java/io/sentry/DeduplicateMultithreadedEventProcessorTest.kt @@ -24,7 +24,7 @@ class DeduplicateMultithreadedEventProcessorTest { this.type = type this.threadId = tid mechanism = Mechanism().apply { this.isHandled = isHandled } - } + }, ) } return event diff --git a/sentry/src/test/java/io/sentry/DefaultCompositePerformanceCollectorTest.kt b/sentry/src/test/java/io/sentry/DefaultCompositePerformanceCollectorTest.kt index d259100853c..5726b6ca25c 100644 --- a/sentry/src/test/java/io/sentry/DefaultCompositePerformanceCollectorTest.kt +++ b/sentry/src/test/java/io/sentry/DefaultCompositePerformanceCollectorTest.kt @@ -243,14 +243,16 @@ class DefaultCompositePerformanceCollectorTest { val collector = fixture.getSut(null, null) assertNotNull(collector.getProperty>("snapshotCollectors")) assertTrue( - collector.getProperty>("snapshotCollectors").isEmpty() + collector.getProperty>("snapshotCollectors").isEmpty(), ) assertNotNull( - collector.getProperty>("continuousCollectors") + collector.getProperty>("continuousCollectors"), ) assertTrue( - collector.getProperty>("continuousCollectors").isEmpty() + collector + .getProperty>("continuousCollectors") + .isEmpty(), ) } diff --git a/sentry/src/test/java/io/sentry/DsnUtilTest.kt b/sentry/src/test/java/io/sentry/DsnUtilTest.kt index b3807c800ba..575b84eb090 100644 --- a/sentry/src/test/java/io/sentry/DsnUtilTest.kt +++ b/sentry/src/test/java/io/sentry/DsnUtilTest.kt @@ -45,7 +45,7 @@ class DsnUtilTest { DsnUtil.urlContainsDsnHost( optionsWithDsn("http://publicKey:secretKey@localhost:8080/path/id?sample.rate=0.1"), "localhost:8081", - ) + ), ) } @@ -55,7 +55,7 @@ class DsnUtilTest { DsnUtil.urlContainsDsnHost( optionsWithDsn("http://publicKey:secretKey@localhost:8080/path/id?sample.rate=0.1"), "localhost:8080", - ) + ), ) } diff --git a/sentry/src/test/java/io/sentry/DuplicateEventDetectionEventProcessorTest.kt b/sentry/src/test/java/io/sentry/DuplicateEventDetectionEventProcessorTest.kt index 8fb929224ea..9786f90cb50 100644 --- a/sentry/src/test/java/io/sentry/DuplicateEventDetectionEventProcessorTest.kt +++ b/sentry/src/test/java/io/sentry/DuplicateEventDetectionEventProcessorTest.kt @@ -66,7 +66,7 @@ class DuplicateEventDetectionEventProcessorTest { val result = processor.process( SentryEvent( - ExceptionMechanismException(Mechanism(), event.throwable!!, Thread.currentThread()) + ExceptionMechanismException(Mechanism(), event.throwable!!, Thread.currentThread()), ), Hint(), ) @@ -78,7 +78,7 @@ class DuplicateEventDetectionEventProcessorTest { val processor = fixture.getSut() val sentryEvent = SentryEvent( - ExceptionMechanismException(Mechanism(), RuntimeException(), Thread.currentThread()) + ExceptionMechanismException(Mechanism(), RuntimeException(), Thread.currentThread()), ) processor.process(sentryEvent, Hint()) diff --git a/sentry/src/test/java/io/sentry/EnvelopeSenderTest.kt b/sentry/src/test/java/io/sentry/EnvelopeSenderTest.kt index dce7c3d5863..0f29d4f3020 100644 --- a/sentry/src/test/java/io/sentry/EnvelopeSenderTest.kt +++ b/sentry/src/test/java/io/sentry/EnvelopeSenderTest.kt @@ -73,7 +73,7 @@ class EnvelopeSenderTest { val sut = fixture.getSut() val testFile = File( - Files.createTempFile("send-cached-event-test", EnvelopeCache.SUFFIX_ENVELOPE_FILE).toUri() + Files.createTempFile("send-cached-event-test", EnvelopeCache.SUFFIX_ENVELOPE_FILE).toUri(), ) testFile.deleteOnExit() sut.processDirectory(testFile) @@ -90,7 +90,7 @@ class EnvelopeSenderTest { val sut = fixture.getSut() val testFile = File( - Files.createTempFile(tempDirectory, "send-cached-event-test", ".not-right-suffix").toUri() + Files.createTempFile(tempDirectory, "send-cached-event-test", ".not-right-suffix").toUri(), ) sut.processDirectory(File(tempDirectory.toUri())) testFile.deleteOnExit() @@ -116,7 +116,7 @@ class EnvelopeSenderTest { "send-cached-event-test", EnvelopeCache.SUFFIX_ENVELOPE_FILE, ) - .toUri() + .toUri(), ) testFile.deleteOnExit() sut.processDirectory(File(tempDirectory.toUri())) @@ -135,7 +135,7 @@ class EnvelopeSenderTest { "send-cached-event-test", EnvelopeCache.SUFFIX_ENVELOPE_FILE, ) - .toUri() + .toUri(), ) testFile.deleteOnExit() @@ -163,7 +163,7 @@ class EnvelopeSenderTest { "send-cached-event-test", EnvelopeCache.SUFFIX_ENVELOPE_FILE, ) - .toUri() + .toUri(), ) testFile.deleteOnExit() sut.processFile(testFile, Hint()) diff --git a/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt b/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt index cdd184b181f..1f90722d115 100644 --- a/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt @@ -38,7 +38,7 @@ class ExternalOptionsTest { "data-collection.graphql.variables=true", "data-collection.database-query-data=false", "data-collection.file-paths=false", - ) + ), ) { options -> val dataCollection = options.dataCollection @@ -91,7 +91,7 @@ class ExternalOptionsTest { "data-collection.graphql.variables=invalid", "data-collection.database-query-data=invalid", "data-collection.file-paths=invalid", - ) + ), ) { options -> assertThat(options.dataCollection!!.userInfo).isFalse() assertThat(options.dataCollection!!.graphql.document).isFalse() @@ -121,7 +121,7 @@ class ExternalOptionsTest { "proxy.port=9090", "proxy.user=some-user", "proxy.pass=some-pass", - ) + ), ) { assertNotNull(it.proxy) { proxy -> assertEquals("proxy.example.com", proxy.host) @@ -192,7 +192,7 @@ class ExternalOptionsTest { listOf( "in-app-includes=org.springframework,com.myapp", "in-app-excludes=org.jboss,com.microsoft", - ) + ), ) { assertEquals(listOf("org.springframework", "com.myapp"), it.inAppIncludes) assertEquals(listOf("org.jboss", "com.microsoft"), it.inAppExcludes) @@ -343,12 +343,12 @@ class ExternalOptionsTest { @Test fun `creates options with multiple bundle IDs using external properties`() { withPropertiesFile( - "bundle-ids=12ea7a02-46ac-44c0-a5bb-6d1fd9586411,faa3ab42-b1bd-4659-af8e-1682324aa744" + "bundle-ids=12ea7a02-46ac-44c0-a5bb-6d1fd9586411,faa3ab42-b1bd-4659-af8e-1682324aa744", ) { options -> assertTrue( options.bundleIds.containsAll( - listOf("12ea7a02-46ac-44c0-a5bb-6d1fd9586411", "faa3ab42-b1bd-4659-af8e-1682324aa744") - ) + listOf("12ea7a02-46ac-44c0-a5bb-6d1fd9586411", "faa3ab42-b1bd-4659-af8e-1682324aa744"), + ), ) } } @@ -397,7 +397,7 @@ class ExternalOptionsTest { fun `creates options with ignoredTransactions`() { withPropertiesFile("ignored-transactions=transactionName1,transactionName2") { options -> assertTrue( - options.ignoredTransactions!!.containsAll(listOf("transactionName1", "transactionName2")) + options.ignoredTransactions!!.containsAll(listOf("transactionName1", "transactionName2")), ) } } @@ -466,7 +466,7 @@ class ExternalOptionsTest { "cron.default-timezone=America/New_York", "cron.default-failure-issue-threshold=40", "cron.default-recovery-threshold=50", - ) + ), ) { options -> assertEquals(1L, options.cron?.defaultCheckinMargin) assertEquals(30L, options.cron?.defaultMaxRuntime) diff --git a/sentry/src/test/java/io/sentry/JsonObjectDeserializerTest.kt b/sentry/src/test/java/io/sentry/JsonObjectDeserializerTest.kt index f2bb1d79044..c6e10b4d96d 100644 --- a/sentry/src/test/java/io/sentry/JsonObjectDeserializerTest.kt +++ b/sentry/src/test/java/io/sentry/JsonObjectDeserializerTest.kt @@ -261,7 +261,7 @@ class JsonObjectDeserializerTest { "boolean" to true, "array" to listOf("a", "b", "c"), "object" to mapOf("key" to "value"), - ) + ), ) val actual = deserialize(json) diff --git a/sentry/src/test/java/io/sentry/JsonObjectReaderTest.kt b/sentry/src/test/java/io/sentry/JsonObjectReaderTest.kt index d4fd525a87b..42614d642fb 100644 --- a/sentry/src/test/java/io/sentry/JsonObjectReaderTest.kt +++ b/sentry/src/test/java/io/sentry/JsonObjectReaderTest.kt @@ -302,7 +302,7 @@ class JsonObjectReaderTest { fun `nextListOrNull keeps elements after a failing object followed by a primitive`() { val reader = getValuesReader( - "[{\"kind\": \"fail\", \"value\": \"bad\"}, \"oops\", {\"kind\": \"ok\", \"value\": \"two\"}]" + "[{\"kind\": \"fail\", \"value\": \"bad\"}, \"oops\", {\"kind\": \"ok\", \"value\": \"two\"}]", ) val deserializer = JsonDeserializer { objectReader, _ -> diff --git a/sentry/src/test/java/io/sentry/JsonSerializerTest.kt b/sentry/src/test/java/io/sentry/JsonSerializerTest.kt index 95b664e13a9..82f5dc7d5b3 100644 --- a/sentry/src/test/java/io/sentry/JsonSerializerTest.kt +++ b/sentry/src/test/java/io/sentry/JsonSerializerTest.kt @@ -395,7 +395,7 @@ class JsonSerializerTest { val jsonEnvelope = FileFromResources.invoke("envelope_session.txt") val envelope = fixture.serializer.deserializeEnvelope( - ByteArrayInputStream(jsonEnvelope.toByteArray(Charsets.UTF_8)) + ByteArrayInputStream(jsonEnvelope.toByteArray(Charsets.UTF_8)), ) assertEnvelopeData(envelope) } @@ -405,7 +405,7 @@ class JsonSerializerTest { val jsonEnvelope = FileFromResources.invoke("envelope_session_sdkversion.txt") val envelope = fixture.serializer.deserializeEnvelope( - ByteArrayInputStream(jsonEnvelope.toByteArray(Charsets.UTF_8)) + ByteArrayInputStream(jsonEnvelope.toByteArray(Charsets.UTF_8)), )!! assertNotNull(envelope.header.sdkVersion) val sdkInfo = envelope.header.sdkVersion!! @@ -418,7 +418,7 @@ class JsonSerializerTest { assertTrue( sdkInfo.packageSet.any { it.name == "io.sentry:maven:sentry-android-core" && it.version == "4.5.6" - } + }, ) } @@ -431,7 +431,7 @@ class JsonSerializerTest { // reversing it so we can assert the values val envelope = fixture.serializer.deserializeEnvelope( - ByteArrayInputStream(jsonEnvelope.toByteArray(Charsets.UTF_8)) + ByteArrayInputStream(jsonEnvelope.toByteArray(Charsets.UTF_8)), ) assertEnvelopeData(envelope) } @@ -450,7 +450,7 @@ class JsonSerializerTest { // reversing it so we can assert the values val envelope = fixture.serializer.deserializeEnvelope( - ByteArrayInputStream(jsonEnvelope.toByteArray(Charsets.UTF_8)) + ByteArrayInputStream(jsonEnvelope.toByteArray(Charsets.UTF_8)), )!! assertNotNull(envelope.header.sdkVersion) @@ -628,7 +628,7 @@ class JsonSerializerTest { ProfileMeasurement.UNIT_PERCENT, listOf(ProfileMeasurementValue(5, 10.52, measurementNow)), ), - ) + ), ) profilingTraceData.sampledProfile = "sampled profile in base 64" @@ -685,7 +685,7 @@ class JsonSerializerTest { "value" to 60.1, "elapsed_since_start_ns" to "1", "timestamp" to measurementNowSeconds, - ) + ), ), ), ProfileMeasurement.ID_MEMORY_FOOTPRINT to @@ -697,7 +697,7 @@ class JsonSerializerTest { "value" to 100.52, "elapsed_since_start_ns" to "2", "timestamp" to measurementNowSeconds, - ) + ), ), ), ProfileMeasurement.ID_MEMORY_NATIVE_FOOTPRINT to @@ -709,7 +709,7 @@ class JsonSerializerTest { "value" to 104.52, "elapsed_since_start_ns" to "3", "timestamp" to measurementNowSeconds, - ) + ), ), ), ProfileMeasurement.ID_CPU_USAGE to @@ -721,7 +721,7 @@ class JsonSerializerTest { "value" to 10.52, "elapsed_since_start_ns" to "5", "timestamp" to measurementNowSeconds, - ) + ), ), ), ), @@ -999,7 +999,7 @@ class JsonSerializerTest { ProfileMeasurement.UNIT_PERCENT, listOf(ProfileMeasurementValue(5, 10.52, measurementNow)), ), - ) + ), ) val actual = serializeToString(profileChunk) @@ -1030,7 +1030,7 @@ class JsonSerializerTest { "value" to 60.1, "elapsed_since_start_ns" to "1", "timestamp" to measurementNowSeconds, - ) + ), ), ), ProfileMeasurement.ID_MEMORY_FOOTPRINT to @@ -1042,7 +1042,7 @@ class JsonSerializerTest { "value" to 100.52, "elapsed_since_start_ns" to "2", "timestamp" to measurementNowSeconds, - ) + ), ), ), ProfileMeasurement.ID_MEMORY_NATIVE_FOOTPRINT to @@ -1054,7 +1054,7 @@ class JsonSerializerTest { "value" to 104.52, "elapsed_since_start_ns" to "3", "timestamp" to measurementNowSeconds, - ) + ), ), ), ProfileMeasurement.ID_CPU_USAGE to @@ -1066,7 +1066,7 @@ class JsonSerializerTest { "value" to 10.52, "elapsed_since_start_ns" to "5", "timestamp" to measurementNowSeconds, - ) + ), ), ), ), @@ -1207,7 +1207,7 @@ class JsonSerializerTest { val jsonTrace = (element["contexts"] as Map<*, *>)["trace"] as Map<*, *> assertEquals("dataValue", (jsonTrace["data"] as Map<*, *>)["dataKey"] as String) assertTrue( - (jsonTrace["data"] as Map<*, *>)["flag.evaluation.transaction-feature-flag"] as Boolean + (jsonTrace["data"] as Map<*, *>)["flag.evaluation.transaction-feature-flag"] as Boolean, ) assertNotNull(jsonTrace["trace_id"] as String) assertNotNull(jsonTrace["span_id"] as String) @@ -1601,7 +1601,7 @@ class JsonSerializerTest { listOf( Breadcrumb(timestamp).apply { message = "test" }, Breadcrumb(timestamp).apply { category = "navigation" }, - ) + ), ) val deserializedCollection = @@ -1725,7 +1725,7 @@ class JsonSerializerTest { private fun generateEmptySentryEvent(date: Date = Date()): SentryEvent = SentryEvent(date) private fun createSessionMockData( - sessionId: String = "c81d4e2e-bcf2-11e6-869b-7df92533d2db" + sessionId: String = "c81d4e2e-bcf2-11e6-869b-7df92533d2db", ): Session = Session( Session.State.Ok, diff --git a/sentry/src/test/java/io/sentry/JsonUnknownSerializationTest.kt b/sentry/src/test/java/io/sentry/JsonUnknownSerializationTest.kt index 37bf1efef98..93cb017f48c 100644 --- a/sentry/src/test/java/io/sentry/JsonUnknownSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/JsonUnknownSerializationTest.kt @@ -73,7 +73,7 @@ class JsonUnknownSerializationTest( SentryPackage( "b59a1949-9950-4203-b394-ddd8d02c9633", "3d7790f3-7f32-43f7-b82f-9f5bc85205a8", - ) + ), ) val sentryRuntime = givenJsonUnknown(SentryRuntime()) val sentrySpan = givenJsonUnknown(SentrySpanSerializationTest.Fixture().getSut()) @@ -86,7 +86,10 @@ class JsonUnknownSerializationTest( val session = givenJsonUnknown(SessionSerializationTest.Fixture().getSut()) val skdVersion = givenJsonUnknown( - SdkVersion("3e934135-3f2b-49bc-8756-9f025b55143e", "3e31738e-4106-42d0-8be2-4a3a1bc648d3") + SdkVersion( + "3e934135-3f2b-49bc-8756-9f025b55143e", + "3e31738e-4106-42d0-8be2-4a3a1bc648d3", + ), ) val spanContext = givenJsonUnknown(SpanContext("c2fb8fee2e2b49758bcb67cda0f713c7")) val traceContext = givenJsonUnknown(TraceContextSerializationTest.Fixture().getSut()) diff --git a/sentry/src/test/java/io/sentry/NoOpConnectionStatusProviderTest.kt b/sentry/src/test/java/io/sentry/NoOpConnectionStatusProviderTest.kt index b412d7c27ed..aad1b68e1dd 100644 --- a/sentry/src/test/java/io/sentry/NoOpConnectionStatusProviderTest.kt +++ b/sentry/src/test/java/io/sentry/NoOpConnectionStatusProviderTest.kt @@ -23,7 +23,7 @@ class NoOpConnectionStatusProviderTest { fun `adding a listener is a no-op and returns false`() { val result = provider.addConnectionStatusObserver( - mock() + mock(), ) assertFalse(result) } @@ -31,7 +31,7 @@ class NoOpConnectionStatusProviderTest { @Test fun `removing a listener is a no-op`() { provider.addConnectionStatusObserver( - mock() + mock(), ) } } diff --git a/sentry/src/test/java/io/sentry/NoOpTransactionTest.kt b/sentry/src/test/java/io/sentry/NoOpTransactionTest.kt index a1a81d37407..72042c85a13 100644 --- a/sentry/src/test/java/io/sentry/NoOpTransactionTest.kt +++ b/sentry/src/test/java/io/sentry/NoOpTransactionTest.kt @@ -18,7 +18,13 @@ class NoOpTransactionTest { assertNotNull(transaction.startChild("op", "desc", SentryNanotimeDate())) assertNotNull(transaction.startChild("op", "desc", SentryNanotimeDate(), Instrumenter.SENTRY)) assertNotNull( - transaction.startChild("op", "desc", SentryNanotimeDate(), Instrumenter.SENTRY, SpanOptions()) + transaction.startChild( + "op", + "desc", + SentryNanotimeDate(), + Instrumenter.SENTRY, + SpanOptions(), + ), ) } diff --git a/sentry/src/test/java/io/sentry/OptionsContainerTest.kt b/sentry/src/test/java/io/sentry/OptionsContainerTest.kt index 7d168e2660a..716b1609189 100644 --- a/sentry/src/test/java/io/sentry/OptionsContainerTest.kt +++ b/sentry/src/test/java/io/sentry/OptionsContainerTest.kt @@ -7,7 +7,7 @@ class OptionsContainerTest { @Test fun `When passing class to OptionsContainer, instance is created based on the type`() { assertTrue( - (OptionsContainer.create(SentryOptions::class.java)).createInstance() is SentryOptions + (OptionsContainer.create(SentryOptions::class.java)).createInstance() is SentryOptions, ) } } diff --git a/sentry/src/test/java/io/sentry/PreviousSessionFinalizerTest.kt b/sentry/src/test/java/io/sentry/PreviousSessionFinalizerTest.kt index 4c8510facca..f9a3097ec7d 100644 --- a/sentry/src/test/java/io/sentry/PreviousSessionFinalizerTest.kt +++ b/sentry/src/test/java/io/sentry/PreviousSessionFinalizerTest.kt @@ -118,7 +118,7 @@ class PreviousSessionFinalizerTest { val sessionCreationToFinalizerInterval = 20000 val sessionCreationTimestamp = DateUtils.getDateTime( - DateUtils.getCurrentDateTime().time - sessionCreationToFinalizerInterval + DateUtils.getCurrentDateTime().time - sessionCreationToFinalizerInterval, ) val finalizer = @@ -154,7 +154,7 @@ class PreviousSessionFinalizerTest { captureTimestamp - session.started!!.time > sessionCreationToFinalizerInterval && session.timestamp!!.time != sessionCreationTimestamp.time && captureTimestamp - session.timestamp!!.time < 1000 - } + }, ) } @@ -177,7 +177,7 @@ class PreviousSessionFinalizerTest { argThat { val session = fixture.sessionFromEnvelope(this) session.release == "io.sentry.sample@1.0" && session.timestamp!! == abnormalEndDate - } + }, ) } @@ -196,7 +196,7 @@ class PreviousSessionFinalizerTest { argThat { val session = fixture.sessionFromEnvelope(this) session.release == "io.sentry.sample@1.0" && session.status == Crashed - } + }, ) } @@ -219,7 +219,7 @@ class PreviousSessionFinalizerTest { session.release == "io.sentry.sample@1.0" && session.status == Session.State.Unhandled && session.hasNonTerminatingUnhandledError() - } + }, ) } @@ -241,7 +241,7 @@ class PreviousSessionFinalizerTest { argThat { val session = fixture.sessionFromEnvelope(this) session.release == "io.sentry.sample@1.0" && session.status == Crashed - } + }, ) } @@ -277,7 +277,7 @@ class PreviousSessionFinalizerTest { any(), argThat { startsWith( - "Timed out waiting to flush previous session to its own file in session finalizer." + "Timed out waiting to flush previous session to its own file in session finalizer.", ) }, ) diff --git a/sentry/src/test/java/io/sentry/ScopeTest.kt b/sentry/src/test/java/io/sentry/ScopeTest.kt index 3fb19078c27..d6cd6f7c1df 100644 --- a/sentry/src/test/java/io/sentry/ScopeTest.kt +++ b/sentry/src/test/java/io/sentry/ScopeTest.kt @@ -211,7 +211,7 @@ class ScopeTest { request.method = "post" scope.setTransaction( - SentryTracer(TransactionContext("newTransaction", "op"), NoOpScopes.getInstance()) + SentryTracer(TransactionContext("newTransaction", "op"), NoOpScopes.getInstance()), ) // because you can only set a new list to scope @@ -1181,7 +1181,7 @@ class ScopeTest { Scope(options).apply { screen = "MainActivity" } verify(observer) .setContexts( - check { contexts -> assertEquals("MainActivity", contexts.app?.viewNames?.first()) } + check { contexts -> assertEquals("MainActivity", contexts.app?.viewNames?.first()) }, ) } @@ -1319,7 +1319,7 @@ class ScopeTest { SentryAttributes.of( SentryAttribute.stringAttribute("key1", "value1"), SentryAttribute.integerAttribute("key2", 42), - ) + ), ) val attrs = scope.attributes assertEquals(2, attrs.size) diff --git a/sentry/src/test/java/io/sentry/ScopesTest.kt b/sentry/src/test/java/io/sentry/ScopesTest.kt index 8e55d4fbc5b..253c054531c 100644 --- a/sentry/src/test/java/io/sentry/ScopesTest.kt +++ b/sentry/src/test/java/io/sentry/ScopesTest.kt @@ -801,7 +801,7 @@ class ScopesTest { assertEquals(userFeedback.email, it.email) assertEquals(userFeedback.name, it.name) assertEquals(userFeedback.comments, it.comments) - } + }, ) } @@ -1591,7 +1591,7 @@ class ScopesTest { anyOrNull(), anyOrNull(), anyOrNull(), - ) + ), ) .thenReturn(SentryId()) @@ -2307,7 +2307,7 @@ class ScopesTest { scopes.continueTrace( "$traceId-$parentSpanId-1", listOf( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=$traceId,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=$traceId,sentry-transaction=HTTP%20GET", ), ) @@ -2329,7 +2329,7 @@ class ScopesTest { scopes.continueTrace( "$traceId-$parentSpanId", listOf( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=$traceId,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=$traceId,sentry-transaction=HTTP%20GET", ), ) @@ -2356,7 +2356,7 @@ class ScopesTest { scopes.continueTrace( "invalid", listOf( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=$traceId,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=$traceId,sentry-transaction=HTTP%20GET", ), ) @@ -2380,7 +2380,7 @@ class ScopesTest { scopes.continueTrace( "$traceId-$parentSpanId-1", listOf( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=$traceId,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=$traceId,sentry-transaction=HTTP%20GET", ), ) @@ -2405,7 +2405,7 @@ class ScopesTest { scopes.continueTrace( "invalid", listOf( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=$traceId,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=$traceId,sentry-transaction=HTTP%20GET", ), ) @@ -2559,7 +2559,7 @@ class ScopesTest { .log( eq(SentryLevel.WARNING), eq( - "Continuous Profiling is not enabled. Set profilesSampleRate and profilesSampler to null to enable it." + "Continuous Profiling is not enabled. Set profilesSampleRate and profilesSampler to null to enable it.", ), ) } @@ -2613,7 +2613,7 @@ class ScopesTest { .log( eq(SentryLevel.WARNING), eq( - "Continuous Profiling is not enabled. Set profilesSampleRate and profilesSampler to null to enable it." + "Continuous Profiling is not enabled. Set profilesSampleRate and profilesSampler to null to enable it.", ), ) } @@ -2960,7 +2960,7 @@ class ScopesTest { SentryAttribute.named("namedintattr", 18), SentryAttribute.named("nameddoubleattr", 4.9), SentryAttribute.named("namedarrayattr", listOf("x", "y")), - ) + ), ), "log message", ) @@ -3720,7 +3720,7 @@ class ScopesTest { SentryAttribute.named("namedintattr", 18), SentryAttribute.named("nameddoubleattr", 4.9), SentryAttribute.named("namedarrayattr", listOf("x", "y")), - ) + ), ), ) @@ -3899,7 +3899,7 @@ class ScopesTest { SentryAttribute.named("namedintattr", 18), SentryAttribute.named("nameddoubleattr", 4.9), SentryAttribute.named("namedarrayattr", listOf("x", "y")), - ) + ), ), ) @@ -4078,7 +4078,7 @@ class ScopesTest { SentryAttribute.named("namedintattr", 18), SentryAttribute.named("nameddoubleattr", 4.9), SentryAttribute.named("namedarrayattr", listOf("x", "y")), - ) + ), ), ) @@ -4551,7 +4551,7 @@ class ScopesTest { private val dsnTest = "https://key@sentry.io/proj" private fun generateScopes( - optionsConfiguration: Sentry.OptionsConfiguration? = null + optionsConfiguration: Sentry.OptionsConfiguration? = null, ): IScopes { val options = SentryOptions().apply { @@ -4565,7 +4565,7 @@ class ScopesTest { } private fun getEnabledScopes( - optionsConfiguration: Sentry.OptionsConfiguration? = null + optionsConfiguration: Sentry.OptionsConfiguration? = null, ): Triple { val logger = mock() diff --git a/sentry/src/test/java/io/sentry/SendCachedEnvelopeFireAndForgetIntegrationTest.kt b/sentry/src/test/java/io/sentry/SendCachedEnvelopeFireAndForgetIntegrationTest.kt index 677f32441e4..fa45da5cad1 100644 --- a/sentry/src/test/java/io/sentry/SendCachedEnvelopeFireAndForgetIntegrationTest.kt +++ b/sentry/src/test/java/io/sentry/SendCachedEnvelopeFireAndForgetIntegrationTest.kt @@ -101,7 +101,7 @@ class SendCachedEnvelopeFireAndForgetIntegrationTest { .log( eq(SentryLevel.ERROR), eq( - "Failed to call the executor. Cached events will not be sent. Did you call Sentry.close()?" + "Failed to call the executor. Cached events will not be sent. Did you call Sentry.close()?", ), any(), ) diff --git a/sentry/src/test/java/io/sentry/SentryClientTest.kt b/sentry/src/test/java/io/sentry/SentryClientTest.kt index e04cadf624f..af3be5847ec 100644 --- a/sentry/src/test/java/io/sentry/SentryClientTest.kt +++ b/sentry/src/test/java/io/sentry/SentryClientTest.kt @@ -467,7 +467,7 @@ class SentryClientTest { scope.addEventProcessor( object : EventProcessor { override fun process(event: SentryLogEvent): SentryLogEvent? = null - } + }, ) val sut = fixture.getSut() @@ -630,7 +630,7 @@ class SentryClientTest { scope.addEventProcessor( object : EventProcessor { override fun process(event: SentryMetricsEvent, hint: Hint): SentryMetricsEvent? = null - } + }, ) val sut = fixture.getSut() @@ -1065,7 +1065,7 @@ class SentryClientTest { assertEquals("application/json", item.header.contentType) assertEnvelopeItemDataForUserFeedback(item) - } + }, ) } @@ -1590,7 +1590,7 @@ class SentryClientTest { transaction.spans.removeIf { it.description != "span2" } return transaction } - } + }, ) fixture.getSut().captureTransaction(transaction, scope, null) @@ -2250,7 +2250,7 @@ class SentryClientTest { assertEquals(1, images.size) assertEquals(DebugImage.PROGUARD, images[0].type) assertEquals("current-uuid", images[0].uuid) - } + }, ) } @@ -2264,7 +2264,7 @@ class SentryClientTest { DebugImage().apply { type = DebugImage.PROGUARD uuid = "previous-uuid" - } + }, ) } @@ -2280,7 +2280,7 @@ class SentryClientTest { assertEquals(1, images.size) assertEquals(DebugImage.PROGUARD, images[0].type) assertEquals("previous-uuid", images[0].uuid) - } + }, ) } @@ -2525,7 +2525,7 @@ class SentryClientTest { } override fun registerSegmentName(segmentName: String) {} - } + }, ) val sut = fixture.getSut() val sentryTracer = SentryTracer(TransactionContext("name", "op"), fixture.scopes) @@ -2542,7 +2542,7 @@ class SentryClientTest { override fun registerSegmentName(segmentName: String) { registeredSegmentName = segmentName } - } + }, ) val sut = fixture.getSut() val sentryTracer = @@ -3119,7 +3119,7 @@ class SentryClientTest { override fun process(transaction: SentryTransaction, hint: Hint): SentryTransaction? { return transaction } - } + }, ) } @@ -3143,7 +3143,7 @@ class SentryClientTest { override fun process(transaction: SentryTransaction, hint: Hint): SentryTransaction? { return transaction } - } + }, ) } @@ -3208,7 +3208,7 @@ class SentryClientTest { hint.addAttachment(fixture.attachment3) return transaction } - } + }, ) } @@ -3242,7 +3242,7 @@ class SentryClientTest { hint.replaceAttachments(listOf(fixture.attachment3)) return transaction } - } + }, ) } @@ -3819,7 +3819,7 @@ class SentryClientTest { called = true return SentryId.EMPTY_ID } - } + }, ) val sut = fixture.getSut() @@ -3836,7 +3836,7 @@ class SentryClientTest { terminated = isTerminating return SentryId.EMPTY_ID } - } + }, ) val sut = fixture.getSut() @@ -3844,7 +3844,7 @@ class SentryClientTest { SentryEvent().apply { exceptions = listOf(SentryException().apply { mechanism = Mechanism().apply { isHandled = false } }) - } + }, ) assertTrue(terminated == true) } @@ -3855,7 +3855,7 @@ class SentryClientTest { fixture.sentryOptions.setReplayController( object : ReplayController by NoOpReplayController.getInstance() { override fun captureReplay(isTerminating: Boolean?): SentryId = replayId - } + }, ) val sut = fixture.getSut() @@ -3916,7 +3916,7 @@ class SentryClientTest { called = true return SentryId.EMPTY_ID } - } + }, ) val sut = fixture.getSut() @@ -3939,7 +3939,7 @@ class SentryClientTest { called = true return SentryId.EMPTY_ID } - } + }, ) val sut = fixture.getSut() @@ -3980,7 +3980,7 @@ class SentryClientTest { called = true return SentryId.EMPTY_ID } - } + }, ) fixture.sentryOptions.sessionReplay.beforeErrorSampling = SentryReplayOptions.BeforeErrorSamplingCallback { _, _ -> @@ -4001,7 +4001,7 @@ class SentryClientTest { called = true return SentryId.EMPTY_ID } - } + }, ) fixture.sentryOptions.sessionReplay.beforeErrorSampling = SentryReplayOptions.BeforeErrorSamplingCallback { _, _ -> @@ -4022,7 +4022,7 @@ class SentryClientTest { called = true return SentryId.EMPTY_ID } - } + }, ) val sut = fixture.getSut() @@ -4049,7 +4049,7 @@ class SentryClientTest { SentryEvent().apply { exceptions = listOf( - SentryException().apply { mechanism = Mechanism().apply { isHandled = handled } } + SentryException().apply { mechanism = Mechanism().apply { isHandled = handled } }, ) } } @@ -4112,7 +4112,7 @@ class SentryClientTest { fixture.sentryOptions.setReplayController( object : ReplayController by NoOpReplayController.getInstance() { override fun captureReplay(isTerminating: Boolean?): SentryId = SentryId.EMPTY_ID - } + }, ) fixture.sentryOptions.sessionReplay.beforeErrorSampling = SentryReplayOptions.BeforeErrorSamplingCallback { event, hint -> @@ -4138,7 +4138,7 @@ class SentryClientTest { called = true return SentryId.EMPTY_ID } - } + }, ) val sut = fixture.getSut() @@ -4417,7 +4417,7 @@ class SentryClientTest { assertClientReport( fixture.sentryOptions.clientReportRecorder, listOf( - DiscardedEvent(DiscardReason.CALLBACK_ERROR.reason, DataCategory.Feedback.category, 1) + DiscardedEvent(DiscardReason.CALLBACK_ERROR.reason, DataCategory.Feedback.category, 1), ), ) @@ -4436,7 +4436,7 @@ class SentryClientTest { assertClientReport( fixture.sentryOptions.clientReportRecorder, listOf( - DiscardedEvent(DiscardReason.EVENT_PROCESSOR.reason, DataCategory.Feedback.category, 1) + DiscardedEvent(DiscardReason.EVENT_PROCESSOR.reason, DataCategory.Feedback.category, 1), ), ) @@ -4465,7 +4465,7 @@ class SentryClientTest { assertClientReport( fixture.sentryOptions.clientReportRecorder, listOf( - DiscardedEvent(DiscardReason.CALLBACK_ERROR.reason, DataCategory.Feedback.category, 1) + DiscardedEvent(DiscardReason.CALLBACK_ERROR.reason, DataCategory.Feedback.category, 1), ), ) verify(onDiscard).execute(DiscardReason.CALLBACK_ERROR, DataCategory.Feedback, 1) @@ -4576,7 +4576,7 @@ class SentryClientTest { val bytesTooBig = ByteArray((fixture.maxAttachmentSize + 1).toInt()) { 0 } addAttachment( - Attachment(bytesTooBig, "will_get_dropped.txt", "application/octet-stream", true) + Attachment(bytesTooBig, "will_get_dropped.txt", "application/octet-stream", true), ) } } @@ -4693,7 +4693,7 @@ class SentryClientTest { val attachmentItemTooBig = attachmentItems.last() assertFailsWith( "Getting data from attachment should" + - "throw an exception, because the attachment is too big." + "throw an exception, because the attachment is too big.", ) { attachmentItemTooBig.data } @@ -4725,7 +4725,7 @@ class SentryClientTest { val profilingTraceItem = actual.items.firstOrNull { item -> item.header.type == SentryItemType.ProfileChunk } assertNotNull(profilingTraceItem?.data) - } + }, ) } diff --git a/sentry/src/test/java/io/sentry/SentryClientTransactionProfileTest.kt b/sentry/src/test/java/io/sentry/SentryClientTransactionProfileTest.kt index 24761837516..b176ec0328e 100644 --- a/sentry/src/test/java/io/sentry/SentryClientTransactionProfileTest.kt +++ b/sentry/src/test/java/io/sentry/SentryClientTransactionProfileTest.kt @@ -72,7 +72,7 @@ class SentryClientTransactionProfileTest( ) if (hasProfile) { expected.add( - DiscardedEvent(DiscardReason.CALLBACK_ERROR.reason, DataCategory.Profile.category, 1) + DiscardedEvent(DiscardReason.CALLBACK_ERROR.reason, DataCategory.Profile.category, 1), ) verify(onDiscard).execute(DiscardReason.CALLBACK_ERROR, DataCategory.Profile, 1) } diff --git a/sentry/src/test/java/io/sentry/SentryEndToEndTest.kt b/sentry/src/test/java/io/sentry/SentryEndToEndTest.kt index 742f4462b2b..3c627902428 100644 --- a/sentry/src/test/java/io/sentry/SentryEndToEndTest.kt +++ b/sentry/src/test/java/io/sentry/SentryEndToEndTest.kt @@ -41,7 +41,7 @@ class SentryEndToEndTest { addBreadcrumb(Breadcrumb("Processed by the event processor")) } } - } + }, ) } @@ -62,11 +62,11 @@ class SentryEndToEndTest { message = Message().apply { message = "Detailed event" } fingerprints = listOf("NewClientDebug") level = SentryLevel.DEBUG - } + }, ) repeat(10) { i -> Sentry.captureEvent( - SentryEvent().apply { message = Message().apply { message = "event $i" } } + SentryEvent().apply { message = Message().apply { message = "event $i" } }, ) } val transaction = Sentry.startTransaction("transaction name", "op") diff --git a/sentry/src/test/java/io/sentry/SentryEnvelopeItemTest.kt b/sentry/src/test/java/io/sentry/SentryEnvelopeItemTest.kt index 9f006ed94e9..561d12a26c2 100644 --- a/sentry/src/test/java/io/sentry/SentryEnvelopeItemTest.kt +++ b/sentry/src/test/java/io/sentry/SentryEnvelopeItemTest.kt @@ -193,7 +193,7 @@ class SentryEnvelopeItemTest { assertFailsWith( "Reading the attachment ${attachment.pathname} failed, because the file located at " + - "the path is not a file." + "the path is not a file.", ) { item.data } @@ -218,7 +218,7 @@ class SentryEnvelopeItemTest { ) assertFailsWith( - "Reading the attachment ${attachment.pathname} failed, " + "because can't read the file." + "Reading the attachment ${attachment.pathname} failed, " + "because can't read the file.", ) { item.data } @@ -272,7 +272,7 @@ class SentryEnvelopeItemTest { assertFailsWith( "Couldn't attach the attachment ${attachment.filename}.\n" + - "Please check that either bytes or a path is set." + "Please check that either bytes or a path is set.", ) { item.data } @@ -385,7 +385,7 @@ class SentryEnvelopeItemTest { assertFailsWith( "Couldn't attach the attachment ${attachment.filename}.\n" + - "Please check that either bytes or a path is set." + "Please check that either bytes or a path is set.", ) { item.data } @@ -427,7 +427,7 @@ class SentryEnvelopeItemTest { val profilingTraceData = mock { whenever(it.traceFile).thenReturn(file) } assertFailsWith( - "Dropping profiling trace data, because the file ${file.path} doesn't exists" + "Dropping profiling trace data, because the file ${file.path} doesn't exists", ) { SentryEnvelopeItem.fromProfilingTrace(profilingTraceData, fixture.maxAttachmentSize, mock()) .data @@ -445,7 +445,7 @@ class SentryEnvelopeItemTest { file.writeBytes(fixture.bytes) file.setReadable(false) assertFailsWith( - "Dropping profiling trace data, because the file ${file.path} doesn't exists" + "Dropping profiling trace data, because the file ${file.path} doesn't exists", ) { SentryEnvelopeItem.fromProfilingTrace(profilingTraceData, fixture.maxAttachmentSize, mock()) .data @@ -538,7 +538,7 @@ class SentryEnvelopeItemTest { } assertFailsWith( - "Dropping profiling trace data, because the file ${file.path} doesn't exists" + "Dropping profiling trace data, because the file ${file.path} doesn't exists", ) { SentryEnvelopeItem.fromProfileChunk(profileChunk, mock()).data } @@ -555,7 +555,7 @@ class SentryEnvelopeItemTest { file.writeBytes(fixture.bytes) file.setReadable(false) assertFailsWith( - "Dropping profiling trace data, because the file ${file.path} doesn't exists" + "Dropping profiling trace data, because the file ${file.path} doesn't exists", ) { SentryEnvelopeItem.fromProfileChunk(profileChunk, mock()).data } diff --git a/sentry/src/test/java/io/sentry/SentryEventTest.kt b/sentry/src/test/java/io/sentry/SentryEventTest.kt index 70514a6b72d..cf113611ba5 100644 --- a/sentry/src/test/java/io/sentry/SentryEventTest.kt +++ b/sentry/src/test/java/io/sentry/SentryEventTest.kt @@ -27,7 +27,7 @@ class SentryEventTest { assertTrue( Instant.now() .plus(1, ChronoUnit.HOURS) - .isAfter(Instant.parse(DateUtils.getTimestamp(SentryEvent().timestamp))) + .isAfter(Instant.parse(DateUtils.getTimestamp(SentryEvent().timestamp))), ) @Test @@ -35,7 +35,7 @@ class SentryEventTest { assertTrue( Instant.now() .minus(1, ChronoUnit.HOURS) - .isBefore(Instant.parse(DateUtils.getTimestamp(SentryEvent().timestamp))) + .isBefore(Instant.parse(DateUtils.getTimestamp(SentryEvent().timestamp))), ) @Test @@ -201,7 +201,7 @@ class SentryEventTest { try { event.set( JsonSerializer(SentryOptions()) - .deserialize(StringReader(json), SentryEvent::class.java) + .deserialize(StringReader(json), SentryEvent::class.java), ) } catch (throwable: Throwable) { error.set(throwable) diff --git a/sentry/src/test/java/io/sentry/SentryExceptionFactoryTest.kt b/sentry/src/test/java/io/sentry/SentryExceptionFactoryTest.kt index 55472ae6738..191d681c219 100644 --- a/sentry/src/test/java/io/sentry/SentryExceptionFactoryTest.kt +++ b/sentry/src/test/java/io/sentry/SentryExceptionFactoryTest.kt @@ -19,7 +19,7 @@ import org.mockito.kotlin.whenever class SentryExceptionFactoryTest { private class Fixture { fun getSut( - stackTraceFactory: SentryStackTraceFactory = SentryStackTraceFactory(SentryOptions()) + stackTraceFactory: SentryStackTraceFactory = SentryStackTraceFactory(SentryOptions()), ): SentryExceptionFactory = SentryExceptionFactory(stackTraceFactory) } @@ -155,7 +155,7 @@ class SentryExceptionFactoryTest { assertTrue( queue.first.stacktrace!!.frames!!.any { it.module != null && it.module!!.startsWith("io.sentry") - } + }, ) } @@ -183,7 +183,7 @@ class SentryExceptionFactoryTest { lineno = 777 module = "io.sentry.samples.MainActivity" function = "run" - } + }, ) } } diff --git a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt index 284c0a98cd5..1a6bbb6148b 100644 --- a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt @@ -339,7 +339,7 @@ class SentryOptionsTest { assertTrue( sdkVersion.packageSet.any { it.name == "maven:io.sentry:sentry" && it.version == BuildConfig.VERSION_NAME - } + }, ) } @@ -558,7 +558,7 @@ class SentryOptionsTest { externalOptions.shutdownTimeoutMillis = 1499L externalOptions.sessionFlushTimeoutMillis = 1498L externalOptions.bundleIds.addAll( - listOf("12ea7a02-46ac-44c0-a5bb-6d1fd9586411 ", " faa3ab42-b1bd-4659-af8e-1682324aa744") + listOf("12ea7a02-46ac-44c0-a5bb-6d1fd9586411 ", " faa3ab42-b1bd-4659-af8e-1682324aa744"), ) externalOptions.isEnabled = false externalOptions.isEnablePrettySerializationOutput = false @@ -853,11 +853,11 @@ class SentryOptionsTest { override fun getConnectionType(): String? = null override fun addConnectionStatusObserver( - observer: IConnectionStatusProvider.IConnectionStatusObserver + observer: IConnectionStatusProvider.IConnectionStatusObserver, ) = false override fun removeConnectionStatusObserver( - observer: IConnectionStatusProvider.IConnectionStatusObserver + observer: IConnectionStatusProvider.IConnectionStatusObserver, ) { // no-op } diff --git a/sentry/src/test/java/io/sentry/SentryStackTraceFactoryTest.kt b/sentry/src/test/java/io/sentry/SentryStackTraceFactoryTest.kt index d93d7f6f027..507181eeaaa 100644 --- a/sentry/src/test/java/io/sentry/SentryStackTraceFactoryTest.kt +++ b/sentry/src/test/java/io/sentry/SentryStackTraceFactoryTest.kt @@ -134,7 +134,7 @@ class SentryStackTraceFactoryTest { SentryOptions().apply { addInAppExclude("io.mysentry") addInAppInclude("io.mysentry") - } + }, ) val sentryElements = sentryStackTraceFactory.getStackFrames(elements, false) @@ -148,7 +148,7 @@ class SentryStackTraceFactoryTest { SentryOptions().apply { addInAppExclude("io.mysentry.not") addInAppInclude("io.mysentry.inApp") - } + }, ) assertTrue(sentryStackTraceFactory.isInApp("io.mysentry.inApp.ClassName")!!) assertTrue(sentryStackTraceFactory.isInApp("io.mysentry.inApp.somePackage.ClassName")!!) @@ -172,7 +172,7 @@ class SentryStackTraceFactoryTest { assertNull( sut.getStackFrames(stacktrace, false)!!.find { it.module != null && it.module!!.startsWith("io.sentry") - } + }, ) } @@ -185,7 +185,7 @@ class SentryStackTraceFactoryTest { assertTrue( sut.getStackFrames(stacktrace, true)!!.any { it.module != null && it.module!!.startsWith("io.sentry") - } + }, ) } @@ -198,7 +198,7 @@ class SentryStackTraceFactoryTest { assertNotNull( sut.getStackFrames(stacktrace, false)!!.find { it.module != null && it.module!!.startsWith("io.sentry") - } + }, ) } @@ -211,7 +211,7 @@ class SentryStackTraceFactoryTest { assertNotNull( sut.getStackFrames(stacktrace, false)!!.find { it.module != null && it.module!!.startsWith("io.sentry") - } + }, ) } diff --git a/sentry/src/test/java/io/sentry/SentryTest.kt b/sentry/src/test/java/io/sentry/SentryTest.kt index 0ccfb79d699..24406d541ba 100644 --- a/sentry/src/test/java/io/sentry/SentryTest.kt +++ b/sentry/src/test/java/io/sentry/SentryTest.kt @@ -653,7 +653,7 @@ class SentryTest { assertNotNull(currentScopesEvent) assertNotNull( - currentScopesEvent.breadcrumbs?.firstOrNull { it.message == "breadcrumbMainClone" } + currentScopesEvent.breadcrumbs?.firstOrNull { it.message == "breadcrumbMainClone" }, ) assertNotNull(currentScopesEvent.breadcrumbs?.firstOrNull { it.message == "breadcrumbCurrent" }) assertNull(currentScopesEvent.breadcrumbs?.firstOrNull { it.message == "breadcrumbNoOp" }) @@ -840,7 +840,7 @@ class SentryTest { .log( eq(SentryLevel.ERROR), eq( - "Failed to call the executor. Old profiles will not be deleted. Did you call Sentry.close()?" + "Failed to call the executor. Old profiles will not be deleted. Did you call Sentry.close()?", ), any(), ) @@ -1231,7 +1231,7 @@ class SentryTest { assertEquals("app.launch", it.transactionContext.name) assertEquals("profile", it.transactionContext.operation) assertTrue(it.transactionContext.isForNextAppStart) - } + }, ) verify(mockProfilesSampler) .sample( @@ -1239,7 +1239,7 @@ class SentryTest { assertEquals("app.launch", it.transactionContext.name) assertEquals("profile", it.transactionContext.operation) assertTrue(it.transactionContext.isForNextAppStart) - } + }, ) } diff --git a/sentry/src/test/java/io/sentry/SentryThreadFactoryTest.kt b/sentry/src/test/java/io/sentry/SentryThreadFactoryTest.kt index c2eda19efc4..7f89c56448d 100644 --- a/sentry/src/test/java/io/sentry/SentryThreadFactoryTest.kt +++ b/sentry/src/test/java/io/sentry/SentryThreadFactoryTest.kt @@ -12,7 +12,7 @@ class SentryThreadFactoryTest { class Fixture { internal fun getSut() = SentryThreadFactory( - SentryStackTraceFactory(SentryOptions().apply { addInAppExclude("io.sentry") }) + SentryStackTraceFactory(SentryOptions().apply { addInAppExclude("io.sentry") }), ) } @@ -53,7 +53,7 @@ class SentryThreadFactoryTest { sut .getCurrentThreads(null, true)!! .filter { it.stacktrace != null } - .any { it.stacktrace!!.frames!!.count() > 0 } + .any { it.stacktrace!!.frames!!.count() > 0 }, ) } @@ -64,7 +64,7 @@ class SentryThreadFactoryTest { sut .getCurrentThreads(null, true)!! .filter { it.stacktrace != null } - .any { it.stacktrace!!.snapshot == true } + .any { it.stacktrace!!.snapshot == true }, ) } @@ -75,7 +75,7 @@ class SentryThreadFactoryTest { sut .getCurrentThreads(null, false)!! .filter { it.stacktrace != null } - .any { it.stacktrace!!.frames!!.count() > 0 } + .any { it.stacktrace!!.frames!!.count() > 0 }, ) } diff --git a/sentry/src/test/java/io/sentry/SentryTracerTest.kt b/sentry/src/test/java/io/sentry/SentryTracerTest.kt index 20232f56b4d..41af30d1d34 100644 --- a/sentry/src/test/java/io/sentry/SentryTracerTest.kt +++ b/sentry/src/test/java/io/sentry/SentryTracerTest.kt @@ -102,11 +102,13 @@ class SentryTracerTest { @Test fun `does not create child span if origin is ignored`() { val tracer = - fixture.getSut({ - it.setDebug(true) - it.setLogger(SystemOutLogger()) - it.setIgnoredSpanOrigins(listOf("ignored")) - }) + fixture.getSut( + { + it.setDebug(true) + it.setLogger(SystemOutLogger()) + it.setIgnoredSpanOrigins(listOf("ignored")) + }, + ) tracer.startChild("child1", null, SpanOptions().also { it.origin = "ignored" }) tracer.startChild("child2") assertEquals(1, tracer.children.size) @@ -115,11 +117,13 @@ class SentryTracerTest { @Test fun `does not add more spans than configured in options`() { val tracer = - fixture.getSut({ - it.maxSpans = 2 - it.setDebug(true) - it.setLogger(SystemOutLogger()) - }) + fixture.getSut( + { + it.maxSpans = 2 + it.setDebug(true) + it.setLogger(SystemOutLogger()) + }, + ) tracer.startChild("child1") tracer.startChild("child2") tracer.startChild("child3") @@ -129,11 +133,13 @@ class SentryTracerTest { @Test fun `when span limit is reached, startChild returns NoOpSpan`() { val tracer = - fixture.getSut({ - it.maxSpans = 2 - it.setDebug(true) - it.setLogger(SystemOutLogger()) - }) + fixture.getSut( + { + it.maxSpans = 2 + it.setDebug(true) + it.setLogger(SystemOutLogger()) + }, + ) tracer.startChild("child1") tracer.startChild("child2") assertTrue(tracer.startChild("child3") is NoOpSpan) @@ -218,7 +224,7 @@ class SentryTracerTest { optionsConfiguration = { it.profilesSampleRate = 0.0 it.setTransactionProfiler(transactionProfiler) - } + }, ) tracer.finish() verify(transactionProfiler, never()).onTransactionFinish(any(), anyOrNull(), anyOrNull()) @@ -461,7 +467,7 @@ class SentryTracerTest { fun `when continuous profiler is not running, profile context is not set`() { val tracer = fixture.getSut( - optionsConfiguration = { it.setContinuousProfiler(NoOpContinuousProfiler.getInstance()) } + optionsConfiguration = { it.setContinuousProfiler(NoOpContinuousProfiler.getInstance()) }, ) tracer.finish() verify(fixture.scopes) @@ -509,7 +515,7 @@ class SentryTracerTest { fixture.getSut( optionsConfiguration = { options -> options.setContinuousProfiler(NoOpContinuousProfiler.getInstance()) - } + }, ) val span = tracer.startChild("span.op") assertNull(span.getData(SpanDataConvention.PROFILER_ID)) @@ -911,10 +917,12 @@ class SentryTracerTest { @Test fun `returns trace state`() { val transaction = - fixture.getSut({ - it.isTraceSampling = true - it.isSendDefaultPii = true - }) + fixture.getSut( + { + it.isTraceSampling = true + it.isSendDefaultPii = true + }, + ) fixture.scopes.setUser(User().apply { id = "user-id" }) val replayId = SentryId() fixture.scopes.configureScope { it.replayId = replayId } @@ -986,12 +994,14 @@ class SentryTracerTest { @Test fun `returns baggage header`() { val transaction = - fixture.getSut({ - it.isTraceSampling = true - it.environment = "production" - it.release = "1.0.99-rc.7" - it.isSendDefaultPii = true - }) + fixture.getSut( + { + it.isTraceSampling = true + it.environment = "production" + it.release = "1.0.99-rc.7" + it.isSendDefaultPii = true + }, + ) fixture.scopes.setUser(User().apply { id = "userId12345" }) val replayId = SentryId() @@ -1015,11 +1025,13 @@ class SentryTracerTest { @Test fun `returns baggage header without userId if not send pii`() { val transaction = - fixture.getSut({ - it.isTraceSampling = true - it.environment = "production" - it.release = "1.0.99-rc.7" - }) + fixture.getSut( + { + it.isTraceSampling = true + it.environment = "production" + it.release = "1.0.99-rc.7" + }, + ) fixture.scopes.setUser(User().apply { id = "userId12345" }) @@ -1040,12 +1052,14 @@ class SentryTracerTest { @Test fun `returns baggage header without userId if send pii and null user`() { val transaction = - fixture.getSut({ - it.isTraceSampling = true - it.environment = "production" - it.release = "1.0.99-rc.7" - it.isSendDefaultPii = true - }) + fixture.getSut( + { + it.isTraceSampling = true + it.environment = "production" + it.release = "1.0.99-rc.7" + it.isSendDefaultPii = true + }, + ) fixture.scopes.setUser(null) @@ -1841,7 +1855,7 @@ class SentryTracerTest { transactionFinishedCallback = { assertFalse(it.isFinished) assertNotNull(it.finishDate) - } + }, ) assertFalse(transaction.isFinished) assertNull(transaction.finishDate) diff --git a/sentry/src/test/java/io/sentry/SentryWrapperTest.kt b/sentry/src/test/java/io/sentry/SentryWrapperTest.kt index 0ed46d8fa38..db52c54fb30 100644 --- a/sentry/src/test/java/io/sentry/SentryWrapperTest.kt +++ b/sentry/src/test/java/io/sentry/SentryWrapperTest.kt @@ -135,7 +135,7 @@ class SentryWrapperTest { Sentry.addBreadcrumb("MyClonedBreadcrumb") Sentry.captureMessage("ClonedMessage") "Result 1" - } + }, ) val future2 = @@ -145,7 +145,7 @@ class SentryWrapperTest { Sentry.addBreadcrumb("MyClonedBreadcrumb2") Sentry.captureMessage("ClonedMessage2") "Result 2" - } + }, ) Sentry.addBreadcrumb("MyOriginalBreadcrumb") @@ -180,7 +180,7 @@ class SentryWrapperTest { assertNotEquals(mainScopes, Sentry.getCurrentScopes()) assertNotEquals(threadedScopes, Sentry.getCurrentScopes()) "Result 1" - } + }, ) callableFuture.get() @@ -216,7 +216,7 @@ class SentryWrapperTest { Sentry.addBreadcrumb("MyClonedBreadcrumb") Sentry.captureMessage("ClonedMessage") "Result 1" - } + }, ) val future2 = @@ -226,7 +226,7 @@ class SentryWrapperTest { Sentry.addBreadcrumb("MyClonedBreadcrumb2") Sentry.captureMessage("ClonedMessage2") "Result 2" - } + }, ) Sentry.addBreadcrumb("MyOriginalBreadcrumb") @@ -261,7 +261,7 @@ class SentryWrapperTest { assertNotEquals(mainScopes, Sentry.getCurrentScopes()) assertNotEquals(threadedScopes, Sentry.getCurrentScopes()) "Result 1" - } + }, ) runnableFuture.get() diff --git a/sentry/src/test/java/io/sentry/SpanTest.kt b/sentry/src/test/java/io/sentry/SpanTest.kt index b61e12ad87f..ef22f65ce54 100644 --- a/sentry/src/test/java/io/sentry/SpanTest.kt +++ b/sentry/src/test/java/io/sentry/SpanTest.kt @@ -29,7 +29,7 @@ class SpanTest { SentryOptions().apply { dsn = "https://key@sentry.io/proj" isTraceSampling = true - } + }, ) } @@ -373,7 +373,7 @@ class SpanTest { SpanOptions().apply { isTrimStart = true isTrimEnd = true - } + }, ) // and two child spans are started @@ -408,7 +408,7 @@ class SpanTest { TransactionOptions().apply { isTrimStart = true isTrimEnd = true - } + }, ) // and two child spans are started @@ -573,7 +573,7 @@ class SpanTest { } private fun getTransaction( - transactionContext: TransactionContext = TransactionContext("name", "op") + transactionContext: TransactionContext = TransactionContext("name", "op"), ): SentryTracer = SentryTracer(transactionContext, fixture.scopes) private fun startChildFromSpan(): Span { diff --git a/sentry/src/test/java/io/sentry/StackTest.kt b/sentry/src/test/java/io/sentry/StackTest.kt index 0c0a8d6c866..38fc567e0ad 100644 --- a/sentry/src/test/java/io/sentry/StackTest.kt +++ b/sentry/src/test/java/io/sentry/StackTest.kt @@ -68,10 +68,10 @@ class StackTest { fun `cloning stack clones stack items`() { val stack = fixture.getSut( - fixture.createStackItem(Scope(fixture.options).apply { this.setTag("rootTag", "value") }) + fixture.createStackItem(Scope(fixture.options).apply { this.setTag("rootTag", "value") }), ) stack.push( - fixture.createStackItem(Scope(fixture.options).apply { this.setTag("childTag", "value") }) + fixture.createStackItem(Scope(fixture.options).apply { this.setTag("childTag", "value") }), ) val clone = Stack(stack) diff --git a/sentry/src/test/java/io/sentry/TracesSamplerTest.kt b/sentry/src/test/java/io/sentry/TracesSamplerTest.kt index 9b8f0666854..28a3c4e52c7 100644 --- a/sentry/src/test/java/io/sentry/TracesSamplerTest.kt +++ b/sentry/src/test/java/io/sentry/TracesSamplerTest.kt @@ -111,7 +111,7 @@ class TracesSamplerTest { val sampler = fixture.getSut(tracesSamplerCallback = { 0.2 }, profilesSamplerCallback = { 0.2 }) val samplingDecision = sampler.sample( - SamplingContext(TransactionContext("name", "op"), CustomSamplingContext(), 0.1, null) + SamplingContext(TransactionContext("name", "op"), CustomSamplingContext(), 0.1, null), ) assertTrue(samplingDecision.sampled) assertEquals(0.2, samplingDecision.sampleRate) @@ -123,7 +123,7 @@ class TracesSamplerTest { val sampler = fixture.getSut(tracesSampleRate = 1.0, profilesSamplerCallback = { 0.2 }) val samplingDecision = sampler.sample( - SamplingContext(TransactionContext("name", "op"), CustomSamplingContext(), 0.1, null) + SamplingContext(TransactionContext("name", "op"), CustomSamplingContext(), 0.1, null), ) assertTrue(samplingDecision.sampled) assertTrue(samplingDecision.profileSampled) @@ -136,7 +136,7 @@ class TracesSamplerTest { val sampler = fixture.getSut(tracesSamplerCallback = { 0.2 }) val samplingDecision = sampler.sample( - SamplingContext(TransactionContext("name", "op"), CustomSamplingContext(), 0.9, null) + SamplingContext(TransactionContext("name", "op"), CustomSamplingContext(), 0.9, null), ) assertFalse(samplingDecision.sampled) assertEquals(0.2, samplingDecision.sampleRate) @@ -148,7 +148,7 @@ class TracesSamplerTest { val sampler = fixture.getSut(tracesSampleRate = 1.0, profilesSamplerCallback = { 0.2 }) val samplingDecision = sampler.sample( - SamplingContext(TransactionContext("name", "op"), CustomSamplingContext(), 0.9, null) + SamplingContext(TransactionContext("name", "op"), CustomSamplingContext(), 0.9, null), ) assertTrue(samplingDecision.sampled) assertFalse(samplingDecision.profileSampled) @@ -185,7 +185,7 @@ class TracesSamplerTest { transactionContextParentSampled.parentSampled = true val samplingDecision = sampler.sample( - SamplingContext(transactionContextParentSampled, CustomSamplingContext(), 0.1, null) + SamplingContext(transactionContextParentSampled, CustomSamplingContext(), 0.1, null), ) assertTrue(samplingDecision.sampled) assertNull(samplingDecision.sampleRate) @@ -199,7 +199,7 @@ class TracesSamplerTest { transactionContextParentSampled.setParentSampled(true, true) val samplingDecision = sampler.sample( - SamplingContext(transactionContextParentSampled, CustomSamplingContext(), 0.1, null) + SamplingContext(transactionContextParentSampled, CustomSamplingContext(), 0.1, null), ) assertTrue(samplingDecision.sampled) assertTrue(samplingDecision.profileSampled) @@ -212,7 +212,7 @@ class TracesSamplerTest { val sampler = fixture.getSut(tracesSampleRate = 0.2, tracesSamplerCallback = { null }) val samplingDecision = sampler.sample( - SamplingContext(TransactionContext("name", "op"), CustomSamplingContext(), 0.1, null) + SamplingContext(TransactionContext("name", "op"), CustomSamplingContext(), 0.1, null), ) assertTrue(samplingDecision.sampled) assertEquals(0.2, samplingDecision.sampleRate) @@ -229,7 +229,7 @@ class TracesSamplerTest { ) val samplingDecision = sampler.sample( - SamplingContext(TransactionContext("name", "op"), CustomSamplingContext(), 0.1, null) + SamplingContext(TransactionContext("name", "op"), CustomSamplingContext(), 0.1, null), ) assertTrue(samplingDecision.sampled) assertTrue(samplingDecision.profileSampled) @@ -241,7 +241,7 @@ class TracesSamplerTest { val sampler = fixture.getSut() val samplingDecision = sampler.sample( - SamplingContext(TransactionContext("name", "op"), CustomSamplingContext(), 0.1, null) + SamplingContext(TransactionContext("name", "op"), CustomSamplingContext(), 0.1, null), ) assertFalse(samplingDecision.sampled) assertNull(samplingDecision.sampleRate) @@ -253,7 +253,7 @@ class TracesSamplerTest { val sampler = fixture.getSut(tracesSampleRate = 1.0) val samplingDecision = sampler.sample( - SamplingContext(TransactionContext("name", "op"), CustomSamplingContext(), 0.1, null) + SamplingContext(TransactionContext("name", "op"), CustomSamplingContext(), 0.1, null), ) assertTrue(samplingDecision.sampled) assertFalse(samplingDecision.profileSampled) @@ -268,7 +268,7 @@ class TracesSamplerTest { transactionContextParentNotSampled.parentSampled = false val samplingDecision = sampler.sample( - SamplingContext(transactionContextParentNotSampled, CustomSamplingContext(), 0.1, null) + SamplingContext(transactionContextParentNotSampled, CustomSamplingContext(), 0.1, null), ) assertFalse(samplingDecision.sampled) assertNull(samplingDecision.sampleRate) @@ -280,7 +280,7 @@ class TracesSamplerTest { transactionContextParentSampled.setParentSampled(true, true) val samplingDecisionParentSampled = sampler.sample( - SamplingContext(transactionContextParentSampled, CustomSamplingContext(), 0.1, null) + SamplingContext(transactionContextParentSampled, CustomSamplingContext(), 0.1, null), ) assertTrue(samplingDecisionParentSampled.sampled) assertNull(samplingDecisionParentSampled.sampleRate) @@ -309,7 +309,7 @@ class TracesSamplerTest { transactionContextNotSampled.sampled = false val samplingDecision = sampler.sample( - SamplingContext(transactionContextNotSampled, CustomSamplingContext(), 0.1, null) + SamplingContext(transactionContextNotSampled, CustomSamplingContext(), 0.1, null), ) assertFalse(samplingDecision.sampled) assertNull(samplingDecision.sampleRate) @@ -331,7 +331,7 @@ class TracesSamplerTest { transactionContextUnsampledWithProfile.setSampled(false, true) val samplingDecisionContextUnsampledWithProfile = sampler.sample( - SamplingContext(transactionContextUnsampledWithProfile, CustomSamplingContext(), 0.1, null) + SamplingContext(transactionContextUnsampledWithProfile, CustomSamplingContext(), 0.1, null), ) assertFalse(samplingDecisionContextUnsampledWithProfile.sampled) assertNull(samplingDecisionContextUnsampledWithProfile.sampleRate) @@ -585,11 +585,11 @@ class TracesSamplerTest { tracesSamplerCallback = { samplingContext -> attributeValue = samplingContext.getAttribute("attr") 1.0 - } + }, ) val decision = sampler.sample( - SamplingContext(TransactionContext("name", "op"), null, 0.0, mapOf("attr" to "123")) + SamplingContext(TransactionContext("name", "op"), null, 0.0, mapOf("attr" to "123")), ) assertTrue(decision.sampled) assertEquals("123", attributeValue) @@ -603,11 +603,11 @@ class TracesSamplerTest { tracesSamplerCallback = { samplingContext -> attributeValue = samplingContext.getAttribute("i-do-not-exist") 1.0 - } + }, ) val decision = sampler.sample( - SamplingContext(TransactionContext("name", "op"), null, 0.0, mapOf("attr" to "123")) + SamplingContext(TransactionContext("name", "op"), null, 0.0, mapOf("attr" to "123")), ) assertTrue(decision.sampled) assertNull(attributeValue) @@ -621,7 +621,7 @@ class TracesSamplerTest { tracesSamplerCallback = { samplingContext -> attributeValue = samplingContext.getAttribute("i-do-not-exist") 1.0 - } + }, ) val decision = sampler.sample(SamplingContext(TransactionContext("name", "op"), null, 0.0, null)) diff --git a/sentry/src/test/java/io/sentry/UncaughtExceptionHandlerIntegrationTest.kt b/sentry/src/test/java/io/sentry/UncaughtExceptionHandlerIntegrationTest.kt index 02da3b9a335..f12b01a88fc 100644 --- a/sentry/src/test/java/io/sentry/UncaughtExceptionHandlerIntegrationTest.kt +++ b/sentry/src/test/java/io/sentry/UncaughtExceptionHandlerIntegrationTest.kt @@ -175,10 +175,10 @@ class UncaughtExceptionHandlerIntegrationTest { assertTrue( outputStreamCaptor .toString() - .contains("java.lang.RuntimeException: This should be printed!") + .contains("java.lang.RuntimeException: This should be printed!"), ) assertTrue( - outputStreamCaptor.toString().contains("UncaughtExceptionHandlerIntegrationTest.kt:") + outputStreamCaptor.toString().contains("UncaughtExceptionHandlerIntegrationTest.kt:"), ) } finally { System.setErr(standardErr) @@ -258,7 +258,7 @@ class UncaughtExceptionHandlerIntegrationTest { any(), argThat { (HintUtils.getSentrySdkHint(this) as UncaughtExceptionHint).isFlushable( - eventCaptor.firstValue.eventId + eventCaptor.firstValue.eventId, ) }, ) @@ -281,7 +281,7 @@ class UncaughtExceptionHandlerIntegrationTest { any(), argThat { !(HintUtils.getSentrySdkHint(this) as UncaughtExceptionHint).isFlushable( - eventCaptor.firstValue.eventId + eventCaptor.firstValue.eventId, ) }, ) @@ -295,7 +295,7 @@ class UncaughtExceptionHandlerIntegrationTest { whenever(handler.defaultUncaughtExceptionHandler).thenAnswer { currentDefaultHandler } whenever( - handler.setDefaultUncaughtExceptionHandler(anyOrNull()) + handler.setDefaultUncaughtExceptionHandler(anyOrNull()), ) .then { currentDefaultHandler = it.getArgument(0) @@ -324,7 +324,7 @@ class UncaughtExceptionHandlerIntegrationTest { whenever(handler.defaultUncaughtExceptionHandler).thenAnswer { currentDefaultHandler } whenever( - handler.setDefaultUncaughtExceptionHandler(anyOrNull()) + handler.setDefaultUncaughtExceptionHandler(anyOrNull()), ) .then { currentDefaultHandler = it.getArgument(0) @@ -354,7 +354,7 @@ class UncaughtExceptionHandlerIntegrationTest { whenever(handler.defaultUncaughtExceptionHandler).thenAnswer { currentDefaultHandler } whenever( - handler.setDefaultUncaughtExceptionHandler(anyOrNull()) + handler.setDefaultUncaughtExceptionHandler(anyOrNull()), ) .then { currentDefaultHandler = it.getArgument(0) @@ -390,7 +390,7 @@ class UncaughtExceptionHandlerIntegrationTest { whenever(handler.defaultUncaughtExceptionHandler).thenAnswer { currentDefaultHandler } whenever( - handler.setDefaultUncaughtExceptionHandler(anyOrNull()) + handler.setDefaultUncaughtExceptionHandler(anyOrNull()), ) .then { currentDefaultHandler = it.getArgument(0) @@ -433,7 +433,7 @@ class UncaughtExceptionHandlerIntegrationTest { whenever(handler.defaultUncaughtExceptionHandler).thenAnswer { currentDefaultHandler } whenever( - handler.setDefaultUncaughtExceptionHandler(anyOrNull()) + handler.setDefaultUncaughtExceptionHandler(anyOrNull()), ) .then { currentDefaultHandler = it.getArgument(0) @@ -487,7 +487,7 @@ class UncaughtExceptionHandlerIntegrationTest { whenever(handler.defaultUncaughtExceptionHandler).thenAnswer { currentDefaultHandler } whenever( - handler.setDefaultUncaughtExceptionHandler(anyOrNull()) + handler.setDefaultUncaughtExceptionHandler(anyOrNull()), ) .then { currentDefaultHandler = it.getArgument(0) diff --git a/sentry/src/test/java/io/sentry/cache/PersistingScopeObserverBatchingTest.kt b/sentry/src/test/java/io/sentry/cache/PersistingScopeObserverBatchingTest.kt index d893e52d4ce..6f337e80807 100644 --- a/sentry/src/test/java/io/sentry/cache/PersistingScopeObserverBatchingTest.kt +++ b/sentry/src/test/java/io/sentry/cache/PersistingScopeObserverBatchingTest.kt @@ -97,7 +97,7 @@ class PersistingScopeObserverBatchingTest { SerializerHook(options.serializer) { sut.setBreadcrumbs(emptyList()) sut.addBreadcrumb(Breadcrumb().apply { message = "kept" }) - } + }, ) sut = getSut(executor) diff --git a/sentry/src/test/java/io/sentry/cache/PersistingScopeObserverTest.kt b/sentry/src/test/java/io/sentry/cache/PersistingScopeObserverTest.kt index b98c5b8a319..147aa5a3e21 100644 --- a/sentry/src/test/java/io/sentry/cache/PersistingScopeObserverTest.kt +++ b/sentry/src/test/java/io/sentry/cache/PersistingScopeObserverTest.kt @@ -235,7 +235,7 @@ class PersistingScopeObserverTest( appStartTime = DateUtils.getCurrentDateTime() buildType = "debug" appVersion = "2021" - } + }, ) setBrowser(Browser().apply { name = "Chrome" }) setDevice( @@ -262,13 +262,13 @@ class PersistingScopeObserverTest( batteryTemperature = 37.0f batteryLevel = 92.0f locale = "en-US" - } + }, ) setGpu( Gpu().apply { vendorName = "GeForce" memorySize = 1000 - } + }, ) setOperatingSystem( OperatingSystem().apply { @@ -276,7 +276,7 @@ class PersistingScopeObserverTest( build = "2021.123_alpha" name = "Android" version = "12" - } + }, ) }, StoreScopeValue { contexts, _ -> setContexts(contexts) }, diff --git a/sentry/src/test/java/io/sentry/cache/tape/QueueFileTest.kt b/sentry/src/test/java/io/sentry/cache/tape/QueueFileTest.kt index f288a1b7c56..d025bf907ab 100644 --- a/sentry/src/test/java/io/sentry/cache/tape/QueueFileTest.kt +++ b/sentry/src/test/java/io/sentry/cache/tape/QueueFileTest.kt @@ -672,8 +672,8 @@ class QueueFileTest { .contains( "zero=true, length=4096," + " size=15," + - " first=Element[position=32, length=0], last=Element[position=179, length=14]}" - ) + " first=Element[position=32, length=0], last=Element[position=179, length=14]}", + ), ) } diff --git a/sentry/src/test/java/io/sentry/clientreport/ClientReportMultiThreadingTest.kt b/sentry/src/test/java/io/sentry/clientreport/ClientReportMultiThreadingTest.kt index 7f14c987438..46c532a8036 100644 --- a/sentry/src/test/java/io/sentry/clientreport/ClientReportMultiThreadingTest.kt +++ b/sentry/src/test/java/io/sentry/clientreport/ClientReportMultiThreadingTest.kt @@ -54,7 +54,7 @@ class ClientReportMultiThreadingTest { (1..numberOfIncrementsPerThread).forEach { clientReportRecorder.recordLostEvent(randomReason(), randomCategory()) } - } + }, ) } @@ -97,7 +97,7 @@ class ClientReportMultiThreadingTest { (1..numberOfIncrementsPerThread).forEach { clientReportRecorder.recordLostEvent(randomReason(), randomCategory()) } - } + }, ) } @@ -109,7 +109,7 @@ class ClientReportMultiThreadingTest { clientReportRecorder.resetCountsAndGenerateClientReport()?.let { clientReports.add(it) } Thread.sleep(20) } - } + }, ) futures.forEach { completionService.take().get() } @@ -152,7 +152,7 @@ class ClientReportMultiThreadingTest { (1..numberOfIncrementsPerThread).forEach { clientReportRecorder.recordLostEvent(randomReason(), randomCategory()) } - } + }, ) } @@ -170,7 +170,7 @@ class ClientReportMultiThreadingTest { clientReportRecorder.recordLostEnvelope(DiscardReason.NETWORK_ERROR, envelope) } } - } + }, ) futures.forEach { completionService.take().get() } diff --git a/sentry/src/test/java/io/sentry/clientreport/ClientReportTest.kt b/sentry/src/test/java/io/sentry/clientreport/ClientReportTest.kt index e077b25fb3c..a8b631a1d59 100644 --- a/sentry/src/test/java/io/sentry/clientreport/ClientReportTest.kt +++ b/sentry/src/test/java/io/sentry/clientreport/ClientReportTest.kt @@ -202,7 +202,7 @@ class ClientReportTest { val envelope = testHelper.newEnvelope( - SentryEnvelopeItem.fromEvent(opts.serializer, SentryTransaction(transaction)) + SentryEnvelopeItem.fromEvent(opts.serializer, SentryTransaction(transaction)), ) clientReportRecorder.recordLostEnvelope(DiscardReason.NETWORK_ERROR, envelope) @@ -322,7 +322,7 @@ class ClientReportTest { ChronoUnit.MILLIS.between( LocalDateTime.now(), envelopeReport.timestamp.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(), - ) < 10000 + ) < 10000, ) } @@ -343,7 +343,7 @@ class ClientReportTest { // Counts restored from an attached client report were already reported once, so replaying them // must not fire onDiscard a second time. Both public entry points have to hold the property. private fun assertRestoringCountsDoesNotFireOnDiscard( - recordLost: (ClientReportRecorder, SentryEnvelope) -> Unit + recordLost: (ClientReportRecorder, SentryEnvelope) -> Unit, ) { val onDiscardMock = mock() givenClientReportRecorder { options -> options.onDiscard = onDiscardMock } @@ -377,9 +377,9 @@ class ClientReportTest { listOf( SentryLogEvent(SentryId(), SentryLongDate(1), "log message 1", SentryLogLevel.ERROR), SentryLogEvent(SentryId(), SentryLongDate(2), "log message 2", SentryLogLevel.WARN), - ) + ), ), - ) + ), ) clientReportRecorder.recordLostEnvelopeItem(DiscardReason.NETWORK_ERROR, envelope.items.first()) @@ -409,9 +409,9 @@ class ClientReportTest { SentryMetricsEvent(SentryId(), SentryLongDate(1), "metric1", "counter", 1.0), SentryMetricsEvent(SentryId(), SentryLongDate(2), "metric2", "gauge", 2.0), SentryMetricsEvent(SentryId(), SentryLongDate(3), "metric3", "distribution", 3.0), - ) + ), ), - ) + ), ) clientReportRecorder.recordLostEnvelopeItem(DiscardReason.NETWORK_ERROR, envelope.items.first()) @@ -579,7 +579,7 @@ class ClientReportTest { this!!.discardedEvents!!.first { it.category == category.category }.quantity private fun givenClientReportRecorder( - callback: Sentry.OptionsConfiguration? = null + callback: Sentry.OptionsConfiguration? = null, ) { setupSentry { options -> callback?.configure(options) } clientReportRecorder = opts.clientReportRecorder as ClientReportRecorder diff --git a/sentry/src/test/java/io/sentry/instrumentation/file/SentryFileInputStreamTest.kt b/sentry/src/test/java/io/sentry/instrumentation/file/SentryFileInputStreamTest.kt index bb4c24e927f..36c1787d9ec 100644 --- a/sentry/src/test/java/io/sentry/instrumentation/file/SentryFileInputStreamTest.kt +++ b/sentry/src/test/java/io/sentry/instrumentation/file/SentryFileInputStreamTest.kt @@ -47,7 +47,7 @@ class SentryFileInputStreamTest { isSendDefaultPii = sendDefaultPii threadChecker = ThreadChecker.getInstance() addInAppInclude("org.junit") - } + }, ) sentryTracer = SentryTracer(TransactionContext("name", "op"), scopes) if (activeTransaction) { diff --git a/sentry/src/test/java/io/sentry/internal/debugmeta/ResourcesDebugMetaLoaderTest.kt b/sentry/src/test/java/io/sentry/internal/debugmeta/ResourcesDebugMetaLoaderTest.kt index 59bc9012348..2861f9f8c56 100644 --- a/sentry/src/test/java/io/sentry/internal/debugmeta/ResourcesDebugMetaLoaderTest.kt +++ b/sentry/src/test/java/io/sentry/internal/debugmeta/ResourcesDebugMetaLoaderTest.kt @@ -57,8 +57,8 @@ class ResourcesDebugMetaLoaderTest { io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68 io.sentry.build-tool=maven """ - .trimIndent() - ) + .trimIndent(), + ), ) val options = SentryOptions() @@ -82,8 +82,8 @@ class ResourcesDebugMetaLoaderTest { io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68,8d11a44a-facd-46c1-a49b-87d256227101 io.sentry.build-tool=maven """ - .trimIndent() - ) + .trimIndent(), + ), ) val options = SentryOptions() @@ -119,7 +119,7 @@ class ResourcesDebugMetaLoaderTest { io.sentry.build-tool=maven """ .trimIndent(), - ) + ), ) val options = SentryOptions() @@ -158,8 +158,8 @@ class ResourcesDebugMetaLoaderTest { io.sentry.build-tool=maven io.sentry.build-tool-version=1.0 """ - .trimIndent() - ) + .trimIndent(), + ), ) val options = SentryOptions() @@ -182,8 +182,8 @@ class ResourcesDebugMetaLoaderTest { io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68 io.sentry.build-tool=maven """ - .trimIndent() - ) + .trimIndent(), + ), ) val options = SentryOptions() @@ -205,8 +205,8 @@ class ResourcesDebugMetaLoaderTest { io.sentry.ProguardUuids=34077988-a0e5-4839-9618-7400e1616d1b io.sentry.bundle-ids=88ba82db-cd26-4c09-8b31-21461d286b68 """ - .trimIndent() - ) + .trimIndent(), + ), ) val options = SentryOptions() diff --git a/sentry/src/test/java/io/sentry/internal/modules/ManifestModulesLoaderTest.kt b/sentry/src/test/java/io/sentry/internal/modules/ManifestModulesLoaderTest.kt index c960902f7bc..dbf35c4b115 100644 --- a/sentry/src/test/java/io/sentry/internal/modules/ManifestModulesLoaderTest.kt +++ b/sentry/src/test/java/io/sentry/internal/modules/ManifestModulesLoaderTest.kt @@ -23,23 +23,23 @@ class ManifestModulesLoaderTest { Collections.enumeration( listOf( URL( - "jar:file:/Users/sentry/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-security/3.0.0/efe7ffae5c9875e2019c6a701759ea524cb331ee/spring-boot-starter-security-3.0.0.jar!/META-INF/MANIFEST.MF" + "jar:file:/Users/sentry/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-security/3.0.0/efe7ffae5c9875e2019c6a701759ea524cb331ee/spring-boot-starter-security-3.0.0.jar!/META-INF/MANIFEST.MF", ), URL( - "jar:file:/Users/sentry/.gradle/caches/modules-2/files-2.1/org.yaml/snakeyaml/1.33/2cd0a87ff7df953f810c344bdf2fe3340b954c69/snakeyaml-1.33.jar!/META-INF/MANIFEST.MF" + "jar:file:/Users/sentry/.gradle/caches/modules-2/files-2.1/org.yaml/snakeyaml/1.33/2cd0a87ff7df953f810c344bdf2fe3340b954c69/snakeyaml-1.33.jar!/META-INF/MANIFEST.MF", ), URL( - "jar:file:/usr/local/tomcat/webapps/ROOT/WEB-INF/lib/aspectjweaver-1.9.9.1.jar!/META-INF/MANIFEST.MF" + "jar:file:/usr/local/tomcat/webapps/ROOT/WEB-INF/lib/aspectjweaver-1.9.9.1.jar!/META-INF/MANIFEST.MF", ), URL( - "jar:file:/Users/sentry/repos/sentry-java/sentry-samples/sentry-samples-spring-boot-jakarta/build/libs/sentry-samples-spring-boot-jakarta-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/kotlin-stdlib-jdk8-1.6.10.jar!/META-INF/MANIFEST.MF" + "jar:file:/Users/sentry/repos/sentry-java/sentry-samples/sentry-samples-spring-boot-jakarta/build/libs/sentry-samples-spring-boot-jakarta-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/kotlin-stdlib-jdk8-1.6.10.jar!/META-INF/MANIFEST.MF", ), URL("http://sentry.io"), URL( - "jar:file:/Users/sentry/repos/sentry-java/sentry-samples/sentry-samples-spring-boot-jakarta/build/libs/sentry-samples-spring-boot-jakarta-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/hello-world.jar!/META-INF/MANIFEST.MF" + "jar:file:/Users/sentry/repos/sentry-java/sentry-samples/sentry-samples-spring-boot-jakarta/build/libs/sentry-samples-spring-boot-jakarta-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/hello-world.jar!/META-INF/MANIFEST.MF", ), - ) - ) + ), + ), ) val sut = ManifestModulesLoader(classLoader, logger) diff --git a/sentry/src/test/java/io/sentry/internal/modules/ResourcesModulesLoaderTest.kt b/sentry/src/test/java/io/sentry/internal/modules/ResourcesModulesLoaderTest.kt index 290fc0d0c0b..55e87d3a924 100644 --- a/sentry/src/test/java/io/sentry/internal/modules/ResourcesModulesLoaderTest.kt +++ b/sentry/src/test/java/io/sentry/internal/modules/ResourcesModulesLoaderTest.kt @@ -38,7 +38,7 @@ class ResourcesModulesLoaderTest { com.squareup.okhttp3:okhttp:3.14.9 com.squareup.okio:okio:1.17.2 """ - .trimIndent() + .trimIndent(), ) assertEquals( @@ -56,7 +56,7 @@ class ResourcesModulesLoaderTest { com.squareup.okhttp3:okhttp:3.14.9 com.squareup.okio:okio:1.17.2 """ - .trimIndent() + .trimIndent(), ) // first, call method to get modules cached @@ -86,7 +86,7 @@ class ResourcesModulesLoaderTest { """ com.squareup.okhttp3;3.14.9 """ - .trimIndent() + .trimIndent(), ) assertTrue(sut.orLoadModules!!.isEmpty()) diff --git a/sentry/src/test/java/io/sentry/protocol/BreadcrumbSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/BreadcrumbSerializationTest.kt index a33ddb91a2b..babe48366cc 100644 --- a/sentry/src/test/java/io/sentry/protocol/BreadcrumbSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/BreadcrumbSerializationTest.kt @@ -88,8 +88,8 @@ class BreadcrumbSerializationTest { mapOf( "data" to mapOf( - 123 to 456 // Invalid key type - ) + 123 to 456, // Invalid key type + ), ) val actual = Breadcrumb.fromMap(map, SentryOptions()) assertTrue(actual.data.isEmpty()) diff --git a/sentry/src/test/java/io/sentry/protocol/DebugMetaSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/DebugMetaSerializationTest.kt index eef5041dcb2..2dca7942212 100644 --- a/sentry/src/test/java/io/sentry/protocol/DebugMetaSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/DebugMetaSerializationTest.kt @@ -36,7 +36,7 @@ class DebugMetaSerializationTest { imageAddr = "8a258c81-641d-4e54-b06e-a0f56b1ee2ef" imageSize = -7905338721846826571L arch = "d00d5bea-fb5c-43c9-85f0-dc1350d957a4" - } + }, ) } } diff --git a/sentry/src/test/java/io/sentry/protocol/DebugMetaTest.kt b/sentry/src/test/java/io/sentry/protocol/DebugMetaTest.kt index a1c2f4edb05..8b8b0351c2b 100644 --- a/sentry/src/test/java/io/sentry/protocol/DebugMetaTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/DebugMetaTest.kt @@ -68,7 +68,7 @@ class DebugMetaTest { DebugImage().apply { type = DebugImage.PROGUARD uuid = "existing-id" - } + }, ) }, options, @@ -98,7 +98,7 @@ class DebugMetaTest { DebugImage().apply { type = DebugImage.PROGUARD uuid = "existing-id" - } + }, ) }, options, @@ -130,7 +130,7 @@ class DebugMetaTest { DebugImage().apply { type = "elf" debugId = "native-id" - } + }, ) }, options, @@ -190,7 +190,7 @@ class DebugMetaTest { DebugImage().apply { type = DebugImage.JVM debugId = "id1" - } + }, ) }, options, diff --git a/sentry/src/test/java/io/sentry/protocol/SentryExceptionSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/SentryExceptionSerializationTest.kt index ca80b34b0b9..a416133b10b 100644 --- a/sentry/src/test/java/io/sentry/protocol/SentryExceptionSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/SentryExceptionSerializationTest.kt @@ -41,11 +41,11 @@ class SentryExceptionSerializationTest { symbolAddr = "180e12cd-1fa8-405d-8dd8-e87b33fa2eb0" instructionAddr = "19864a78-2466-461f-9f0b-93a5c9ae7622" rawFunction = "f33035a4-0cf0-453d-b6f4-d7c27e9af924" - } + }, ) registers = mapOf( - "160eef70-2b1f-4ad8-8449-902bf7bef11b" to "6000b565-2a55-4337-99be-edf8a2668d1b" + "160eef70-2b1f-4ad8-8449-902bf7bef11b" to "6000b565-2a55-4337-99be-edf8a2668d1b", ) snapshot = true } @@ -57,11 +57,11 @@ class SentryExceptionSerializationTest { isHandled = false meta = mapOf( - "91e0d6d4-0818-403e-9826-6e4443f2b54e" to "11707d85-3cae-4a4c-8157-7a9b717cbe1e" + "91e0d6d4-0818-403e-9826-6e4443f2b54e" to "11707d85-3cae-4a4c-8157-7a9b717cbe1e", ) data = mapOf( - "0275caba-1fd8-4de3-9ead-b6c8dcdd5666" to "669cc6ad-1435-4233-b199-2800f901bbcd" + "0275caba-1fd8-4de3-9ead-b6c8dcdd5666" to "669cc6ad-1435-4233-b199-2800f901bbcd", ) synthetic = false } diff --git a/sentry/src/test/java/io/sentry/protocol/SentryLogsSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/SentryLogsSerializationTest.kt index ade038a408b..64d09f34371 100644 --- a/sentry/src/test/java/io/sentry/protocol/SentryLogsSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/SentryLogsSerializationTest.kt @@ -50,8 +50,8 @@ class SentryLogsSerializationTest { "custom.integer" to SentryLogEventAttributeValue("integer", 10), ) it.severityNumber = 10 - } - ) + }, + ), ) } diff --git a/sentry/src/test/java/io/sentry/protocol/SentryMetricsSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/SentryMetricsSerializationTest.kt index 2ce89e0af4b..07364105920 100644 --- a/sentry/src/test/java/io/sentry/protocol/SentryMetricsSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/SentryMetricsSerializationTest.kt @@ -49,8 +49,8 @@ class SentryMetricsSerializationTest { "custom.point" to SentryLogEventAttributeValue("string", Point(20, 30)), "custom.integer" to SentryLogEventAttributeValue("integer", 10), ) - } - ) + }, + ), ) } diff --git a/sentry/src/test/java/io/sentry/protocol/SentryProfileSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/SentryProfileSerializationTest.kt index b605a4a53dd..6ae478647b0 100644 --- a/sentry/src/test/java/io/sentry/protocol/SentryProfileSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/SentryProfileSerializationTest.kt @@ -73,7 +73,7 @@ class SentryProfileSerializationTest { SentryThreadMetadata().apply { name = "http-nio-8080-Acceptor" priority = 0 - } + }, ) } } diff --git a/sentry/src/test/java/io/sentry/protocol/SentryStackTraceSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/SentryStackTraceSerializationTest.kt index fc48446e5e4..8f7c15174b4 100644 --- a/sentry/src/test/java/io/sentry/protocol/SentryStackTraceSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/SentryStackTraceSerializationTest.kt @@ -36,7 +36,7 @@ class SentryStackTraceSerializationTest { symbolAddr = "180e12cd-1fa8-405d-8dd8-e87b33fa2eb0" instructionAddr = "19864a78-2466-461f-9f0b-93a5c9ae7622" rawFunction = "f33035a4-0cf0-453d-b6f4-d7c27e9af924" - } + }, ) registers = mapOf("160eef70-2b1f-4ad8-8449-902bf7bef11b" to "6000b565-2a55-4337-99be-edf8a2668d1b") diff --git a/sentry/src/test/java/io/sentry/protocol/SentryThreadSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/SentryThreadSerializationTest.kt index 674d10aa41e..cd1ef4b8129 100644 --- a/sentry/src/test/java/io/sentry/protocol/SentryThreadSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/SentryThreadSerializationTest.kt @@ -46,7 +46,7 @@ class SentryThreadSerializationTest { symbolAddr = "180e12cd-1fa8-405d-8dd8-e87b33fa2eb0" instructionAddr = "19864a78-2466-461f-9f0b-93a5c9ae7622" rawFunction = "f33035a4-0cf0-453d-b6f4-d7c27e9af924" - } + }, ) registers = mapOf( @@ -63,7 +63,7 @@ class SentryThreadSerializationTest { packageName = "java.lang" type = SentryLockReason.BLOCKED threadId = 11 - } + }, ) } } diff --git a/sentry/src/test/java/io/sentry/protocol/UserSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/UserSerializationTest.kt index 958382b8f68..b2098840940 100644 --- a/sentry/src/test/java/io/sentry/protocol/UserSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/UserSerializationTest.kt @@ -91,8 +91,8 @@ class UserSerializationTest { mapOf( "data" to mapOf( - 123 to 456 // Invalid key type - ) + 123 to 456, // Invalid key type + ), ) val actual = User.fromMap(map, SentryOptions()) assertTrue(actual?.data?.isEmpty() ?: false) diff --git a/sentry/src/test/java/io/sentry/protocol/ViewHierarchyNodeSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/ViewHierarchyNodeSerializationTest.kt index eb2f9e32e44..4e9f2e8205a 100644 --- a/sentry/src/test/java/io/sentry/protocol/ViewHierarchyNodeSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/ViewHierarchyNodeSerializationTest.kt @@ -24,7 +24,7 @@ class ViewHierarchyNodeSerializationTest { ViewHierarchyNode().apply { renderingSystem = "compose" type = "Clickable" - } + }, ) width = 100.0 height = 200.0 diff --git a/sentry/src/test/java/io/sentry/rrweb/RRWebInteractionMoveEventSerializationTest.kt b/sentry/src/test/java/io/sentry/rrweb/RRWebInteractionMoveEventSerializationTest.kt index f0baa59b980..d3bbc3c3021 100644 --- a/sentry/src/test/java/io/sentry/rrweb/RRWebInteractionMoveEventSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/rrweb/RRWebInteractionMoveEventSerializationTest.kt @@ -21,7 +21,7 @@ class RRWebInteractionMoveEventSerializationTest { x = 1.0f y = 2.0f timeOffset = 100 - } + }, ) pointerId = 1 } diff --git a/sentry/src/test/java/io/sentry/rrweb/RRWebOptionsEventSerializationTest.kt b/sentry/src/test/java/io/sentry/rrweb/RRWebOptionsEventSerializationTest.kt index 32dbd9a7d47..a1883fb5d47 100644 --- a/sentry/src/test/java/io/sentry/rrweb/RRWebOptionsEventSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/rrweb/RRWebOptionsEventSerializationTest.kt @@ -25,7 +25,7 @@ class RRWebOptionsEventSerializationTest { sessionReplay.quality = LOW sessionReplay.unmaskViewClasses.add("com.example.MyClass") sessionReplay.maskViewClasses.clear() - } + }, ) .apply { timestamp = 12345678901 } } diff --git a/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportClientReportTest.kt b/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportClientReportTest.kt index 6877d521d26..367f1776665 100644 --- a/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportClientReportTest.kt +++ b/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportClientReportTest.kt @@ -79,7 +79,7 @@ class AsyncHttpTransportClientReportTest { // given givenSetup(TransportResult.error(500)) whenever( - fixture.envelopeCache.storeEnvelope(eq(fixture.envelopeBeforeAttachingClientReport), any()) + fixture.envelopeCache.storeEnvelope(eq(fixture.envelopeBeforeAttachingClientReport), any()), ) .thenReturn(true) @@ -130,7 +130,7 @@ class AsyncHttpTransportClientReportTest { // given givenSetup(TransportResult.error(400)) whenever( - fixture.envelopeCache.storeEnvelope(eq(fixture.envelopeBeforeAttachingClientReport), any()) + fixture.envelopeCache.storeEnvelope(eq(fixture.envelopeBeforeAttachingClientReport), any()), ) .thenReturn(true) @@ -180,7 +180,7 @@ class AsyncHttpTransportClientReportTest { // given givenSetup(TransportResult.error(413)) whenever( - fixture.envelopeCache.storeEnvelope(eq(fixture.envelopeBeforeAttachingClientReport), any()) + fixture.envelopeCache.storeEnvelope(eq(fixture.envelopeBeforeAttachingClientReport), any()), ) .thenReturn(true) @@ -431,8 +431,8 @@ class AsyncHttpTransportClientReportTest { whenever( fixture.clientReportRecorder.attachReportToEnvelope( - eq(fixture.envelopeBeforeAttachingClientReport) - ) + eq(fixture.envelopeBeforeAttachingClientReport), + ), ) .thenReturn(fixture.envelopeAfterAttachingClientReport) } diff --git a/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportTest.kt b/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportTest.kt index 6f711cfedbf..cc14d0ad663 100644 --- a/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportTest.kt +++ b/sentry/src/test/java/io/sentry/transport/AsyncHttpTransportTest.kt @@ -527,7 +527,7 @@ class AsyncHttpTransportTest { override fun markEnqueued() { called = true } - } + }, ) fixture.getSUT().send(envelope, hint) diff --git a/sentry/src/test/java/io/sentry/transport/DistrustedCertificatesTest.kt b/sentry/src/test/java/io/sentry/transport/DistrustedCertificatesTest.kt index 994a0a438e7..b50cd113c38 100644 --- a/sentry/src/test/java/io/sentry/transport/DistrustedCertificatesTest.kt +++ b/sentry/src/test/java/io/sentry/transport/DistrustedCertificatesTest.kt @@ -66,7 +66,7 @@ class DistrustedCertificatesTest { @Test fun `accepts a chain without distrusted CAs`() { DistrustedCertificates.check( - arrayOf(leafIssuedBy(trustedCa).certificate, trustedCa.certificate) + arrayOf(leafIssuedBy(trustedCa).certificate, trustedCa.certificate), ) } diff --git a/sentry/src/test/java/io/sentry/transport/HttpConnectionTest.kt b/sentry/src/test/java/io/sentry/transport/HttpConnectionTest.kt index 63a297d950c..610b70803c9 100644 --- a/sentry/src/test/java/io/sentry/transport/HttpConnectionTest.kt +++ b/sentry/src/test/java/io/sentry/transport/HttpConnectionTest.kt @@ -199,7 +199,7 @@ class HttpConnectionTest { ) = println(String.format(message)) override fun isEnabled(level: SentryLevel?): Boolean = true - } + }, ) // when error message contains funky formatting symbols @@ -236,7 +236,7 @@ class HttpConnectionTest { check { assertEquals("some-user", it.user) assertEquals("some-password", it.password) - } + }, ) } diff --git a/sentry/src/test/java/io/sentry/transport/RateLimiterTest.kt b/sentry/src/test/java/io/sentry/transport/RateLimiterTest.kt index 00ba9cd9872..eda14e5fb7c 100644 --- a/sentry/src/test/java/io/sentry/transport/RateLimiterTest.kt +++ b/sentry/src/test/java/io/sentry/transport/RateLimiterTest.kt @@ -506,7 +506,7 @@ class RateLimiterTest { SentryEnvelopeItem.fromLogs( fixture.serializer, SentryLogEvents( - listOf(SentryLogEvent(SentryId(), SentryLongDate(0), "hello", SentryLogLevel.INFO)) + listOf(SentryLogEvent(SentryId(), SentryLongDate(0), "hello", SentryLogLevel.INFO)), ), ) val envelope = SentryEnvelope(SentryEnvelopeHeader(null), arrayListOf(logEventItem)) @@ -531,7 +531,7 @@ class RateLimiterTest { SentryEnvelopeItem.fromLogs( fixture.serializer, SentryLogEvents( - listOf(SentryLogEvent(SentryId(), SentryLongDate(0), "hello", SentryLogLevel.INFO)) + listOf(SentryLogEvent(SentryId(), SentryLongDate(0), "hello", SentryLogLevel.INFO)), ), ) val envelope = SentryEnvelope(SentryEnvelopeHeader(null), arrayListOf(logEventItem)) diff --git a/sentry/src/test/java/io/sentry/util/CheckInUtilsTest.kt b/sentry/src/test/java/io/sentry/util/CheckInUtilsTest.kt index 02f69bf0e4e..0c6ae14893f 100644 --- a/sentry/src/test/java/io/sentry/util/CheckInUtilsTest.kt +++ b/sentry/src/test/java/io/sentry/util/CheckInUtilsTest.kt @@ -89,14 +89,14 @@ class CheckInUtilsTest { check { assertEquals("monitor-1", it.monitorSlug) assertEquals(CheckInStatus.IN_PROGRESS.apiName(), it.status) - } + }, ) verify(scopes) .captureCheckIn( check { assertEquals("monitor-1", it.monitorSlug) assertEquals(CheckInStatus.OK.apiName(), it.status) - } + }, ) verify(lifecycleToken).close() } @@ -129,7 +129,7 @@ class CheckInUtilsTest { assertEquals("monitor-1", it.monitorSlug) assertEquals("environment-1", it.environment) assertEquals(CheckInStatus.IN_PROGRESS.apiName(), it.status) - } + }, ) verify(scopes) .captureCheckIn( @@ -137,7 +137,7 @@ class CheckInUtilsTest { assertEquals("monitor-1", it.monitorSlug) assertEquals("environment-1", it.environment) assertEquals(CheckInStatus.OK.apiName(), it.status) - } + }, ) verify(lifecycleToken).close() } @@ -171,14 +171,14 @@ class CheckInUtilsTest { check { assertEquals("monitor-1", it.monitorSlug) assertEquals(CheckInStatus.IN_PROGRESS.apiName(), it.status) - } + }, ) verify(scopes) .captureCheckIn( check { assertEquals("monitor-1", it.monitorSlug) assertEquals(CheckInStatus.ERROR.apiName(), it.status) - } + }, ) verify(lifecycleToken).close() } @@ -209,14 +209,14 @@ class CheckInUtilsTest { assertEquals("monitor-1", it.monitorSlug) assertSame(monitorConfig, it.monitorConfig) assertEquals(CheckInStatus.IN_PROGRESS.apiName(), it.status) - } + }, ) verify(scopes) .captureCheckIn( check { assertEquals("monitor-1", it.monitorSlug) assertEquals(CheckInStatus.OK.apiName(), it.status) - } + }, ) verify(lifecycleToken).close() } @@ -251,14 +251,14 @@ class CheckInUtilsTest { assertEquals("monitor-1", it.monitorSlug) assertSame(monitorConfig, it.monitorConfig) assertEquals(CheckInStatus.IN_PROGRESS.apiName(), it.status) - } + }, ) verify(scopes) .captureCheckIn( check { assertEquals("monitor-1", it.monitorSlug) assertEquals(CheckInStatus.OK.apiName(), it.status) - } + }, ) verify(lifecycleToken).close() } @@ -281,7 +281,7 @@ class CheckInUtilsTest { defaultFailureIssueThreshold = 40 defaultRecoveryThreshold = 50 } - } + }, ) val monitorConfig = MonitorConfig(MonitorSchedule.interval(7, MonitorScheduleUnit.DAY)) @@ -308,7 +308,7 @@ class CheckInUtilsTest { defaultMaxRuntime = 50 defaultTimezone = "America/New_York" } - } + }, ) val monitorConfig = diff --git a/sentry/src/test/java/io/sentry/util/CookieUtilsTest.kt b/sentry/src/test/java/io/sentry/util/CookieUtilsTest.kt index 0c000d31e41..9873cbb6d63 100644 --- a/sentry/src/test/java/io/sentry/util/CookieUtilsTest.kt +++ b/sentry/src/test/java/io/sentry/util/CookieUtilsTest.kt @@ -60,7 +60,7 @@ class CookieUtilsTest { "name=value", KeyValueCollectionBehavior.off(), emptyList(), - ) + ), ) .isNull() } @@ -72,10 +72,10 @@ class CookieUtilsTest { "name=value; sessionId=secret; customerId=123; frameworkSession=456", KeyValueCollectionBehavior.denyList("customer"), listOf("frameworkSession"), - ) + ), ) .isEqualTo( - "name=value; sessionId=[Filtered]; customerId=[Filtered]; frameworkSession=[Filtered]" + "name=value; sessionId=[Filtered]; customerId=[Filtered]; frameworkSession=[Filtered]", ) } @@ -86,7 +86,7 @@ class CookieUtilsTest { "theme=dark; sessionId=secret; language=en", KeyValueCollectionBehavior.allowList("theme", "session"), emptyList(), - ) + ), ) .isEqualTo("theme=dark; sessionId=[Filtered]; language=[Filtered]") } @@ -98,7 +98,7 @@ class CookieUtilsTest { "empty=; data=YWJjZA==", KeyValueCollectionBehavior.denyList(), emptyList(), - ) + ), ) .isEqualTo("empty=; data=YWJjZA==") } @@ -110,7 +110,7 @@ class CookieUtilsTest { "theme=dark=contrast; token=abc=123", KeyValueCollectionBehavior.denyList(), emptyList(), - ) + ), ) .isEqualTo("theme=dark=contrast; token=[Filtered]") } @@ -122,7 +122,7 @@ class CookieUtilsTest { "theme=dark; opaque; =secret; empty=; sessionId=secret", KeyValueCollectionBehavior.denyList(), emptyList(), - ) + ), ) .isEqualTo("theme=dark;[Filtered];[Filtered]; empty=; sessionId=[Filtered]") } @@ -134,7 +134,7 @@ class CookieUtilsTest { "theme=dark, sessionId=secret", KeyValueCollectionBehavior.denyList(), emptyList(), - ) + ), ) .isEqualTo("[Filtered]") } @@ -146,7 +146,7 @@ class CookieUtilsTest { "theme=dark sessionId=secret", KeyValueCollectionBehavior.denyList(), emptyList(), - ) + ), ) .isEqualTo("[Filtered]") } @@ -161,7 +161,7 @@ class CookieUtilsTest { cookies, KeyValueCollectionBehavior.denyList(), emptyList(), - ) + ), ) .isEqualTo(cookies) } @@ -173,7 +173,7 @@ class CookieUtilsTest { "theme=dark ", KeyValueCollectionBehavior.denyList(), emptyList(), - ) + ), ) .isEqualTo("theme=dark ") } @@ -185,7 +185,7 @@ class CookieUtilsTest { "theme=dark;", KeyValueCollectionBehavior.denyList(), emptyList(), - ) + ), ) .isEqualTo("theme=dark;") assertThat( @@ -193,7 +193,7 @@ class CookieUtilsTest { "theme=dark; ", KeyValueCollectionBehavior.denyList(), emptyList(), - ) + ), ) .isEqualTo("theme=dark; ") } @@ -205,7 +205,7 @@ class CookieUtilsTest { "theme=\"dark, sessionId=secret\"", KeyValueCollectionBehavior.denyList(), emptyList(), - ) + ), ) .isEqualTo("[Filtered]") } @@ -217,7 +217,7 @@ class CookieUtilsTest { "theme=\"dark sessionId=secret\"", KeyValueCollectionBehavior.denyList(), emptyList(), - ) + ), ) .isEqualTo("[Filtered]") } @@ -229,7 +229,7 @@ class CookieUtilsTest { "theme=dark; opaque; =secret", KeyValueCollectionBehavior.allowList("theme", "opaque"), emptyList(), - ) + ), ) .isEqualTo("theme=dark;[Filtered];[Filtered]") } @@ -240,7 +240,7 @@ class CookieUtilsTest { CookieUtils.filterSetCookie( "sessionId=secret; Path=/; HttpOnly; SameSite=Lax", KeyValueCollectionBehavior.denyList(), - ) + ), ) .isEqualTo("sessionId=[Filtered]; Path=/; HttpOnly; SameSite=Lax") } @@ -251,16 +251,16 @@ class CookieUtilsTest { CookieUtils.filterSetCookie( "data=YWJjZA==; Expires=Wed, 09 Jun 2021 10:18:14 GMT; Max-Age=3600; Domain=example.com; Path=/; Secure; HttpOnly; SameSite=Lax", KeyValueCollectionBehavior.denyList(), - ) + ), ) .isEqualTo( - "data=YWJjZA==; Expires=Wed, 09 Jun 2021 10:18:14 GMT; Max-Age=3600; Domain=example.com; Path=/; Secure; HttpOnly; SameSite=Lax" + "data=YWJjZA==; Expires=Wed, 09 Jun 2021 10:18:14 GMT; Max-Age=3600; Domain=example.com; Path=/; Secure; HttpOnly; SameSite=Lax", ) assertThat( CookieUtils.filterSetCookie( "empty=; Path=/", KeyValueCollectionBehavior.denyList(), - ) + ), ) .isEqualTo("empty=; Path=/") } @@ -271,7 +271,7 @@ class CookieUtilsTest { CookieUtils.filterSetCookie( "theme=dark; Path=/; Secure", KeyValueCollectionBehavior.allowList("theme"), - ) + ), ) .isEqualTo("theme=dark; Path=/; Secure") } @@ -282,14 +282,14 @@ class CookieUtilsTest { CookieUtils.filterSetCookie( "opaque; Path=/; HttpOnly", KeyValueCollectionBehavior.denyList(), - ) + ), ) .isEqualTo("[Filtered]") assertThat( CookieUtils.filterSetCookie( "=secret; Path=/; HttpOnly", KeyValueCollectionBehavior.denyList(), - ) + ), ) .isEqualTo("[Filtered]") } @@ -300,7 +300,7 @@ class CookieUtilsTest { CookieUtils.filterSetCookie( "opaque; Path=/; HttpOnly", KeyValueCollectionBehavior.allowList("opaque"), - ) + ), ) .isEqualTo("[Filtered]") } @@ -311,7 +311,7 @@ class CookieUtilsTest { CookieUtils.filterSetCookie( "theme=dark; Path=/", KeyValueCollectionBehavior.off(), - ) + ), ) .isNull() } @@ -323,7 +323,7 @@ class CookieUtilsTest { listOf("theme=dark; SID=secret", "language=en"), KeyValueCollectionBehavior.denyList(), emptyList(), - ) + ), ) .containsExactly("theme=dark; SID=[Filtered]", "language=en") .inOrder() @@ -336,7 +336,7 @@ class CookieUtilsTest { java.util.Arrays.asList("theme=dark", null), KeyValueCollectionBehavior.denyList(), emptyList(), - ) + ), ) .containsExactly("theme=dark") } diff --git a/sentry/src/test/java/io/sentry/util/HttpUtilsTest.kt b/sentry/src/test/java/io/sentry/util/HttpUtilsTest.kt index 624f94a2ef0..c0791642b5c 100644 --- a/sentry/src/test/java/io/sentry/util/HttpUtilsTest.kt +++ b/sentry/src/test/java/io/sentry/util/HttpUtilsTest.kt @@ -16,7 +16,7 @@ class HttpUtilsTest { HttpUtils.filterQueryParams( "name=value&access_token=secret&customerId=123", KeyValueCollectionBehavior.denyList("customer"), - ) + ), ) .isEqualTo("name=value&access_token=[Filtered]&customerId=[Filtered]") } @@ -27,7 +27,7 @@ class HttpUtilsTest { HttpUtils.filterQueryParams( "name=value&access_token=secret&customerId=123", KeyValueCollectionBehavior.allowList("name", "access_token"), - ) + ), ) .isEqualTo("name=value&access_token=[Filtered]&customerId=[Filtered]") } @@ -38,7 +38,7 @@ class HttpUtilsTest { HttpUtils.filterQueryParams( "access%5Ftoken=secret&display%20name=Jane+Doe", KeyValueCollectionBehavior.denyList(), - ) + ), ) .isEqualTo("access%5Ftoken=[Filtered]&display%20name=Jane+Doe") } @@ -49,7 +49,7 @@ class HttpUtilsTest { HttpUtils.filterQueryParams( "name=&flag&&token", KeyValueCollectionBehavior.denyList(), - ) + ), ) .isEqualTo("name=&flag&&token=[Filtered]") } diff --git a/sentry/src/test/java/io/sentry/util/InitUtilTest.kt b/sentry/src/test/java/io/sentry/util/InitUtilTest.kt index f72eb74a64c..dd12a5879ce 100644 --- a/sentry/src/test/java/io/sentry/util/InitUtilTest.kt +++ b/sentry/src/test/java/io/sentry/util/InitUtilTest.kt @@ -71,7 +71,7 @@ class InitUtilTest { SentryOptions().also { it.initPriority = InitPriority.LOWEST it.isForceInit = true - } + }, ) givenClientEnabled() diff --git a/sentry/src/test/java/io/sentry/util/JsonSerializationUtilsTest.kt b/sentry/src/test/java/io/sentry/util/JsonSerializationUtilsTest.kt index caa93f1af7a..2b53aa0116c 100644 --- a/sentry/src/test/java/io/sentry/util/JsonSerializationUtilsTest.kt +++ b/sentry/src/test/java/io/sentry/util/JsonSerializationUtilsTest.kt @@ -48,7 +48,7 @@ class JsonSerializationUtilsTest { fun `serializes AtomicIntegerArray to list`() { val actual = JsonSerializationUtils.atomicIntegerArrayToList( - AtomicIntegerArray(arrayOf(1, 2, 3).toIntArray()) + AtomicIntegerArray(arrayOf(1, 2, 3).toIntArray()), ) assertEquals(listOf(1, 2, 3), actual) } diff --git a/sentry/src/test/java/io/sentry/util/LoadClassTest.kt b/sentry/src/test/java/io/sentry/util/LoadClassTest.kt index 4cb921feff8..f73c6edd16d 100644 --- a/sentry/src/test/java/io/sentry/util/LoadClassTest.kt +++ b/sentry/src/test/java/io/sentry/util/LoadClassTest.kt @@ -24,7 +24,7 @@ class LoadClassTest { loadClass.isClassAvailable( "io.sentry.ThisClassDoesNotExist", null as io.sentry.ILogger?, - ) + ), ) .isTrue() assertThat(loadClass.isClassAvailable("io.sentry.Sentry", null as io.sentry.ILogger?)) @@ -49,7 +49,7 @@ class LoadClassTest { val loadClass = LoadClass() assertNotNull(loadClass.loadClass("io.sentry.SentryEvent", null)) assertFalse( - loadClass.isClassAvailable("io.sentry.ThisClassDoesNotExist", null as io.sentry.ILogger?) + loadClass.isClassAvailable("io.sentry.ThisClassDoesNotExist", null as io.sentry.ILogger?), ) } diff --git a/sentry/src/test/java/io/sentry/util/MapObjectReaderTest.kt b/sentry/src/test/java/io/sentry/util/MapObjectReaderTest.kt index e7ad9bc61e3..0981841a33c 100644 --- a/sentry/src/test/java/io/sentry/util/MapObjectReaderTest.kt +++ b/sentry/src/test/java/io/sentry/util/MapObjectReaderTest.kt @@ -18,7 +18,7 @@ import org.junit.Test class MapObjectReaderTest { enum class BasicEnum { - A + A, } data class BasicSerializable(var test: String = "string") : JsonSerializable { @@ -216,7 +216,7 @@ class MapObjectReaderTest { partialSerializableValue("fail", "bad"), "oops", partialSerializableValue("ok", "two"), - ) + ), ) val actual = reader.nextListOrNull(logger, partiallyFailingDeserializer) @@ -286,7 +286,7 @@ class MapObjectReaderTest { linkedMapOf( "bad" to serializableValue("fail"), "good" to listOf(serializableValue("one")), - ) + ), ) .nextMapOfListOrNull(logger, BasicSerializable.Deserializer()) @@ -300,7 +300,7 @@ class MapObjectReaderTest { linkedMapOf( "good" to listOf(serializableValue("two")), "bad" to serializableValue("fail"), - ) + ), ) .nextMapOfListOrNull(logger, BasicSerializable.Deserializer()) @@ -311,7 +311,7 @@ class MapObjectReaderTest { fun `nextListOrNull keeps elements after a partially consumed failing element`() { val actual = getValuesReader( - listOf(partialSerializableValue("fail", "bad"), partialSerializableValue("ok", "two")) + listOf(partialSerializableValue("fail", "bad"), partialSerializableValue("ok", "two")), ) .nextListOrNull(logger, partiallyFailingDeserializer) @@ -325,7 +325,7 @@ class MapObjectReaderTest { linkedMapOf( "bad" to partialSerializableValue("fail", "bad"), "good" to partialSerializableValue("ok", "two"), - ) + ), ) .nextMapOrNull(logger, partiallyFailingDeserializer) @@ -339,7 +339,7 @@ class MapObjectReaderTest { linkedMapOf( "bad" to listOf(partialSerializableValue("fail", "bad")), "good" to listOf(partialSerializableValue("ok", "two")), - ) + ), ) .nextMapOfListOrNull(logger, partiallyFailingDeserializer) diff --git a/sentry/src/test/java/io/sentry/util/MapObjectWriterTest.kt b/sentry/src/test/java/io/sentry/util/MapObjectWriterTest.kt index 1a5c1d22a7e..665e093b9ae 100644 --- a/sentry/src/test/java/io/sentry/util/MapObjectWriterTest.kt +++ b/sentry/src/test/java/io/sentry/util/MapObjectWriterTest.kt @@ -21,7 +21,7 @@ import kotlin.test.assertTrue class MapObjectWriterTest { enum class BasicEnum { - A + A, } class BasicSerializable : JsonSerializable { diff --git a/sentry/src/test/java/io/sentry/util/MonitorConfigUtilsTest.kt b/sentry/src/test/java/io/sentry/util/MonitorConfigUtilsTest.kt index e882b3ed070..830818c1bd3 100644 --- a/sentry/src/test/java/io/sentry/util/MonitorConfigUtilsTest.kt +++ b/sentry/src/test/java/io/sentry/util/MonitorConfigUtilsTest.kt @@ -62,7 +62,7 @@ class MonitorConfigUtilsTest { .thenReturn( SentryOptions().apply { cron = SentryOptions.Cron().apply { defaultCheckinMargin = margin } - } + }, ) block() } @@ -316,7 +316,7 @@ class MonitorConfigUtilsTest { null, null, TimeUnit.MINUTES.toMillis(Int.MAX_VALUE.toLong() + 1), - ) + ), ) .isNull() } @@ -350,7 +350,7 @@ class MonitorConfigUtilsTest { ) for ((cron, crontab) in expected) { assertThat( - MonitorConfigUtils.fromSpringScheduled(cron, "UTC", null, null, false)?.schedule?.value + MonitorConfigUtils.fromSpringScheduled(cron, "UTC", null, null, false)?.schedule?.value, ) .isEqualTo(crontab) } @@ -362,11 +362,11 @@ class MonitorConfigUtilsTest { TimeZone.setDefault(TimeZone.getTimeZone("Asia/Tokyo")) try { assertThat( - MonitorConfigUtils.fromSpringScheduled("0 0 2 * * *", null, null, null, false)?.timezone + MonitorConfigUtils.fromSpringScheduled("0 0 2 * * *", null, null, null, false)?.timezone, ) .isEqualTo("Asia/Tokyo") assertThat( - MonitorConfigUtils.fromSpringScheduled("0 0 2 * * *", "", null, null, false)?.timezone + MonitorConfigUtils.fromSpringScheduled("0 0 2 * * *", "", null, null, false)?.timezone, ) .isEqualTo("Asia/Tokyo") } finally { @@ -388,7 +388,7 @@ class MonitorConfigUtilsTest { assertThat(MonitorConfigUtils.fromSpringScheduled(cron, "UTC", null, null, false)).isNull() } assertThat( - MonitorConfigUtils.fromSpringScheduled("0 0 2 * * *", "GMT+05:30", null, null, false) + MonitorConfigUtils.fromSpringScheduled("0 0 2 * * *", "GMT+05:30", null, null, false), ) .isNull() assertThat(MonitorConfigUtils.fromSpringScheduled(null, null, 30_000L, null, false)).isNull() @@ -433,7 +433,7 @@ class MonitorConfigUtilsTest { ) for ((cron, crontab) in expected) { assertThat( - MonitorConfigUtils.fromSpringScheduled(cron, "UTC", null, null, true)?.schedule?.value + MonitorConfigUtils.fromSpringScheduled(cron, "UTC", null, null, true)?.schedule?.value, ) .isEqualTo(crontab) } @@ -453,7 +453,7 @@ class MonitorConfigUtilsTest { TimeZone.setDefault(TimeZone.getTimeZone("Asia/Tokyo")) try { assertThat( - MonitorConfigUtils.fromSpringScheduled("0 0 2 * * *", null, null, null, true)?.timezone + MonitorConfigUtils.fromSpringScheduled("0 0 2 * * *", null, null, null, true)?.timezone, ) .isEqualTo("Asia/Tokyo") } finally { diff --git a/sentry/src/test/java/io/sentry/util/SpanUtilsTest.kt b/sentry/src/test/java/io/sentry/util/SpanUtilsTest.kt index 481700533a2..262892d92ef 100644 --- a/sentry/src/test/java/io/sentry/util/SpanUtilsTest.kt +++ b/sentry/src/test/java/io/sentry/util/SpanUtilsTest.kt @@ -13,7 +13,7 @@ class SpanUtilsTest { assertThat(SpanUtils.ignoredSpanOriginsForOpenTelemetry(SentryOpenTelemetryMode.AGENT)) .contains("auto.http.okhttp") assertThat( - SpanUtils.ignoredSpanOriginsForOpenTelemetry(SentryOpenTelemetryMode.AGENTLESS_SPRING) + SpanUtils.ignoredSpanOriginsForOpenTelemetry(SentryOpenTelemetryMode.AGENTLESS_SPRING), ) .doesNotContain("auto.http.okhttp") } diff --git a/sentry/src/test/java/io/sentry/util/TracingUtilsTest.kt b/sentry/src/test/java/io/sentry/util/TracingUtilsTest.kt index 8fa8eb05ef3..5cd50d6486e 100644 --- a/sentry/src/test/java/io/sentry/util/TracingUtilsTest.kt +++ b/sentry/src/test/java/io/sentry/util/TracingUtilsTest.kt @@ -81,7 +81,7 @@ class TracingUtilsTest { assertTrue( headers.baggageHeader!! .value - .contains("sentry-trace_id=${fixture.scope.propagationContext.traceId}") + .contains("sentry-trace_id=${fixture.scope.propagationContext.traceId}"), ) assertFalse(fixture.scope.propagationContext.baggage!!.isMutable) } @@ -181,7 +181,7 @@ class TracingUtilsTest { SpanId(), null, Baggage.fromHeader( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET", ) .also { it.freeze() }, true, @@ -202,12 +202,12 @@ class TracingUtilsTest { assertEquals(fixture.scope.propagationContext.traceId, headers.sentryTraceHeader.traceId) assertTrue(headers.baggageHeader!!.value.contains("some-baggage-key=some-baggage-value")) assertTrue( - headers.baggageHeader!!.value.contains("sentry-trace_id=2722d9f6ec019ade60c776169d9a8904") + headers.baggageHeader!!.value.contains("sentry-trace_id=2722d9f6ec019ade60c776169d9a8904"), ) assertFalse( headers.baggageHeader!! .value - .contains("sentry-trace_id=${fixture.scope.propagationContext.traceId}") + .contains("sentry-trace_id=${fixture.scope.propagationContext.traceId}"), ) } @@ -355,7 +355,7 @@ class TracingUtilsTest { SpanId(), null, Baggage.fromHeader( - "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET" + "sentry-public_key=502f25099c204a2fbf4cb16edc5975d1,sentry-sample_rate=1,sentry-trace_id=2722d9f6ec019ade60c776169d9a8904,sentry-transaction=HTTP%20GET", ), true, ) diff --git a/sentry/src/test/java/io/sentry/util/UrlUtilsTest.kt b/sentry/src/test/java/io/sentry/util/UrlUtilsTest.kt index f7bdbcbcfb1..de8829f7efc 100644 --- a/sentry/src/test/java/io/sentry/util/UrlUtilsTest.kt +++ b/sentry/src/test/java/io/sentry/util/UrlUtilsTest.kt @@ -258,7 +258,7 @@ class UrlUtilsTest { fun `does not filter email address in path`() { val urlDetails = UrlUtils.parseNullable( - "https://staging.server.com/api/v4/auth/password/reset/email@example.com" + "https://staging.server.com/api/v4/auth/password/reset/email@example.com", )!! assertEquals( "https://staging.server.com/api/v4/auth/password/reset/email@example.com", @@ -272,7 +272,7 @@ class UrlUtilsTest { fun `does not filter email address in path with fragment`() { val urlDetails = UrlUtils.parseNullable( - "https://staging.server.com/api/v4/auth/password/reset/email@example.com#top" + "https://staging.server.com/api/v4/auth/password/reset/email@example.com#top", )!! assertEquals( "https://staging.server.com/api/v4/auth/password/reset/email@example.com", @@ -286,7 +286,7 @@ class UrlUtilsTest { fun `does not filter email address in path with query and fragment`() { val urlDetails = UrlUtils.parseNullable( - "https://staging.server.com/api/v4/auth/password/reset/email@example.com?a=b&c=d#top" + "https://staging.server.com/api/v4/auth/password/reset/email@example.com?a=b&c=d#top", )!! assertEquals( "https://staging.server.com/api/v4/auth/password/reset/email@example.com",