Package org.nuxeo.runtime.stream
Class StreamMetricsComputation
- java.lang.Object
-
- org.nuxeo.lib.stream.computation.AbstractComputation
-
- org.nuxeo.runtime.stream.StreamMetricsComputation
-
- All Implemented Interfaces:
Computation
public class StreamMetricsComputation extends AbstractComputation
A computation that exposes Nuxeo Stream metrics as Dropwizard metrics.- Since:
- 11.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStreamMetricsComputation.LatencyMetric
-
Field Summary
Fields Modifier and Type Field Description protected Codec<Record>codecprotected List<LogPartitionGroup>groupsprotected List<String>inputStreamsprotected longintervalMsprotected Set<Name>invalidStreamsprotected LogManagermanagerprotected List<StreamMetricsComputation.LatencyMetric>metricsprotected static StringNAMEprotected longrefreshGroupCounterprotected io.dropwizard.metrics5.MetricRegistryregistryprotected List<Name>streams-
Fields inherited from class org.nuxeo.lib.stream.computation.AbstractComputation
INPUT_1, INPUT_2, INPUT_3, INPUT_NULL, metadata, OUTPUT_1, OUTPUT_2, OUTPUT_3, OUTPUT_4
-
-
Constructor Summary
Constructors Constructor Description StreamMetricsComputation(Duration interval, List<String> streams)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Called when the framework is ready to shutdown the computation.protected List<LogPartitionGroup>getGroups()protected LogManagergetManager()protected List<Name>getStreams()voidinit(ComputationContext context)Called when the framework has registered the computation successfully.voidprocessRecord(ComputationContext context, String inputStreamName, Record record)Process an incoming record on one of the computation's input streams.voidprocessTimer(ComputationContext context, String key, long timestamp)Process a timer callback previously set viaComputationContext.setTimer(String, long).protected voidrefreshMetricsIfNeeded()protected voidregisterMetrics()protected voidunregisterMetrics()-
Methods inherited from class org.nuxeo.lib.stream.computation.AbstractComputation
metadata, processFailure, processRetry
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.lib.stream.computation.Computation
signalStop
-
-
-
-
Field Detail
-
NAME
protected static final String NAME
- See Also:
- Constant Field Values
-
registry
protected io.dropwizard.metrics5.MetricRegistry registry
-
intervalMs
protected final long intervalMs
-
groups
protected final List<LogPartitionGroup> groups
-
metrics
protected final List<StreamMetricsComputation.LatencyMetric> metrics
-
manager
protected LogManager manager
-
refreshGroupCounter
protected long refreshGroupCounter
-
-
Method Detail
-
init
public void init(ComputationContext context)
Description copied from interface:ComputationCalled when the framework has registered the computation successfully. Gives users a first opportunity to schedule timer callbacks and produce records. This method can be called multiple times.- Specified by:
initin interfaceComputation- Overrides:
initin classAbstractComputation- Parameters:
context- The computation context object provided by the system.
-
destroy
public void destroy()
Description copied from interface:ComputationCalled when the framework is ready to shutdown the computation. Gives users a chance to perform some cleanup before the process is killed.
-
registerMetrics
protected void registerMetrics()
-
unregisterMetrics
protected void unregisterMetrics()
-
processTimer
public void processTimer(ComputationContext context, String key, long timestamp)
Description copied from interface:ComputationProcess a timer callback previously set viaComputationContext.setTimer(String, long).- Specified by:
processTimerin interfaceComputation- Overrides:
processTimerin classAbstractComputation- Parameters:
context- The computation context object provided by the system.key- The name of the timer.timestamp- The timestamp (in ms) for which the callback was scheduled.
-
refreshMetricsIfNeeded
protected void refreshMetricsIfNeeded()
-
getGroups
protected List<LogPartitionGroup> getGroups()
-
getManager
protected LogManager getManager()
-
processRecord
public void processRecord(ComputationContext context, String inputStreamName, Record record)
Description copied from interface:ComputationProcess an incoming record on one of the computation's input streams.- Parameters:
context- The computation context object provided by the system.inputStreamName- Name of the input stream that provides the record.record- The record.
-
-