From e57f4557ef74211013a91db210781833b2432a70 Mon Sep 17 00:00:00 2001 From: jtama <39991688+jtama@users.noreply.github.com> Date: Fri, 27 Jan 2023 09:31:13 +0100 Subject: [PATCH] Match prometheus export metrics format Links #30576 --- docs/src/main/asciidoc/micrometer.adoc | 11 ++++++++--- .../main/asciidoc/telemetry-micrometer-tutorial.adoc | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/docs/src/main/asciidoc/micrometer.adoc b/docs/src/main/asciidoc/micrometer.adoc index b8fefe6a3e7d5..ee3eb4039b207 100644 --- a/docs/src/main/asciidoc/micrometer.adoc +++ b/docs/src/main/asciidoc/micrometer.adoc @@ -367,11 +367,11 @@ timers, look for `http_server_requests_seconds_count`, `http_server_requests_sec ---- # HELP http_server_requests_seconds # TYPE http_server_requests_seconds summary -http_server_requests_seconds_count{method="GET",outcome="SUCCESS",status="200",uri="/example/prime/{number}",} 1.0 -http_server_requests_seconds_sum{method="GET",outcome="SUCCESS",status="200",uri="/example/prime/{number}",} 0.017385896 +http_server_requests_seconds_count{method="GET",outcome="SUCCESS",status="200",uri="/example/prime/{number}"} 1.0 +http_server_requests_seconds_sum{method="GET",outcome="SUCCESS",status="200",uri="/example/prime/{number}"} 0.017385896 # HELP http_server_requests_seconds_max # TYPE http_server_requests_seconds_max gauge -http_server_requests_seconds_max{method="GET",outcome="SUCCESS",status="200",uri="/example/prime/{number}",} 0.017385896 +http_server_requests_seconds_max{method="GET",outcome="SUCCESS",status="200",uri="/example/prime/{number}"} 0.017385896 # ---- @@ -398,6 +398,11 @@ string. For example, setting `quarkus.micrometer.binder.http-server.match-patterns=/example/prime/[0-9]+=/example/{jellybeans}` would use the value `/example/{jellybeans}` for the uri attribute any time the requested uri matches `/example/prime/[0-9]+`. +.Exported metrics format + +By default, the metrics are exported using the Prometheus format `application/openmetrics-text`, +you can revert to the former format by specifying the `Accept` request header to `plain/text` (`curl -H "Accept: plain/text" localhost:8080/q/metrics/`). + == Using MeterFilter to configure metrics Micrometer uses `MeterFilter` instances to customize the metrics emitted by `MeterRegistry` instances. diff --git a/docs/src/main/asciidoc/telemetry-micrometer-tutorial.adoc b/docs/src/main/asciidoc/telemetry-micrometer-tutorial.adoc index 57cc8b870a00e..5a2d0068d735f 100644 --- a/docs/src/main/asciidoc/telemetry-micrometer-tutorial.adoc +++ b/docs/src/main/asciidoc/telemetry-micrometer-tutorial.adoc @@ -77,16 +77,21 @@ Dimensional labels are added for the request uri, the HTTP method ---- # HELP http_server_requests_seconds # TYPE http_server_requests_seconds summary -http_server_requests_seconds_count{method="GET",outcome="SUCCESS",status="200",uri="/example/prime/{number}",} 2.0 -http_server_requests_seconds_sum{method="GET",outcome="SUCCESS",status="200",uri="/example/prime/{number}",} 0.017385896 +http_server_requests_seconds_count{method="GET",outcome="SUCCESS",status="200",uri="/example/prime/{number}"} 2.0 +http_server_requests_seconds_sum{method="GET",outcome="SUCCESS",status="200",uri="/example/prime/{number}"} 0.017385896 # HELP http_server_requests_seconds_max # TYPE http_server_requests_seconds_max gauge -http_server_requests_seconds_max{method="GET",outcome="SUCCESS",status="200",uri="/example/prime/{number}",} 0.017385896 +http_server_requests_seconds_max{method="GET",outcome="SUCCESS",status="200",uri="/example/prime/{number}"} 0.017385896 # ---- NOTE: Metrics appear lazily, you often won't see any data for your endpoint until it is accessed. +.Exported metrics format + +By default, the metrics are exported using the Prometheus format `application/openmetrics-text`, +you can revert to the former format by specifying the `Accept` request header to `plain/text` (`curl -H "Accept: plain/text" localhost:8080/q/metrics/`). + == Inject the MeterRegistry To register meters, you need a reference to the `MeterRegistry` that is configured and maintained by the Micrometer extension.