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

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


        Metrics metrics = new Metrics();
        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,
View Full Code Here


            this.connectionCreated.add("connection-creation-rate", "New connections established per second in the window.", new Rate());

            this.bytesTransferred = this.metrics.sensor("bytes-sent-received");
            bytesTransferred.add("network-io-rate",
                                 "The average number of network operations (reads or writes) on all connections per second.",
                                 new Rate(new Count()));

            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()));

            this.selectTime = this.metrics.sensor("select-time");
            this.selectTime.add("select-rate",
                                "Number of times the I/O layer checked for new I/O to perform per second",
                                new Rate(new Count()));
            this.selectTime.add("io-wait-time-ns-avg",
                                "The average length of time the I/O thread spent waiting for a socket ready for reads or writes in nanoseconds.",
                                new Avg());
            this.selectTime.add("io-wait-ratio", "The fraction of time the I/O thread spent waiting.", new Rate(TimeUnit.NANOSECONDS));
View Full Code Here

                if (nodeRequest == null) {
                    nodeRequest = this.metrics.sensor(nodeRequestName);
                    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

        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",
                                                                                                                         99.9)));

        Sensor s2 = metrics.sensor("test.sensor2");
        s2.add("s2.total", new Total());
View Full Code Here

    }

    @Test
    public void testHierarchicalSensors() {
        Sensor parent1 = metrics.sensor("test.parent1");
        parent1.add("test.parent1.count", new Count());
        Sensor parent2 = metrics.sensor("test.parent2");
        parent2.add("test.parent2.count", new Count());
        Sensor child1 = metrics.sensor("test.child1", parent1, parent2);
        child1.add("test.child1.count", new Count());
        Sensor child2 = metrics.sensor("test.child2", parent1);
        child2.add("test.child2.count", new Count());
        Sensor grandchild = metrics.sensor("test.grandchild", child1);
        grandchild.add("test.grandchild.count", new Count());

        /* increment each sensor one time */
        parent1.record();
        parent2.record();
        child1.record();
View Full Code Here

        metrics.sensor("gc", c1, c2); // should fail
    }

    @Test
    public void testEventWindowing() {
        Count count = new Count();
        MetricConfig config = new MetricConfig().eventWindow(1).samples(2);
        count.record(config, 1.0, time.milliseconds());
        count.record(config, 1.0, time.milliseconds());
        assertEquals(2.0, count.measure(config, time.milliseconds()), EPS);
        count.record(config, 1.0, time.milliseconds()); // first event times out
        assertEquals(2.0, count.measure(config, time.milliseconds()), EPS);
    }
View Full Code Here

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

    @Test
    public void testTimeWindowing() {
        Count count = new Count();
        MetricConfig config = new MetricConfig().timeWindow(1, TimeUnit.MILLISECONDS).samples(2);
        count.record(config, 1.0, time.milliseconds());
        time.sleep(1);
        count.record(config, 1.0, time.milliseconds());
        assertEquals(2.0, count.measure(config, time.milliseconds()), EPS);
        time.sleep(1);
        count.record(config, 1.0, time.milliseconds()); // oldest event times out
        assertEquals(2.0, count.measure(config, time.milliseconds()), EPS);
    }
View Full Code Here

TOP

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

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.