UNPKG

@takentrade/takentrade-libs

Version:
50 lines (49 loc) 2.02 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.HealthController = void 0; const common_1 = require("@nestjs/common"); const terminus_1 = require("@nestjs/terminus"); const microservices_1 = require("@nestjs/microservices"); let HealthController = class HealthController { health; disk; memory; microservice; constructor(health, disk, memory, microservice) { this.health = health; this.disk = disk; this.memory = memory; this.microservice = microservice; } check() { return this.health.check([ () => this.disk.checkStorage('storage', { thresholdPercent: 0.5, path: '/', }), () => this.memory.checkHeap('memory_heap', 150 * 1024 * 1024), () => this.memory.checkRSS('memory_rss', 150 * 1024 * 1024), () => this.microservice.pingCheck('nats', { transport: microservices_1.Transport.NATS, options: { servers: [process.env.NATS_URL], }, }), ]); } }; exports.HealthController = HealthController; __decorate([ (0, common_1.Get)(), (0, terminus_1.HealthCheck)() ], HealthController.prototype, "check", null); exports.HealthController = HealthController = __decorate([ (0, common_1.Controller)('health'), (0, common_1.Injectable)() ], HealthController);