Skip to content

Autoinstall Profiler#222

Open
lbloder wants to merge 8 commits intomainfrom
feat/autoinstall-profiler
Open

Autoinstall Profiler#222
lbloder wants to merge 8 commits intomainfrom
feat/autoinstall-profiler

Conversation

@lbloder
Copy link
Copy Markdown
Collaborator

@lbloder lbloder commented Feb 4, 2026

📜 Description

Add a new flag installProfiler to automatically install the sentry-async-profiler using the maven plugin.

💡 Motivation and Context

resolves: #221

💚 How did you test it?

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • No breaking changes

🔮 Next steps

@lbloder lbloder marked this pull request as ready for review February 5, 2026 21:04
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Autofix Details

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: Unused constant DEFAULT_INSTALL_PROFILER_STRING never referenced
    • I added an installProfiler @Parameter(defaultValue = DEFAULT_INSTALL_PROFILER_STRING) to ExtensionConfigurationHolderMojo, which makes the constant used and exposes the configuration consistently.
  • ✅ Fixed: Default constant declared after instance field that uses it
    • I moved DEFAULT_INSTALL_PROFILER and DEFAULT_INSTALL_PROFILER_STRING into the top default-constants block before instance fields to match class ordering conventions.

Create PR

Or push these changes by commenting:

@cursor push 7458bc9470
Preview (7458bc9470)
diff --git a/src/main/java/io/sentry/ExtensionConfigurationHolderMojo.java b/src/main/java/io/sentry/ExtensionConfigurationHolderMojo.java
--- a/src/main/java/io/sentry/ExtensionConfigurationHolderMojo.java
+++ b/src/main/java/io/sentry/ExtensionConfigurationHolderMojo.java
@@ -1,5 +1,6 @@
 package io.sentry;
 
+import static io.sentry.config.PluginConfig.DEFAULT_INSTALL_PROFILER_STRING;
 import static io.sentry.config.PluginConfig.DEFAULT_SKIP_AUTO_INSTALL_STRING;
 import static io.sentry.config.PluginConfig.DEFAULT_SKIP_TELEMETRY_STRING;
 
@@ -21,6 +22,10 @@
   @Parameter(defaultValue = DEFAULT_SKIP_TELEMETRY_STRING)
   private boolean skipTelemetry;
 
+  @SuppressWarnings("UnusedVariable")
+  @Parameter(defaultValue = DEFAULT_INSTALL_PROFILER_STRING)
+  private boolean installProfiler;
+
   @Override
   public void execute() throws MojoExecutionException, MojoFailureException {}
 }

diff --git a/src/main/java/io/sentry/config/PluginConfig.java b/src/main/java/io/sentry/config/PluginConfig.java
--- a/src/main/java/io/sentry/config/PluginConfig.java
+++ b/src/main/java/io/sentry/config/PluginConfig.java
@@ -23,6 +23,8 @@
   public static final boolean DEFAULT_SKIP_VALIDATE_SDK_DEPENDENCY_VERSIONS = false;
   public static final @NotNull String DEFAULT_SKIP_VALIDATE_SDK_DEPENDENCY_VERSIONS_STRING =
       "false";
+  public static final boolean DEFAULT_INSTALL_PROFILER = false;
+  public static final @NotNull String DEFAULT_INSTALL_PROFILER_STRING = "false";
   public static final @NotNull String DEFAULT_ADDITIONAL_SOURCE_DIRS_FOR_SOURCE_CONTEXT = "";
 
   private boolean skip = DEFAULT_SKIP;
@@ -38,9 +40,6 @@
       DEFAULT_ADDITIONAL_SOURCE_DIRS_FOR_SOURCE_CONTEXT;
   private boolean installProfiler = DEFAULT_INSTALL_PROFILER;
 
-  public static final boolean DEFAULT_INSTALL_PROFILER = false;
-  public static final @NotNull String DEFAULT_INSTALL_PROFILER_STRING = "false";
-
   private @Nullable String org;
   private @Nullable String project;
   private @Nullable String url;
This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

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");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

<additionalSourceDirsForSourceContext>
<value>src/main/extra_param</value>
</additionalSourceDirsForSourceContext>
<installProfiler>false</installProfiler>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m why do we set it to false but show options for enabling profiling above?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

### Features

- add option to ignore source bundle upload failures ([#209](https://github.com/getsentry/sentry-maven-plugin/pull/209))
- Autoinstall Profiler ([#222](https://github.com/getsentry/sentry-maven-plugin/pull/222))
Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated changelog

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d15cf76. Configure here.

autoInstallState.setInstallGraphql(shouldInstallGraphQL(resolvedArtifacts));
autoInstallState.setInstallJdbc(!isModuleAvailable(resolvedArtifacts, SENTRY_JDBC_ID));
autoInstallState.setInstallQuartz(!isModuleAvailable(resolvedArtifacts, SENTRY_QUARTZ_ID));
autoInstallState.setInstallProfiler(shouldInstallProfiler(resolvedArtifacts, pluginConfig));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Profiler skip message logged for every build by default

Medium Severity

Since installProfiler defaults to false (opt-in feature) and ProfilerInstallStrategy is always in the installers list, every build will log "sentry-async-profiler won't be installed because it was already installed directly or its auto-installation has been disabled" — even for users who never requested profiler installation. Other integrations only show their skip message when already installed as a direct dependency, because their install flags default to true. This will confuse customers, as the reviewer noted.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d15cf76. Configure here.

}

assertTrue(fixture.dependencies.none { it.groupId == "io.sentry" && it.artifactId == "sentry-async-profiler" })
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit test doesn't verify "already installed" scenario

Low Severity

The test when sentry-async-profiler is a direct dependency logs a message and does nothing sets installProfiler = false, so shouldInstallModule returns false before resolvedArtifacts is ever consulted. The profilerAlreadyInstalled = true parameter has no effect — this test exercises the exact same code path as the when installProfiler flag is false does not install test, making it a duplicate rather than a test of the "already installed" scenario.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d15cf76. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto install profiler

2 participants