Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
da5e8d70
Commit
da5e8d70
authored
Jun 05, 2020
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Support filtered scrape for Prometheus"
See gh-21545
parent
cd1baf18
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
7 deletions
+21
-7
prometheus.adoc
...autoconfigure/src/docs/asciidoc/endpoints/prometheus.adoc
+19
-5
PrometheusScrapeEndpointDocumentationTests.java
...mentation/PrometheusScrapeEndpointDocumentationTests.java
+2
-2
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/prometheus.adoc
View file @
da5e8d70
...
...
@@ -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[]
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/PrometheusScrapeEndpointDocumentationTests.java
View file @
da5e8d70
...
...
@@ -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
())));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment