Browse Source

Merge pull request #6772 from nocodb/nc-refact/sentry-additional-infos

Refactor: remove rate-limiter for health api
pull/6782/head
Pranav C 11 months ago committed by GitHub
parent
commit
39f121bee9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      packages/nocodb/src/controllers/utils.controller.ts
  2. 10
      packages/nocodb/src/filters/global-exception/global-exception.filter.ts

1
packages/nocodb/src/controllers/utils.controller.ts

@ -71,7 +71,6 @@ export class UtilsController {
}); });
} }
@UseGuards(PublicApiLimiterGuard)
@Get('/api/v1/health') @Get('/api/v1/health')
async appHealth() { async appHealth() {
return await this.utilsService.appHealth(); return await this.utilsService.appHealth();

10
packages/nocodb/src/filters/global-exception/global-exception.filter.ts

@ -18,10 +18,10 @@ import {
@Catch() @Catch()
export class GlobalExceptionFilter implements ExceptionFilter { export class GlobalExceptionFilter implements ExceptionFilter {
constructor( constructor(
@Optional() @InjectSentry() private readonly sentryClient: SentryService, @Optional() @InjectSentry() protected readonly sentryClient: SentryService,
) {} ) {}
private logger = new Logger(GlobalExceptionFilter.name); protected logger = new Logger(GlobalExceptionFilter.name);
catch(exception: any, host: ArgumentsHost) { catch(exception: any, host: ArgumentsHost) {
const ctx = host.switchToHttp(); const ctx = host.switchToHttp();
@ -106,7 +106,7 @@ export class GlobalExceptionFilter implements ExceptionFilter {
if (exception.getStatus?.()) { if (exception.getStatus?.()) {
response.status(exception.getStatus()).json(exception.getResponse()); response.status(exception.getStatus()).json(exception.getResponse());
} else { } else {
this.sentryClient?.instance().captureException(exception); this.captureException(exception, request);
// todo: change the response code // todo: change the response code
response.status(400).json({ response.status(400).json({
@ -114,4 +114,8 @@ export class GlobalExceptionFilter implements ExceptionFilter {
}); });
} }
} }
protected captureException(exception: any, _request: any) {
this.sentryClient?.instance().captureException(exception);
}
} }

Loading…
Cancel
Save