From 1a2bd813d6dccc91070abfbb0709b4643d7f422e Mon Sep 17 00:00:00 2001 From: Ray <11846445+A77AY@users.noreply.github.com> Date: Tue, 28 Jul 2026 23:06:53 +0800 Subject: [PATCH 1/2] fix --- src/app/app.component.ts | 1 - src/main.ts | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index a96a144ed..5f74b3b7b 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -8,7 +8,6 @@ import { DestroyRef, OnInit, inject, - isDevMode, signal, } from '@angular/core'; import { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop'; diff --git a/src/main.ts b/src/main.ts index 1d64dcc63..9ee394a23 100644 --- a/src/main.ts +++ b/src/main.ts @@ -10,6 +10,9 @@ if (SENTRY_DSN) { dsn: SENTRY_DSN, environment: isDevMode() ? 'development' : 'production', integrations: [ + Sentry.breadcrumbsIntegration({ + console: false, + }), Sentry.browserTracingIntegration(), Sentry.replayIntegration({ maskAllText: true, @@ -20,7 +23,7 @@ if (SENTRY_DSN) { tracesSampleRate: 1, replaysSessionSampleRate: 1, replaysOnErrorSampleRate: 1, - enableLogs: true, + enableLogs: false, }); } From 8ab50fcfcd58bd03e89a8ffa5ad72f2d569690dd Mon Sep 17 00:00:00 2001 From: Ray <11846445+A77AY@users.noreply.github.com> Date: Tue, 28 Jul 2026 23:12:56 +0800 Subject: [PATCH 2/2] feat: integrate Sentry error reporting into thrift service logging --- src/utils/thrift/provide-thrift-services.ts | 33 ++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/utils/thrift/provide-thrift-services.ts b/src/utils/thrift/provide-thrift-services.ts index cee4c9361..a27aeeaca 100644 --- a/src/utils/thrift/provide-thrift-services.ts +++ b/src/utils/thrift/provide-thrift-services.ts @@ -4,6 +4,7 @@ import { combineLatest, map } from 'rxjs'; import { UnionToIntersection } from 'utility-types'; import { Type, inject, isDevMode, makeEnvironmentProviders } from '@angular/core'; +import * as Sentry from '@sentry/angular'; import { ConnectOptions } from '@vality/domain-proto'; import { toJson } from '@vality/ng-thrift'; @@ -18,6 +19,8 @@ export const LOGGING = { fullLogging: isDevMode(), }; +type ParsedThriftError = ReturnType; + export function parseThriftError(error: unknown) { const traceId = error?.['info']?.headers?.['x-woody-trace-id']; @@ -72,12 +75,40 @@ export function parseThriftError(error: unknown) { } } +function captureThriftError( + params: Parameters>[0], + error: ParsedThriftError, +) { + Sentry.withScope((scope) => { + scope.setTags({ + 'thrift.error_type': error.type, + 'thrift.namespace': params.namespace, + 'thrift.service': params.serviceName, + 'thrift.method': params.name, + }); + scope.setFingerprint([ + '{{ default }}', + error.type, + params.namespace, + params.serviceName, + params.name, + ]); + + if (error.traceId) { + scope.setTag('thrift.trace_id', error.traceId); + } + + Sentry.captureException(params.error); + }); +} + const logger: ConnectOptions['loggingFn'] = (params) => { const info = `${params.name} (${params.namespace} ${params.serviceName})`; switch (params.type) { case 'error': { const parsedError = parseThriftError(params.error); + captureThriftError(params, parsedError); console.groupCollapsed( `🔴\u00A0${info}`, `\n⚠️\u00A0${parsedError.message || parsedError.name || 'Unknown error'}`, @@ -131,7 +162,7 @@ function createConnectOptions(serviceName: string) { createCallOptions: () => ({ headers: createRequestWachterHeaders(), }), - timeout: isDevMode() ? 10_000 : 60_000, + timeout: isDevMode() ? 15_000 : 60_000, ...config.api.wachter, }), ),