Package org.apache.kafka.common.metrics

Examples of org.apache.kafka.common.metrics.Measurable


            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();
                }
            });
            metrics.addMetric("metadata-age", "The age in seconds of the current producer metadata being used.", new Measurable() {
                public double measure(MetricConfig config, long now) {
                    return (now - metadata.lastUpdate()) / 1000.0;
                }
            });
        }
View Full Code Here


    }

    private void registerMetrics(Metrics metrics) {
        metrics.addMetric("waiting-threads",
                          "The number of user threads blocked waiting for buffer memory to enqueue their records",
                          new Measurable() {
                              public double measure(MetricConfig config, long now) {
                                  return free.queued();
                              }
                          });
        metrics.addMetric("buffer-total-bytes",
                          "The maximum amount of buffer memory the client can use (whether or not it is currently used).",
                          new Measurable() {
                              public double measure(MetricConfig config, long now) {
                                  return free.totalMemory();
                              }
                          });
        metrics.addMetric("buffer-available-bytes",
                          "The total amount of buffer memory that is not being used (either unallocated or in the free list).",
                          new Measurable() {
                              public double measure(MetricConfig config, long now) {
                                  return free.availableMemory();
                              }
                          });
    }
View Full Code Here

            this.ioTime = this.metrics.sensor("io-time");
            this.ioTime.add("io-time-ns-avg", "The average length of time for I/O per select call in nanoseconds.", new Avg());
            this.ioTime.add("io-ratio", "The fraction of time the I/O thread spent doing I/O", new Rate(TimeUnit.NANOSECONDS));

            this.metrics.addMetric("connection-count", "The current number of active connections.", new Measurable() {
                public double measure(MetricConfig config, long now) {
                    return keys.size();
                }
            });
        }
View Full Code Here

    @Override
    public List<NamedMeasurable> stats() {
        List<NamedMeasurable> ms = new ArrayList<NamedMeasurable>(this.percentiles.length);
        for (Percentile percentile : this.percentiles) {
            final double pct = percentile.percentile();
            ms.add(new NamedMeasurable(percentile.name(), percentile.description(), new Measurable() {
                public double measure(MetricConfig config, long now) {
                    return value(config, now, pct / 100.0);
                }
            }));
        }
View Full Code Here

TOP

Related Classes of org.apache.kafka.common.metrics.Measurable

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.