Skip to content

Autoinstall Profiler#222

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

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

Conversation

@lbloder
Copy link
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

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

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.

private boolean installProfiler = DEFAULT_INSTALL_PROFILER;

public static final boolean DEFAULT_INSTALL_PROFILER = false;
public static final @NotNull String DEFAULT_INSTALL_PROFILER_STRING = "false";
Copy link

Choose a reason for hiding this comment

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

Unused constant DEFAULT_INSTALL_PROFILER_STRING never referenced

Low Severity

DEFAULT_INSTALL_PROFILER_STRING is declared but never used anywhere in the codebase. Other DEFAULT_*_STRING constants are used as @Parameter(defaultValue = ...) in Maven Mojo classes (e.g., ExtensionConfigurationHolderMojo, UploadSourceBundleMojo). If installProfiler needs a corresponding @Parameter declaration in a Mojo (like skipAutoInstall and skipTelemetry have in ExtensionConfigurationHolderMojo), then a Mojo declaration is missing. If not, this constant is dead code.

Fix in Cursor Fix in Web

private boolean installProfiler = DEFAULT_INSTALL_PROFILER;

public static final boolean DEFAULT_INSTALL_PROFILER = false;
public static final @NotNull String DEFAULT_INSTALL_PROFILER_STRING = "false";
Copy link

Choose a reason for hiding this comment

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

Default constant declared after instance field that uses it

Low Severity

DEFAULT_INSTALL_PROFILER and DEFAULT_INSTALL_PROFILER_STRING are declared on lines 41–42, after the instance field installProfiler that references the constant on line 39. Every other DEFAULT_* constant in this class is declared at the top (lines 7–26) before the instance fields. While Java inlines compile-time constants so this works at runtime, the inconsistent ordering breaks the established class structure pattern and could confuse future maintainers.

Fix in Cursor Fix in Web

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

1 participant