From 88373dd28f812cb31d5000fb6854ea1757096ed2 Mon Sep 17 00:00:00 2001 From: "junior[bot]" Date: Wed, 13 May 2026 10:21:05 +0000 Subject: [PATCH 1/6] feat(onboarding): Add missing ProductSolutions for Ruby, Elixir, and Rust Add Elixir and Rust to platformProductAvailability and add METRICS to Ruby/Ruby-rack/Ruby-rails entries. Feature support verified against sentry-docs frontmatter: - Ruby (ruby, ruby-rack, ruby-rails): add METRICS (already had perf, profiling, logs) - Elixir: add PERFORMANCE_MONITORING, LOGS, METRICS (no profiling/replay in SDK) - Rust: add PERFORMANCE_MONITORING, LOGS, METRICS (no profiling/replay in SDK) --- .../app/components/onboarding/productSelection.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/static/app/components/onboarding/productSelection.tsx b/static/app/components/onboarding/productSelection.tsx index 4693c58a08f7..62e9c0a8bec7 100644 --- a/static/app/components/onboarding/productSelection.tsx +++ b/static/app/components/onboarding/productSelection.tsx @@ -138,6 +138,11 @@ export const platformProductAvailability = { ], 'dotnet-xamarin': [ProductSolution.PERFORMANCE_MONITORING], dart: [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.LOGS], + elixir: [ + ProductSolution.PERFORMANCE_MONITORING, + ProductSolution.LOGS, + ProductSolution.METRICS, + ], kotlin: [ProductSolution.PERFORMANCE_MONITORING], go: [ ProductSolution.PERFORMANCE_MONITORING, @@ -489,16 +494,24 @@ export const platformProductAvailability = { ProductSolution.PERFORMANCE_MONITORING, ProductSolution.PROFILING, ProductSolution.LOGS, + ProductSolution.METRICS, ], 'ruby-rack': [ ProductSolution.PERFORMANCE_MONITORING, ProductSolution.PROFILING, ProductSolution.LOGS, + ProductSolution.METRICS, ], 'ruby-rails': [ ProductSolution.PERFORMANCE_MONITORING, ProductSolution.PROFILING, ProductSolution.LOGS, + ProductSolution.METRICS, + ], + rust: [ + ProductSolution.PERFORMANCE_MONITORING, + ProductSolution.LOGS, + ProductSolution.METRICS, ], unity: [ProductSolution.LOGS, ProductSolution.METRICS], unreal: [ProductSolution.LOGS], From 377e5b91c3fcdb12ac9703552560e60da8d91d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Daxb=C3=B6ck?= Date: Thu, 21 May 2026 15:07:05 +0200 Subject: [PATCH 2/6] feat(onboarding): Add metrics onboarding docs for Rust and Elixir Add metrics onboarding snippets for Rust (sentry::metrics API) and Elixir (Sentry.Metrics module), wire them up in each platform's index.tsx, and register both platforms in withMetricsOnboarding. Also remove Elixir from withoutPerformanceSupport since it now supports performance monitoring. Update Ruby metrics snippets to use Sentry.metrics accessor style matching the official docs, use realistic example metric names, and add trailing docs links across all three SDKs for consistency with other platform onboarding files. Co-Authored-By: Claude --- static/app/data/platformCategories.tsx | 3 +- .../app/gettingStartedDocs/elixir/index.tsx | 2 + .../app/gettingStartedDocs/elixir/metrics.tsx | 106 ++++++++++++++++++ .../app/gettingStartedDocs/ruby/metrics.tsx | 23 +++- static/app/gettingStartedDocs/rust/index.tsx | 2 + .../app/gettingStartedDocs/rust/metrics.tsx | 76 +++++++++++++ 6 files changed, 208 insertions(+), 4 deletions(-) create mode 100644 static/app/gettingStartedDocs/elixir/metrics.tsx create mode 100644 static/app/gettingStartedDocs/rust/metrics.tsx diff --git a/static/app/data/platformCategories.tsx b/static/app/data/platformCategories.tsx index e1ff40f52f52..f27e58df312b 100644 --- a/static/app/data/platformCategories.tsx +++ b/static/app/data/platformCategories.tsx @@ -300,7 +300,6 @@ export const withPerformanceOnboarding = new Set([ // List of platforms that do not have performance support. We make use of this list in the product to not provide any Performance // views such as Performance onboarding checklist. export const withoutPerformanceSupport = new Set([ - 'elixir', 'minidump', 'nintendo-switch', 'playstation', @@ -495,6 +494,8 @@ export const withMetricsOnboarding = new Set([ 'ruby', 'ruby-rack', 'ruby-rails', + 'rust', + 'elixir', 'unity', ]); diff --git a/static/app/gettingStartedDocs/elixir/index.tsx b/static/app/gettingStartedDocs/elixir/index.tsx index 4883d00a9755..b1a02a2ebb30 100644 --- a/static/app/gettingStartedDocs/elixir/index.tsx +++ b/static/app/gettingStartedDocs/elixir/index.tsx @@ -1,6 +1,7 @@ import type {Docs} from 'sentry/components/onboarding/gettingStartedDoc/types'; import {crashReport} from 'sentry/gettingStartedDocs/elixir/crashReport'; import {logs} from 'sentry/gettingStartedDocs/elixir/logs'; +import {metrics} from 'sentry/gettingStartedDocs/elixir/metrics'; import {onboarding} from 'sentry/gettingStartedDocs/elixir/onboarding'; import { feedbackOnboardingJsLoader, @@ -13,4 +14,5 @@ export const docs: Docs = { crashReportOnboarding: crashReport, feedbackOnboardingJsLoader, logsOnboarding: logs, + metricsOnboarding: metrics, }; diff --git a/static/app/gettingStartedDocs/elixir/metrics.tsx b/static/app/gettingStartedDocs/elixir/metrics.tsx new file mode 100644 index 000000000000..b6c8952e276e --- /dev/null +++ b/static/app/gettingStartedDocs/elixir/metrics.tsx @@ -0,0 +1,106 @@ +import {ExternalLink} from '@sentry/scraps/link'; + +import type { + DocsParams, + OnboardingConfig, +} from 'sentry/components/onboarding/gettingStartedDoc/types'; +import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/types'; +import {tct} from 'sentry/locale'; + +const getInstallSnippet = () => ` +defp deps do + [ + # ... + {:sentry, "~> 13.0"}, + {:jason, "~> 1.2"}, + {:hackney, "~> 1.8"} + ] +end`; + +const getVerifySnippet = (params: DocsParams) => ` +Sentry.init( + dsn: "${params.dsn.public}", + environment_name: Mix.env() +) + +# Counter metric +Sentry.Metrics.count( + "button_click", + 5, + attributes: %{browser: "Firefox", app_version: "1.0.0"} +) + +# Gauge metric +Sentry.Metrics.gauge( + "page_load", + 15.0, + unit: "millisecond", + attributes: %{page: "/home"} +) + +# Distribution metric +Sentry.Metrics.distribution( + "page_load", + 15.0, + unit: "millisecond", + attributes: %{page: "/home"} +)`; + +export const metrics: OnboardingConfig = { + install: () => [ + { + type: StepType.INSTALL, + content: [ + { + type: 'text', + text: tct( + 'Metrics are supported in Sentry Elixir SDK version [code:13.0.0] and above. Make sure your [code:mix.exs] specifies at least this version:', + {code: } + ), + }, + { + type: 'code', + language: 'elixir', + code: getInstallSnippet(), + }, + { + type: 'text', + text: tct('Then fetch the updated dependency: [code:mix deps.get]', { + code: , + }), + }, + ], + }, + ], + configure: () => [], + verify: params => [ + { + type: StepType.VERIFY, + content: [ + { + type: 'text', + text: tct( + 'Metrics are automatically enabled. You can emit metrics using the [code:Sentry.Metrics] module.', + {code: } + ), + }, + { + type: 'code', + language: 'elixir', + code: getVerifySnippet(params), + }, + { + type: 'text', + text: tct( + 'For more detailed information, see the [link:metrics documentation].', + { + link: ( + + ), + } + ), + }, + ], + }, + ], +}; diff --git a/static/app/gettingStartedDocs/ruby/metrics.tsx b/static/app/gettingStartedDocs/ruby/metrics.tsx index a47e1eaf1c21..5f13781e2e21 100644 --- a/static/app/gettingStartedDocs/ruby/metrics.tsx +++ b/static/app/gettingStartedDocs/ruby/metrics.tsx @@ -66,13 +66,30 @@ export const metrics = < end # Counter metric -Sentry::Metrics.count('test-counter', value: 10, attributes: { my_attribute: 'foo'}) +Sentry.metrics.count('button_click', value: 5, attributes: { browser: 'Firefox', app_version: '1.0.0' }) # Gauge metric -Sentry::Metrics.gauge('test-gauge', 50.0, unit: 'millisecond', attributes: { my_attribute: 'foo' }) +Sentry.metrics.gauge('page_load', 15.0, unit: 'millisecond', attributes: { page: '/home' }) # Distribution metric -Sentry::Metrics.distribution('test-distribution', 20.0, unit: 'kilobyte', attributes: { my_attribute: 'foo' })`, +Sentry.metrics.distribution('page_load', 15.0, unit: 'millisecond', attributes: { page: '/home' })`, + }, + { + type: 'text', + text: tct( + 'For more detailed information, see the [link:metrics documentation].', + { + link: ( + + ), + } + ), }, ], }, diff --git a/static/app/gettingStartedDocs/rust/index.tsx b/static/app/gettingStartedDocs/rust/index.tsx index 2430ee5546b8..1d2cbb97a757 100644 --- a/static/app/gettingStartedDocs/rust/index.tsx +++ b/static/app/gettingStartedDocs/rust/index.tsx @@ -2,10 +2,12 @@ import type {Docs} from 'sentry/components/onboarding/gettingStartedDoc/types'; import {crashReport} from './crashReport'; import {logs} from './logs'; +import {metrics} from './metrics'; import {onboarding} from './onboarding'; export const docs: Docs = { onboarding, crashReportOnboarding: crashReport, logsOnboarding: logs, + metricsOnboarding: metrics, }; diff --git a/static/app/gettingStartedDocs/rust/metrics.tsx b/static/app/gettingStartedDocs/rust/metrics.tsx new file mode 100644 index 000000000000..f91d5cdc05a8 --- /dev/null +++ b/static/app/gettingStartedDocs/rust/metrics.tsx @@ -0,0 +1,76 @@ +import {ExternalLink} from '@sentry/scraps/link'; + +import type {OnboardingConfig} from 'sentry/components/onboarding/gettingStartedDoc/types'; +import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/types'; +import {tct} from 'sentry/locale'; + +export const metrics: OnboardingConfig = { + install: () => [ + { + type: StepType.INSTALL, + content: [ + { + type: 'text', + text: tct( + 'Metrics are supported in Sentry Rust SDK version [code:0.48.2] and above. The [code:metrics] feature flag needs to be enabled in your [code:Cargo.toml]:', + {code: } + ), + }, + { + type: 'code', + language: 'toml', + code: `[dependencies] +sentry = { version = "0.48.2", features = ["metrics"] }`, + }, + ], + }, + ], + configure: () => [], + verify: params => [ + { + type: StepType.VERIFY, + content: [ + { + type: 'text', + text: tct( + 'Metrics are enabled by default when the [code:metrics] feature is included. You can emit metrics using the [code:sentry::metrics] API.', + {code: } + ), + }, + { + type: 'code', + language: 'rust', + code: `let _guard = sentry::init(("${params.dsn.public}", sentry::ClientOptions { + release: sentry::release_name!(), + ..Default::default() +})); + +use sentry::metrics; + +// Counter metric +metrics::counter("button_click", 1).capture(); + +// Gauge metric +metrics::gauge("queue.depth", 42).capture(); + +// Distribution metric +metrics::distribution("page_load", 15.5) + .unit(sentry::protocol::Unit::Millisecond) + .attribute("page", "/home") + .capture();`, + }, + { + type: 'text', + text: tct( + 'For more detailed information, see the [link:metrics documentation].', + { + link: ( + + ), + } + ), + }, + ], + }, + ], +}; From 0c45dc18643bbbc429f49c32061e200274e72585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Daxb=C3=B6ck?= Date: Thu, 21 May 2026 16:32:07 +0200 Subject: [PATCH 3/6] test(onboarding): Add metrics onboarding tests for Rust, Elixir, and Ruby Verify that metrics onboarding content renders when METRICS is selected and does not render when it is not, following the same pattern as the existing .NET metrics spec. Co-Authored-By: Claude --- .../elixir/metrics.spec.tsx | 29 +++++++++++++++++++ .../gettingStartedDocs/ruby/metrics.spec.tsx | 29 +++++++++++++++++++ .../gettingStartedDocs/rust/metrics.spec.tsx | 29 +++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 static/app/gettingStartedDocs/elixir/metrics.spec.tsx create mode 100644 static/app/gettingStartedDocs/ruby/metrics.spec.tsx create mode 100644 static/app/gettingStartedDocs/rust/metrics.spec.tsx diff --git a/static/app/gettingStartedDocs/elixir/metrics.spec.tsx b/static/app/gettingStartedDocs/elixir/metrics.spec.tsx new file mode 100644 index 000000000000..552a3f8b1858 --- /dev/null +++ b/static/app/gettingStartedDocs/elixir/metrics.spec.tsx @@ -0,0 +1,29 @@ +import {renderWithOnboardingLayout} from 'sentry-test/onboarding/renderWithOnboardingLayout'; +import {screen} from 'sentry-test/reactTestingLibrary'; +import {textWithMarkupMatcher} from 'sentry-test/utils'; + +import {ProductSolution} from 'sentry/components/onboarding/gettingStartedDoc/types'; + +import {docs} from '.'; + +describe('metrics', () => { + it('elixir metrics onboarding docs', () => { + renderWithOnboardingLayout(docs, { + selectedProducts: [ProductSolution.METRICS], + }); + + expect( + screen.getByText(textWithMarkupMatcher(/Sentry\.Metrics\.count/)) + ).toBeInTheDocument(); + }); + + it('does not render metrics configuration when metrics is not enabled', () => { + renderWithOnboardingLayout(docs, { + selectedProducts: [], + }); + + expect( + screen.queryByText(textWithMarkupMatcher(/Sentry\.Metrics\.count/)) + ).not.toBeInTheDocument(); + }); +}); diff --git a/static/app/gettingStartedDocs/ruby/metrics.spec.tsx b/static/app/gettingStartedDocs/ruby/metrics.spec.tsx new file mode 100644 index 000000000000..4065d721aa54 --- /dev/null +++ b/static/app/gettingStartedDocs/ruby/metrics.spec.tsx @@ -0,0 +1,29 @@ +import {renderWithOnboardingLayout} from 'sentry-test/onboarding/renderWithOnboardingLayout'; +import {screen} from 'sentry-test/reactTestingLibrary'; +import {textWithMarkupMatcher} from 'sentry-test/utils'; + +import {ProductSolution} from 'sentry/components/onboarding/gettingStartedDoc/types'; + +import {docs} from '.'; + +describe('metrics', () => { + it('ruby metrics onboarding docs', () => { + renderWithOnboardingLayout(docs, { + selectedProducts: [ProductSolution.METRICS], + }); + + expect( + screen.getByText(textWithMarkupMatcher(/Sentry\.metrics\.count/)) + ).toBeInTheDocument(); + }); + + it('does not render metrics configuration when metrics is not enabled', () => { + renderWithOnboardingLayout(docs, { + selectedProducts: [], + }); + + expect( + screen.queryByText(textWithMarkupMatcher(/Sentry\.metrics\.count/)) + ).not.toBeInTheDocument(); + }); +}); diff --git a/static/app/gettingStartedDocs/rust/metrics.spec.tsx b/static/app/gettingStartedDocs/rust/metrics.spec.tsx new file mode 100644 index 000000000000..9343702bd891 --- /dev/null +++ b/static/app/gettingStartedDocs/rust/metrics.spec.tsx @@ -0,0 +1,29 @@ +import {renderWithOnboardingLayout} from 'sentry-test/onboarding/renderWithOnboardingLayout'; +import {screen} from 'sentry-test/reactTestingLibrary'; +import {textWithMarkupMatcher} from 'sentry-test/utils'; + +import {ProductSolution} from 'sentry/components/onboarding/gettingStartedDoc/types'; + +import {docs} from '.'; + +describe('metrics', () => { + it('rust metrics onboarding docs', () => { + renderWithOnboardingLayout(docs, { + selectedProducts: [ProductSolution.METRICS], + }); + + expect( + screen.getByText(textWithMarkupMatcher(/metrics::counter/)) + ).toBeInTheDocument(); + }); + + it('does not render metrics configuration when metrics is not enabled', () => { + renderWithOnboardingLayout(docs, { + selectedProducts: [], + }); + + expect( + screen.queryByText(textWithMarkupMatcher(/metrics::counter/)) + ).not.toBeInTheDocument(); + }); +}); From 75ff4c07a0009c43868a8df9040bb25ac33d53df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Daxb=C3=B6ck?= Date: Thu, 21 May 2026 19:52:30 +0200 Subject: [PATCH 4/6] fix(onboarding): Fix metrics onboarding tests to test config directly The renderWithOnboardingLayout helper renders the main onboarding flow, not the standalone metricsOnboarding config. Switch to testing the config object directly, matching the Python metrics test pattern. Co-Authored-By: Claude --- .../elixir/metrics.spec.tsx | 41 ++++++++---------- .../gettingStartedDocs/ruby/metrics.spec.tsx | 43 +++++++++---------- .../gettingStartedDocs/rust/metrics.spec.tsx | 41 ++++++++---------- 3 files changed, 59 insertions(+), 66 deletions(-) diff --git a/static/app/gettingStartedDocs/elixir/metrics.spec.tsx b/static/app/gettingStartedDocs/elixir/metrics.spec.tsx index 552a3f8b1858..65a51ab8705f 100644 --- a/static/app/gettingStartedDocs/elixir/metrics.spec.tsx +++ b/static/app/gettingStartedDocs/elixir/metrics.spec.tsx @@ -1,29 +1,26 @@ -import {renderWithOnboardingLayout} from 'sentry-test/onboarding/renderWithOnboardingLayout'; -import {screen} from 'sentry-test/reactTestingLibrary'; -import {textWithMarkupMatcher} from 'sentry-test/utils'; - -import {ProductSolution} from 'sentry/components/onboarding/gettingStartedDoc/types'; - -import {docs} from '.'; +const {metrics} = jest.requireActual('sentry/gettingStartedDocs/elixir/metrics'); describe('metrics', () => { - it('elixir metrics onboarding docs', () => { - renderWithOnboardingLayout(docs, { - selectedProducts: [ProductSolution.METRICS], - }); + const mockParams = { + dsn: { + public: 'https://test@example.com/123', + }, + }; - expect( - screen.getByText(textWithMarkupMatcher(/Sentry\.Metrics\.count/)) - ).toBeInTheDocument(); - }); + it('generates metrics onboarding config', () => { + const installSteps = metrics.install(); + expect(installSteps).toHaveLength(1); + expect(installSteps[0].type).toBe('install'); - it('does not render metrics configuration when metrics is not enabled', () => { - renderWithOnboardingLayout(docs, { - selectedProducts: [], - }); + const verifySteps = metrics.verify(mockParams); + expect(verifySteps).toHaveLength(1); + expect(verifySteps[0].type).toBe('verify'); - expect( - screen.queryByText(textWithMarkupMatcher(/Sentry\.Metrics\.count/)) - ).not.toBeInTheDocument(); + const codeSnippet = verifySteps[0].content[1].code; + expect(codeSnippet).toContain('Sentry.init'); + expect(codeSnippet).toContain(mockParams.dsn.public); + expect(codeSnippet).toContain('Sentry.Metrics.count'); + expect(codeSnippet).toContain('Sentry.Metrics.gauge'); + expect(codeSnippet).toContain('Sentry.Metrics.distribution'); }); }); diff --git a/static/app/gettingStartedDocs/ruby/metrics.spec.tsx b/static/app/gettingStartedDocs/ruby/metrics.spec.tsx index 4065d721aa54..4d564abb0da7 100644 --- a/static/app/gettingStartedDocs/ruby/metrics.spec.tsx +++ b/static/app/gettingStartedDocs/ruby/metrics.spec.tsx @@ -1,29 +1,28 @@ -import {renderWithOnboardingLayout} from 'sentry-test/onboarding/renderWithOnboardingLayout'; -import {screen} from 'sentry-test/reactTestingLibrary'; -import {textWithMarkupMatcher} from 'sentry-test/utils'; - -import {ProductSolution} from 'sentry/components/onboarding/gettingStartedDoc/types'; - -import {docs} from '.'; +const {metrics} = jest.requireActual('sentry/gettingStartedDocs/ruby/metrics'); describe('metrics', () => { - it('ruby metrics onboarding docs', () => { - renderWithOnboardingLayout(docs, { - selectedProducts: [ProductSolution.METRICS], - }); + const mockParams = { + dsn: { + public: 'https://test@example.com/123', + }, + }; - expect( - screen.getByText(textWithMarkupMatcher(/Sentry\.metrics\.count/)) - ).toBeInTheDocument(); - }); + it('generates metrics onboarding config', () => { + const config = metrics({docsPlatform: 'ruby'}); + + const installSteps = config.install(); + expect(installSteps).toHaveLength(1); + expect(installSteps[0].type).toBe('install'); - it('does not render metrics configuration when metrics is not enabled', () => { - renderWithOnboardingLayout(docs, { - selectedProducts: [], - }); + const verifySteps = config.verify(mockParams); + expect(verifySteps).toHaveLength(1); + expect(verifySteps[0].type).toBe('verify'); - expect( - screen.queryByText(textWithMarkupMatcher(/Sentry\.metrics\.count/)) - ).not.toBeInTheDocument(); + const codeSnippet = verifySteps[0].content[1].code; + expect(codeSnippet).toContain('Sentry.init'); + expect(codeSnippet).toContain(mockParams.dsn.public); + expect(codeSnippet).toContain('Sentry.metrics.count'); + expect(codeSnippet).toContain('Sentry.metrics.gauge'); + expect(codeSnippet).toContain('Sentry.metrics.distribution'); }); }); diff --git a/static/app/gettingStartedDocs/rust/metrics.spec.tsx b/static/app/gettingStartedDocs/rust/metrics.spec.tsx index 9343702bd891..a7fdebdf7061 100644 --- a/static/app/gettingStartedDocs/rust/metrics.spec.tsx +++ b/static/app/gettingStartedDocs/rust/metrics.spec.tsx @@ -1,29 +1,26 @@ -import {renderWithOnboardingLayout} from 'sentry-test/onboarding/renderWithOnboardingLayout'; -import {screen} from 'sentry-test/reactTestingLibrary'; -import {textWithMarkupMatcher} from 'sentry-test/utils'; - -import {ProductSolution} from 'sentry/components/onboarding/gettingStartedDoc/types'; - -import {docs} from '.'; +const {metrics} = jest.requireActual('sentry/gettingStartedDocs/rust/metrics'); describe('metrics', () => { - it('rust metrics onboarding docs', () => { - renderWithOnboardingLayout(docs, { - selectedProducts: [ProductSolution.METRICS], - }); + const mockParams = { + dsn: { + public: 'https://test@example.com/123', + }, + }; - expect( - screen.getByText(textWithMarkupMatcher(/metrics::counter/)) - ).toBeInTheDocument(); - }); + it('generates metrics onboarding config', () => { + const installSteps = metrics.install(); + expect(installSteps).toHaveLength(1); + expect(installSteps[0].type).toBe('install'); - it('does not render metrics configuration when metrics is not enabled', () => { - renderWithOnboardingLayout(docs, { - selectedProducts: [], - }); + const verifySteps = metrics.verify(mockParams); + expect(verifySteps).toHaveLength(1); + expect(verifySteps[0].type).toBe('verify'); - expect( - screen.queryByText(textWithMarkupMatcher(/metrics::counter/)) - ).not.toBeInTheDocument(); + const codeSnippet = verifySteps[0].content[1].code; + expect(codeSnippet).toContain('sentry::init'); + expect(codeSnippet).toContain(mockParams.dsn.public); + expect(codeSnippet).toContain('metrics::counter'); + expect(codeSnippet).toContain('metrics::gauge'); + expect(codeSnippet).toContain('metrics::distribution'); }); }); From 028dac23b00979690ad6d77ddd9eaa3e81e1bea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Daxb=C3=B6ck?= Date: Thu, 21 May 2026 19:58:11 +0200 Subject: [PATCH 5/6] fix(onboarding): Use unique variable names in metrics test files Rename destructured metrics to rustMetrics/elixirMetrics/rubyMetrics to avoid TS2451 global scope collision between script-scoped files. Co-Authored-By: Claude --- static/app/gettingStartedDocs/elixir/metrics.spec.tsx | 8 +++++--- static/app/gettingStartedDocs/ruby/metrics.spec.tsx | 6 ++++-- static/app/gettingStartedDocs/rust/metrics.spec.tsx | 8 +++++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/static/app/gettingStartedDocs/elixir/metrics.spec.tsx b/static/app/gettingStartedDocs/elixir/metrics.spec.tsx index 65a51ab8705f..4db51f5f55fd 100644 --- a/static/app/gettingStartedDocs/elixir/metrics.spec.tsx +++ b/static/app/gettingStartedDocs/elixir/metrics.spec.tsx @@ -1,4 +1,6 @@ -const {metrics} = jest.requireActual('sentry/gettingStartedDocs/elixir/metrics'); +const {metrics: elixirMetrics} = jest.requireActual( + 'sentry/gettingStartedDocs/elixir/metrics' +); describe('metrics', () => { const mockParams = { @@ -8,11 +10,11 @@ describe('metrics', () => { }; it('generates metrics onboarding config', () => { - const installSteps = metrics.install(); + const installSteps = elixirMetrics.install(); expect(installSteps).toHaveLength(1); expect(installSteps[0].type).toBe('install'); - const verifySteps = metrics.verify(mockParams); + const verifySteps = elixirMetrics.verify(mockParams); expect(verifySteps).toHaveLength(1); expect(verifySteps[0].type).toBe('verify'); diff --git a/static/app/gettingStartedDocs/ruby/metrics.spec.tsx b/static/app/gettingStartedDocs/ruby/metrics.spec.tsx index 4d564abb0da7..632cb02b96f7 100644 --- a/static/app/gettingStartedDocs/ruby/metrics.spec.tsx +++ b/static/app/gettingStartedDocs/ruby/metrics.spec.tsx @@ -1,4 +1,6 @@ -const {metrics} = jest.requireActual('sentry/gettingStartedDocs/ruby/metrics'); +const {metrics: rubyMetrics} = jest.requireActual( + 'sentry/gettingStartedDocs/ruby/metrics' +); describe('metrics', () => { const mockParams = { @@ -8,7 +10,7 @@ describe('metrics', () => { }; it('generates metrics onboarding config', () => { - const config = metrics({docsPlatform: 'ruby'}); + const config = rubyMetrics({docsPlatform: 'ruby'}); const installSteps = config.install(); expect(installSteps).toHaveLength(1); diff --git a/static/app/gettingStartedDocs/rust/metrics.spec.tsx b/static/app/gettingStartedDocs/rust/metrics.spec.tsx index a7fdebdf7061..0c45920aaf7e 100644 --- a/static/app/gettingStartedDocs/rust/metrics.spec.tsx +++ b/static/app/gettingStartedDocs/rust/metrics.spec.tsx @@ -1,4 +1,6 @@ -const {metrics} = jest.requireActual('sentry/gettingStartedDocs/rust/metrics'); +const {metrics: rustMetrics} = jest.requireActual( + 'sentry/gettingStartedDocs/rust/metrics' +); describe('metrics', () => { const mockParams = { @@ -8,11 +10,11 @@ describe('metrics', () => { }; it('generates metrics onboarding config', () => { - const installSteps = metrics.install(); + const installSteps = rustMetrics.install(); expect(installSteps).toHaveLength(1); expect(installSteps[0].type).toBe('install'); - const verifySteps = metrics.verify(mockParams); + const verifySteps = rustMetrics.verify(mockParams); expect(verifySteps).toHaveLength(1); expect(verifySteps[0].type).toBe('verify'); From cfe92fd91d0d805f05a6e30388380d142d819f79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Daxb=C3=B6ck?= Date: Fri, 22 May 2026 23:38:27 +0200 Subject: [PATCH 6/6] feat(onboarding): React to product selection in Rust and Elixir onboarding Update the configure and verify snippets to conditionally include traces_sample_rate when Performance is selected and enable_logs when Logs is selected, matching the pattern used by Go and Python. Previously the checkboxes appeared (added in 88373dd) but toggling them did not change the generated code snippets. Co-Authored-By: Claude --- .../gettingStartedDocs/elixir/onboarding.tsx | 15 +++++++++- .../gettingStartedDocs/rust/onboarding.tsx | 30 +++++++++++++++++-- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/static/app/gettingStartedDocs/elixir/onboarding.tsx b/static/app/gettingStartedDocs/elixir/onboarding.tsx index 41f6ad7b824e..1074c7ff902c 100644 --- a/static/app/gettingStartedDocs/elixir/onboarding.tsx +++ b/static/app/gettingStartedDocs/elixir/onboarding.tsx @@ -20,7 +20,20 @@ const getConfigureSnippet = (params: DocsParams) => ` dsn: "${params.dsn.public}", environment_name: Mix.env(), enable_source_code_context: true, - root_source_code_paths: [File.cwd!()]`; + root_source_code_paths: [File.cwd!()]${ + params.isPerformanceSelected + ? `, + # Set traces_sample_rate to 1.0 to capture 100% + # of transactions for tracing. + traces_sample_rate: 1.0` + : '' + }${ + params.isLogsSelected + ? `, + # Enable sending logs to Sentry + enable_logs: true` + : '' + }`; const getPlugSnippet = () => ` defmodule MyAppWeb.Endpoint diff --git a/static/app/gettingStartedDocs/rust/onboarding.tsx b/static/app/gettingStartedDocs/rust/onboarding.tsx index f21ebf30e8b9..6ac74ca6f7ea 100644 --- a/static/app/gettingStartedDocs/rust/onboarding.tsx +++ b/static/app/gettingStartedDocs/rust/onboarding.tsx @@ -24,7 +24,20 @@ let _guard = sentry::init(("${params.dsn.public}", sentry::ClientOptions { release: sentry::release_name!(), // Capture user IPs and potentially sensitive headers when using HTTP server integrations // see https://docs.sentry.io/platforms/rust/data-management/data-collected for more info - send_default_pii: true, + send_default_pii: true,${ + params.isPerformanceSelected + ? ` + // Set traces_sample_rate to 1.0 to capture 100% + // of transactions for tracing. + traces_sample_rate: 1.0,` + : '' + }${ + params.isLogsSelected + ? ` + // Enable sending logs to Sentry + enable_logs: true,` + : '' + } ..Default::default() }));`; @@ -34,7 +47,20 @@ fn main() { release: sentry::release_name!(), // Capture user IPs and potentially sensitive headers when using HTTP server integrations // see https://docs.sentry.io/platforms/rust/data-management/data-collected for more info - send_default_pii: true, + send_default_pii: true,${ + params.isPerformanceSelected + ? ` + // Set traces_sample_rate to 1.0 to capture 100% + // of transactions for tracing. + traces_sample_rate: 1.0,` + : '' + }${ + params.isLogsSelected + ? ` + // Enable sending logs to Sentry + enable_logs: true,` + : '' + } ..Default::default() }));