Adding Graphite support to Spring Boot Actuator

I made a very simple Graphite implementation of the MetricWriter interface, you can see the code in my GitHub repo spring-boot-actuator-graphite.

If you want to use it in a production environment please be aware that it does open and close a new Socket connection for each metric measurement.

Assuming you have a Spring Boot Actuator project, below is an example @Configuration class to enable writing your metrics to Graphite.

public class MonitoringConfiguration {

    private String prefix;

    private String host;

    private int port;

    public MetricsEndpointMetricReader metricsEndpointMetricReader(MetricsEndpoint metricsEndpoint) {
        return new MetricsEndpointMetricReader(metricsEndpoint);

    MetricWriter metricWriter() {
        return new GraphiteMetricWriter(this.prefix,, this.port);