The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
import { CanActivate, ExecutionContext, Injectable, ServiceUnavailableException } from '@nestjs/common';
import { FeatureFlagsService } from './feature-flags.service';
@Injectable()
export class FeatureFlagsGuard implements CanActivate {
constructor(private readonly flags: FeatureFlagsService) {}
async canActivate(ctx: ExecutionContext): Promise<boolean> {
const req = ctx.switchToHttp().getRequest();
req.flags = await this.flags.load();
if (req.flags.get('storefront.maintenance')?.enabled) {
throw new ServiceUnavailableException('storefront is in maintenance');
}
return true;
}
}