Metrics

SDL exports metrics using the Prometheus exposition format. Prometheus is a pull-based model, so metrics are exported by a HTTP server that is spawned on a separate thread when a service is initialised.

Services can add their own metrics, that will be collected and exported like the default metrics, using the appropriate Prometheus client API for their language.

For example, in TypeScript:

import { TestService } from "@cartax/sdl/services/Test";
import { Counter } from "prom-client";

// This starts the metrics server...
service = TestService.instance();

// ...and we can add our own metrics to be collected and exported.
const myMetricCounter = new Counter({
	name: "my_metrics",
	help: "My help text",
});

myMetricsCounter.inc();

Configuration

Helm ParameterKeyTypeDescriptionDefault
metrics.enabledSDL_METRICS_ENABLEDboolEnables the metrics feature.false
N/ASDL_METRICS_PORTnumberThe port number that the metrics server will listen on.9100