Package org.mockserver.metrics
Class PrometheusRemoteWriteExporter
java.lang.Object
org.mockserver.metrics.PrometheusRemoteWriteExporter
Optional push exporter that, on a fixed interval, snapshots the same
Prometheus metrics served at
/mockserver/metrics, encodes them as a
Prometheus Remote-Write WriteRequest protobuf — v1 or v2 per
mockserver.prometheusRemoteWriteProtocolVersion (see
selectEncoder(String)) — snappy-compresses it (raw block format),
and HTTP POSTs it to a configured remote-write endpoint (Prometheus
--web.enable-remote-write-receiver, Grafana Mimir, New Relic,
VictoriaMetrics, Thanos Receive).
Off unless mockserver.prometheusRemoteWriteEnabled is set. Mirrors the
OtelMetricsExporter lifecycle and is fail-soft throughout: telemetry
must never throw into the server or prevent it from running. Remote write is
inherently cumulative (the Prometheus model) — there is no delta here.
-
Method Summary
Modifier and TypeMethodDescriptionStart the exporter if enabled in configuration, returning the running instance, ornullif disabled, mis-configured, or startup failed (fail-soft — telemetry must never prevent the server from running).startIfEnabled(Configuration configuration) AsstartIfEnabled()but preferring the values carried on the suppliedConfigurationinstance, falling back to the staticConfigurationPropertiesstore for each value the instance leaves unset, so remote-write settings applied overPUT /mockserver/configurationtake effect here.voidstop()Stop pushing and release the scheduler.
-
Method Details
-
startIfEnabled
Start the exporter if enabled in configuration, returning the running instance, ornullif disabled, mis-configured, or startup failed (fail-soft — telemetry must never prevent the server from running). -
startIfEnabled
AsstartIfEnabled()but preferring the values carried on the suppliedConfigurationinstance, falling back to the staticConfigurationPropertiesstore for each value the instance leaves unset, so remote-write settings applied overPUT /mockserver/configurationtake effect here.- Parameters:
configuration- the live server configuration, ornullto read the static store
-
stop
public void stop()Stop pushing and release the scheduler. Safe to call once.
-