Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
public class Metrics {

    /** The metrics reporters container. */
  	private final List<MetricsReporter> reporters;

	/** The metrics group. */
	private final List<MetricGroup>Map<String, MetricGroup> metricGroups;

	/** Register metrics to MetricGroup. 
 		@param name The name of metric.
		@param metric The metric to register.	
	*/
	public void registerMetrics(String name, Metric metric, int groupIndex) {}
}

MetricGroup

MetricGroup is a class responsible for metrics registering and tagging, there is a metrics container in it. It provides register method for each type of measurable metric, registering metrics will put metrics to the metrics container.

Code Block
languagejava
public class MetricGroup {
	private final String groupName;
	
	/** tags of metric group. */
	private final Map<String, Set<String>> tags = new HashMap<>();

	/** Map of gauge metrics. */
    private final Map<String, Gauge<?>> gauges = new HashMap<>();

    /** Map of counter metrics. */
    private final Map<String, Counter> counters = new HashMap<>();

	/** Map of counter metrics. */
    private final Map<String, Histogram> histograms = new HashMap<>();

   /** Register gauge metric. */
 	public void gauge(String name, Gauge gauge) {}

	/** Register counter metric. */
	public void counter(String name, Counter counter) {}

	/** Register histogram metric. */
	public void histogram(String name, Histogram counter) {}    

	/** Add tag for metric group. */
	public void addTag(String tag, String value) {}  
}

...