@Internal public class MailboxMetricsController extends Object
TimerService
, induce (cyclic) dependencies between MailboxProcessor
and StreamTask
. An instance of
this class contains and gives control over these dependencies.Modifier and Type | Field and Description |
---|---|
int |
defaultLatencyMeasurementInterval
Default timer interval in milliseconds for triggering mailbox latency measurement.
|
Constructor and Description |
---|
MailboxMetricsController(Histogram latencyHistogram,
Counter mailCounter)
Creates instance of
MailboxMetricsController with references to metrics provided as
parameters. |
Modifier and Type | Method and Description |
---|---|
Counter |
getMailCounter()
Gets
Counter for number of mails processed. |
boolean |
isLatencyMeasurementSetup()
Indicates if latency measurement has been setup.
|
boolean |
isLatencyMeasurementStarted()
Indicates if latency mesurement has been started.
|
void |
measureMailboxLatency() |
void |
setLatencyMeasurementInterval(int measurementInterval) |
void |
setupLatencyMeasurement(TimerService timerService,
MailboxExecutor mailboxExecutor)
Sets up latency measurement with required
TimerService and MailboxExecutor . |
void |
startLatencyMeasurement()
Starts mailbox latency measurement.
|
public final int defaultLatencyMeasurementInterval
public MailboxMetricsController(Histogram latencyHistogram, Counter mailCounter)
MailboxMetricsController
with references to metrics provided as
parameters.latencyHistogram
- Histogram of mailbox latency measurements.mailCounter
- Counter for number of mails processed.public void setupLatencyMeasurement(TimerService timerService, MailboxExecutor mailboxExecutor)
TimerService
and MailboxExecutor
.
Note: For each instance, latency measurement can be set up only once.
timerService
- TimerService
used for latency measurement.mailboxExecutor
- MailboxExecutor
used for latency measurement.public void startLatencyMeasurement()
setupLatencyMeasurement(TimerService, MailboxExecutor)
. Latency is
measured through execution of a mail that is triggered by default in the interval defined by
defaultLatencyMeasurementInterval
.
Note: For each instance, latency measurement can be started only once.
public boolean isLatencyMeasurementStarted()
public boolean isLatencyMeasurementSetup()
public Counter getMailCounter()
Counter
for number of mails processed.Counter
for number of mails processed.@VisibleForTesting public void setLatencyMeasurementInterval(int measurementInterval)
@VisibleForTesting public void measureMailboxLatency()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.