Search in sources :

Example 1 with DeltaCounterValueException

use of com.wavefront.data.DeltaCounterValueException in project java by wavefrontHQ.

the class ReportPointHandlerImpl method reportInternal.

@Override
void reportInternal(ReportPoint point) {
    receivedTagCount.update(point.getAnnotations().size());
    try {
        validatePoint(point, validationConfig);
    } catch (DeltaCounterValueException e) {
        discardedCounterSupplier.get().inc();
        return;
    }
    receivedPointLag.update(Clock.now() - point.getTimestamp());
    if (point.getValue() instanceof Histogram && recompressor != null) {
        Histogram histogram = (Histogram) point.getValue();
        point.setValue(recompressor.apply(histogram));
    }
    final String strPoint = serializer.apply(point);
    getTask().add(strPoint);
    getReceivedCounter().inc();
    if (validItemsLogger != null)
        validItemsLogger.info(strPoint);
}
Also used : Histogram(wavefront.report.Histogram) DeltaCounterValueException(com.wavefront.data.DeltaCounterValueException)

Example 2 with DeltaCounterValueException

use of com.wavefront.data.DeltaCounterValueException in project java by wavefrontHQ.

the class DeltaCounterAccumulationHandlerImpl method reportInternal.

@Override
void reportInternal(ReportPoint point) {
    if (DeltaCounter.isDelta(point.getMetric())) {
        try {
            validatePoint(point, validationConfig);
        } catch (DeltaCounterValueException e) {
            discardedCounterSupplier.get().inc();
            return;
        }
        getReceivedCounter().inc();
        double deltaValue = (double) point.getValue();
        receivedPointLag.update(Clock.now() - point.getTimestamp());
        HostMetricTagsPair hostMetricTagsPair = new HostMetricTagsPair(point.getHost(), point.getMetric(), point.getAnnotations());
        Objects.requireNonNull(aggregatedDeltas.get(hostMetricTagsPair, key -> new AtomicDouble(0))).getAndAdd(deltaValue);
        if (validItemsLogger != null && validItemsLogger.isLoggable(Level.FINEST)) {
            validItemsLogger.info(serializer.apply(point));
        }
    } else {
        reject(point, "Port is not configured to accept non-delta counter data!");
    }
}
Also used : AtomicDouble(com.google.common.util.concurrent.AtomicDouble) HostMetricTagsPair(com.wavefront.common.HostMetricTagsPair) DeltaCounterValueException(com.wavefront.data.DeltaCounterValueException)

Aggregations

DeltaCounterValueException (com.wavefront.data.DeltaCounterValueException)2 AtomicDouble (com.google.common.util.concurrent.AtomicDouble)1 HostMetricTagsPair (com.wavefront.common.HostMetricTagsPair)1 Histogram (wavefront.report.Histogram)1