-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Java Continuous Profiling #15154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Java Continuous Profiling #15154
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e6bbe54
add setup instructions for java continuous profiling
lbloder 063a2d3
Merge branch 'master' into feat/java-profiling
lbloder 3daa293
update default version in install instructions, added code sample for…
lbloder e2b8c5c
add dif
lbloder 6612b69
Merge branch 'master' into feat/java-profiling
lbloder 31f24d3
add updated info about new async-profiler version. add information on…
lbloder 9810ea1
Merge branch 'master' into feat/java-profiling
lbloder bc83790
Merge branch 'master' into feat/java-profiling
lbloder fa9c69d
Merge branch 'master' into feat/java-profiling
lbloder b66266a
add new profiler options
lbloder dc280cb
remove onboarding buttons in java configure
lbloder 4373a64
document config and installation based on whether profiling is enable…
lbloder f621a90
Merge branch 'master' into feat/java-profiling
lbloder 6f9d3db
Merge branch 'master' into feat/java-profiling
lbloder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| --- | ||
| title: Set Up Java Profiling | ||
| sidebar_title: Profiling | ||
| description: "Learn how to enable profiling in your app if it is not already set up." | ||
| sidebar_order: 5000 | ||
| supported: | ||
| - java | ||
| --- | ||
|
|
||
| <PlatformContent includePath="profiling/index/preface" /> | ||
| <PlatformContent includePath="profiling/index/why-profiling" /> | ||
|
|
||
| <Alert> | ||
|
|
||
| Continuous profiling is available starting in SDK version `8.23.0` for macOS and Linux. | ||
|
|
||
| </Alert> | ||
|
|
||
| <Alert level="warning"> | ||
| Versions < `8.26.0` use [async-profiler](https://github.com/async-profiler/async-profiler) in version 3 and thus only support Java up to JDK 22. Starting with `8.26.0` we upgraded to [async-profiler](https://github.com/async-profiler/async-profiler) 4.2 enabling support for all Java versions up to JDK 25. | ||
| </Alert> | ||
|
|
||
| ## Install | ||
|
|
||
| In addition to your typical Sentry dependencies, you will need to add `sentry-async-profiler` as a dependency: | ||
|
|
||
| ```groovy {tabTitle:Gradle} | ||
| implementation 'io.sentry:sentry-async-profiler:{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}' | ||
| ``` | ||
| ```xml {tabTitle:Maven} | ||
| <dependency> | ||
| <groupId>io.sentry</groupId> | ||
| <artifactId>sentry-async-profiler</artifactId> | ||
| <version>{{@inject packages.version('sentry.java.async-profiler', '8.23.0') }}</version> | ||
| </dependency> | ||
| ``` | ||
|
|
||
| ## Enabling Continuous Profiling | ||
|
|
||
| Continuous profiling supports two modes - `manual` and `trace`. The two modes are mutually exclusive, and cannot be used at the same time. | ||
|
|
||
| In `manual` mode, the profiling data collection can be managed via calls to `Sentry.startProfiler()` and `Sentry.stopProfiler()`. You are entirely in control of when the profiler runs. | ||
|
|
||
| In `trace` mode, the profiler manages its own start and stop calls, which are based on spans: the profiler continues to run while there is at least one active span, and stops when there are no active spans. | ||
|
|
||
| <PlatformContent includePath="profiling/automatic-instrumentation-setup" /> | ||
|
|
||
| ### Managing Profile Sampling Rates | ||
|
|
||
| Sentry SDK supports an additional `profileSessionSampleRate` that must be set to a non-zero value to enable continuous profiling. This can be used to control session sampling rates at the service level as the sampling decision is evaluated only once at SDK initialization. | ||
|
|
||
| This is useful for cases where you deploy your service many times, but would only like a subset of those deployments to be profiled. In a single service environment we recommend to set this to 1.0. | ||
|
|
||
| ### Manage Storage Location for Profiles | ||
| The files generated by the underlying profiler are temporarily stored. By default we use the directory `System.getProperty("java.io.tmpdir")/profiling_traces`. This path can be configured by setting the `profilingTracesDirPath` option. | ||
|
|
||
| ## Platform Support | ||
|
|
||
| Continuous profiling for Java is currently supported on: | ||
|
|
||
| - macOS | ||
| - Linux | ||
|
|
||
| The profiler uses [async-profiler](https://github.com/async-profiler/async-profiler) under the hood to collect profiling data. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.