Skip to content

Add Metrics to Java onboarding#106508

Merged
adinauer merged 14 commits intomasterfrom
feat/java-metrics-onboarding
Jan 21, 2026
Merged

Add Metrics to Java onboarding#106508
adinauer merged 14 commits intomasterfrom
feat/java-metrics-onboarding

Conversation

@adinauer
Copy link
Copy Markdown
Member

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.

@adinauer adinauer requested a review from a team as a code owner January 19, 2026 09:43
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 19, 2026
],
});

export const metrics = <
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Member Author

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

Copy link
Copy Markdown
Contributor

@lbloder lbloder left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Comment thread static/app/components/onboarding/productSelection.tsx
)

<!-- 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>
Comment thread static/app/data/platformCategories.tsx
Copy link
Copy Markdown
Contributor

@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 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment thread static/app/data/platformCategories.tsx
Copy link
Copy Markdown
Contributor

@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 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment thread static/app/gettingStartedDocs/android/metrics.tsx Outdated
Comment thread static/app/components/onboarding/productSelection.tsx
Comment thread static/app/components/onboarding/productSelection.tsx
Comment thread static/app/components/onboarding/productSelection.tsx

export const limitedMetricsSupportPrefixes: Set<string> = new Set([
'android',
'java',
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.

Are we listing only java because it serves as a prefix for java-logback, java-log4j2, java-spring, and java-spring-boot?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There seems to only be prefixes here for other SDKs so I replicated this for Java too.

Comment thread static/app/gettingStartedDocs/android/metrics.tsx
Comment on lines +38 to +68
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(),
},
],
},
],
});
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.

It appears that this function is not used anywhere. Knip may be failing in this PR, though I haven’t confirmed yet.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

removed the function


${getMetricsCodeJava()}`;

export const getMetricsVerifyKotlinSnippet = () => `import io.sentry.Sentry
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.

this is only being used in the metricsVerify which is not used anywhere. we should do a cleanup in this file.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Will clean the files up a bit.

{
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.",
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.

nit: should we say version here?

Comment on lines +72 to +74
docsPlatform,
}: {
docsPlatform: string;
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.

nit: maybe java can be the default? or do we want to force developers to always inform the platform?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

now inferring docsPlatform as you suggested

replayOnboardingJsLoader,
feedbackOnboardingJsLoader,
logsOnboarding: logs,
metricsOnboarding: metrics({docsPlatform: 'spring'}),
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.

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.

Co-authored-by: Priscila Oliveira <priscila.oliveira@sentry.io>
Comment thread static/app/gettingStartedDocs/android/index.tsx
@priscilawebdev
Copy link
Copy Markdown
Member

@adinauer The issue is that the component renderWithOnboardingLayout
used in the javascript tests has the platformKey "java-spring-boot" set. Since you enabled Metrics for this platformKey, the checkbox is now displayed, causing the tests to fail.

I’ll update this test utility in a separate PR, so we don’t need to modify the JavaScript tests here in this PR. They shouldn’t fail when updating a Java platform.

priscilawebdev added a commit that referenced this pull request Jan 20, 2026
…latformKey (#106557)

Because the platformKey is static - java-spring-boot - enabling Metrics
for this platform is causing the JavaScript tests to fail, even though
they shouldn’t
([see](#106508 (comment))).
Copy link
Copy Markdown
Member

@priscilawebdev priscilawebdev left a comment

Choose a reason for hiding this comment

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

Nit: I’d update the sentence and combine the verify metrics code with the error so there’s one less code snippet ....just like we do for javascript-react:

Image

Other than that, it looks good to me! 🚀

@adinauer
Copy link
Copy Markdown
Member Author

Created getsentry/sentry-java#5043 to track the follow up for combining snippets so we can get this merged.

@adinauer adinauer merged commit abe1edc into master Jan 21, 2026
53 checks passed
@adinauer adinauer deleted the feat/java-metrics-onboarding branch January 21, 2026 13:23
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants