import {Fragment} from 'react'; import ExternalLink from 'sentry/components/links/externalLink'; import {Layout, LayoutProps} from 'sentry/components/onboarding/gettingStartedDoc/layout'; import {ModuleProps} from 'sentry/components/onboarding/gettingStartedDoc/sdkDocumentation'; import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step'; import {t, tct} from 'sentry/locale'; // Configuration Start export const steps = ({ dsn, }: { dsn?: string; } = {}): LayoutProps['steps'] => [ { type: StepType.INSTALL, description: (
{tct(
'Edit your [mixCode:mix.exs] file to add it as a dependency and add the [sentryCode::sentry] package to your applications:',
{sentryCode: , mixCode:
}
)}
{tct('Install [code:sentry-sdk]:', {code: })}
{tct(
'Setup the application production environment in your [code:config/prod.exs]',
{
code: ,
}
)}
{tct(
'The [environmentNameCode:environment_name] and [includedEnvironmentsCode:included_environments] work together to determine if and when Sentry should record exceptions. The [environmentNameCode:environment_name] is the name of the current environment. In the example above, we have explicitly set the environment to [prodCode::prod] which works well if you are inside an environment specific configuration like [configCode:config/prod.exs].',
{
environmentNameCode: ,
includedEnvironmentsCode:
,
prodCode:
,
configCode:
,
}
)}
{tct(
'An alternative is to use [code:Mix.env] in your general configuration file:',
{code: }
)}
{tct(
'This will set the environment name to whatever the current Mix environment atom is, but it will only send events if the current environment is [prodCode::prod], since that is the only entry in the [includedEnvironmentsCode:included_environments] key.',
{
prodCode: ,
includedEnvironmentsCode:
,
}
)}
{tct(
"In this example, we are getting the environment name from the [code:RELEASE_LEVEL] environment variable. If that variable does not exist, it will default to [code:'development']. Now, on our servers, we can set the environment variable appropriately. On our local development machines, exceptions will never be sent, because the default value is not in the list of [code:included_environments].",
{
code: ,
}
)}
{tct(
'If using an environment with Plug or Phoenix, add the following to [plugRouterCode:Plug.Router] or [phoenixEndpointCode:Phoenix.Endpoint]:',
{plugRouterCode: , phoenixEndpointCode:
}
)}
{tct(
'[sentryPlugContextCode:Sentry.PlugContext] gathers the contextual information for errors, and [sentryPlugCaptureCode:Sentry.PlugCapture] captures and sends any errors that occur in the Plug stack. [sentryPlugContextCode:Sentry.PlugContext] should be below [sentryPlugParsersCode:Plug.Parsers] if you are using it.',
{
sentryPlugCaptureCode: ,
sentryPlugContextCode:
,
sentryPlugParsersCode:
,
}
)}
{tct(
'This library comes with an extension to capture all error messages that the Plug handler might not. This is based on [link:Logger.Backend]. You can add it as a backend when your application starts:',
{
link: (
{t('Otherwise, we provide a simple way to capture exceptions manually:')}