Package org.jmxtrans.embedded.output
Class LibratoWriter
java.lang.Object
org.jmxtrans.embedded.output.AbstractOutputWriter
org.jmxtrans.embedded.output.LibratoWriter
- All Implemented Interfaces:
OutputWriter
public class LibratoWriter extends AbstractOutputWriter implements OutputWriter
Librato Metrics implementation of the OutputWriter.
This implementation uses
POST
/v1/metrics HTTP API.
LibratoWriter uses the "query.attribute.type" configuration parameter (via
QueryResult.getType()) to publish the metrics.
Supported types are "counter" and "gauge".
If the type is null or unsupported, metric is exported
as "counter".
Settings:
- "
url": Librato server URL. Optional, default value: "https://metrics-api.librato.com/v1/metrics". - "
user": Librato user. Mandatory - "
token": Librato token. Mandatory - "
libratoApiTimeoutInMillis": read timeout of the calls to Librato HTTP API. Optional, default value: 1000. - "
enabled": flag to enable/disable the writer. Optional, default value: {$code true}. - "
source": Librato . Optional, default value: "#hostname#" (the hostname of the server).
- Author:
- Cyrille Le Clerc
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_LIBRATO_API_TIMEOUT_IN_MILLISstatic StringDEFAULT_LIBRATO_API_URLstatic StringDEFAULT_SOURCEprotected StringhttpUserAgentstatic StringMETRIC_TYPE_COUNTERstatic StringMETRIC_TYPE_GAUGEstatic StringSETTING_LIBRATO_API_TIMEOUT_IN_MILLISstatic StringSETTING_SOURCEFields inherited from class org.jmxtrans.embedded.output.AbstractOutputWriter
SETTING_HOST, SETTING_NAME_PREFIX, SETTING_PORT, SETTING_PROTOCOL, SETTING_PROXY_HOST, SETTING_PROXY_PORT, SETTING_SOCKET_FACTORY, SETTING_TLS_INSECURE, SETTING_TLS_KEY_STORE, SETTING_TLS_KEY_STORE_PASSWORD, SETTING_TLS_TRUST_STORE, SETTING_TLS_TRUST_STORE_PASSWORD, SETTING_TOKEN, SETTING_URL, SETTING_USE_TLS, SETTING_USERNAME -
Constructor Summary
Constructors Constructor Description LibratoWriter() -
Method Summary
Modifier and Type Method Description intgetExceptionCounter()voidserialize(Iterable<QueryResult> counters, Iterable<QueryResult> gauges, OutputStream out)voidstart()Load settingsvoidwrite(Iterable<QueryResult> results)Send given metrics to the Graphite server.Methods inherited from class org.jmxtrans.embedded.output.AbstractOutputWriter
equals, getBooleanSetting, getIntSetting, getIntSetting, getLongSetting, getSettings, getStrategy, getStringSetting, getStringSetting, hashCode, isEnabled, setEnabled, setSettings, setStrategy, stop, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jmxtrans.embedded.output.OutputWriter
getSettings, isEnabled, setEnabled, setSettings, stop
-
Field Details
-
METRIC_TYPE_GAUGE
- See Also:
- Constant Field Values
-
METRIC_TYPE_COUNTER
- See Also:
- Constant Field Values
-
DEFAULT_LIBRATO_API_URL
- See Also:
- Constant Field Values
-
SETTING_LIBRATO_API_TIMEOUT_IN_MILLIS
- See Also:
- Constant Field Values
-
DEFAULT_LIBRATO_API_TIMEOUT_IN_MILLIS
public static final int DEFAULT_LIBRATO_API_TIMEOUT_IN_MILLIS- See Also:
- Constant Field Values
-
SETTING_SOURCE
- See Also:
- Constant Field Values
-
DEFAULT_SOURCE
- See Also:
- Constant Field Values
-
httpUserAgent
See How to set a custom User Agent when integrating with Librato
TODO discover embedded-jmxtrans' version from maven's embedded pom.xml instead of hardcoding "1"
-
-
Constructor Details
-
LibratoWriter
public LibratoWriter()
-
-
Method Details
-
start
public void start()Load settings- Specified by:
startin interfaceOutputWriter- Overrides:
startin classAbstractOutputWriter
-
write
Send given metrics to the Graphite server.- Specified by:
writein interfaceOutputWriter- Specified by:
writein classAbstractOutputWriter
-
serialize
public void serialize(@Nonnull Iterable<QueryResult> counters, @Nonnull Iterable<QueryResult> gauges, @Nonnull OutputStream out) throws IOException- Throws:
IOException
-
getExceptionCounter
public int getExceptionCounter()
-