All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.firefly.net.tcp.aio.metric.SessionMetric Maven / Gradle / Ivy

There is a newer version: 5.0.0-dev6
Show newest version
package com.firefly.net.tcp.aio.metric;

import com.codahale.metrics.Counter;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.MetricRegistry;

/**
 * @author Pengtao Qiu
 */
public class SessionMetric {
    private final Counter activeSessionCount;
    private final Histogram duration;
    private final Histogram allocatedInputBufferSize;
    private final Histogram outputBufferQueueSize;
    private final Histogram mergedOutputBufferSize;

    public SessionMetric(MetricRegistry metrics, String prefix) {
        activeSessionCount = metrics.counter(prefix + ".activeSessionCount");
        duration = metrics.histogram(prefix + ".duration");
        outputBufferQueueSize = metrics.histogram(prefix + ".outputBufferQueueSize");
        mergedOutputBufferSize = metrics.histogram(prefix + ".mergedOutputBufferSize");
        allocatedInputBufferSize = metrics.histogram(prefix + ".allocatedInputBufferSize");
    }

    public Counter getActiveSessionCount() {
        return activeSessionCount;
    }

    public Histogram getDuration() {
        return duration;
    }

    public Histogram getAllocatedInputBufferSize() {
        return allocatedInputBufferSize;
    }

    public Histogram getOutputBufferQueueSize() {
        return outputBufferQueueSize;
    }

    public Histogram getMergedOutputBufferSize() {
        return mergedOutputBufferSize;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy