-
-
Notifications
You must be signed in to change notification settings - Fork 4
Autoinstall Profiler #222
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
Open
lbloder
wants to merge
9
commits into
main
Choose a base branch
from
feat/autoinstall-profiler
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Autoinstall Profiler #222
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cc3948a
auto-install sentry-async-profiler if flag is set
lbloder 04b26ee
add profiling config to sample
lbloder 3172dfc
add changelog entry
lbloder 41221cf
Merge branch 'main' into feat/autoinstall-profiler
lbloder 90cf614
Merge branch 'main' into feat/autoinstall-profiler
lbloder 59add6f
set installProfiler to true in sample, fix wrong log if sentry min ve…
lbloder be846af
fix changelog
lbloder d15cf76
add installProfiler to ExtensionConfigurationHolderMojo, add possibil…
lbloder a9b3e0a
only log "not installed" message for profiler if the profiler is alre…
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
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
63 changes: 63 additions & 0 deletions
63
src/main/java/io/sentry/autoinstall/profiler/ProfilerInstallStrategy.java
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,63 @@ | ||
| package io.sentry.autoinstall.profiler; | ||
|
|
||
| import static io.sentry.Constants.SENTRY_GROUP_ID; | ||
|
|
||
| import io.sentry.autoinstall.AbstractIntegrationInstaller; | ||
| import io.sentry.autoinstall.AutoInstallState; | ||
| import io.sentry.semver.Version; | ||
| import java.util.List; | ||
| import org.eclipse.aether.artifact.Artifact; | ||
| import org.eclipse.aether.artifact.DefaultArtifact; | ||
| import org.jetbrains.annotations.NotNull; | ||
| import org.jetbrains.annotations.Nullable; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| public class ProfilerInstallStrategy extends AbstractIntegrationInstaller { | ||
| public static final @NotNull String SENTRY_ASYNC_PROFILER_ID = "sentry-async-profiler"; | ||
|
|
||
| public ProfilerInstallStrategy() { | ||
| this(LoggerFactory.getLogger(ProfilerInstallStrategy.class)); | ||
| } | ||
|
|
||
| public ProfilerInstallStrategy(final @NotNull Logger logger) { | ||
| super(logger); | ||
| } | ||
|
|
||
| @Override | ||
| protected @Nullable Artifact findThirdPartyDependency( | ||
| final @NotNull List<Artifact> resolvedArtifacts) { | ||
| // Return a dummy artifact as there are no third-party dependencies required | ||
| return new DefaultArtifact("dummy:dummy:1.0.0"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks fine as a workaround for now. We should consider a cleaner implementation if there's more of these in the future. |
||
| } | ||
|
|
||
| @Override | ||
| protected boolean shouldInstallModule(final @NotNull AutoInstallState autoInstallState) { | ||
| return autoInstallState.isInstallProfiler(); | ||
| } | ||
|
cursor[bot] marked this conversation as resolved.
|
||
|
|
||
| @Override | ||
| protected boolean shouldLogSkippedInstallMessage( | ||
| final @NotNull List<Artifact> resolvedArtifacts, | ||
| final @NotNull AutoInstallState autoInstallState) { | ||
| return isSentryAsyncProfilerAvailable(resolvedArtifacts); | ||
| } | ||
|
|
||
| private boolean isSentryAsyncProfilerAvailable(final @NotNull List<Artifact> resolvedArtifacts) { | ||
| return resolvedArtifacts.stream() | ||
| .anyMatch( | ||
| (dep) -> | ||
| dep.getGroupId().equals(SENTRY_GROUP_ID) | ||
| && dep.getArtifactId().equals(SENTRY_ASYNC_PROFILER_ID)); | ||
| } | ||
|
|
||
| @Override | ||
| protected @NotNull Version minSupportedSentryVersion() { | ||
| return Version.create(8, 23, 0); | ||
| } | ||
|
|
||
| @Override | ||
| protected @NotNull String sentryModuleId() { | ||
| return SENTRY_ASYNC_PROFILER_ID; | ||
| } | ||
| } | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should mention the name of the option to enable it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated changelog