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
b4f83619
Commit
b4f83619
authored
Jun 05, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make JMX metrics domain configurable
Closes gh-13356
parent
571c50e4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
4 deletions
+32
-4
JmxProperties.java
...tuate/autoconfigure/metrics/export/jmx/JmxProperties.java
+13
-0
JmxPropertiesConfigAdapter.java
...figure/metrics/export/jmx/JmxPropertiesConfigAdapter.java
+6
-0
JmxPropertiesTests.java
.../autoconfigure/metrics/export/jmx/JmxPropertiesTests.java
+1
-0
appendix-application-properties.adoc
...cs/src/main/asciidoc/appendix-application-properties.adoc
+1
-0
production-ready-features.adoc
...oot-docs/src/main/asciidoc/production-ready-features.adoc
+11
-4
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/jmx/JmxProperties.java
View file @
b4f83619
...
...
@@ -30,11 +30,24 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties
(
prefix
=
"management.metrics.export.jmx"
)
public
class
JmxProperties
{
/**
* Metrics JMX domain name.
*/
private
String
domain
=
"metrics"
;
/**
* Step size (i.e. reporting frequency) to use.
*/
private
Duration
step
=
Duration
.
ofMinutes
(
1
);
public
String
getDomain
()
{
return
this
.
domain
;
}
public
void
setDomain
(
String
domain
)
{
this
.
domain
=
domain
;
}
public
Duration
getStep
()
{
return
this
.
step
;
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/jmx/JmxPropertiesConfigAdapter.java
View file @
b4f83619
...
...
@@ -26,6 +26,7 @@ import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.
* Adapter to convert {@link JmxProperties} to a {@link JmxConfig}.
*
* @author Jon Schneider
* @author Stephane Nicoll
*/
class
JmxPropertiesConfigAdapter
extends
PropertiesConfigAdapter
<
JmxProperties
>
implements
JmxConfig
{
...
...
@@ -39,6 +40,11 @@ class JmxPropertiesConfigAdapter extends PropertiesConfigAdapter<JmxProperties>
return
null
;
}
@Override
public
String
domain
()
{
return
get
(
JmxProperties:
:
getDomain
,
JmxConfig
.
super
::
domain
);
}
@Override
public
Duration
step
()
{
return
get
(
JmxProperties:
:
getStep
,
JmxConfig
.
super
::
step
);
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/jmx/JmxPropertiesTests.java
View file @
b4f83619
...
...
@@ -32,6 +32,7 @@ public class JmxPropertiesTests {
public
void
defaultValuesAreConsistent
()
{
JmxProperties
properties
=
new
JmxProperties
();
JmxConfig
config
=
JmxConfig
.
DEFAULT
;
assertThat
(
properties
.
getDomain
()).
isEqualTo
(
config
.
domain
());
assertThat
(
properties
.
getStep
()).
isEqualTo
(
config
.
step
());
}
...
...
spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
View file @
b4f83619
...
...
@@ -1375,6 +1375,7 @@ content into your application. Rather, pick only the properties that you need.
management.metrics.export.influx.step=1m # Step size (i.e. reporting frequency) to use.
management.metrics.export.influx.uri=http://localhost:8086 # URI of the Influx server.
management.metrics.export.influx.user-name= # Login user of the Influx server.
management.metrics.export.jmx.domain=metrics # Metrics JMX domain name.
management.metrics.export.jmx.enabled=true # Whether exporting of metrics to JMX is enabled.
management.metrics.export.jmx.step=1m # Step size (i.e. reporting frequency) to use.
management.metrics.export.newrelic.account-id= # New Relic account ID.
...
...
spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc
View file @
b4f83619
...
...
@@ -1470,10 +1470,17 @@ server] to use can be provided using:
==== JMX
Micrometer provides a hierarchical mapping to
{micrometer-registry-documentation}/jmx[JMX], primarily as a cheap and portable way to
view metrics locally. Micrometer provides a default `HierarchicalNameMapper` that governs
how a dimensional meter id is
{micrometer-registry-documentation}/jmx#_hierarchical_name_mapping[mapped to flat
hierarchical names].
view metrics locally.By default, metrics are exported to the `metrics` JMX domain. The
domain to use can be provided provided using:
[source,properties,indent=0]
----
management.metrics.export.jmx.domain=com.example.app.metrics
----
Micrometer provides a default `HierarchicalNameMapper` that governs how a dimensional
meter id is {micrometer-registry-documentation}/jmx#_hierarchical_name_mapping[mapped to
flat hierarchical names].
TIP: To take control over this behaviour, define your `JmxMeterRegistry` and supply your
own `HierarchicalNameMapper`. An auto-configured `JmxConfig` and `Clock` beans are
...
...
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