Example #1
0
  static {
    final Window[] windows = Window.values();
    final ValueMetric[] valueMetrics = ValueMetric.values();
    final DurationMetric[] durationMetrics = DurationMetric.values();
    ALL_METRICS =
        new ArrayList<MetricAttributeDefinition>(
            windows.length * (valueMetrics.length + durationMetrics.length));

    for (final Window window : windows) {
      for (final DurationMetric metric : durationMetrics) {
        final MetricAttributeDefinition attrDefn =
            new DurationMetricAttributeDefinition(metric, window);
        ALL_METRICS.add(attrDefn);
      }

      for (final ValueMetric metric : valueMetrics) {
        final MetricAttributeDefinition attrDefn =
            new ValueMetricAttributeDefinition(metric, window);
        ALL_METRICS.add(attrDefn);
      }
    }
  }
Example #2
0
 /**
  * @param metricName the metric name (cannot be <code>null</code> or empty)
  * @param window the metrics window (cannot be <code>null</code>)
  * @return the attribute definition name (never <code>null</code> or empty)
  */
 public static final String attributeName(final String metricName, final Window window) {
   assert !StringUtil.isBlank(metricName);
   assert (window != null);
   return (metricName + '-' + window.getLiteral());
 }