Search in sources :

Example 1 with TimerRateMetricsResponse

use of org.graylog2.rest.models.metrics.responses.TimerRateMetricsResponse in project graylog2-server by Graylog2.

the class MetricUtils method buildTimerMap.

public static TimerRateMetricsResponse buildTimerMap(Timer t) {
    final TimerRateMetricsResponse result = new TimerRateMetricsResponse();
    final TimerMetricsResponse time = new TimerMetricsResponse();
    final RateMetricsResponse rate = new RateMetricsResponse();
    if (t == null) {
        return result;
    }
    time.max = TimeUnit.MICROSECONDS.convert(t.getSnapshot().getMax(), TimeUnit.NANOSECONDS);
    time.min = TimeUnit.MICROSECONDS.convert(t.getSnapshot().getMin(), TimeUnit.NANOSECONDS);
    time.mean = TimeUnit.MICROSECONDS.convert((long) t.getSnapshot().getMean(), TimeUnit.NANOSECONDS);
    time.percentile95th = TimeUnit.MICROSECONDS.convert((long) t.getSnapshot().get95thPercentile(), TimeUnit.NANOSECONDS);
    time.percentile98th = TimeUnit.MICROSECONDS.convert((long) t.getSnapshot().get98thPercentile(), TimeUnit.NANOSECONDS);
    time.percentile99th = TimeUnit.MICROSECONDS.convert((long) t.getSnapshot().get99thPercentile(), TimeUnit.NANOSECONDS);
    time.stdDev = TimeUnit.MICROSECONDS.convert((long) t.getSnapshot().getStdDev(), TimeUnit.NANOSECONDS);
    rate.oneMinute = t.getOneMinuteRate();
    rate.fiveMinute = t.getFiveMinuteRate();
    rate.fifteenMinute = t.getFifteenMinuteRate();
    rate.total = t.getCount();
    rate.mean = t.getMeanRate();
    result.time = time;
    result.rate = rate;
    result.rateUnit = "events/second";
    result.durationUnit = TimeUnit.MICROSECONDS.toString().toLowerCase(Locale.ENGLISH);
    return result;
}
Also used : RateMetricsResponse(org.graylog2.rest.models.metrics.responses.RateMetricsResponse) TimerRateMetricsResponse(org.graylog2.rest.models.metrics.responses.TimerRateMetricsResponse) TimerRateMetricsResponse(org.graylog2.rest.models.metrics.responses.TimerRateMetricsResponse) TimerMetricsResponse(org.graylog2.rest.models.metrics.responses.TimerMetricsResponse)

Aggregations

RateMetricsResponse (org.graylog2.rest.models.metrics.responses.RateMetricsResponse)1 TimerMetricsResponse (org.graylog2.rest.models.metrics.responses.TimerMetricsResponse)1 TimerRateMetricsResponse (org.graylog2.rest.models.metrics.responses.TimerRateMetricsResponse)1