-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Add Metrics to Java onboarding #106508
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
base: master
Are you sure you want to change the base?
Add Metrics to Java onboarding #106508
Conversation
| ], | ||
| }); | ||
|
|
||
| export const metrics = < |
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.
Looks like the java platforms (java, java-log4j, java-spring, etc) are missing in the withMetricsOnboarding Set in platformCategories.tsx.
Then it shows up in Explore > Metrics.
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.
This is changed in #106513
lbloder
left a comment
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.
LGTM 👍
) <!-- Describe your PR here. --> <!-- Sentry employees and contractors can delete or ignore the following. --> ### Legal Boilerplate Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms. --------- Co-authored-by: Lukas Bloder <lukas.bloder@gmail.com>
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.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
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.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| ProductSolution.LOGS, | ||
| ProductSolution.METRICS, | ||
| ], | ||
| 'java-spring-boot': [ | ||
| ProductSolution.PERFORMANCE_MONITORING, | ||
| ProductSolution.LOGS, | ||
| ProductSolution.METRICS, | ||
| ], | ||
| javascript: [ | ||
| ProductSolution.PERFORMANCE_MONITORING, | ||
| ProductSolution.SESSION_REPLAY, |
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.
Bug: The 'android' platform is missing from the platformProductAvailability object, which will prevent the product selection UI from rendering during onboarding for Android projects.
Severity: MEDIUM
Suggested Fix
Add an entry for the 'android' platform to the platformProductAvailability object in static/app/components/onboarding/productSelection.tsx, similar to the other platforms. This entry should list the available products for Android, such as profiling, replay, and metrics.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: static/app/components/onboarding/productSelection.tsx#L112-L142
Potential issue: The 'android' platform is missing from the
`platformProductAvailability` object in `productSelection.tsx`. While the PR adds
metrics onboarding documentation for Android, this omission will cause the
`ProductSelection` component to look up `platformProductAvailability['android']`,
receive `undefined`, and consequently return `null`. This prevents users from seeing or
selecting any products (like Metrics, Logs, or Replay) during the onboarding flow for a
new Android project, making the feature incomplete for this platform.
Did we get this right? 👍 / 👎 to inform future reviews.
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.
Product selection is not available on Android platforms. Instead, we offer a command-line wizard or a link to the documentation for manual instrumentation.
| ProductSolution.LOGS, | ||
| ProductSolution.METRICS, | ||
| ], | ||
| 'java-spring-boot': [ | ||
| ProductSolution.PERFORMANCE_MONITORING, | ||
| ProductSolution.LOGS, | ||
| ProductSolution.METRICS, | ||
| ], | ||
| javascript: [ | ||
| ProductSolution.PERFORMANCE_MONITORING, | ||
| ProductSolution.SESSION_REPLAY, |
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.
Product selection is not available on Android platforms. Instead, we offer a command-line wizard or a link to the documentation for manual instrumentation.
|
|
||
| export const limitedMetricsSupportPrefixes: Set<string> = new Set([ | ||
| 'android', | ||
| 'java', |
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.
Are we listing only java because it serves as a prefix for java-logback, java-log4j2, java-spring, and java-spring-boot?
| text: tct( | ||
| "To start using metrics, make sure your Sentry Android SDK version is [code] or higher. If you're on an older version of the SDK, follow our [link:migration guide] to upgrade.", | ||
| { | ||
| code: ( | ||
| <code>{getPackageVersion(params, 'sentry.java.android', '8.30.0')}</code> | ||
| ), | ||
| link: ( | ||
| <ExternalLink href="https://docs.sentry.io/platforms/android/migration/" /> | ||
| ), | ||
| } | ||
| ), |
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.
nit:
| text: tct( | |
| "To start using metrics, make sure your Sentry Android SDK version is [code] or higher. If you're on an older version of the SDK, follow our [link:migration guide] to upgrade.", | |
| { | |
| code: ( | |
| <code>{getPackageVersion(params, 'sentry.java.android', '8.30.0')}</code> | |
| ), | |
| link: ( | |
| <ExternalLink href="https://docs.sentry.io/platforms/android/migration/" /> | |
| ), | |
| } | |
| ), | |
| text: tct( | |
| "To start using metrics, make sure your Sentry Android SDK version is [version] or higher. If you're on an older version of the SDK, follow our [link:migration guide] to upgrade.", | |
| { | |
| version: ( | |
| <code>{getPackageVersion(params, 'sentry.java.android', '8.30.0')}</code> | |
| ), | |
| link: ( | |
| <ExternalLink href="https://docs.sentry.io/platforms/android/migration/" /> | |
| ), | |
| } | |
| ), |
| export const metricsVerify = < | ||
| PlatformOptions extends BasePlatformOptions = BasePlatformOptions, | ||
| >( | ||
| params: DocsParams<PlatformOptions> | ||
| ): ContentBlock => ({ | ||
| type: 'conditional', | ||
| condition: params.isMetricsSelected, | ||
| content: [ | ||
| { | ||
| type: 'text', | ||
| text: t( | ||
| 'Send test metrics from your app to verify metrics are arriving in Sentry.' | ||
| ), | ||
| }, | ||
| { | ||
| type: 'code', | ||
| tabs: [ | ||
| { | ||
| label: 'Java', | ||
| language: 'java', | ||
| code: getMetricsVerifyJavaSnippet(), | ||
| }, | ||
| { | ||
| label: 'Kotlin', | ||
| language: 'kotlin', | ||
| code: getMetricsVerifyKotlinSnippet(), | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| }); |
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.
It appears that this function is not used anywhere. Knip may be failing in this PR, though I haven’t confirmed yet.
| ${getMetricsCodeJava()}`; | ||
|
|
||
| export const getMetricsVerifyKotlinSnippet = () => `import io.sentry.Sentry |
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.
this is only being used in the metricsVerify which is not used anywhere. we should do a cleanup in this file.
| { | ||
| type: 'text', | ||
| text: tct( | ||
| "To start using metrics, make sure your Sentry Java SDK version is [code:8.30.0] or higher. If you're on an older version of the SDK, follow our [link:migration guide] to upgrade.", |
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.
nit: should we say version here?
| docsPlatform, | ||
| }: { | ||
| docsPlatform: string; |
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.
nit: maybe java can be the default? or do we want to force developers to always inform the platform?
| replayOnboardingJsLoader, | ||
| feedbackOnboardingJsLoader, | ||
| logsOnboarding: logs, | ||
| metricsOnboarding: metrics({docsPlatform: 'spring'}), |
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.
Based on what I observed, if we remove the java- prefix, the names are identical. I propose we avoid making the metrics a function and instead use something like params.platformKey.split('java-')[1] directly.
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.