From a572a1d281f3323d17fa2e9f669521baa2909e26 Mon Sep 17 00:00:00 2001 From: mango-habanero Date: Tue, 27 Jun 2023 15:12:15 +0300 Subject: [PATCH] chore(metrics): Adds flag to toggle availability of metrics endpoint. - Adds config to toggle metrics. --- .env.example | 1 - src/app.ts | 5 +---- src/config.ts | 3 --- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.env.example b/.env.example index 4fa3c80..f064b90 100644 --- a/.env.example +++ b/.env.example @@ -18,7 +18,6 @@ KE_SERVICE_CODES= KE_SUPPORT_PHONE= LOG_LEVEL= LOG_NAME= -METRICS_ENABLED= NATS_DURAABLE_NAME= NATS_SERVER= NATS_STREAM_NAME= diff --git a/src/app.ts b/src/app.ts index 2c5d2c1..3ecb566 100644 --- a/src/app.ts +++ b/src/app.ts @@ -14,7 +14,6 @@ import { config } from '@/config'; import pino from 'pino'; import moment from 'moment-timezone'; import atNotifier from '@plugins/atNotifier'; -import { balanceResolverRoutes } from '@routes/balances'; export const logger = pino({ name: config.LOG.NAME, @@ -50,9 +49,7 @@ app.addContentTypeParser('application/x-www-form-urlencoded', // register third-party plugins. app.register(fastifyCors, { origin: true }) app.register(fastifySensible) -if (config.METRICS.ENABLED) { - app.register(fastifyMetrics, { endpoint: '/metrics' }) -} +app.register(fastifyMetrics, { endpoint: '/metrics' }) app.register(fastifyPostgres, { connectionString: config.DATABASE.URL }) // register custom plugins diff --git a/src/config.ts b/src/config.ts index d79cca5..7cd0750 100644 --- a/src/config.ts +++ b/src/config.ts @@ -45,9 +45,6 @@ export const config = { LEVEL: process.env.LOG_LEVEL ?? 'info', NAME: process.env.LOG_NAME ?? 'cic-ussd', }, - METRICS: { - ENABLED: process.env.METRICS_ENABLED === 'true', - }, NATS: { DURABLE_NAME: process.env.NATS_DURABLE_NAME ?? 'cic-ussd', SERVER: process.env.NATS_SERVER ?? 'nats://localhost:4222',