static String forCountedMethod(Class<?> klass, Member member, Counted annotation) { return chooseName(annotation.name(), annotation.absolute(), klass, member); }
@Override public boolean isAbsoluteName(Counted annotation) { return annotation.absolute(); }
@Nonnull @Override public String getNameForCounted(@Nonnull Method method, @Nonnull Counted counted) { if (counted.absolute()) { return counted.name(); } if (counted.name().isEmpty()) { if (counted.monotonic()) { return name(method.getDeclaringClass(), method.getName(), COUNTER_SUFFIX_MONOTONIC); } else { return name(method.getDeclaringClass(), method.getName(), COUNTER_SUFFIX); } } return name(method.getDeclaringClass(), counted.name()); }
@Nonnull @Override public String getNameForCounted(@Nonnull Method method, @Nonnull Counted counted) { if (counted.absolute()) { return counted.name(); } if (counted.name().isEmpty()) { if (counted.monotonic()) { return name(method.getDeclaringClass(), method.getName(), COUNTER_SUFFIX_MONOTONIC); } else { return name(method.getDeclaringClass(), method.getName(), COUNTER_SUFFIX); } } return name(method.getDeclaringClass(), counted.name()); }
@Nonnull @Override public String getNameForCounted(@Nonnull final Method method, @Nonnull final Counted counted) { if (counted.absolute()) { return counted.name(); } else { return metricName(method, counted.name()); } }
private boolean isMetricAbsolute(Annotation annotation) { if (extension.<Boolean>getParameter(UseAbsoluteName).orElse(false)) return true; if (CachedGauge.class.isInstance(annotation)) return ((CachedGauge) annotation).absolute(); else if (Counted.class.isInstance(annotation)) return ((Counted) annotation).absolute(); else if (ExceptionMetered.class.isInstance(annotation)) return ((ExceptionMetered) annotation).absolute(); else if (Gauge.class.isInstance(annotation)) return ((Gauge) annotation).absolute(); else if (Metered.class.isInstance(annotation)) return ((Metered) annotation).absolute(); else if (Timed.class.isInstance(annotation)) return ((Timed) annotation).absolute(); else throw new IllegalArgumentException("Unsupported Metrics forMethod [" + annotation.getClass().getName() + "]"); }
private boolean isMetricAbsolute(Annotation annotation) { if (extension.<Boolean>getParameter(UseAbsoluteName).orElse(false)) return true; if (CachedGauge.class.isInstance(annotation)) return ((CachedGauge) annotation).absolute(); else if (Counted.class.isInstance(annotation)) return ((Counted) annotation).absolute(); else if (ExceptionMetered.class.isInstance(annotation)) return ((ExceptionMetered) annotation).absolute(); else if (Gauge.class.isInstance(annotation)) return ((Gauge) annotation).absolute(); else if (Metered.class.isInstance(annotation)) return ((Metered) annotation).absolute(); else if (Timed.class.isInstance(annotation)) return ((Timed) annotation).absolute(); else throw new IllegalArgumentException("Unsupported Metrics forMethod [" + annotation.getClass().getName() + "]"); }