mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 13:11:02 +00:00
fix(health): send healthcheck result to sentry to improve debugging
This commit is contained in:
parent
d1a5eb57d7
commit
dbf4374aeb
1 changed files with 10 additions and 3 deletions
|
|
@ -1,12 +1,13 @@
|
|||
import { Controller, Get } from "@nestjs/common";
|
||||
import { ConfigService } from "@nestjs/config";
|
||||
import {
|
||||
HttpHealthIndicator,
|
||||
HealthCheck,
|
||||
HealthCheckResult,
|
||||
HealthCheckService,
|
||||
HttpHealthIndicator,
|
||||
TypeOrmHealthIndicator,
|
||||
} from "@nestjs/terminus";
|
||||
import { configureScope, Scope } from "@sentry/node";
|
||||
|
||||
@Controller("api/v1/health")
|
||||
export class HealthCheckController {
|
||||
|
|
@ -19,8 +20,8 @@ export class HealthCheckController {
|
|||
|
||||
@Get()
|
||||
@HealthCheck()
|
||||
check(): Promise<HealthCheckResult> {
|
||||
return this.health.check([
|
||||
async check(): Promise<HealthCheckResult> {
|
||||
const health = await this.health.check([
|
||||
() =>
|
||||
this.http.pingCheck(
|
||||
"spotify-web",
|
||||
|
|
@ -33,5 +34,11 @@ export class HealthCheckController {
|
|||
),
|
||||
() => this.typeorm.pingCheck("db"),
|
||||
]);
|
||||
|
||||
configureScope((scope: Scope) => {
|
||||
scope.setExtra("health", health);
|
||||
});
|
||||
|
||||
return health;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue