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
a8c026a5
Commit
a8c026a5
authored
Apr 06, 2020
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose Prometheus#histogramFlavor property
Closes gh-20853
parent
f64f5a0f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
3 deletions
+29
-3
PrometheusProperties.java
...igure/metrics/export/prometheus/PrometheusProperties.java
+16
-1
PrometheusPropertiesConfigAdapter.java
.../export/prometheus/PrometheusPropertiesConfigAdapter.java
+7
-1
additional-spring-configuration-metadata.json
...es/META-INF/additional-spring-configuration-metadata.json
+4
-0
PrometheusPropertiesTests.java
.../metrics/export/prometheus/PrometheusPropertiesTests.java
+2
-1
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusProperties.java
View file @
a8c026a5
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -20,6 +20,8 @@ import java.time.Duration;
...
@@ -20,6 +20,8 @@ import java.time.Duration;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
io.micrometer.prometheus.HistogramFlavor
;
import
org.springframework.boot.actuate.metrics.export.prometheus.PrometheusPushGatewayManager.ShutdownOperation
;
import
org.springframework.boot.actuate.metrics.export.prometheus.PrometheusPushGatewayManager.ShutdownOperation
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
...
@@ -46,6 +48,11 @@ public class PrometheusProperties {
...
@@ -46,6 +48,11 @@ public class PrometheusProperties {
*/
*/
private
final
Pushgateway
pushgateway
=
new
Pushgateway
();
private
final
Pushgateway
pushgateway
=
new
Pushgateway
();
/**
* Histogram type for backing DistributionSummary and Timer.
*/
private
HistogramFlavor
histogramFlavor
=
HistogramFlavor
.
Prometheus
;
/**
/**
* Step size (i.e. reporting frequency) to use.
* Step size (i.e. reporting frequency) to use.
*/
*/
...
@@ -59,6 +66,14 @@ public class PrometheusProperties {
...
@@ -59,6 +66,14 @@ public class PrometheusProperties {
this
.
descriptions
=
descriptions
;
this
.
descriptions
=
descriptions
;
}
}
public
HistogramFlavor
getHistogramFlavor
()
{
return
this
.
histogramFlavor
;
}
public
void
setHistogramFlavor
(
HistogramFlavor
histogramFlavor
)
{
this
.
histogramFlavor
=
histogramFlavor
;
}
public
Duration
getStep
()
{
public
Duration
getStep
()
{
return
this
.
step
;
return
this
.
step
;
}
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusPropertiesConfigAdapter.java
View file @
a8c026a5
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -18,6 +18,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.prometheus
...
@@ -18,6 +18,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.prometheus
import
java.time.Duration
;
import
java.time.Duration
;
import
io.micrometer.prometheus.HistogramFlavor
;
import
io.micrometer.prometheus.PrometheusConfig
;
import
io.micrometer.prometheus.PrometheusConfig
;
import
org.springframework.boot.actuate.autoconfigure.metrics.export.properties.PropertiesConfigAdapter
;
import
org.springframework.boot.actuate.autoconfigure.metrics.export.properties.PropertiesConfigAdapter
;
...
@@ -45,6 +46,11 @@ class PrometheusPropertiesConfigAdapter extends PropertiesConfigAdapter<Promethe
...
@@ -45,6 +46,11 @@ class PrometheusPropertiesConfigAdapter extends PropertiesConfigAdapter<Promethe
return
get
(
PrometheusProperties:
:
isDescriptions
,
PrometheusConfig
.
super
::
descriptions
);
return
get
(
PrometheusProperties:
:
isDescriptions
,
PrometheusConfig
.
super
::
descriptions
);
}
}
@Override
public
HistogramFlavor
histogramFlavor
()
{
return
get
(
PrometheusProperties:
:
getHistogramFlavor
,
PrometheusConfig
.
super
::
histogramFlavor
);
}
@Override
@Override
public
Duration
step
()
{
public
Duration
step
()
{
return
get
(
PrometheusProperties:
:
getStep
,
PrometheusConfig
.
super
::
step
);
return
get
(
PrometheusProperties:
:
getStep
,
PrometheusConfig
.
super
::
step
);
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json
View file @
a8c026a5
...
@@ -328,6 +328,10 @@
...
@@ -328,6 +328,10 @@
"description"
:
"Whether exporting of metrics to Prometheus is enabled."
,
"description"
:
"Whether exporting of metrics to Prometheus is enabled."
,
"defaultValue"
:
true
"defaultValue"
:
true
},
},
{
"name"
:
"management.metrics.export.prometheus.histogram-flavor"
,
"defaultValue"
:
"prometheus"
},
{
{
"name"
:
"management.metrics.export.signalfx.num-threads"
,
"name"
:
"management.metrics.export.signalfx.num-threads"
,
"type"
:
"java.lang.Integer"
,
"type"
:
"java.lang.Integer"
,
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusPropertiesTests.java
View file @
a8c026a5
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -33,6 +33,7 @@ class PrometheusPropertiesTests {
...
@@ -33,6 +33,7 @@ class PrometheusPropertiesTests {
PrometheusProperties
properties
=
new
PrometheusProperties
();
PrometheusProperties
properties
=
new
PrometheusProperties
();
PrometheusConfig
config
=
PrometheusConfig
.
DEFAULT
;
PrometheusConfig
config
=
PrometheusConfig
.
DEFAULT
;
assertThat
(
properties
.
isDescriptions
()).
isEqualTo
(
config
.
descriptions
());
assertThat
(
properties
.
isDescriptions
()).
isEqualTo
(
config
.
descriptions
());
assertThat
(
properties
.
getHistogramFlavor
()).
isEqualTo
(
config
.
histogramFlavor
());
assertThat
(
properties
.
getStep
()).
isEqualTo
(
config
.
step
());
assertThat
(
properties
.
getStep
()).
isEqualTo
(
config
.
step
());
}
}
...
...
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