From cfd437ca9d48d6b3737e16269800731e70f67fd2 Mon Sep 17 00:00:00 2001 From: Sebastian Leidig Date: Tue, 2 Jul 2024 13:21:22 +0200 Subject: [PATCH] fix(logging): upgrade sentry and enable offline caching --- package-lock.json | 162 +++++++++--------------- package.json | 2 +- src/app/core/logging/logging.service.ts | 9 +- 3 files changed, 68 insertions(+), 105 deletions(-) diff --git a/package-lock.json b/package-lock.json index cf100611c5..4cd474a77a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,7 +31,7 @@ "@fortawesome/free-regular-svg-icons": "^6.5.2", "@fortawesome/free-solid-svg-icons": "^6.5.2", "@ngneat/until-destroy": "^10.0.0", - "@sentry/browser": "^7.117.0", + "@sentry/browser": "^8.13.0", "angulartics2": "^12.2.1", "assert": "^2.1.0", "crypto-es": "^2.1.0", @@ -7357,121 +7357,106 @@ "yarn": ">= 1.13.0" } }, - "node_modules/@sentry-internal/feedback": { - "version": "7.117.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-7.117.0.tgz", - "integrity": "sha512-4X+NnnY17W74TymgLFH7/KPTVYpEtoMMJh8HzVdCmHTOE6j32XKBeBMRaXBhmNYmEgovgyRKKf2KvtSfgw+V1Q==", - "dependencies": { - "@sentry/core": "7.117.0", - "@sentry/types": "7.117.0", - "@sentry/utils": "7.117.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@sentry-internal/replay-canvas": { - "version": "7.117.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-7.117.0.tgz", - "integrity": "sha512-7hjIhwEcoosr+BIa0AyEssB5xwvvlzUpvD5fXu4scd3I3qfX8gdnofO96a8r+LrQm3bSj+eN+4TfKEtWb7bU5A==", + "node_modules/@sentry-internal/browser-utils": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-8.13.0.tgz", + "integrity": "sha512-lqq8BYbbs9KTlDuyB5NjdZB6P/llqQs32KUgaCQ/k5DFB4Zf56+BFHXObnMHxwx375X1uixtnEphagWZa+nsLQ==", "dependencies": { - "@sentry/core": "7.117.0", - "@sentry/replay": "7.117.0", - "@sentry/types": "7.117.0", - "@sentry/utils": "7.117.0" + "@sentry/core": "8.13.0", + "@sentry/types": "8.13.0", + "@sentry/utils": "8.13.0" }, "engines": { - "node": ">=12" + "node": ">=14.18" } }, - "node_modules/@sentry-internal/tracing": { - "version": "7.117.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.117.0.tgz", - "integrity": "sha512-fAIyijNvKBZNA12IcKo+dOYDRTNrzNsdzbm3DP37vJRKVQu19ucqP4Y6InvKokffDP2HZPzFPDoGXYuXkDhUZg==", + "node_modules/@sentry-internal/feedback": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-8.13.0.tgz", + "integrity": "sha512-YyJ6SzpTonixvguAg0H9vkEp7Jq8ZeVY8M4n47ClR0+TtaAUp04ZhcJpHKF7PwBIAzc7DRr2XP112tmWgiVEcg==", "dependencies": { - "@sentry/core": "7.117.0", - "@sentry/types": "7.117.0", - "@sentry/utils": "7.117.0" + "@sentry/core": "8.13.0", + "@sentry/types": "8.13.0", + "@sentry/utils": "8.13.0" }, "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry/browser": { - "version": "7.117.0", - "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.117.0.tgz", - "integrity": "sha512-29X9HlvDEKIaWp6XKlNPPSNND0U6P/ede5WA2nVHfs1zJLWdZ7/ijuMc0sH/CueEkqHe/7gt94hBcI7HOU/wSw==", + "node_modules/@sentry-internal/replay": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay/-/replay-8.13.0.tgz", + "integrity": "sha512-DJ1jF/Pab0FH4SeCvSGCnGAu/s0wJvhBWM5VjQp7Jjmcfunp+R3vJibqU8gAVZU1nYRLaqprLdIXrSyP2Km8nQ==", "dependencies": { - "@sentry-internal/feedback": "7.117.0", - "@sentry-internal/replay-canvas": "7.117.0", - "@sentry-internal/tracing": "7.117.0", - "@sentry/core": "7.117.0", - "@sentry/integrations": "7.117.0", - "@sentry/replay": "7.117.0", - "@sentry/types": "7.117.0", - "@sentry/utils": "7.117.0" + "@sentry-internal/browser-utils": "8.13.0", + "@sentry/core": "8.13.0", + "@sentry/types": "8.13.0", + "@sentry/utils": "8.13.0" }, "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry/core": { - "version": "7.117.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.117.0.tgz", - "integrity": "sha512-1XZ4/d/DEwnfM2zBMloXDwX+W7s76lGKQMgd8bwgPJZjjEztMJ7X0uopKAGwlQcjn242q+hsCBR6C+fSuI5kvg==", + "node_modules/@sentry-internal/replay-canvas": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-8.13.0.tgz", + "integrity": "sha512-lPlfWVIHX+gW4S8a/UOVutuqMyQhlkNUAay0W21MVhZJT5Mtj0p21D/Cz7nrOQRDIiLNq90KAGK2tLxx5NkiWA==", "dependencies": { - "@sentry/types": "7.117.0", - "@sentry/utils": "7.117.0" + "@sentry-internal/replay": "8.13.0", + "@sentry/core": "8.13.0", + "@sentry/types": "8.13.0", + "@sentry/utils": "8.13.0" }, "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry/integrations": { - "version": "7.117.0", - "resolved": "https://registry.npmjs.org/@sentry/integrations/-/integrations-7.117.0.tgz", - "integrity": "sha512-U3suSZysmU9EiQqg0ga5CxveAyNbi9IVdsapMDq5EQGNcVDvheXtULs+BOc11WYP3Kw2yWB38VDqLepfc/Fg2g==", + "node_modules/@sentry/browser": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-8.13.0.tgz", + "integrity": "sha512-/tp7HZ5qjwDLtwooPMoexdAi2PG7gMNY0bHeMlwy20hs8mclC8RW8ZiJA6czXHfgnbmvxfrHaY53IJyz//JnlA==", "dependencies": { - "@sentry/core": "7.117.0", - "@sentry/types": "7.117.0", - "@sentry/utils": "7.117.0", - "localforage": "^1.8.1" + "@sentry-internal/browser-utils": "8.13.0", + "@sentry-internal/feedback": "8.13.0", + "@sentry-internal/replay": "8.13.0", + "@sentry-internal/replay-canvas": "8.13.0", + "@sentry/core": "8.13.0", + "@sentry/types": "8.13.0", + "@sentry/utils": "8.13.0" }, "engines": { - "node": ">=8" + "node": ">=14.18" } }, - "node_modules/@sentry/replay": { - "version": "7.117.0", - "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.117.0.tgz", - "integrity": "sha512-V4DfU+x4UsA4BsufbQ8jHYa5H0q5PYUgso2X1PR31g1fpx7yiYguSmCfz1UryM6KkH92dfTnqXapDB44kXOqzQ==", + "node_modules/@sentry/core": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.13.0.tgz", + "integrity": "sha512-N9Qg4ZGxZWp8eb2eUUHVVKgjBLtFIjS805nG92s6yJmkvOpKm6mLtcUaT/iDf3Hta6nG+xRkhbE3r+Z4cbXG8w==", "dependencies": { - "@sentry-internal/tracing": "7.117.0", - "@sentry/core": "7.117.0", - "@sentry/types": "7.117.0", - "@sentry/utils": "7.117.0" + "@sentry/types": "8.13.0", + "@sentry/utils": "8.13.0" }, "engines": { - "node": ">=12" + "node": ">=14.18" } }, "node_modules/@sentry/types": { - "version": "7.117.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.117.0.tgz", - "integrity": "sha512-5dtdulcUttc3F0Te7ekZmpSp/ebt/CA71ELx0uyqVGjWsSAINwskFD77sdcjqvZWek//WjiYX1+GRKlpJ1QqsA==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-8.13.0.tgz", + "integrity": "sha512-r63s/H5gvQnQM9tTGBXz2xErUbxZALh4e2Lg/1aHj4zIvGLBjA2z5qWsh6TEZYbpmgAyGShLDr6+rWeUVf9yBQ==", "engines": { - "node": ">=8" + "node": ">=14.18" } }, "node_modules/@sentry/utils": { - "version": "7.117.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.117.0.tgz", - "integrity": "sha512-KkcLY8643SGBiDyPvMQOubBkwVX5IPknMHInc7jYC8pDVncGp7C65Wi506bCNPpKCWspUd/0VDNWOOen51/qKA==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-8.13.0.tgz", + "integrity": "sha512-PxV0v9VbGWH9zP37P5w2msLUFDr287nYjoY2XVF+RSolyiTs1CQNI5ZMUO3o4MsSac/dpXxjyrZXQd72t/jRYA==", "dependencies": { - "@sentry/types": "7.117.0" + "@sentry/types": "8.13.0" }, "engines": { - "node": ">=8" + "node": ">=14.18" } }, "node_modules/@sigstore/bundle": { @@ -18118,11 +18103,6 @@ "node": ">=16.x" } }, - "node_modules/immediate": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" - }, "node_modules/immutable": { "version": "4.3.6", "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.6.tgz", @@ -20282,14 +20262,6 @@ } } }, - "node_modules/lie": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", - "integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==", - "dependencies": { - "immediate": "~3.0.5" - } - }, "node_modules/lines-and-columns": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-2.0.4.tgz", @@ -20375,14 +20347,6 @@ "node": ">= 12.13.0" } }, - "node_modules/localforage": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz", - "integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==", - "dependencies": { - "lie": "3.1.1" - } - }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", diff --git a/package.json b/package.json index dac9787f1f..e690264fd1 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "@fortawesome/free-regular-svg-icons": "^6.5.2", "@fortawesome/free-solid-svg-icons": "^6.5.2", "@ngneat/until-destroy": "^10.0.0", - "@sentry/browser": "^7.117.0", + "@sentry/browser": "^8.13.0", "angulartics2": "^12.2.1", "assert": "^2.1.0", "crypto-es": "^2.1.0", diff --git a/src/app/core/logging/logging.service.ts b/src/app/core/logging/logging.service.ts index 1ab5391c21..30d7b51e48 100644 --- a/src/app/core/logging/logging.service.ts +++ b/src/app/core/logging/logging.service.ts @@ -1,7 +1,6 @@ import { Injectable } from "@angular/core"; import { LogLevel } from "./log-level"; import * as Sentry from "@sentry/browser"; -import { Breadcrumb, BrowserOptions, SeverityLevel } from "@sentry/browser"; import { environment } from "../../../environments/environment"; /* eslint-disable no-console */ @@ -23,7 +22,7 @@ export class LoggingService { * If set up this will be used to send errors to a remote endpoint for analysis. * @param options */ - static initRemoteLogging(options: BrowserOptions) { + static initRemoteLogging(options: Sentry.BrowserOptions) { if (!options.dsn) { // abort if no target url is set return; @@ -31,7 +30,7 @@ export class LoggingService { const defaultOptions = { release: "ndb-core@" + environment.appVersion, - + transport: Sentry.makeBrowserOfflineTransport(Sentry.makeFetchTransport), beforeBreadcrumb: enhanceSentryBreadcrumb, }; Sentry.init(Object.assign(defaultOptions, options)); @@ -151,7 +150,7 @@ export class LoggingService { } } - private translateLogLevel(logLevel: LogLevel): SeverityLevel { + private translateLogLevel(logLevel: LogLevel): Sentry.SeverityLevel { switch (+logLevel) { case LogLevel.DEBUG: return "debug"; @@ -173,7 +172,7 @@ export class LoggingService { * see https://docs.sentry.io/platforms/javascript/enriching-events/breadcrumbs/ */ function enhanceSentryBreadcrumb( - breadcrumb: Breadcrumb, + breadcrumb: Sentry.Breadcrumb, hint: SentryBreadcrumbHint, ) { if (breadcrumb.category === "ui.click") {