Skip to content

Metrics

Configures metrics collection and export via OpenTelemetry and Prometheus.

This object can be configured from the WebUI under Settings › Telemetry › Metrics › General Settings › Telemetry › Metrics › OpenTelemetry Settings › Telemetry › Metrics › Prometheus

Type: MetricsOtel · required

OpenTelemetry metrics configuration

Type: MetricsPrometheus · required

Prometheus metrics endpoint configuration

Type: MetricType[]

List of metrics to include or exclude based on filter mode

Type: EventPolicy · default: "exclude"

How to interpret the metrics list

The Metrics singleton is available via the urn:stalwart:jmap capability.

This is a standard Foo/get method as defined in RFC 8620, Section 5.1.

For singletons, the ids argument should be the literal singleton (or null to return the single instance).

This method requires the sysMetricsGet permission.

Terminal window
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:Metrics/get",
{
"ids": [
"singleton"
]
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

This is a standard Foo/set method as defined in RFC 8620, Section 5.3.

For singletons, only the update argument with id singleton is accepted; create and destroy arguments are rejected.

This method requires the sysMetricsUpdate permission.

Terminal window
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:Metrics/set",
{
"update": {
"singleton": {
"openTelemetry": {
"@type": "Disabled"
}
}
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

stalwart-cli wraps the same JMAP calls. See the CLI reference for installation, authentication, and general usage.

Terminal window
stalwart-cli get Metrics
Terminal window
stalwart-cli update Metrics --field openTelemetry='{"@type":"Disabled"}'

OpenTelemetry metrics configuration.

OpenTelemetry HTTP metrics exporter.

Type: Uri · required

The endpoint for Open Telemetry

Type: Duration · default: "1m"

The minimum amount of time that must pass between each push request to the OpenTelemetry endpoint

Type: Duration · default: "10s"

Maximum amount of time that Stalwart will wait for a response from the OpenTelemetry endpoint

Type: HttpAuth · required

The type of HTTP authentication to use

Type: Map<String, String>

Additional headers to include in HTTP requests

Defines the HTTP authentication method to use for HTTP requests.

  • Unauthenticated: Anonymous. No additional fields.
  • Basic: Basic Authentication. Carries the fields of HttpAuthBasic.
  • Bearer: Bearer Token. Carries the fields of HttpAuthBearer.

HTTP Basic authentication credentials.

Type: String · required

Username for HTTP Basic Authentication

Type: SecretKey · required

Password for HTTP Basic Authentication

A secret value provided directly, from an environment variable, or from a file.

A secret value provided directly.

Type: String · required · secret

Password or secret value

A secret value read from an environment variable.

Type: String · required

Environment variable name to read the secret from

A secret value read from a file.

Type: String · required

File path to read the secret from

HTTP Bearer token authentication.

Type: SecretKey · required

Bearer token for HTTP Bearer Authentication

OpenTelemetry gRPC metrics exporter.

Type: Uri?

The endpoint for Open Telemetry

Type: Duration · default: "1m"

The minimum amount of time that must pass between each push request to the OpenTelemetry endpoint

Type: Duration · default: "10s"

Maximum amount of time that Stalwart will wait for a response from the OpenTelemetry endpoint

Prometheus metrics endpoint configuration.

Prometheus metrics endpoint authentication.

Type: SecretKeyOptional · required

The Prometheus endpoint’s secret for Basic authentication

Type: String?

The Prometheus endpoint’s username for Basic authentication

An optional secret value, or none.

  • None: No secret. No additional fields.
  • Value: Secret value. Carries the fields of SecretKeyValue.
  • EnvironmentVariable: Secret read from environment variable. Carries the fields of SecretKeyEnvironmentVariable.
  • File: Secret read from file. Carries the fields of SecretKeyFile.
ValueLabel
includeOnly include the specified events
excludeExclude the specified events