Package com.yammer.metrics.core

Examples of com.yammer.metrics.core.Metric


  protected void addCodahaleMetrics(final MetricTreeObject tree) {
    for (Entry<String, SortedMap<MetricName, Metric>> entry : getMetricsRegistry().groupedMetrics(predicate)
        .entrySet()) {
      for (Entry<MetricName, Metric> subEntry : entry.getValue().entrySet()) {
        final Metric metric = subEntry.getValue();
        if (metric != null) {
          try {
            MetricDispatcher.dispatch(subEntry.getValue(), subEntry.getKey(), this, tree);
          } catch (Exception ignored) {
            LOG.error("Error printing regular metrics:", ignored);
View Full Code Here


       
        @Override
        public String value() {
            Map<String,Double> latencies = new HashMap<String,Double>();
            for(Map.Entry<MetricName,Metric> e: registry.allMetrics().entrySet()) {
                Metric metric = e.getValue();
                if(metric instanceof SHTimerMetric) {
                    SHTimerMetric timerMetric = (SHTimerMetric)metric;
                    latencies.put(e.getKey().getName(), timerMetric.getSnapshot().getValue(0.9D));
                }
            }
View Full Code Here

       
        Map<MetricName,Metric> updatedMetrics = StatsHTable.opTypeTimers.allMetrics();
       
        // Assert that the expected metrics were present and received at least one update
        for(MetricName metricName: expectedMetrics) {
            Metric metric = updatedMetrics.get(metricName);
            if(metric == null) {
                Assert.fail("Metric was unexpectedly absent for " + metricName);
            }
            SHTimerMetric timerMetric = (SHTimerMetric)metric;
            if(timerMetric.count() < 1) {
View Full Code Here

    try {
      context.setTime(System.currentTimeMillis());
      for (Entry<String, SortedMap<MetricName, Metric>> entry : getMetricsRegistry().groupedMetrics().entrySet()) {
        for (Entry<MetricName, Metric> subEntry : entry.getValue().entrySet()) {
          MetricName name = subEntry.getKey();
          Metric metric = subEntry.getValue();
          if (metric instanceof Counter) {
            context.typeTable.put(name, "counter");
          } else if (metric instanceof Gauge) {
            context.typeTable.put(name, "gauge");
          } else if (metric instanceof Histogram) {
            context.typeTable.put(name, "histogram");
          } else if (metric instanceof Meter) {
            context.typeTable.put(name, "meter");
          } else if (metric instanceof Timer) {
            context.typeTable.put(name, "timer");
          }
          metric.processWith(this, name, context);
        }
      }
      ResetableCharArrayWriter writer = getWriter();
      writer.reset();
      Set<Entry<MetricName, MetricInfo>> entrySet = context.metricInfoMap.entrySet();
View Full Code Here

   * @param name String name of Gauge
   * @param <T> value type Gauge returns
   * @return Gauge<T> from MetricsRegistry
   */
  public <T> Gauge<T> getExistingGauge(String name) {
    Metric metric = registry.allMetrics().get(makeMetricName(name));
    return metric instanceof Gauge ? (Gauge<T>) metric : null;
  }
View Full Code Here

                // Parse all of the metrics in the message
                for (JSONMetric jsonMetric : jsonMetrics) {
                    if (!metricCache.containsKey(jsonMetric.getName())) {
                        logger.info("Creating new " + jsonMetric.getType().name() + " metric for '" + jsonMetric.getName() + "'");
                        Metric newMetric = createMetric(jsonMetric);
                        metricCache.put(jsonMetric.getName(), newMetric);
                    }

                    // Record the update
                    logger.debug("Updating '" + jsonMetric.getName() + "' with <" + jsonMetric.getValue() + ">");
View Full Code Here

                // Parse all of the metrics in the message
                for (JSONMetric jsonMetric : jsonMetrics) {
                    if (!metricCache.containsKey(jsonMetric.getName())) {
                        logger.info("Creating new " + jsonMetric.getType().name() + " metric for '" + jsonMetric.getName() + "'");
                        Metric newMetric = createMetric(jsonMetric);
                        metricCache.put(jsonMetric.getName(), newMetric);
                    }

                    // Record the update
                    logger.debug("Updating " + jsonMetric.getType() + " '" + jsonMetric.getName() + "' with <" + jsonMetric.getValue() + ">");
View Full Code Here

                // Parse all of the metrics in the message
                for (JSONMetric jsonMetric : jsonMetrics) {
                    if (!metricCache.containsKey(jsonMetric.getName())) {
                        logger.info("Creating new " + jsonMetric.getType().name() + " metric for '" + jsonMetric.getName() + "'");
                        Metric newMetric = createMetric(jsonMetric);
                        metricCache.put(jsonMetric.getName(), newMetric);
                    }

                    // Record the update
                    logger.debug("Updating " + jsonMetric.getType() + " '" + jsonMetric.getName() + "' with <" + jsonMetric.getValue() + ">");
View Full Code Here

                new IndexerMetricsUtil.IndexerMetricPredicate());
        for (Entry<String, SortedMap<MetricName, Metric>> metricsGroupEntry : groupedMetrics.entrySet()) {
            SortedMap<MetricName, Metric> metricsGroupMap = metricsGroupEntry.getValue();
            for (Entry<MetricName, Metric> metricEntry : metricsGroupMap.entrySet()) {
                MetricName metricName = metricEntry.getKey();
                Metric metric = metricEntry.getValue();
                String counterName = metricName.getType() + ": " + metricName.getName();
                if (metric instanceof Counter) {
                    Counter counter = (Counter) metric;
                    context.getCounter(COUNTER_GROUP, counterName).increment(counter.count());
                } else if (metric instanceof Meter) {
View Full Code Here

                // Parse all of the metrics in the message
                for (JSONMetric jsonMetric : jsonMetrics) {
                    if (!metricCache.containsKey(jsonMetric.getName())) {
                        logger.info("Creating new " + jsonMetric.getType().name() + " metric for '" + jsonMetric.getName() + "'");
                        Metric newMetric = createMetric(jsonMetric);
                        metricCache.put(jsonMetric.getName(), newMetric);
                    }

                    // Record the update
                    logger.debug("Updating " + jsonMetric.getType() + " '" + jsonMetric.getName() + "' with <" + jsonMetric.getValue() + ">");
View Full Code Here

TOP

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

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.