Make the Graphite export protocol configurable
Closes gh-10523
This commit is contained in:
committed by
Andy Wilkinson
parent
7fc272df6e
commit
ff636b58e1
@@ -19,6 +19,8 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.graphite;
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.micrometer.graphite.GraphiteProtocol;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
@@ -29,6 +31,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "spring.metrics.graphite")
|
||||
public class GraphiteProperties {
|
||||
|
||||
/**
|
||||
* Enable publishing to the backend.
|
||||
*/
|
||||
@@ -59,6 +62,11 @@ public class GraphiteProperties {
|
||||
*/
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* Protocol to use while shipping data to Graphite.
|
||||
*/
|
||||
private GraphiteProtocol protocol = GraphiteProtocol.Pickled;
|
||||
|
||||
public Boolean getEnabled() {
|
||||
return this.enabled;
|
||||
}
|
||||
@@ -106,4 +114,13 @@ public class GraphiteProperties {
|
||||
public void setPort(Integer port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public GraphiteProtocol getProtocol() {
|
||||
return this.protocol;
|
||||
}
|
||||
|
||||
public void setProtocol(GraphiteProtocol protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.time.Duration;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.micrometer.graphite.GraphiteConfig;
|
||||
import io.micrometer.graphite.GraphiteProtocol;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.metrics.export.PropertiesConfigAdapter;
|
||||
|
||||
@@ -74,4 +75,9 @@ class GraphitePropertiesConfigAdapter
|
||||
return get(GraphiteProperties::getPort, GraphiteConfig::port);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphiteProtocol protocol() {
|
||||
return get(GraphiteProperties::getProtocol, GraphiteConfig::protocol);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user