Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .env.test
Original file line number Diff line number Diff line change
@@ -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
ASSERT_CONFIGS_ON_START=false
2 changes: 1 addition & 1 deletion docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
7 changes: 5 additions & 2 deletions src/main/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -47,14 +47,17 @@ 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();
}

override async stop() {
await super.stop();
if (this.START_AUX_HTTP_ON_START) {
await this.auxHttpServer.stop();
}
await this.afterStop();
}

Expand Down