Class AbstractOutputWriter

java.lang.Object
org.jmxtrans.agent.AbstractOutputWriter
All Implemented Interfaces:
OutputWriter
Direct Known Subclasses:
ConsoleOutputWriter, DevNullOutputWriter, FileOverwriterOutputWriter, GraphitePlainTextTcpOutputWriter, GraphiteUdpOutputWriter, InfluxDbOutputWriter, LibratoWriter, OutputWritersChain, PerMinuteSummarizerOutputWriter, RollingFileOutputWriter, StackdriverWriter, StatsDOutputWriter, ZabbixTcpOutputWriter

public abstract class AbstractOutputWriter
extends java.lang.Object
implements OutputWriter
Author:
Cyrille Le Clerc
  • Field Summary

    Fields
    Modifier and Type Field Description
    protected Logger logger  
    static java.lang.String SETTING_LOG_LEVEL
    Define the level of log message to display tweaking java.util.logging configuration.
    static java.lang.String SETTING_LOG_LEVEL_DEFAULT_VALUE  
  • Constructor Summary

    Constructors
    Constructor Description
    AbstractOutputWriter()  
  • Method Summary

    Modifier and Type Method Description
    protected java.util.logging.Level getDebugLevel()
    To workaround the complex configuration of java.util.logging, we tweak the level for "debug style" messages using the "logLevel" initialization parameter.
    protected java.util.logging.Level getInfoLevel()
    To workaround the complex configuration of java.util.logging, we tweak the level for "info style" messages using the "logLevel" initialization parameter.
    protected java.util.logging.Level getTraceLevel()
    To workaround the complex configuration of java.util.logging, we tweak the level for "trace style" messages using the "logLevel" initialization parameter.
    void postCollect()
    called after a serie of writes, typically at the end of a collection.
    void postConstruct​(java.util.Map<java.lang.String,​java.lang.String> settings)  
    void preCollect()
    Called before metrics collection starts
    void preDestroy()  
    abstract void writeInvocationResult​(java.lang.String invocationName, java.lang.Object value)  
    abstract void writeQueryResult​(java.lang.String metricName, java.lang.String metricType, java.lang.Object value)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SETTING_LOG_LEVEL

      public static final java.lang.String SETTING_LOG_LEVEL
      Define the level of log message to display tweaking java.util.logging configuration. Supported values are INFO
      See Also:
      Constant Field Values
    • SETTING_LOG_LEVEL_DEFAULT_VALUE

      public static final java.lang.String SETTING_LOG_LEVEL_DEFAULT_VALUE
      See Also:
      Constant Field Values
    • logger

      protected final Logger logger
  • Constructor Details

    • AbstractOutputWriter

      public AbstractOutputWriter()
  • Method Details

    • postConstruct

      public void postConstruct​(@Nonnull java.util.Map<java.lang.String,​java.lang.String> settings)
      Specified by:
      postConstruct in interface OutputWriter
    • preDestroy

      public void preDestroy()
      Specified by:
      preDestroy in interface OutputWriter
    • postCollect

      public void postCollect() throws java.io.IOException
      Description copied from interface: OutputWriter

      called after a serie of writes, typically at the end of a collection.

      Useful with batch writers.

      Specified by:
      postCollect in interface OutputWriter
      Throws:
      java.io.IOException
    • preCollect

      public void preCollect() throws java.io.IOException
      Description copied from interface: OutputWriter
      Called before metrics collection starts
      Specified by:
      preCollect in interface OutputWriter
      Throws:
      java.io.IOException
    • writeInvocationResult

      public abstract void writeInvocationResult​(@Nonnull java.lang.String invocationName, @Nullable java.lang.Object value) throws java.io.IOException
      Specified by:
      writeInvocationResult in interface OutputWriter
      Throws:
      java.io.IOException
    • writeQueryResult

      public abstract void writeQueryResult​(@Nonnull java.lang.String metricName, @Nullable java.lang.String metricType, @Nullable java.lang.Object value) throws java.io.IOException
      Specified by:
      writeQueryResult in interface OutputWriter
      metricType - see Query.type
      Throws:
      java.io.IOException
    • getDebugLevel

      @Nonnull protected java.util.logging.Level getDebugLevel()
      To workaround the complex configuration of java.util.logging, we tweak the level for "debug style" messages using the "logLevel" initialization parameter.
    • getTraceLevel

      @Nonnull protected java.util.logging.Level getTraceLevel()
      To workaround the complex configuration of java.util.logging, we tweak the level for "trace style" messages using the "logLevel" initialization parameter.
    • getInfoLevel

      @Nonnull protected java.util.logging.Level getInfoLevel()
      To workaround the complex configuration of java.util.logging, we tweak the level for "info style" messages using the "logLevel" initialization parameter.