Package com.codahale.metrics.graphite
Class GraphiteRabbitMQ
java.lang.Object
com.codahale.metrics.graphite.GraphiteRabbitMQ
- All Implemented Interfaces:
GraphiteSender,Closeable,AutoCloseable
A rabbit-mq client to a Carbon server.
-
Constructor Summary
ConstructorsConstructorDescriptionGraphiteRabbitMQ(com.rabbitmq.client.ConnectionFactory connectionFactory, String exchange) Creates a new client with a given aConnectionFactoryand an amqp exchangeGraphiteRabbitMQ(String rabbitHost, Integer rabbitPort, String rabbitUsername, String rabbitPassword, String exchange) Creates a new client given connection detailsGraphiteRabbitMQ(String rabbitHost, Integer rabbitPort, String rabbitUsername, String rabbitPassword, String exchange, Integer rabbitConnectionTimeoutMS, Integer rabbitSocketTimeoutMS, Integer rabbitRequestedHeartbeatInSeconds) Creates a new client given connection details -
Method Summary
-
Constructor Details
-
GraphiteRabbitMQ
Creates a new client with a given aConnectionFactoryand an amqp exchange- Parameters:
connectionFactory- theConnectionFactoryused to establish connection and publish to graphite serverexchange- the amqp exchange
-
GraphiteRabbitMQ
public GraphiteRabbitMQ(String rabbitHost, Integer rabbitPort, String rabbitUsername, String rabbitPassword, String exchange) Creates a new client given connection details- Parameters:
rabbitHost- the rabbitmq server hostrabbitPort- the rabbitmq server portrabbitUsername- the rabbitmq server usernamerabbitPassword- the rabbitmq server passwordexchange- the amqp exchange
-
GraphiteRabbitMQ
public GraphiteRabbitMQ(String rabbitHost, Integer rabbitPort, String rabbitUsername, String rabbitPassword, String exchange, Integer rabbitConnectionTimeoutMS, Integer rabbitSocketTimeoutMS, Integer rabbitRequestedHeartbeatInSeconds) Creates a new client given connection details- Parameters:
rabbitHost- the rabbitmq server hostrabbitPort- the rabbitmq server portrabbitUsername- the rabbitmq server usernamerabbitPassword- the rabbitmq server passwordexchange- the amqp exchangerabbitConnectionTimeoutMS- the connection timeout in millisecondsrabbitSocketTimeoutMS- the socket timeout in millisecondsrabbitRequestedHeartbeatInSeconds- the hearthbeat in seconds
-
-
Method Details
-
connect
Description copied from interface:GraphiteSenderConnects to the server.- Specified by:
connectin interfaceGraphiteSender- Throws:
IllegalStateException- if the client is already connectedIOException- if there is an error connecting
-
isConnected
public boolean isConnected()Description copied from interface:GraphiteSenderReturns true if ready to send data- Specified by:
isConnectedin interfaceGraphiteSender
-
send
Description copied from interface:GraphiteSenderSends the given measurement to the server.- Specified by:
sendin interfaceGraphiteSender- Parameters:
name- the name of the metricvalue- the value of the metrictimestamp- the timestamp of the metric- Throws:
IOException- if there was an error sending the metric
-
flush
Description copied from interface:GraphiteSenderFlushes buffer, if applicable- Specified by:
flushin interfaceGraphiteSender- Throws:
IOException- if there was an error during flushing metrics to the socket
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getFailures
public int getFailures()Description copied from interface:GraphiteSenderReturns the number of failed writes to the server.- Specified by:
getFailuresin interfaceGraphiteSender- Returns:
- the number of failed writes to the server
-
sanitize
-