diff --git a/.env.test b/.env.test index 0e7857e..f092a07 100644 --- a/.env.test +++ b/.env.test @@ -1,5 +1,4 @@ PORT=3000 LOG_LEVEL=mute AC_JWKS_URL=http://auth.example.com -ASSERT_CONFIGS_ON_START=false -START_AUX_HTTP_SERVER_ON_START=false \ No newline at end of file +ASSERT_CONFIGS_ON_START=false \ No newline at end of file diff --git a/docs/metrics.md b/docs/metrics.md index 142d976..a2ba2b1 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -69,7 +69,7 @@ In this example, `app_method_latencies_seconds{class="MyClass",method="doWork"}` ### Metrics endpoint -By default, the application will run a http server (in a different port) that handles requests to `GET /metrics` endpoint, unless configured otherwise (i.e. `START_AUX_HTTP_SERVER_ON_START=false` is set). So, you don't have to do anything to expose the metrics reports. +By default, the application will run a http server (in a different port) that handles requests to `GET /metrics` endpoint, unless configured otherwise (i.e. `START_AUX_HTTP_ON_START=false` is set). So, you don't have to do anything to expose the metrics reports. This endpoint reports metrics from all registered ones, which are: diff --git a/src/main/application.ts b/src/main/application.ts index 3ea5de0..ed15fe6 100644 --- a/src/main/application.ts +++ b/src/main/application.ts @@ -14,7 +14,7 @@ import { GlobalMetrics } from './metrics/global.js'; export class Application extends BaseApp { @config({ default: false }) ASSERT_CONFIGS_ON_START!: boolean; - @config({ default: true }) START_AUX_HTTP_SERVER_ON_START!: boolean; + @config({ default: true }) START_AUX_HTTP_ON_START!: boolean; @dep() httpServer!: HttpServer; @dep() auxHttpServer!: AuxHttpServer; @@ -47,7 +47,7 @@ export class Application extends BaseApp { if (this.ASSERT_CONFIGS_ON_START) { this.assertConfigs(); } - if (this.START_AUX_HTTP_SERVER_ON_START) { + if (this.START_AUX_HTTP_ON_START) { await this.auxHttpServer.start(); } await this.beforeStart(); @@ -55,6 +55,9 @@ export class Application extends BaseApp { override async stop() { await super.stop(); + if (this.START_AUX_HTTP_ON_START) { + await this.auxHttpServer.stop(); + } await this.afterStop(); }