Skip to content

Commit

Permalink
Add Sentry monitoring (#378)
Browse files Browse the repository at this point in the history
* start - playground node

* add sentry client config

* add to ui-testing playground

* add sentry release notification to release and snapshot actions

* Add conditional step to create Sentry release
  • Loading branch information
Adammatthiesen authored Nov 17, 2024
1 parent 79b0990 commit ee0666c
Show file tree
Hide file tree
Showing 10 changed files with 1,169 additions and 18 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/changeset-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ jobs:
GITHUB_TOKEN: ${{ secrets.STUDIOCMS_SERVICE_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create Sentry release
if: steps.changesets.outputs.published == 'true'
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: studiocms
SENTRY_URL: https://sentry.studiocms.xyz/
with:
environment: production
projects: studiocms-playground studiocms-ui-testing

- name: Add Label to CI PR
if: ${{ steps.changesets.outputs.hasChangesets == 'true' }}
run: gh pr edit "$PR_URL" --add-label "ci"
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/changeset-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ jobs:
FORCE_COLOR: 0
NO_COLOR: 1

- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: studiocms
SENTRY_URL: https://sentry.studiocms.xyz/
with:
environment: production
projects: studiocms-playground studiocms-ui-testing

- name: Pull Request Notification
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
env:
Expand Down
5 changes: 4 additions & 1 deletion playgrounds/node/.env.demo
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ CMS_AUTH0_DOMAIN=
CMS_AUTH0_REDIRECT_URI=http://localhost:4321/studiocms_api/auth/auth0/callback

## Cloudinary Javascript SDK
CMS_CLOUDINARY_CLOUDNAME="demo"
CMS_CLOUDINARY_CLOUDNAME="demo"

# Sentry DSN
SENTRY_AUTH_TOKEN=
8 changes: 8 additions & 0 deletions playgrounds/node/astro.config.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import db from '@astrojs/db';
import node from '@astrojs/node';
import sentry from '@sentry/astro';
// import webvitals from '@astrojs/web-vitals';
import studioCMSBlog from '@studiocms/blog';
import devapps from '@studiocms/devapps';
Expand All @@ -13,6 +14,13 @@ export default defineConfig({
output: 'server',
adapter: node({ mode: 'standalone' }),
integrations: [
sentry({
dsn: 'https://[email protected]/2',
sourceMapsUploadOptions: {
project: 'studiocms-playground',
authToken: process.env.SENTRY_AUTH_TOKEN,
},
}),
db(),
// webvitals(),
studioCMS(), // StudioCMS Integration options can be found in `studiocms.config.mjs`
Expand Down
3 changes: 2 additions & 1 deletion playgrounds/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"studiocms": "workspace:*",
"sharp": "catalog:",
"@studiocms/blog": "workspace:*",
"@studiocms/devapps": "workspace:*"
"@studiocms/devapps": "workspace:*",
"@sentry/astro": "^8.38.0"
}
}
12 changes: 12 additions & 0 deletions playgrounds/node/sentry.client.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as Sentry from '@sentry/astro';

Sentry.init({
dsn: 'https://[email protected]/2',
integrations: [
Sentry.feedbackIntegration({
// Additional SDK configuration goes in here, for example:
colorScheme: 'system',
isNameRequired: true,
}),
],
});
10 changes: 10 additions & 0 deletions playgrounds/ui/astro.config.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import sentry from '@sentry/astro';
import { defineConfig } from 'astro/config';

// https://astro.build/config
export default defineConfig({
site: 'https://ui-testing.studiocms.xyz',
output: 'static',
integrations: [
sentry({
dsn: 'https://[email protected]/3',
sourceMapsUploadOptions: {
project: 'studiocms-ui-testing',
authToken: process.env.SENTRY_AUTH_TOKEN,
},
}),
],
});
3 changes: 2 additions & 1 deletion playgrounds/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@astrojs/node": "catalog:",
"astro": "catalog:",
"@studiocms/ui": "workspace:*",
"@fontsource-variable/onest": "catalog:studiocms-shared"
"@fontsource-variable/onest": "catalog:studiocms-shared",
"@sentry/astro": "^8.38.0"
}
}
12 changes: 12 additions & 0 deletions playgrounds/ui/sentry.client.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as Sentry from '@sentry/astro';

Sentry.init({
dsn: 'https://[email protected]/3',
integrations: [
Sentry.feedbackIntegration({
// Additional SDK configuration goes in here, for example:
colorScheme: 'system',
isNameRequired: true,
}),
],
});
Loading

0 comments on commit ee0666c

Please sign in to comment.