Package com.arpnetworking.tsdcore.sinks
Class PeriodicStatisticsSink
java.lang.Object
com.arpnetworking.tsdcore.sinks.BaseSink
com.arpnetworking.tsdcore.sinks.PeriodicStatisticsSink
- All Implemented Interfaces:
Sink
Aggregates and periodically logs metrics about the aggregated data being
record; effectively, this is metrics about metrics. It's primary purpose is
to provide a quick sanity check on installations by generating metrics that
the aggregator can then consume (and use to generate more metrics). This
class is thread safe.
TODO(vkoskela): Remove synchronized blocks [MAI-110]
Details: The synchronization can be removed if the metrics client can
be configured to throw ISE when attempting to write to a closed instance.
This would allow a retry on the new instance; starvation would theoretically
be possible but practically should never happen.
(+) The implementation of _age as an AtomicLong currently relies on the
locking provided by the synchronized block to perform it's check and set.
This can be replaced with a separate lock or a thread-safe accumulator
implementation.
- Author:
- Ville Koskela (ville dot koskela at inscopemetrics dot com)
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Implementation of builder pattern forPeriodicStatisticsSink
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Called to allow the publisher to clean-up.void
recordAggregateData
(PeriodicData periodicData) Called when additionalPeriodicData
instances are available for publication.Generate a Steno log compatible representation.Methods inherited from class com.arpnetworking.tsdcore.sinks.BaseSink
getMetricSafeName, getName, toString
-
Method Details
-
recordAggregateData
Description copied from interface:Sink
Called when additionalPeriodicData
instances are available for publication.- Parameters:
periodicData
- The {PeriodicData
to be published.
-
close
public void close()Description copied from interface:Sink
Called to allow the publisher to clean-up. No further calls to recordAggregation will be made after a call to close. -
toLogValue
Description copied from class:BaseSink
Generate a Steno log compatible representation.- Overrides:
toLogValue
in classBaseSink
- Returns:
- Steno log compatible representation.
-