Polish "Support filtered scrape for Prometheus"
See gh-21545
This commit is contained in:
@@ -6,15 +6,15 @@ The `prometheus` endpoint provides Spring Boot application's metrics in the form
|
||||
|
||||
|
||||
[[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:
|
||||
|
||||
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.
|
||||
The following table shows the supported query parameters:
|
||||
|
||||
[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
|
||||
|
||||
@Test
|
||||
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
|
||||
@@ -52,7 +52,7 @@ class PrometheusScrapeEndpointDocumentationTests extends MockMvcEndpointDocument
|
||||
.perform(get("/actuator/prometheus").param("includedNames",
|
||||
"jvm_memory_used_bytes,jvm_memory_committed_bytes"))
|
||||
.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())));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user