Skip to content

Commit e2b8c5c

Browse files
committed
add dif
1 parent 3daa293 commit e2b8c5c

File tree

2 files changed

+53
-48
lines changed

2 files changed

+53
-48
lines changed

platform-includes/profiling/automatic-instrumentation-setup/java.mdx

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,90 +6,90 @@ To enable trace profiling, set the lifecycle to `trace`. Trace profiling require
66
Check out the <PlatformLink to="/tracing/">tracing setup documentation</PlatformLink> for more detailed information on how to configure sampling. Setting the sample rate to 1.0 means all transactions will be captured.
77

88

9-
```java
9+
```java {diff}
1010
import io.sentry.Sentry;
1111
import io.sentry.ProfileLifecycle;
1212

1313
Sentry.init(options -> {
1414
options.setDsn("___PUBLIC_DSN___");
15-
// Set traces_sample_rate to 1.0 to capture 100%
16-
// of transactions for tracing.
17-
options.setTracesSampleRate(1.0);
18-
// To collect profiles for all profile sessions,
19-
// set `profile_session_sample_rate` to 1.0.
20-
options.setProfileSessionSampleRate(1.0);
21-
// Profiles will be automatically collected while
22-
// there is an active span.
23-
options.setProfileLifecycle(ProfileLifecycle.TRACE);
15+
+ // Set traces_sample_rate to 1.0 to capture 100%
16+
+ // of transactions for tracing.
17+
+ options.setTracesSampleRate(1.0);
18+
+ // To collect profiles for all profile sessions,
19+
+ // set `profile_session_sample_rate` to 1.0.
20+
+ options.setProfileSessionSampleRate(1.0);
21+
+ // Profiles will be automatically collected while
22+
+ // there is an active span.
23+
+ options.setProfileLifecycle(ProfileLifecycle.TRACE);
2424
});
2525
```
2626

27-
```kotlin
27+
```kotlin {diff}
2828
import io.sentry.Sentry
29-
import io.sentry.ProfileLifecycle
29+
+import io.sentry.ProfileLifecycle
3030

3131
Sentry.init { options ->
3232
options.dsn = "___PUBLIC_DSN___"
33-
// Set traces_sample_rate to 1.0 to capture 100%
34-
// of transactions for tracing.
35-
options.tracesSampleRate = 1.0
36-
// To collect profiles for all profile sessions,
37-
// set `profile_session_sample_rate` to 1.0.
38-
options.profileSessionSampleRate = 1.0
39-
// Profiles will be automatically collected while
40-
// there is an active span.
41-
options.profileLifecycle = ProfileLifecycle.TRACE
33+
+ // Set traces_sample_rate to 1.0 to capture 100%
34+
+ // of transactions for tracing.
35+
+ options.tracesSampleRate = 1.0
36+
+ // To collect profiles for all profile sessions,
37+
+ // set `profile_session_sample_rate` to 1.0.
38+
+ options.profileSessionSampleRate = 1.0
39+
+ // Profiles will be automatically collected while
40+
+ // there is an active span.
41+
+ options.profileLifecycle = ProfileLifecycle.TRACE
4242
}
4343
```
4444

4545
### Enabling Manual Lifecycle Profiling
4646

4747
To enable manual profiling, set the lifecycle to `manual`. Manual profiling does not require tracing to be enabled.
4848

49-
```java
49+
```java {diff}
5050
import io.sentry.Sentry;
51-
import io.sentry.ProfileLifecycle;
51+
+import io.sentry.ProfileLifecycle;
5252

5353
Sentry.init(options -> {
5454
options.setDsn("___PUBLIC_DSN___");
55-
// To collect profiles for all profile sessions,
56-
// set `profile_session_sample_rate` to 1.0.
57-
options.setProfileSessionSampleRate(1.0)
58-
// Profiles will be collected when
59-
// `Sentry.startProfiler()` is called and
60-
// stopped when `Sentry.stopProfiler()` is called.
61-
options.setProfileLifecycle(ProfileLifecycle.MANUAL);
55+
+ // To collect profiles for all profile sessions,
56+
+ // set `profile_session_sample_rate` to 1.0.
57+
+ options.setProfileSessionSampleRate(1.0)
58+
+ // Profiles will be collected when
59+
+ // `Sentry.startProfiler()` is called and
60+
+ // stopped when `Sentry.stopProfiler()` is called.
61+
+ options.setProfileLifecycle(ProfileLifecycle.MANUAL);
6262
});
6363

64-
// Start profiling
65-
Sentry.startProfiler();
64+
+// Start profiling
65+
+Sentry.startProfiler();
6666

6767
// run some code here
6868

69-
// Stop profiling
70-
Sentry.stopProfiler();
69+
+// Stop profiling
70+
+Sentry.stopProfiler();
7171
```
7272

73-
```kotlin
73+
```kotlin {diff}
7474
import io.sentry.Sentry
75-
import io.sentry.ProfileLifecycle
75+
+import io.sentry.ProfileLifecycle
7676

7777
Sentry.init { options ->
7878
options.dsn = "___PUBLIC_DSN___"
79-
// To collect profiles for all profile sessions,
80-
// set `profile_session_sample_rate` to 1.0.
81-
options.profileSessionSampleRate = 1.0
82-
// Profiles will be collected when
83-
// `Sentry.startProfiler()` is called and
84-
// stopped when `Sentry.stopProfiler()` is called.
85-
options.profileLifecycle = ProfileLifecycle.MANUAL
79+
+ // To collect profiles for all profile sessions,
80+
+ // set `profile_session_sample_rate` to 1.0.
81+
+ options.profileSessionSampleRate = 1.0
82+
+ // Profiles will be collected when
83+
+ // `Sentry.startProfiler()` is called and
84+
+ // stopped when `Sentry.stopProfiler()` is called.
85+
+ options.profileLifecycle = ProfileLifecycle.MANUAL
8686
}
8787

88-
// Start profiling
89-
Sentry.startProfiler()
88+
+// Start profiling
89+
+Sentry.startProfiler()
9090

9191
// run some code here
9292

93-
// Stop profiling
94-
Sentry.stopProfiler()
93+
+// Stop profiling
94+
+Sentry.stopProfiler()
9595
```

platform-includes/profiling/automatic-instrumentation-setup/java.spring-boot.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,9 @@ Sentry.startProfiler()
5858
5959
// Stop profiling
6060
Sentry.stopProfiler()
61-
```
61+
```
62+
63+
<Alert level="warning">
64+
If you are using our OpenTelemetry Agent, profiling does currently NOT support the <PlatformLink to="/opentelemetry/setup/agent/auto-init">Agent Auto-Init</PlatformLink> case.
65+
</Alert>
66+

0 commit comments

Comments
 (0)