public class LibratoWriter extends AbstractOutputWriter implements OutputWriter
/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. Mandatorytoken": Librato token. MandatorylibratoApiTimeoutInMillis": 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).| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_LIBRATO_API_TIMEOUT_IN_MILLIS |
static String |
DEFAULT_LIBRATO_API_URL |
static String |
DEFAULT_SOURCE |
protected String |
httpUserAgent
|
static String |
METRIC_TYPE_COUNTER |
static String |
METRIC_TYPE_GAUGE |
static String |
SETTING_LIBRATO_API_TIMEOUT_IN_MILLIS |
static String |
SETTING_SOURCE |
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 and Description |
|---|
LibratoWriter() |
| Modifier and Type | Method and Description |
|---|---|
int |
getExceptionCounter() |
void |
serialize(Iterable<QueryResult> counters,
Iterable<QueryResult> gauges,
OutputStream out) |
void |
start()
Load settings
|
void |
write(Iterable<QueryResult> results)
Send given metrics to the Graphite server.
|
equals, getBooleanSetting, getIntSetting, getIntSetting, getLongSetting, getSettings, getStrategy, getStringSetting, getStringSetting, hashCode, isEnabled, setEnabled, setSettings, setStrategy, stop, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetSettings, isEnabled, setEnabled, setSettings, stoppublic static final String METRIC_TYPE_GAUGE
public static final String METRIC_TYPE_COUNTER
public static final String DEFAULT_LIBRATO_API_URL
public static final String SETTING_LIBRATO_API_TIMEOUT_IN_MILLIS
public static final int DEFAULT_LIBRATO_API_TIMEOUT_IN_MILLIS
public static final String SETTING_SOURCE
public static final String DEFAULT_SOURCE
protected final String 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"
public void start()
start in interface OutputWriterstart in class AbstractOutputWriterpublic void write(Iterable<QueryResult> results)
write in interface OutputWriterwrite in class AbstractOutputWriterpublic void serialize(@Nonnull Iterable<QueryResult> counters, @Nonnull Iterable<QueryResult> gauges, @Nonnull OutputStream out) throws IOException
IOExceptionpublic int getExceptionCounter()
Copyright © 2017. All Rights Reserved.