Skip to content

Commit

Permalink
chore(metrics): Adds flag to toggle availability of metrics endpoint.
Browse files Browse the repository at this point in the history
- Adds config to toggle metrics.
  • Loading branch information
mango-habanero committed Jun 27, 2023
1 parent f0a4e1d commit a572a1d
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ KE_SERVICE_CODES=
KE_SUPPORT_PHONE=
LOG_LEVEL=
LOG_NAME=
METRICS_ENABLED=
NATS_DURAABLE_NAME=
NATS_SERVER=
NATS_STREAM_NAME=
Expand Down
5 changes: 1 addition & 4 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit a572a1d

Please sign in to comment.