public abstract class OpenTSDBGenericWriter extends BaseOutputWriter
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_MERGE_TYPE_NAMES_TAGS |
protected String |
host |
protected OpenTSDBMessageFormatter |
messageFormatter |
protected Integer |
port |
BINARY_PATH, BOOLEAN_AS_NUMBER, DEBUG, HOST, OUTPUT_FILE, PORT, TEMPLATE_FILE, TYPE_NAMES| Constructor and Description |
|---|
OpenTSDBGenericWriter(com.google.common.collect.ImmutableList<String> typeNames,
boolean booleanAsNumber,
Boolean debugEnabled,
String host,
Integer port,
Map<String,String> tags,
String tagName,
Boolean mergeTypeNamesTags,
String metricNamingExpression,
Boolean addHostnameTag,
Map<String,Object> settings) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected void |
finishOutput()
Complete a batch of results output, if needed.
|
protected abstract boolean |
getAddHostnameTagDefault()
Subclass responsibility: specify the default value for the "addHostnameTag" setting.
|
void |
internalWrite(Server server,
Query query,
com.google.common.collect.ImmutableList<Result> results)
Write the results of the query.
|
protected void |
prepareSender()
Prepare for sending metrics, if needed.
|
protected abstract void |
sendOutput(String metricLine)
Subcall responsibility: method to perform the actual output for the given metric line.
|
protected void |
shutdownSender()
Shutdown the sender, if needed.
|
void |
start()
Start the output writer.
|
protected void |
startOutput()
Prepare a batch of results output, if needed.
|
void |
validateSetup(Server server,
Query query)
Validation per query, after the writer has been start()ed
|
create, doWrite, firstNonNull, getConcatedTypeNameValues, getSettings, getTypeNames, isDebugEnabled, toStringpublic static final boolean DEFAULT_MERGE_TYPE_NAMES_TAGS
protected final String host
protected final Integer port
protected final OpenTSDBMessageFormatter messageFormatter
public OpenTSDBGenericWriter(com.google.common.collect.ImmutableList<String> typeNames, boolean booleanAsNumber, Boolean debugEnabled, String host, Integer port, Map<String,String> tags, String tagName, Boolean mergeTypeNamesTags, String metricNamingExpression, Boolean addHostnameTag, Map<String,Object> settings) throws LifecycleException
LifecycleExceptionprotected void prepareSender()
throws LifecycleException
LifecycleExceptionprotected void shutdownSender()
throws LifecycleException
LifecycleExceptionprotected void startOutput()
throws IOException
IOExceptionprotected abstract boolean getAddHostnameTagDefault()
protected abstract void sendOutput(String metricLine) throws IOException
metricLine - - the line containing the metric name, value, and tags for a single metric; excludes the
"put" keyword expected by OpenTSDB and the trailing newline character.IOExceptionprotected void finishOutput()
throws IOException
IOExceptionpublic void internalWrite(Server server, Query query, com.google.common.collect.ImmutableList<Result> results) throws Exception
internalWrite in class BaseOutputWriterserver - query - - the query and its results.results - Exceptionpublic void validateSetup(Server server, Query query) throws ValidationException
ValidationExceptionpublic void start()
throws LifecycleException
start in interface OutputWriterstart in class BaseOutputWriterLifecycleExceptionpublic void close()
throws LifecycleException
close in interface OutputWriterclose in interface AutoCloseableclose in class BaseOutputWriterLifecycleExceptionCopyright © 2010-2017 JmxTrans team. All Rights Reserved.