Metrics
Metrics
Section titled “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
Fields
Section titled “Fields”openTelemetry
Section titled “openTelemetry”Type:
MetricsOtel· requiredOpenTelemetry metrics configuration
prometheus
Section titled “prometheus”Type:
MetricsPrometheus· requiredPrometheus metrics endpoint configuration
metrics
Section titled “metrics”Type:
MetricType[]List of metrics to include or exclude based on filter mode
metricsPolicy
Section titled “metricsPolicy”Type:
EventPolicy· default:"exclude"How to interpret the metrics list
JMAP API
Section titled “JMAP API”The Metrics singleton is available via the urn:stalwart:jmap capability.
x:Metrics/get
Section titled “x:Metrics/get”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.
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" ] }'x:Metrics/set
Section titled “x:Metrics/set”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.
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.
stalwart-cli get MetricsUpdate
Section titled “Update”stalwart-cli update Metrics --field openTelemetry='{"@type":"Disabled"}'Nested types
Section titled “Nested types”MetricsOtel
Section titled “MetricsOtel”OpenTelemetry metrics configuration.
Disabled: Disabled. No additional fields.Http: HTTP. Carries the fields ofMetricsOtelHttp.Grpc: gRPC. Carries the fields ofMetricsOtelGrpc.
MetricsOtelHttp
Section titled “MetricsOtelHttp”OpenTelemetry HTTP metrics exporter.
endpoint
Section titled “endpoint”Type:
Uri· requiredThe endpoint for Open Telemetry
interval
Section titled “interval”Type:
Duration· default:"1m"The minimum amount of time that must pass between each push request to the OpenTelemetry endpoint
timeout
Section titled “timeout”Type:
Duration· default:"10s"Maximum amount of time that Stalwart will wait for a response from the OpenTelemetry endpoint
httpAuth
Section titled “httpAuth”Type:
HttpAuth· requiredThe type of HTTP authentication to use
httpHeaders
Section titled “httpHeaders”Type:
Map<String, String>Additional headers to include in HTTP requests
HttpAuth
Section titled “HttpAuth”Defines the HTTP authentication method to use for HTTP requests.
Unauthenticated: Anonymous. No additional fields.Basic: Basic Authentication. Carries the fields ofHttpAuthBasic.Bearer: Bearer Token. Carries the fields ofHttpAuthBearer.
HttpAuthBasic
Section titled “HttpAuthBasic”HTTP Basic authentication credentials.
username
Section titled “username”Type:
String· requiredUsername for HTTP Basic Authentication
secret
Section titled “secret”Type:
SecretKey· requiredPassword for HTTP Basic Authentication
SecretKey
Section titled “SecretKey”A secret value provided directly, from an environment variable, or from a file.
Value: Secret value. Carries the fields ofSecretKeyValue.EnvironmentVariable: Secret read from environment variable. Carries the fields ofSecretKeyEnvironmentVariable.File: Secret read from file. Carries the fields ofSecretKeyFile.
SecretKeyValue
Section titled “SecretKeyValue”A secret value provided directly.
secret
Section titled “secret”Type:
String· required · secretPassword or secret value
SecretKeyEnvironmentVariable
Section titled “SecretKeyEnvironmentVariable”A secret value read from an environment variable.
variableName
Section titled “variableName”Type:
String· requiredEnvironment variable name to read the secret from
SecretKeyFile
Section titled “SecretKeyFile”A secret value read from a file.
filePath
Section titled “filePath”Type:
String· requiredFile path to read the secret from
HttpAuthBearer
Section titled “HttpAuthBearer”HTTP Bearer token authentication.
bearerToken
Section titled “bearerToken”Type:
SecretKey· requiredBearer token for HTTP Bearer Authentication
MetricsOtelGrpc
Section titled “MetricsOtelGrpc”OpenTelemetry gRPC metrics exporter.
endpoint
Section titled “endpoint”Type:
Uri?The endpoint for Open Telemetry
interval
Section titled “interval”Type:
Duration· default:"1m"The minimum amount of time that must pass between each push request to the OpenTelemetry endpoint
timeout
Section titled “timeout”Type:
Duration· default:"10s"Maximum amount of time that Stalwart will wait for a response from the OpenTelemetry endpoint
MetricsPrometheus
Section titled “MetricsPrometheus”Prometheus metrics endpoint configuration.
Disabled: Disabled. No additional fields.Enabled: Enabled. Carries the fields ofMetricsPrometheusProperties.
MetricsPrometheusProperties
Section titled “MetricsPrometheusProperties”Prometheus metrics endpoint authentication.
authSecret
Section titled “authSecret”Type:
SecretKeyOptional· requiredThe Prometheus endpoint’s secret for Basic authentication
authUsername
Section titled “authUsername”Type:
String?The Prometheus endpoint’s username for Basic authentication
SecretKeyOptional
Section titled “SecretKeyOptional”An optional secret value, or none.
None: No secret. No additional fields.Value: Secret value. Carries the fields ofSecretKeyValue.EnvironmentVariable: Secret read from environment variable. Carries the fields ofSecretKeyEnvironmentVariable.File: Secret read from file. Carries the fields ofSecretKeyFile.
EventPolicy
Section titled “EventPolicy”| Value | Label |
|---|---|
include | Only include the specified events |
exclude | Exclude the specified events |