Package org.apache.kafka.common.metrics.stats

Examples of org.apache.kafka.common.metrics.stats.Max


        public SenderMetrics(Metrics metrics) {
            this.metrics = metrics;

            this.batchSizeSensor = metrics.sensor("batch-size");
            this.batchSizeSensor.add("batch-size-avg", "The average number of bytes sent per partition per-request.", new Avg());
            this.batchSizeSensor.add("batch-size-max", "The max number of bytes sent per partition per-request.", new Max());

            this.compressionRateSensor = metrics.sensor("compression-rate");
            this.compressionRateSensor.add("compression-rate-avg", "The average compression rate of record batches.", new Avg());

            this.queueTimeSensor = metrics.sensor("queue-time");
            this.queueTimeSensor.add("record-queue-time-avg",
                                     "The average time in ms record batches spent in the record accumulator.",
                                     new Avg());
            this.queueTimeSensor.add("record-queue-time-max",
                                     "The maximum time in ms record batches spent in the record accumulator.",
                                     new Max());

            this.requestTimeSensor = metrics.sensor("request-time");
            this.requestTimeSensor.add("request-latency-avg", "The average request latency in ms", new Avg());
            this.requestTimeSensor.add("request-latency-max", "The maximum request latency in ms", new Max());

            this.recordsPerRequestSensor = metrics.sensor("records-per-request");
            this.recordsPerRequestSensor.add("record-send-rate", "The average number of records sent per second.", new Rate());
            this.recordsPerRequestSensor.add("records-per-request-avg", "The average number of records per request.", new Avg());

            this.retrySensor = metrics.sensor("record-retries");
            this.retrySensor.add("record-retry-rate", "The average per-second number of retried record sends", new Rate());

            this.errorSensor = metrics.sensor("errors");
            this.errorSensor.add("record-error-rate", "The average per-second number of record sends that resulted in errors", new Rate());

            this.maxRecordSizeSensor = metrics.sensor("record-size-max");
            this.maxRecordSizeSensor.add("record-size-max", "The maximum record size", new Max());
            this.maxRecordSizeSensor.add("record-size-avg", "The average record size", new Avg());

            this.metrics.addMetric("requests-in-flight", "The current number of in-flight requests awaiting a response.", new Measurable() {
                public double measure(MetricConfig config, long now) {
                    return client.inFlightRequestCount();
View Full Code Here


        Sensor parent = metrics.sensor("parent");
        Sensor child = metrics.sensor("child", parent);
        for (Sensor sensor : Arrays.asList(parent, child)) {
            sensor.add(sensor.name() + ".avg", new Avg());
            sensor.add(sensor.name() + ".count", new Count());
            sensor.add(sensor.name() + ".max", new Max());
            sensor.add(new Percentiles(1024,
                                       0.0,
                                       iters,
                                       BucketSizing.CONSTANT,
                                       new Percentile(sensor.name() + ".median", 50.0),
View Full Code Here

            this.bytesSent = this.metrics.sensor("bytes-sent", bytesTransferred);
            this.bytesSent.add("outgoing-byte-rate", "The average number of outgoing bytes sent per second to all servers.", new Rate());
            this.bytesSent.add("request-rate", "The average number of requests sent per second.", new Rate(new Count()));
            this.bytesSent.add("request-size-avg", "The average size of all requests in the window..", new Avg());
            this.bytesSent.add("request-size-max", "The maximum size of any request sent in the window.", new Max());

            this.bytesReceived = this.metrics.sensor("bytes-received", bytesTransferred);
            this.bytesReceived.add("incoming-byte-rate", "Bytes/second read off all sockets", new Rate());
            this.bytesReceived.add("response-rate", "Responses received sent per second.", new Rate(new Count()));
View Full Code Here

                    nodeRequest.add("node-" + node + ".outgoing-byte-rate", new Rate());
                    nodeRequest.add("node-" + node + ".request-rate",
                                    "The average number of requests sent per second.",
                                    new Rate(new Count()));
                    nodeRequest.add("node-" + node + ".request-size-avg", "The average size of all requests in the window..", new Avg());
                    nodeRequest.add("node-" + node + ".request-size-max", "The maximum size of any request sent in the window.", new Max());

                    String nodeResponseName = "node-" + node + ".bytes-received";
                    Sensor nodeResponse = this.metrics.sensor(nodeResponseName);
                    nodeResponse.add("node-" + node + ".incoming-byte-rate", new Rate());
                    nodeResponse.add("node-" + node + ".response-rate",
                                     "The average number of responses received per second.",
                                     new Rate(new Count()));

                    String nodeTimeName = "node-" + node + ".latency";
                    Sensor nodeRequestTime = this.metrics.sensor(nodeTimeName);
                    nodeRequestTime.add("node-" + node + ".request-latency-avg", new Avg());
                    nodeRequestTime.add("node-" + node + ".request-latency-max", new Max());
                }
            }
        }
View Full Code Here

    public void testSimpleStats() throws Exception {
        ConstantMeasurable measurable = new ConstantMeasurable();
        metrics.addMetric("direct.measurable", measurable);
        Sensor s = metrics.sensor("test.sensor");
        s.add("test.avg", new Avg());
        s.add("test.max", new Max());
        s.add("test.min", new Min());
        s.add("test.rate", new Rate(TimeUnit.SECONDS));
        s.add("test.occurences", new Rate(TimeUnit.SECONDS, new Count()));
        s.add("test.count", new Count());
        s.add(new Percentiles(100, -100, 100, BucketSizing.CONSTANT, new Percentile("test.median", 50.0), new Percentile("test.perc99_9",
View Full Code Here

        assertEquals(2.0, count.measure(config, time.milliseconds()), EPS);
    }

    @Test
    public void testOldDataHasNoEffect() {
        Max max = new Max();
        long windowMs = 100;
        int samples = 2;
        MetricConfig config = new MetricConfig().timeWindow(windowMs, TimeUnit.MILLISECONDS).samples(samples);
        max.record(config, 50, time.milliseconds());
        time.sleep(samples * windowMs);
        assertEquals(Double.NEGATIVE_INFINITY, max.measure(config, time.milliseconds()), EPS);
    }
View Full Code Here

TOP

Related Classes of org.apache.kafka.common.metrics.stats.Max

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.