Skip to content

Commit 1440de9

Browse files
authored
Rename continuous profiling APIs (#4182)
* renamed Sentry.startProfiler with Sentry.startProfileSession and Sentry.stopProfiler with Sentry.stopProfileSession
1 parent fcfa576 commit 1440de9

File tree

16 files changed

+76
-76
lines changed

16 files changed

+76
-76
lines changed

CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
- Add Continuous Profiling Support ([#3710](https://github.com/getsentry/sentry-java/pull/3710))
88

9-
To enable Continuous Profiling use the `Sentry.startProfiler` and `Sentry.stopProfiler` experimental APIs. Sampling rate can be set through `options.continuousProfilesSampleRate`, which defaults to null (disabled).
9+
To enable Continuous Profiling use the `Sentry.startProfileSession` and `Sentry.stopProfileSession` experimental APIs. Sampling rate can be set through `options.profileSessionSampleRate`, which defaults to null (disabled).
1010
Note: Both `options.profilesSampler` and `options.profilesSampleRate` must **not** be set to enable Continuous Profiling.
1111

1212
```java
@@ -18,10 +18,10 @@
1818
options.getExperimental().setProfileSessionSampleRate(1.0);
1919
}
2020
// Start profiling
21-
Sentry.startProfiler();
21+
Sentry.startProfileSession();
2222

2323
// After all profiling is done, stop the profiler. Profiles can last indefinitely if not stopped.
24-
Sentry.stopProfiler();
24+
Sentry.stopProfileSession();
2525
```
2626
```kotlin
2727
import io.sentry.android.core.SentryAndroid
@@ -32,10 +32,10 @@
3232
options.experimental.profileSessionSampleRate = 1.0
3333
}
3434
// Start profiling
35-
Sentry.startProfiler()
35+
Sentry.startProfileSession()
3636

3737
// After all profiling is done, stop the profiler. Profiles can last indefinitely if not stopped.
38-
Sentry.stopProfiler()
38+
Sentry.stopProfileSession()
3939
```
4040

4141
To learn more visit [Sentry's Continuous Profiling](https://docs.sentry.io/product/explore/profiling/transaction-vs-continuous-profiling/#continuous-profiling-mode) documentation page.

sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MyApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class MyApplication extends Application {
99

1010
@Override
1111
public void onCreate() {
12-
Sentry.startProfiler();
12+
Sentry.startProfileSession();
1313
strictMode();
1414
super.onCreate();
1515

sentry/api/sentry.api

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -625,10 +625,10 @@ public final class io/sentry/HubAdapter : io/sentry/IHub {
625625
public fun setTag (Ljava/lang/String;Ljava/lang/String;)V
626626
public fun setTransaction (Ljava/lang/String;)V
627627
public fun setUser (Lio/sentry/protocol/User;)V
628-
public fun startProfiler ()V
628+
public fun startProfileSession ()V
629629
public fun startSession ()V
630630
public fun startTransaction (Lio/sentry/TransactionContext;Lio/sentry/TransactionOptions;)Lio/sentry/ITransaction;
631-
public fun stopProfiler ()V
631+
public fun stopProfileSession ()V
632632
public fun withIsolationScope (Lio/sentry/ScopeCallback;)V
633633
public fun withScope (Lio/sentry/ScopeCallback;)V
634634
}
@@ -692,10 +692,10 @@ public final class io/sentry/HubScopesWrapper : io/sentry/IHub {
692692
public fun setTag (Ljava/lang/String;Ljava/lang/String;)V
693693
public fun setTransaction (Ljava/lang/String;)V
694694
public fun setUser (Lio/sentry/protocol/User;)V
695-
public fun startProfiler ()V
695+
public fun startProfileSession ()V
696696
public fun startSession ()V
697697
public fun startTransaction (Lio/sentry/TransactionContext;Lio/sentry/TransactionOptions;)Lio/sentry/ITransaction;
698-
public fun stopProfiler ()V
698+
public fun stopProfileSession ()V
699699
public fun withIsolationScope (Lio/sentry/ScopeCallback;)V
700700
public fun withScope (Lio/sentry/ScopeCallback;)V
701701
}
@@ -931,13 +931,13 @@ public abstract interface class io/sentry/IScopes {
931931
public abstract fun setTag (Ljava/lang/String;Ljava/lang/String;)V
932932
public abstract fun setTransaction (Ljava/lang/String;)V
933933
public abstract fun setUser (Lio/sentry/protocol/User;)V
934-
public abstract fun startProfiler ()V
934+
public abstract fun startProfileSession ()V
935935
public abstract fun startSession ()V
936936
public fun startTransaction (Lio/sentry/TransactionContext;)Lio/sentry/ITransaction;
937937
public abstract fun startTransaction (Lio/sentry/TransactionContext;Lio/sentry/TransactionOptions;)Lio/sentry/ITransaction;
938938
public fun startTransaction (Ljava/lang/String;Ljava/lang/String;)Lio/sentry/ITransaction;
939939
public fun startTransaction (Ljava/lang/String;Ljava/lang/String;Lio/sentry/TransactionOptions;)Lio/sentry/ITransaction;
940-
public abstract fun stopProfiler ()V
940+
public abstract fun stopProfileSession ()V
941941
public abstract fun withIsolationScope (Lio/sentry/ScopeCallback;)V
942942
public abstract fun withScope (Lio/sentry/ScopeCallback;)V
943943
}
@@ -1478,10 +1478,10 @@ public final class io/sentry/NoOpHub : io/sentry/IHub {
14781478
public fun setTag (Ljava/lang/String;Ljava/lang/String;)V
14791479
public fun setTransaction (Ljava/lang/String;)V
14801480
public fun setUser (Lio/sentry/protocol/User;)V
1481-
public fun startProfiler ()V
1481+
public fun startProfileSession ()V
14821482
public fun startSession ()V
14831483
public fun startTransaction (Lio/sentry/TransactionContext;Lio/sentry/TransactionOptions;)Lio/sentry/ITransaction;
1484-
public fun stopProfiler ()V
1484+
public fun stopProfileSession ()V
14851485
public fun withIsolationScope (Lio/sentry/ScopeCallback;)V
14861486
public fun withScope (Lio/sentry/ScopeCallback;)V
14871487
}
@@ -1640,10 +1640,10 @@ public final class io/sentry/NoOpScopes : io/sentry/IScopes {
16401640
public fun setTag (Ljava/lang/String;Ljava/lang/String;)V
16411641
public fun setTransaction (Ljava/lang/String;)V
16421642
public fun setUser (Lio/sentry/protocol/User;)V
1643-
public fun startProfiler ()V
1643+
public fun startProfileSession ()V
16441644
public fun startSession ()V
16451645
public fun startTransaction (Lio/sentry/TransactionContext;Lio/sentry/TransactionOptions;)Lio/sentry/ITransaction;
1646-
public fun stopProfiler ()V
1646+
public fun stopProfileSession ()V
16471647
public fun withIsolationScope (Lio/sentry/ScopeCallback;)V
16481648
public fun withScope (Lio/sentry/ScopeCallback;)V
16491649
}
@@ -2298,10 +2298,10 @@ public final class io/sentry/Scopes : io/sentry/IScopes {
22982298
public fun setTag (Ljava/lang/String;Ljava/lang/String;)V
22992299
public fun setTransaction (Ljava/lang/String;)V
23002300
public fun setUser (Lio/sentry/protocol/User;)V
2301-
public fun startProfiler ()V
2301+
public fun startProfileSession ()V
23022302
public fun startSession ()V
23032303
public fun startTransaction (Lio/sentry/TransactionContext;Lio/sentry/TransactionOptions;)Lio/sentry/ITransaction;
2304-
public fun stopProfiler ()V
2304+
public fun stopProfileSession ()V
23052305
public fun withIsolationScope (Lio/sentry/ScopeCallback;)V
23062306
public fun withScope (Lio/sentry/ScopeCallback;)V
23072307
}
@@ -2365,10 +2365,10 @@ public final class io/sentry/ScopesAdapter : io/sentry/IScopes {
23652365
public fun setTag (Ljava/lang/String;Ljava/lang/String;)V
23662366
public fun setTransaction (Ljava/lang/String;)V
23672367
public fun setUser (Lio/sentry/protocol/User;)V
2368-
public fun startProfiler ()V
2368+
public fun startProfileSession ()V
23692369
public fun startSession ()V
23702370
public fun startTransaction (Lio/sentry/TransactionContext;Lio/sentry/TransactionOptions;)Lio/sentry/ITransaction;
2371-
public fun stopProfiler ()V
2371+
public fun stopProfileSession ()V
23722372
public fun withIsolationScope (Lio/sentry/ScopeCallback;)V
23732373
public fun withScope (Lio/sentry/ScopeCallback;)V
23742374
}
@@ -2471,14 +2471,14 @@ public final class io/sentry/Sentry {
24712471
public static fun setTag (Ljava/lang/String;Ljava/lang/String;)V
24722472
public static fun setTransaction (Ljava/lang/String;)V
24732473
public static fun setUser (Lio/sentry/protocol/User;)V
2474-
public static fun startProfiler ()V
2474+
public static fun startProfileSession ()V
24752475
public static fun startSession ()V
24762476
public static fun startTransaction (Lio/sentry/TransactionContext;)Lio/sentry/ITransaction;
24772477
public static fun startTransaction (Lio/sentry/TransactionContext;Lio/sentry/TransactionOptions;)Lio/sentry/ITransaction;
24782478
public static fun startTransaction (Ljava/lang/String;Ljava/lang/String;)Lio/sentry/ITransaction;
24792479
public static fun startTransaction (Ljava/lang/String;Ljava/lang/String;Lio/sentry/TransactionOptions;)Lio/sentry/ITransaction;
24802480
public static fun startTransaction (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/sentry/TransactionOptions;)Lio/sentry/ITransaction;
2481-
public static fun stopProfiler ()V
2481+
public static fun stopProfileSession ()V
24822482
public static fun withIsolationScope (Lio/sentry/ScopeCallback;)V
24832483
public static fun withScope (Lio/sentry/ScopeCallback;)V
24842484
}

sentry/src/main/java/io/sentry/HubAdapter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,13 @@ public boolean isAncestorOf(final @Nullable IScopes otherScopes) {
278278
}
279279

280280
@Override
281-
public void startProfiler() {
282-
Sentry.startProfiler();
281+
public void startProfileSession() {
282+
Sentry.startProfileSession();
283283
}
284284

285285
@Override
286-
public void stopProfiler() {
287-
Sentry.stopProfiler();
286+
public void stopProfileSession() {
287+
Sentry.stopProfileSession();
288288
}
289289

290290
@Override

sentry/src/main/java/io/sentry/HubScopesWrapper.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,13 @@ public boolean isAncestorOf(final @Nullable IScopes otherScopes) {
278278
}
279279

280280
@Override
281-
public void startProfiler() {
282-
scopes.startProfiler();
281+
public void startProfileSession() {
282+
scopes.startProfileSession();
283283
}
284284

285285
@Override
286-
public void stopProfiler() {
287-
scopes.stopProfiler();
286+
public void stopProfileSession() {
287+
scopes.stopProfileSession();
288288
}
289289

290290
@ApiStatus.Internal

sentry/src/main/java/io/sentry/IScopes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,9 +592,9 @@ ITransaction startTransaction(
592592
final @NotNull TransactionContext transactionContext,
593593
final @NotNull TransactionOptions transactionOptions);
594594

595-
void startProfiler();
595+
void startProfileSession();
596596

597-
void stopProfiler();
597+
void stopProfileSession();
598598

599599
/**
600600
* Associates {@link ISpan} and the transaction name with the {@link Throwable}. Used to determine

sentry/src/main/java/io/sentry/NoOpHub.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,10 @@ public boolean isAncestorOf(@Nullable IScopes otherScopes) {
244244
}
245245

246246
@Override
247-
public void startProfiler() {}
247+
public void startProfileSession() {}
248248

249249
@Override
250-
public void stopProfiler() {}
250+
public void stopProfileSession() {}
251251

252252
@Override
253253
public void setSpanContext(

sentry/src/main/java/io/sentry/NoOpScopes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,10 @@ public boolean isAncestorOf(@Nullable IScopes otherScopes) {
239239
}
240240

241241
@Override
242-
public void startProfiler() {}
242+
public void startProfileSession() {}
243243

244244
@Override
245-
public void stopProfiler() {}
245+
public void stopProfileSession() {}
246246

247247
@Override
248248
public void setSpanContext(

sentry/src/main/java/io/sentry/Scopes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ public void flush(long timeoutMillis) {
924924
}
925925

926926
@Override
927-
public void startProfiler() {
927+
public void startProfileSession() {
928928
if (getOptions().isContinuousProfilingEnabled()) {
929929
getOptions().getContinuousProfiler().start(getOptions().getInternalTracesSampler());
930930
} else if (getOptions().isProfilingEnabled()) {
@@ -937,7 +937,7 @@ public void startProfiler() {
937937
}
938938

939939
@Override
940-
public void stopProfiler() {
940+
public void stopProfileSession() {
941941
if (getOptions().isContinuousProfilingEnabled()) {
942942
getOptions().getLogger().log(SentryLevel.DEBUG, "Stopped continuous Profiling.");
943943
getOptions().getContinuousProfiler().stop();

sentry/src/main/java/io/sentry/ScopesAdapter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,13 +281,13 @@ public boolean isAncestorOf(final @Nullable IScopes otherScopes) {
281281
}
282282

283283
@Override
284-
public void startProfiler() {
285-
Sentry.startProfiler();
284+
public void startProfileSession() {
285+
Sentry.startProfileSession();
286286
}
287287

288288
@Override
289-
public void stopProfiler() {
290-
Sentry.stopProfiler();
289+
public void stopProfileSession() {
290+
Sentry.stopProfileSession();
291291
}
292292

293293
@ApiStatus.Internal

0 commit comments

Comments
 (0)