Skip to content
This repository has been archived by the owner on Mar 2, 2025. It is now read-only.

Commit

Permalink
feat(stats): add default metrics configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
IKatsuba committed Nov 21, 2023
1 parent a1d9e8b commit 0b38b26
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libs/api/models/src/lib/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@ export interface Environment {

ENV: 'development' | string;

// Prometheus starts here
METRICS_PATH: string;
DEFAULT_METRICS_ENABLED: boolean;
DEFAULT_METRICS_PREFIX: string;
// Prometheus ends here
}
6 changes: 6 additions & 0 deletions libs/api/stats/src/lib/prometheus-stats.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ import { Environment } from '@nx-turbo/api-models';
PrometheusModule.registerAsync({
useFactory: (config: ConfigService<Environment>) => ({
path: config.get('METRICS_PATH', '/metrics'),
defaultMetrics: {
enabled: config.get('DEFAULT_METRICS_ENABLED', true),
config: {
prefix: config.get('DEFAULT_METRICS_PREFIX', 'nx_cloud_'),
},
},
}),
inject: [ConfigService],
}),
Expand Down

0 comments on commit 0b38b26

Please sign in to comment.