Package com.yammer.metrics.core

Examples of com.yammer.metrics.core.MetricName


    /** Total size of file cache, in bytes */
    public final Gauge<Long> size;

    public FileCacheMetrics()
    {
        hits = Metrics.newMeter(new MetricName(FileCacheService.class, "Hits"), "hits", TimeUnit.SECONDS);
        requests = Metrics.newMeter(new MetricName(FileCacheService.class, "Requests"), "requests", TimeUnit.SECONDS);
        hitRate = Metrics.newGauge(new MetricName(FileCacheService.class, "HitRate"), new RatioGauge()
        {
            protected double getNumerator()
            {
                return hits.count();
            }

            protected double getDenominator()
            {
                return requests.count();
            }
        });
        size = Metrics.newGauge(new MetricName(FileCacheService.class, "Size"), new Gauge<Long>()
        {
            public Long value()
            {
                return FileCacheService.instance.sizeInBytes();
            }
View Full Code Here


        mbeanName.append("type=").append(type);
        mbeanName.append(",path=").append(path);
        mbeanName.append(",scope=").append(poolName);
        mbeanName.append(",name=").append(metricName);

        return new MetricName(groupName, type, metricName, path + "." + poolName, mbeanName.toString());
    }
View Full Code Here

        private final Counter meter;
        private long reported = 0;

        public DifferencingCounter(InetAddress address)
        {
            this.meter = Metrics.newCounter(new MetricName(GROUP_NAME, TYPE_NAME, "Hints_not_stored-" + address.getHostAddress()));
        }
View Full Code Here

            }
        });
    }

    protected MetricName createMetricName(String name) {
        return new MetricName(metricGroup, metricType, name);
    }
View Full Code Here

            }
        });
    }

    protected MetricName createMetricName(String name) {
        return new MetricName(metricGroup, metricType, name);
    }
View Full Code Here

     * @param jsonMetric A JSONMetric to make a Metric from
     * @return A Metric equivalent to the given JSONMetric
     */
    protected Metric createMetric(JSONMetric jsonMetric) {
        // Split the name from the JSON on dots for the metric group/type/name
        MetricName metricName;
        ArrayList<String> parts = new ArrayList<String>(Arrays.asList(jsonMetric.getName().split("\\.")));
        if (parts.size() >= 3)
            metricName = new MetricName(parts.remove(0), parts.remove(0), StringUtils.join(parts, "."));
        else
            metricName = new MetricName(jsonMetric.getName(), "", "");

        Class<?> metricType = jsonMetric.getMetricClass();
        if (metricType == Gauge.class) {
            return Metrics.newGauge(metricName, new GaugeMetricImpl());
        } else if (metricType == Counter.class) {
View Full Code Here

    TimeUnit durationUnit = TimeUnit.MICROSECONDS;
    TimeUnit rateUnit = TimeUnit.MILLISECONDS;

    this.printPeriod = printPeriod;

    readTimer = Metrics.newTimer(new MetricName(name, "", "reads"),
        durationUnit, rateUnit);
    readSuccessRatio =
        new CounterRatioGauge(Metrics.newCounter(new MetricName(name, "", "successes")),
            Metrics.newCounter(new MetricName(name, "", "-reads")));
    parseTimer = Metrics.newTimer(new MetricName(name, "", "parses"),
        durationUnit, rateUnit);
  }
View Full Code Here

        String metricGroup = serviceConfig.metricsJmxRoot;

        // and then create metrics
       
        // first: in-flight counter, "active" requests
        _metricInFlight = Metrics.newCounter(new MetricName(metricGroup, operationName, "active"));
        _metricRate = Metrics.newMeter(new MetricName(metricGroup, operationName, "rate"),
                "requests", TimeUnit.SECONDS);
        _metricTimes = Metrics.newTimer(new MetricName(metricGroup, operationName, "times"),
                TimeUnit.MILLISECONDS, TimeUnit.SECONDS);

        _metricSizes = includeSizes ?
                Metrics.newHistogram(new MetricName(metricGroup, operationName, "sizes"), true)
                : null;
        _metricEntryCounts = includeEntryCounts ?
                Metrics.newHistogram(new MetricName(metricGroup, operationName, "counts"), true)
                : null;
    }
View Full Code Here

        return _instanceGauge;
    }

    @VisibleForTesting
    MetricName newName(String scope, String name) {
        return new MetricName(_domain, name, scope);
    }
View Full Code Here

    private MetricName newRegisteredName(String scope, String name) {
        checkNotNullOrEmpty(scope);
        checkNotNullOrEmpty(name);

        MetricName metricName = newName(scope, name);
        _registeredMetrics.add(metricName);
        return metricName;
    }
View Full Code Here

TOP

Related Classes of com.yammer.metrics.core.MetricName

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.