Skip to content

Commit

Permalink
Use compile time environment variables for Sentry
Browse files Browse the repository at this point in the history
The dev/prod division belongs in `environment`, we will bake the
cli/action distinction as `entrypoint`
  • Loading branch information
jmhobbs committed Oct 1, 2024
1 parent f468773 commit 952331a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion node-src/errorMonitoring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ export function filterBreadcrumb(breadcrumb: Sentry.Breadcrumb) {
Sentry.init({
dsn: 'https://4fa173db2ef3fb073b8ea153a5466d28@o4504181686599680.ingest.us.sentry.io/4507930289373184',
sampleRate: 1,
environment: process.env.CI && process.env.GITHUB_RUN_ID ? 'action' : 'cli',
environment: process.env.SENTRY_ENVIRONMENT,
enabled: process.env.DISABLE_ERROR_MONITORING !== 'true',
enableTracing: false,
integrations: [],
initialScope: {
tags: {
entrypoint: process.env.CI && process.env.GITHUB_RUN_ID ? 'action' : 'cli',
version: process.env.npm_package_version,
},
},
Expand Down
6 changes: 6 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export default defineConfig((options) => [
clean: true,
platform: 'node',
target: 'node16', // Storybook still supports Node 16
env: {
SENTRY_ENVIRONMENT: process.env.CI ? 'production' : 'development',
},
},
{
entry: ['action-src/register.js'],
Expand All @@ -30,5 +33,8 @@ export default defineConfig((options) => [
clean: true,
platform: 'node',
target: 'node20', // Sync with `runs.using` in action.yml
env: {
SENTRY_ENVIRONMENT: process.env.CI ? 'production' : 'development',
},
},
]);

0 comments on commit 952331a

Please sign in to comment.