001package org.avaje.metric; 002 003/** 004 * The name of the metric. 005 */ 006public interface MetricName extends Comparable<MetricName> { 007 008 /** 009 * Create a Metric name by parsing a name that is expected to include periods (dot notation 010 * similar to package.Class.method). 011 */ 012 static MetricName of(String name) { 013 return MetricManager.name(name); 014 } 015 016 /** 017 * Create a MetricName based on a class and name. 018 * <p> 019 * Often the name maps to a method name. 020 */ 021 static MetricName of(Class<?> cls, String name) { 022 return MetricManager.name(cls, name); 023 } 024 025 /** 026 * Return a simple java like name. 027 */ 028 String getSimpleName(); 029 030 /** 031 * Create and return another MetricName by appending the suffix. 032 */ 033 MetricName append(String suffix); 034 035 /** 036 * Return true if the metric name starts with the given prefix. 037 */ 038 boolean startsWith(String prefix); 039 040 /** 041 * Return true if the metric is considered an "error" metric with a name ending in ".error". 042 */ 043 boolean isError(); 044}