From 5d5951aa13803686a311192ba28470028c489928 Mon Sep 17 00:00:00 2001 From: Neel Shah Date: Sat, 28 Mar 2026 10:36:11 +0100 Subject: [PATCH] feat(onboarding): Add logs onboarding for Elixir (#110038) Add logs onboarding documentation for the Elixir platform. The Elixir SDK (v12.0+) supports structured log capture via Sentry.LoggerHandler, which is attached automatically on startup. This PR wires up the onboarding flow so users see install, configure, and verify steps when setting up logs for Elixir projects. Changes: * Add `static/app/gettingStartedDocs/elixir/logs.tsx` with install/configure/verify steps * Register `logsOnboarding` in the Elixir docs index * Move elixir from `withoutLoggingSupport` to `withLoggingOnboarding` in `platformCategories.tsx` Co-authored-by: Claude --- static/app/data/platformCategories.tsx | 3 +- .../app/gettingStartedDocs/elixir/index.tsx | 2 + static/app/gettingStartedDocs/elixir/logs.tsx | 115 ++++++++++++++++++ 3 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 static/app/gettingStartedDocs/elixir/logs.tsx diff --git a/static/app/data/platformCategories.tsx b/static/app/data/platformCategories.tsx index 4710a547a534f5..7ea6da29ccc3e4 100644 --- a/static/app/data/platformCategories.tsx +++ b/static/app/data/platformCategories.tsx @@ -394,6 +394,7 @@ export const withLoggingOnboarding = new Set([ 'python-tornado', 'python-tryton', 'python-wsgi', + 'elixir', 'react-native', 'ruby', 'ruby-rack', @@ -404,7 +405,7 @@ export const withLoggingOnboarding = new Set([ ]); // List of platforms that do not have logging support. We make use of this list in the product to not provide any Logging -export const withoutLoggingSupport = new Set(['elixir', 'dotnet-xamarin']); +export const withoutLoggingSupport = new Set(['dotnet-xamarin']); // List of platforms that have metrics onboarding checklist content export const withMetricsOnboarding = new Set([ diff --git a/static/app/gettingStartedDocs/elixir/index.tsx b/static/app/gettingStartedDocs/elixir/index.tsx index 4ec0cb978d32fd..4883d00a9755d6 100644 --- a/static/app/gettingStartedDocs/elixir/index.tsx +++ b/static/app/gettingStartedDocs/elixir/index.tsx @@ -1,5 +1,6 @@ import type {Docs} from 'sentry/components/onboarding/gettingStartedDoc/types'; import {crashReport} from 'sentry/gettingStartedDocs/elixir/crashReport'; +import {logs} from 'sentry/gettingStartedDocs/elixir/logs'; import {onboarding} from 'sentry/gettingStartedDocs/elixir/onboarding'; import { feedbackOnboardingJsLoader, @@ -11,4 +12,5 @@ export const docs: Docs = { replayOnboardingJsLoader, crashReportOnboarding: crashReport, feedbackOnboardingJsLoader, + logsOnboarding: logs, }; diff --git a/static/app/gettingStartedDocs/elixir/logs.tsx b/static/app/gettingStartedDocs/elixir/logs.tsx new file mode 100644 index 00000000000000..daa62daaa430f9 --- /dev/null +++ b/static/app/gettingStartedDocs/elixir/logs.tsx @@ -0,0 +1,115 @@ +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 {t, tct} from 'sentry/locale'; + +const getInstallSnippet = () => ` +defp deps do + [ + # ... + {:sentry, "~> 12.0"}, + {:jason, "~> 1.2"}, + {:hackney, "~> 1.8"} + ] +end`; + +const getConfigureSnippet = (params: DocsParams) => ` +config :sentry, + dsn: "${params.dsn.public}", + environment_name: Mix.env(), + enable_logs: true, + logs: [ + level: :info, + metadata: [:request_id, :user_id] + ]`; + +const getVerifySnippet = () => ` +require Logger + +Logger.info("This is a test log from Elixir") +Logger.warning("Something might be wrong", user_id: 42) +Logger.error("An error occurred")`; + +export const logs: OnboardingConfig = { + install: () => [ + { + type: StepType.INSTALL, + content: [ + { + type: 'text', + text: tct( + 'Logs are supported in [code:sentry] version [code:12.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: params => [ + { + type: StepType.CONFIGURE, + content: [ + { + type: 'text', + text: tct( + 'Enable logs by adding [code:enable_logs: true] to your Sentry configuration in [code:config/config.exs] (or [code:config/prod.exs]). The SDK automatically attaches a [code:Sentry.LoggerHandler] on startup — no manual setup required.', + {code: } + ), + }, + { + type: 'code', + language: 'elixir', + code: getConfigureSnippet(params), + }, + { + type: 'text', + text: tct( + 'For more configuration options, see the [link:Elixir Logs documentation].', + { + link: , + } + ), + }, + ], + }, + ], + verify: () => [ + { + type: StepType.VERIFY, + content: [ + { + type: 'text', + text: t( + 'Verify that logging is working by sending a few log messages via the Elixir Logger:' + ), + }, + { + type: 'code', + language: 'elixir', + code: getVerifySnippet(), + }, + { + type: 'text', + text: t( + 'Wait a moment, then check the Logs section in Sentry to confirm the messages arrived.' + ), + }, + ], + }, + ], +};