Search in sources :

Example 1 with PeriodMeter

use of org.apache.servicecomb.foundation.metrics.meter.PeriodMeter in project java-chassis by ServiceComb.

the class GlobalRegistry method poll.

public PolledEvent poll(long secondInterval) {
    long msNow = clock.wallTime();
    List<Meter> meters = new ArrayList<>();
    List<Measurement> measurements = new ArrayList<>();
    for (Registry registry : registries) {
        SpectatorUtils.removeExpiredMeters(registry);
        for (Meter meter : registry) {
            if (meter instanceof PeriodMeter) {
                ((PeriodMeter) meter).calcMeasurements(msNow, secondInterval);
            }
            meters.add(meter);
            meter.measure().forEach(measurements::add);
        }
    }
    return new PolledEvent(meters, measurements);
}
Also used : Measurement(com.netflix.spectator.api.Measurement) PeriodMeter(org.apache.servicecomb.foundation.metrics.meter.PeriodMeter) PeriodMeter(org.apache.servicecomb.foundation.metrics.meter.PeriodMeter) Meter(com.netflix.spectator.api.Meter) PolledEvent(org.apache.servicecomb.foundation.metrics.PolledEvent) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) Registry(com.netflix.spectator.api.Registry)

Example 2 with PeriodMeter

use of org.apache.servicecomb.foundation.metrics.meter.PeriodMeter in project incubator-servicecomb-java-chassis by apache.

the class GlobalRegistry method poll.

public PolledEvent poll(long secondInterval) {
    long msNow = clock.wallTime();
    List<Meter> meters = new ArrayList<>();
    List<Measurement> measurements = new ArrayList<>();
    for (Registry registry : registries) {
        SpectatorUtils.removeExpiredMeters(registry);
        for (Meter meter : registry) {
            if (meter instanceof PeriodMeter) {
                ((PeriodMeter) meter).calcMeasurements(msNow, secondInterval);
            }
            meters.add(meter);
            meter.measure().forEach(measurements::add);
        }
    }
    return new PolledEvent(meters, measurements);
}
Also used : Measurement(com.netflix.spectator.api.Measurement) PeriodMeter(org.apache.servicecomb.foundation.metrics.meter.PeriodMeter) PeriodMeter(org.apache.servicecomb.foundation.metrics.meter.PeriodMeter) Meter(com.netflix.spectator.api.Meter) PolledEvent(org.apache.servicecomb.foundation.metrics.PolledEvent) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) Registry(com.netflix.spectator.api.Registry)

Aggregations

Measurement (com.netflix.spectator.api.Measurement)2 Meter (com.netflix.spectator.api.Meter)2 Registry (com.netflix.spectator.api.Registry)2 ArrayList (java.util.ArrayList)2 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)2 PolledEvent (org.apache.servicecomb.foundation.metrics.PolledEvent)2 PeriodMeter (org.apache.servicecomb.foundation.metrics.meter.PeriodMeter)2