Skip to content

Commit

Permalink
Feat/sentry (#75)
Browse files Browse the repository at this point in the history
* install package

Signed-off-by: Mirko Mollik <[email protected]>

* upload files to sentry

Signed-off-by: Mirko Mollik <[email protected]>

---------

Signed-off-by: Mirko Mollik <[email protected]>
  • Loading branch information
cre8 authored Jul 3, 2024
1 parent aabfd35 commit d2eaa71
Show file tree
Hide file tree
Showing 7 changed files with 232 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ jobs:
run: cd deploys/keycloak && docker-compose build keycloak && docker-compose push keycloak

- name: Build and push images
run: INPUT_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} INPUT_PUSH=true pnpm exec nx affected -t container
run: INPUT_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} INPUT_PUSH=true pnpm exec nx affected -t container sentry
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ Thumbs.db
.nx/cache
.nx/workspace-data
.angular

# Sentry Config File
.sentryclirc
5 changes: 5 additions & 0 deletions apps/holder-app/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"polyfills": ["zone.js"],
"tsConfig": "apps/holder-app/tsconfig.app.json",
"inlineStyleLanguage": "scss",
"sourceMap": true,
"assets": [
"apps/holder-app/src/favicon.ico",
"apps/holder-app/src/assets",
Expand Down Expand Up @@ -100,6 +101,10 @@
"tags": ["latest"]
}
}
},
"sentry": {
"dependsOn": ["build"],
"command": "sentry-cli sourcemaps inject --org credhub --project pwa ./dist/apps/holder-app/browser && sentry-cli sourcemaps upload --org credhub --project pwa ./dist/apps/holder-app/browser"
}
}
}
32 changes: 30 additions & 2 deletions apps/holder-app/src/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import {
importProvidersFrom,
APP_INITIALIZER,
isDevMode,
ErrorHandler,
} from '@angular/core';
import { provideRouter } from '@angular/router';
import { Router, provideRouter } from '@angular/router';

import { routes } from './app.routes';
import {
Expand All @@ -23,6 +24,23 @@ import {
import { AuthService } from './auth/auth.service';
import { provideServiceWorker } from '@angular/service-worker';
import { ConfigService } from './config.service';
import * as Sentry from '@sentry/angular';
import { environment } from '../environments/environment';

Sentry.init({
dsn: environment.sentryDsn,
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration(),
],
// Performance Monitoring
tracesSampleRate: 1.0, // Capture 100% of the transactions
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ['localhost', /^https:\/\/backend\.credhub\.eu/],
// Session Replay
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
});

export const appConfig: ApplicationConfig = {
providers: [
Expand All @@ -45,7 +63,7 @@ export const appConfig: ApplicationConfig = {
authService.init();
await authService.runInitialLoginSequence();
},
deps: [AuthService, ConfigService, HttpClient],
deps: [AuthService, ConfigService, HttpClient, Sentry.TraceService],
multi: true,
},
{
Expand Down Expand Up @@ -85,5 +103,15 @@ export const appConfig: ApplicationConfig = {
enabled: !isDevMode(),
registrationStrategy: 'registerWhenStable:30000',
}),
{
provide: ErrorHandler,
useValue: Sentry.createErrorHandler({
showDialog: true,
}),
},
{
provide: Sentry.TraceService,
deps: [Router],
},
],
};
3 changes: 3 additions & 0 deletions apps/holder-app/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ export const environment = {
get keycloakClient() {
return globalThis.environment?.keycloakClient;
},

sentryDsn:
'https://6350a5821ef72c29668bd6ca1697b108@o4507537672830976.ingest.de.sentry.io/4507537674993744',
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
],
"description": "A monorepo including multiple apps for SSI",
"author": "Mirko Mollik <[email protected]>",
"scripts": {},
"engines": {
"node": ">=18",
"pnpm": "=8"
Expand Down Expand Up @@ -102,6 +101,8 @@
"@sd-jwt/jwt-status-list": "^0.7.1",
"@sd-jwt/sd-jwt-vc": "^0.7.1",
"@sd-jwt/types": "^0.7.1",
"@sentry/angular": "^8.13.0",
"@sentry/cli": "^2.32.1",
"@simplewebauthn/browser": "^10.0.0",
"@simplewebauthn/server": "^10.0.0",
"@sphereon/did-auth-siop": "^0.6.4",
Expand Down
188 changes: 188 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d2eaa71

Please sign in to comment.