@InterfaceAudience.Private public final class BandwidthGaugeUpdater extends Object
Modifier and Type | Field and Description |
---|---|
static org.apache.commons.logging.Log |
LOG |
static String |
THREAD_NAME |
Constructor and Description |
---|
BandwidthGaugeUpdater(AzureFileSystemInstrumentation instrumentation)
Create a new updater object with default values.
|
BandwidthGaugeUpdater(AzureFileSystemInstrumentation instrumentation,
int windowSizeMs,
boolean manualUpdateTrigger)
Create a new updater object with some overrides (used in unit tests).
|
Modifier and Type | Method and Description |
---|---|
void |
blockDownloaded(Date startDate,
Date endDate,
long length)
Indicate that a block has been downloaded.
|
void |
blockUploaded(Date startDate,
Date endDate,
long length)
Indicate that a block has been uploaded.
|
void |
close() |
void |
resumeAutoUpdate()
Resumes auto-update (undo suppressAutoUpdate).
|
void |
suppressAutoUpdate()
For unit test purposes, suppresses auto-update of the metrics
from the dedicated thread.
|
void |
triggerUpdate(boolean updateWrite)
Triggers the update of the metrics gauge based on all the blocks
uploaded/downloaded so far.
|
public static final org.apache.commons.logging.Log LOG
public static final String THREAD_NAME
public BandwidthGaugeUpdater(AzureFileSystemInstrumentation instrumentation)
instrumentation
- The metrics source to update.public BandwidthGaugeUpdater(AzureFileSystemInstrumentation instrumentation, int windowSizeMs, boolean manualUpdateTrigger)
instrumentation
- The metrics source to update.windowSizeMs
- The window size to use for calculating bandwidth
(in milliseconds).manualUpdateTrigger
- If true, then this object won't create the
auto-update threads, and will wait for manual
calls to triggerUpdate to occur.public void blockUploaded(Date startDate, Date endDate, long length)
startDate
- The exact time the upload started.endDate
- The exact time the upload ended.length
- The number of bytes uploaded in the block.public void blockDownloaded(Date startDate, Date endDate, long length)
startDate
- The exact time the download started.endDate
- The exact time the download ended.length
- The number of bytes downloaded in the block.public void suppressAutoUpdate()
public void resumeAutoUpdate()
public void triggerUpdate(boolean updateWrite)
updateWrite
- If true, we'll update the write (upload) metrics.
Otherwise we'll update the read (download) ones.public void close()
Copyright © 2018 Apache Software Foundation. All Rights Reserved.