From 7ab8392e57bbc8cf12fff65b8f824c95d771e094 Mon Sep 17 00:00:00 2001 From: Yann ROBERT Date: Mon, 15 Jun 2015 19:22:51 +0200 Subject: [PATCH] marked all of the OutputWriter implementations with a marker interface, for documentation. --- .../jmxtrans/embedded/output/ConsoleWriter.java | 1 + .../embedded/output/CopperEggWriter.java | 1 + .../org/jmxtrans/embedded/output/CsvWriter.java | 1 + .../jmxtrans/embedded/output/ExplicitEpoch.java | 13 +++++++++++++ .../embedded/output/GraphiteHttpWriter.java | 1 + .../embedded/output/GraphitePickleWriter.java | 1 + .../embedded/output/GraphiteWriter.java | 1 + .../jmxtrans/embedded/output/ImplicitEpoch.java | 17 +++++++++++++++++ .../jmxtrans/embedded/output/LibratoWriter.java | 1 + .../jmxtrans/embedded/output/NoOpWriter.java | 1 + .../jmxtrans/embedded/output/Slf4jWriter.java | 1 + .../embedded/output/StackdriverWriter.java | 1 + .../jmxtrans/embedded/output/StatsDWriter.java | 1 + 13 files changed, 41 insertions(+) create mode 100644 src/main/java/org/jmxtrans/embedded/output/ExplicitEpoch.java create mode 100644 src/main/java/org/jmxtrans/embedded/output/ImplicitEpoch.java diff --git a/src/main/java/org/jmxtrans/embedded/output/ConsoleWriter.java b/src/main/java/org/jmxtrans/embedded/output/ConsoleWriter.java index b699c1bc..f6b95357 100644 --- a/src/main/java/org/jmxtrans/embedded/output/ConsoleWriter.java +++ b/src/main/java/org/jmxtrans/embedded/output/ConsoleWriter.java @@ -44,6 +44,7 @@ * * @author Cyrille Le Clerc */ +@ExplicitEpoch public class ConsoleWriter extends AbstractOutputWriter implements OutputWriter { /** diff --git a/src/main/java/org/jmxtrans/embedded/output/CopperEggWriter.java b/src/main/java/org/jmxtrans/embedded/output/CopperEggWriter.java index 35db2c3a..63f5a7a8 100644 --- a/src/main/java/org/jmxtrans/embedded/output/CopperEggWriter.java +++ b/src/main/java/org/jmxtrans/embedded/output/CopperEggWriter.java @@ -96,6 +96,7 @@ * CopperEggWriter.java was derived from LibratoWriter.java * @author Scott Johnson */ +@ExplicitEpoch public class CopperEggWriter extends AbstractOutputWriter implements OutputWriter { public static final String METRIC_TYPE_GAUGE = "gauge"; public static final String METRIC_TYPE_COUNTER = "counter"; diff --git a/src/main/java/org/jmxtrans/embedded/output/CsvWriter.java b/src/main/java/org/jmxtrans/embedded/output/CsvWriter.java index aeabc7b9..fedd1200 100644 --- a/src/main/java/org/jmxtrans/embedded/output/CsvWriter.java +++ b/src/main/java/org/jmxtrans/embedded/output/CsvWriter.java @@ -55,6 +55,7 @@ * @author Ryan Larson * */ +@ExplicitEpoch public class CsvWriter extends AbstractOutputWriter implements OutputWriter { private final Logger logger = LoggerFactory.getLogger(getClass()); diff --git a/src/main/java/org/jmxtrans/embedded/output/ExplicitEpoch.java b/src/main/java/org/jmxtrans/embedded/output/ExplicitEpoch.java new file mode 100644 index 00000000..f734ecec --- /dev/null +++ b/src/main/java/org/jmxtrans/embedded/output/ExplicitEpoch.java @@ -0,0 +1,13 @@ +package org.jmxtrans.embedded.output; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** + * It's the contrary of ImplicitEpoch + * + * @see ImplicitEpoch + */ +@Retention(RetentionPolicy.SOURCE) +@interface ExplicitEpoch { +} diff --git a/src/main/java/org/jmxtrans/embedded/output/GraphiteHttpWriter.java b/src/main/java/org/jmxtrans/embedded/output/GraphiteHttpWriter.java index 92eeb2fd..009a82e7 100644 --- a/src/main/java/org/jmxtrans/embedded/output/GraphiteHttpWriter.java +++ b/src/main/java/org/jmxtrans/embedded/output/GraphiteHttpWriter.java @@ -56,6 +56,7 @@ * * @author Simon Mazas */ +@ExplicitEpoch public class GraphiteHttpWriter extends AbstractOutputWriter implements OutputWriter { public static final String DEFAULT_NAME_PREFIX = "servers.#hostname#."; diff --git a/src/main/java/org/jmxtrans/embedded/output/GraphitePickleWriter.java b/src/main/java/org/jmxtrans/embedded/output/GraphitePickleWriter.java index 3a7d5a6a..902d6287 100644 --- a/src/main/java/org/jmxtrans/embedded/output/GraphitePickleWriter.java +++ b/src/main/java/org/jmxtrans/embedded/output/GraphitePickleWriter.java @@ -61,6 +61,7 @@ * * @author Cyrille Le Clerc */ +@ExplicitEpoch public class GraphitePickleWriter extends AbstractOutputWriter implements OutputWriter { public static final int DEFAULT_GRAPHITE_SERVER_PORT = 2004; diff --git a/src/main/java/org/jmxtrans/embedded/output/GraphiteWriter.java b/src/main/java/org/jmxtrans/embedded/output/GraphiteWriter.java index ce93304a..8f731f8a 100644 --- a/src/main/java/org/jmxtrans/embedded/output/GraphiteWriter.java +++ b/src/main/java/org/jmxtrans/embedded/output/GraphiteWriter.java @@ -58,6 +58,7 @@ * @author Cyrille Le Clerc * @author Patrick Brühlmann */ +@ExplicitEpoch public class GraphiteWriter extends AbstractOutputWriter implements OutputWriter { public static final int DEFAULT_GRAPHITE_SERVER_PORT = 2003; diff --git a/src/main/java/org/jmxtrans/embedded/output/ImplicitEpoch.java b/src/main/java/org/jmxtrans/embedded/output/ImplicitEpoch.java new file mode 100644 index 00000000..f4b7f5dc --- /dev/null +++ b/src/main/java/org/jmxtrans/embedded/output/ImplicitEpoch.java @@ -0,0 +1,17 @@ +package org.jmxtrans.embedded.output; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** + * Indicates that the OutputWriter is not exporting the time (epoch) at which the metric was collected. + * This is generally implied by the protocol being used to transport the metric. + * In this case, it's the server who's receiving the data that will set the metric epoch to the time it received it. + *

+ * The support for explicit epoch may be important when the export is happening a while after it was collected. + * OutputWriters implementing ImplicitEpoch will need to be exported sooner after the collection, and retry on error may not be appropriate. + * OutputWriters implementing ExplicitEpoch will support export delayed from collection, and retry on error will be remain accurate. + */ +@Retention(RetentionPolicy.SOURCE) +@interface ImplicitEpoch { +} diff --git a/src/main/java/org/jmxtrans/embedded/output/LibratoWriter.java b/src/main/java/org/jmxtrans/embedded/output/LibratoWriter.java index 47a3ca00..93add030 100644 --- a/src/main/java/org/jmxtrans/embedded/output/LibratoWriter.java +++ b/src/main/java/org/jmxtrans/embedded/output/LibratoWriter.java @@ -74,6 +74,7 @@ * * @author Cyrille Le Clerc */ +@ExplicitEpoch public class LibratoWriter extends AbstractOutputWriter implements OutputWriter { public static final String METRIC_TYPE_GAUGE = "gauge"; diff --git a/src/main/java/org/jmxtrans/embedded/output/NoOpWriter.java b/src/main/java/org/jmxtrans/embedded/output/NoOpWriter.java index c72ab554..5c49c150 100644 --- a/src/main/java/org/jmxtrans/embedded/output/NoOpWriter.java +++ b/src/main/java/org/jmxtrans/embedded/output/NoOpWriter.java @@ -39,6 +39,7 @@ * * @author Cyrille Le Clerc */ +@ExplicitEpoch public class NoOpWriter extends AbstractOutputWriter { static class NullWriter extends Writer { diff --git a/src/main/java/org/jmxtrans/embedded/output/Slf4jWriter.java b/src/main/java/org/jmxtrans/embedded/output/Slf4jWriter.java index d7d7cad1..a6a26abb 100644 --- a/src/main/java/org/jmxtrans/embedded/output/Slf4jWriter.java +++ b/src/main/java/org/jmxtrans/embedded/output/Slf4jWriter.java @@ -47,6 +47,7 @@ * * @author Cyrille Le Clerc */ +@ExplicitEpoch public class Slf4jWriter extends AbstractOutputWriter { private Logger logger = LoggerFactory.getLogger(getClass()); diff --git a/src/main/java/org/jmxtrans/embedded/output/StackdriverWriter.java b/src/main/java/org/jmxtrans/embedded/output/StackdriverWriter.java index 99d01738..d99c96af 100644 --- a/src/main/java/org/jmxtrans/embedded/output/StackdriverWriter.java +++ b/src/main/java/org/jmxtrans/embedded/output/StackdriverWriter.java @@ -70,6 +70,7 @@ * * @author Eric Kilby */ +@ExplicitEpoch public class StackdriverWriter extends AbstractOutputWriter implements OutputWriter { public static final int STACKDRIVER_PROTOCOL_VERSION = 1; diff --git a/src/main/java/org/jmxtrans/embedded/output/StatsDWriter.java b/src/main/java/org/jmxtrans/embedded/output/StatsDWriter.java index 9106307a..1fcba27f 100644 --- a/src/main/java/org/jmxtrans/embedded/output/StatsDWriter.java +++ b/src/main/java/org/jmxtrans/embedded/output/StatsDWriter.java @@ -21,6 +21,7 @@ * @author Cyrille Le Clerc * @since 1.0.15 */ +@ImplicitEpoch public class StatsDWriter extends AbstractOutputWriter implements OutputWriter { public final static String SETTING_BUFFER_SIZE = "bufferSize";