![JAR search and dependency download from the Maven repository](/logo.png)
org.whispersystems.wavefront.metrics.NetworkSentGauge Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dropwizard-wavefront Show documentation
Show all versions of dropwizard-wavefront Show documentation
A Dropwizard Metrics reporter for Wavefront
The newest version!
package org.whispersystems.wavefront.metrics;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
public class NetworkSentGauge extends NetworkGauge {
private final Logger logger = LoggerFactory.getLogger(NetworkSentGauge.class);
private long lastTimestamp;
private long lastSent;
@Override
public Long getValue() {
try {
long timestamp = System.currentTimeMillis();
SentAndReceived sentAndReceived = getSentReceived();
long result = 0;
if (lastTimestamp != 0) {
result = sentAndReceived.sent - lastSent;
lastSent = sentAndReceived.sent;
}
lastTimestamp = timestamp;
return result;
} catch (IOException e) {
logger.warn("NetworkSentGauge", e);
return -1L;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy