diff --git a/static/app/data/platformCategories.tsx b/static/app/data/platformCategories.tsx index 3d161ff6c32a2e..9043658c8e8eb2 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 e28d9c4f30b386..abfc2bdfdd8126 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,6 +12,7 @@ const docs: Docs = { replayOnboardingJsLoader, crashReportOnboarding: crashReport, feedbackOnboardingJsLoader, + logsOnboarding: logs, }; export default docs; 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.' + ), + }, + ], + }, + ], +};