parent
571c50e43f
commit
b4f8361989
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue