Package io.prometheus.client.bridge
Class Graphite
- java.lang.Object
-
- io.prometheus.client.bridge.Graphite
-
public class Graphite extends java.lang.Object
Export metrics in the Graphite plaintext format.Graphite g = new Graphite("localhost", 2003); // Push the default registry once. g.push(CollectorRegistry.defaultRegistry); // Push the default registry every 60 seconds. Thread thread = g.start(CollectorRegistry.defaultRegistry, 60); // Stop pushing. thread.interrupt(); thread.join();
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
Graphite.PushThread
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
host
private static java.util.regex.Pattern
INVALID_GRAPHITE_CHARS
private static java.util.logging.Logger
logger
private int
port
-
Constructor Summary
Constructors Constructor Description Graphite(java.lang.String host, int port)
Construct a Graphite Bridge with the given host:port.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
push(CollectorRegistry registry)
Push samples from the given registry to Graphite.java.lang.Thread
start(CollectorRegistry registry)
Push samples from the given registry to Graphite every minute.java.lang.Thread
start(CollectorRegistry registry, int intervalSeconds)
Push samples from the given registry to Graphite at the given interval.
-
-
-
Method Detail
-
push
public void push(CollectorRegistry registry) throws java.io.IOException
Push samples from the given registry to Graphite.- Throws:
java.io.IOException
-
start
public java.lang.Thread start(CollectorRegistry registry)
Push samples from the given registry to Graphite every minute.
-
start
public java.lang.Thread start(CollectorRegistry registry, int intervalSeconds)
Push samples from the given registry to Graphite at the given interval.
-
-