Examples of MetricName


Examples of com.yammer.metrics.core.MetricName

   *
   * @param name String name given to metric
   * @return MetricName for use with MetricsRegistry
   */
  protected MetricName makeMetricName(String name) {
    return new MetricName(groupName, type, name);
  }
View Full Code Here

Examples of com.yammer.metrics.core.MetricName

    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

Examples of com.yammer.metrics.core.MetricName

            mbeanName.append("type=").append(type);
            mbeanName.append(",keyspace=").append(keyspaceName);
            mbeanName.append(",scope=").append(columnFamilyName);
            mbeanName.append(",name=").append(metricName);

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

Examples of com.yammer.metrics.core.MetricName

        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.toString()));
        }
View Full Code Here

Examples of com.yammer.metrics.core.MetricName

    /** Total number of bytes compacted since server [re]start */
    public final Counter bytesCompacted;

    public CompactionMetrics(final ThreadPoolExecutor... collectors)
    {
        pendingTasks = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "PendingTasks"), new Gauge<Integer>()
        {
            public Integer value()
            {
                int n = 0;
                for (String tableName : Schema.instance.getTables())
                {
                    for (ColumnFamilyStore cfs : Table.open(tableName).getColumnFamilyStores())
                        n += cfs.getCompactionStrategy().getEstimatedRemainingTasks();
                }
                for (ThreadPoolExecutor collector : collectors)
                    n += collector.getTaskCount() - collector.getCompletedTaskCount();
                return n;
            }
        });
        completedTasks = Metrics.newGauge(new MetricName(GROUP_NAME, TYPE_NAME, "CompletedTasks"), new Gauge<Long>()
        {
            public Long value()
            {
                long completedTasks = 0;
                for (ThreadPoolExecutor collector : collectors)
                    completedTasks += collector.getCompletedTaskCount();
                return completedTasks;
            }
        });
        totalCompactionsCompleted = Metrics.newMeter(new MetricName(GROUP_NAME, TYPE_NAME, "TotalCompactionsCompleted"), "compaction completed", TimeUnit.SECONDS);
        bytesCompacted = Metrics.newCounter(new MetricName(GROUP_NAME, TYPE_NAME, "BytesCompacted"));
    }
View Full Code Here

Examples of com.yammer.metrics.core.MetricName

     * @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 == GaugeMetric.class) {
            return Metrics.newGauge(metricName, new GaugeMetricImpl());
        } else if (metricType == CounterMetric.class) {
View Full Code Here

Examples of com.yammer.metrics.core.MetricName

   * @param metricName name of the metric.
   * @param value to increment the metric by.
   */
  public void counter(Class<?> scope, String metricName, long value) {
    if (!counters.containsKey(metricName)) {
      MetricName name = getMetricName(scope, metricName);
      counters.put(metricName, Metrics.newCounter(name));
    }
    counters.get(metricName).inc(value);
  }
View Full Code Here

Examples of com.yammer.metrics.core.MetricName

   * @param metricName  the name of the {@link Metric}
   * @param scope the scope of the {@link Metric}
   * @return instance of {@link MetricName}
   */
  protected MetricName getMetricName(Class<?> scope, String metricName) {
    return new MetricName(metricGroup, metricType.name(),
                                     metricName,
                                     scope == null ? null : getScope(scope));
  }
View Full Code Here

Examples of com.yammer.metrics.core.MetricName

   * @param metricName name of the metric.
   * @param value to be associated with the metric.
   */
  public void set(String metricName, final float value) {
    if (!gauges.containsKey(metricName)) {
      MetricName name = getMetricName(null, metricName);
      gauges.put(metricName, Metrics.newGauge(name, new Gauge<Float>() {
        @Override
        public Float value() {
          return value;
        }
View Full Code Here

Examples of com.yammer.metrics.core.MetricName

   * @param metricName name of the metric.
   * @param value to increment the meter by.
   */
  public void meter(Class<?> scope, String metricName, long value) {
    if (!meters.containsKey(metricName)) {
      MetricName name = getMetricName(scope, metricName);
      meters.put(metricName,
                 Metrics.newMeter(name, metricName, TimeUnit.SECONDS));
    }
    meters.get(metricName).mark(value);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.