Package com.dianping.cat.message

Examples of com.dianping.cat.message.Metric


  }

  @Test
  public void testMetric() {
    long timestamp = 1325489621987L;
    Metric metric = newMetric("type", "name", timestamp, "0", "here is the data.");

    check(metric, "M2012-01-02 15:33:41.987\ttype\tname\t0\there is the data.\t\n");
  }
View Full Code Here


      m_queues.put(i, queue);
    }
  }

  private void logMetricForAvg(long timestamp, double duration, String group, String key) {
    Metric metric = Cat.getProducer().newMetric(group, key);
    DefaultMetric defaultMetric = (DefaultMetric) metric;

    defaultMetric.setTimestamp(timestamp);
    defaultMetric.setStatus("S,C");
    defaultMetric.addData(String.format("%s,%.2f", 1, duration));
View Full Code Here

    defaultMetric.setStatus("S,C");
    defaultMetric.addData(String.format("%s,%.2f", 1, duration));
  }

  private void logMetricForCount(long timestamp, String group, String key, int count) {
    Metric metric = Cat.getProducer().newMetric(group, key);
    DefaultMetric defaultMetric = (DefaultMetric) metric;

    defaultMetric.setTimestamp(timestamp);

    defaultMetric.setStatus("C");
View Full Code Here

    }
    return buildMetric(group, domain, key, type, time, value);
  }

  private Metric buildMetric(String group, String domain, String key, String type, long time, double value) {
    Metric metric = Cat.getProducer().newMetric(group, key);
    DefaultMetric defaultMetric = (DefaultMetric) metric;

    defaultMetric.setTimestamp(time);
    if (MetricType.SUM.name().equalsIgnoreCase(type)) {
      defaultMetric.setStatus("S,C");
View Full Code Here

  }

  @Override
  public void logMetric(String name, String status, String nameValuePairs) {
    String type = "";
    Metric metric = newMetric(type, name);

    if (nameValuePairs != null && nameValuePairs.length() > 0) {
      metric.addData(nameValuePairs);
    }

    metric.setStatus(status);
    metric.complete();
  }
View Full Code Here

      HttpServletRequest httpServletRequest = (HttpServletRequest) request;
      String vip = queryVip(httpServletRequest);
      String sourceIp = querySourceIp(httpServletRequest);

      if (StringUtils.isNotEmpty(sourceIp) && StringUtils.isNotEmpty(vip)) {
        Metric metric = Cat.getProducer().newMetric("cdn", vip + ":" + sourceIp);

        metric.setStatus("C");
        metric.addData(String.valueOf(1));
      }
    } catch (Exception e) {
      Cat.logError(e);
    }
    chain.doFilter(request, response);
View Full Code Here

  }

  @Test
  public void testMetric() throws Exception {
    long timestamp = 1325489621987L;
    Metric Metric = newMetric("type", "name", timestamp, "0", "here is the data.");

    MessageTree tree = new DefaultMessageTree();
    tree.setMessage(Metric);
    check(tree, Metric,
          "<tr><td>M15:33:41.987</td><td>type</td><td>name</td><td>&nbsp;</td><td>here is the data.</td></tr>\r\n");
View Full Code Here

TOP

Related Classes of com.dianping.cat.message.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.