Class GraphiteClient
- java.lang.Object
-
- org.pipecraft.infra.monitoring.graphite.GraphiteClient
-
public class GraphiteClient extends Object
A simple graphite client that sends metrics to graphite server.- Author:
- Michal Rockban
-
-
Constructor Summary
Constructors Constructor Description GraphiteClient(String host, int port, String rootPath)C-tor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected longgetCurrentTimestamp()voidsendMetric(String key, Number value)Sends the metric to graphite, under environment root path, in the current timestamp.voidsendMetric(String key, Number value, long timestamp)Sends the metric to graphite, under environment root path, in the given timestamp.voidsendMetrics(Map<String,? extends Number> metrics)Sends the metrics to graphite, under environment root path, in the current timestamp.voidsendMetrics(Map<String,? extends Number> metrics, long timestamp)Sends the metric to graphite, under environment root path
-
-
-
Method Detail
-
sendMetric
public void sendMetric(String key, Number value) throws GraphiteException
Sends the metric to graphite, under environment root path, in the current timestamp.- Parameters:
key- metric pathvalue- metric value- Throws:
GraphiteException
-
sendMetrics
public void sendMetrics(Map<String,? extends Number> metrics) throws GraphiteException
Sends the metrics to graphite, under environment root path, in the current timestamp.- Parameters:
metrics- metric path and key map- Throws:
GraphiteException
-
sendMetrics
public void sendMetrics(Map<String,? extends Number> metrics, long timestamp) throws GraphiteException
Sends the metric to graphite, under environment root path- Parameters:
metrics- metric path and key maptimestamp- the timestampe, in seconds since epoch.- Throws:
GraphiteException
-
sendMetric
public void sendMetric(String key, Number value, long timestamp) throws GraphiteException
Sends the metric to graphite, under environment root path, in the given timestamp.- Parameters:
key- metric pathvalue- metric valuetimestamp- the timestamp (in seconds since epoch)- Throws:
GraphiteException
-
getCurrentTimestamp
protected long getCurrentTimestamp()
-
-