Commit da5e8d70 authored by Stephane Nicoll's avatar Stephane Nicoll

Polish "Support filtered scrape for Prometheus"

See gh-21545
parent cd1baf18
...@@ -6,15 +6,15 @@ The `prometheus` endpoint provides Spring Boot application's metrics in the form ...@@ -6,15 +6,15 @@ The `prometheus` endpoint provides Spring Boot application's metrics in the form
[[prometheus-retrieving]] [[prometheus-retrieving]]
== Retrieving the Metrics == Retrieving All Metrics
To retrieve the metrics, make a `GET` request to `/actuator/prometheus`, as shown in the following curl-based example: To retrieve all metrics, make a `GET` request to `/actuator/prometheus`, as shown in the following curl-based example:
include::{snippets}/prometheus/curl-request.adoc[] include::{snippets}/prometheus/all/curl-request.adoc[]
The resulting response is similar to the following: The resulting response is similar to the following:
include::{snippets}/prometheus/http-response.adoc[] include::{snippets}/prometheus/all/http-response.adoc[]
...@@ -25,4 +25,18 @@ The endpoint uses query parameters to limit the samples that it returns. ...@@ -25,4 +25,18 @@ The endpoint uses query parameters to limit the samples that it returns.
The following table shows the supported query parameters: The following table shows the supported query parameters:
[cols="2,4"] [cols="2,4"]
include::{snippets}/prometheus/request-parameters.adoc[] include::{snippets}/prometheus/names/request-parameters.adoc[]
[[prometheus-retrieving-names]]
== Retrieving Filtered Metrics
To retrieve metrics matching specific names, make a `GET` request to `/actuator/prometheus` with the `includedNames` query parameter, as shown in the following curl-based example:
include::{snippets}/prometheus/names/curl-request.adoc[]
The resulting response is similar to the following:
include::{snippets}/prometheus/names/http-response.adoc[]
...@@ -43,7 +43,7 @@ class PrometheusScrapeEndpointDocumentationTests extends MockMvcEndpointDocument ...@@ -43,7 +43,7 @@ class PrometheusScrapeEndpointDocumentationTests extends MockMvcEndpointDocument
@Test @Test
void prometheus() throws Exception { void prometheus() throws Exception {
this.mockMvc.perform(get("/actuator/prometheus")).andExpect(status().isOk()).andDo(document("prometheus")); this.mockMvc.perform(get("/actuator/prometheus")).andExpect(status().isOk()).andDo(document("prometheus/all"));
} }
@Test @Test
...@@ -52,7 +52,7 @@ class PrometheusScrapeEndpointDocumentationTests extends MockMvcEndpointDocument ...@@ -52,7 +52,7 @@ class PrometheusScrapeEndpointDocumentationTests extends MockMvcEndpointDocument
.perform(get("/actuator/prometheus").param("includedNames", .perform(get("/actuator/prometheus").param("includedNames",
"jvm_memory_used_bytes,jvm_memory_committed_bytes")) "jvm_memory_used_bytes,jvm_memory_committed_bytes"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andDo(document("prometheus", requestParameters(parameterWithName("includedNames") .andDo(document("prometheus/names", requestParameters(parameterWithName("includedNames")
.description("Restricts the samples to those that match the names. Optional.").optional()))); .description("Restricts the samples to those that match the names. Optional.").optional())));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment