Skip to content

Commit

Permalink
fix(api-observability): sentry exception filter logger not provided c…
Browse files Browse the repository at this point in the history
…orrectly
  • Loading branch information
timonmasberg committed Mar 13, 2024
1 parent 0544f21 commit d9b6c94
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import { KordisLogger } from '../services/kordis-logger.interface';

@Catch()
export class SentryExceptionsFilter implements ExceptionFilter {
readonly logger: KordisLogger;

constructor(_logger: Logger) {
this.logger = _logger;
}
private readonly logger: KordisLogger = new Logger(
SentryExceptionsFilter.name,
);

catch(exception: unknown): void {
if (exception instanceof PresentableException) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Logger, Module, OnModuleInit } from '@nestjs/common';
import { Module, OnModuleInit } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { APP_FILTER, APP_INTERCEPTOR, ModulesContainer } from '@nestjs/core';
import { init as initSentry } from '@sentry/node';
Expand All @@ -7,7 +7,6 @@ import { SentryExceptionsFilter } from './filters/sentry-exceptions.filter';
import { SentryOTelUserContextInterceptor } from './interceptors/sentry-otel-user-context.interceptor';
import oTelSDK from './oTelSdk';
import { KORDIS_LOGGER_SERVICE } from './services/kordis-logger-service.interface';
import { KordisLogger } from './services/kordis-logger.interface';
import { SentryLogger } from './services/sentry-logger.service';
import { wrapProvidersWithTracingSpans } from './trace-wrapper';

Expand All @@ -30,10 +29,6 @@ import { wrapProvidersWithTracingSpans } from './trace-wrapper';
exports: [KORDIS_LOGGER_SERVICE],
})
export class SentryObservabilityModule implements OnModuleInit {
private readonly logger: KordisLogger = new Logger(
SentryObservabilityModule.name,
);

constructor(
private readonly config: ConfigService,
private readonly modulesContainer: ModulesContainer,
Expand All @@ -49,7 +44,5 @@ export class SentryObservabilityModule implements OnModuleInit {
});
wrapProvidersWithTracingSpans(this.modulesContainer);
oTelSDK.start();

this.logger.log('Sentry initialized');
}
}

0 comments on commit d9b6c94

Please sign in to comment.