Versions Compared

Key

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

...

Code Block
languagejava
public class MetricGroup {
	private final String groupName;

	/** Constructor of MetricGroup. */
	public MetricGroup(String groupName) {
		this.groupName = groupName;
   		 getMetricsInstance().addGroup(groupName, this);
   }
	
	/** 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) {}
}

...

Code Block
languagejava
public class CommitMetrics {
	private final String GROUP_NAME = "commitMetricGroup";
	private final String LAST_COMMIT_DURATION_METRIC = "lastCommitDuration";
	...
	private MetricGroup group;

	public CommitMetrics() {
		this.group = new MetricsGroup(GROUP_NAME);
  		 getMetricsInstance().addGroup(GROUP_NAME, group);
	}
	private void registerCommitMetrics() {   
		group.gauge(LAST_COMMIT_DURATION_METRIC, new CommitDurationGauge());
		...
	}
}

...

Code Block
public class ScanMetrics {
	private final String GROUP_NAME = "scanMetricGroup";
	private final String LAST_SCAN_SKIPPED_MANIFESTS_METRIC = "lastScanSkippedManifests";
	...
 	private MetricGroup group;

	public ScanMetrics() {
		this.group = new MetricsGroup(GROUP_NAME);
  		 getMetricsInstance().addGroup(GROUP_NAME, group);
	}
   	
	private void registerScanMetrics() {   
		group.countergauge(LAST_SCAN_SKIPPED_MANIFESTS_METRIC, new LastScanSkippedManifestsGauge());
		...
	}
}

...

Code Block
public class CompactionMetrics {

 	private final String GROUP_NAME = "compactionMetricGroup";
	private final String LAST_TABLE_FILES_COMPACTED_BEFORE_METRIC = "lastTableFilesCompactedBefore";
 	...
 	private MetricGroup group;

	public CompactionMetrics() {
		this.group = new MetricsGroup(GROUP_NAME);
  		 getMetricsInstance().addGroup(GROUP_NAME, group);
	}
   	
	private void registerScanMetrics() {   
		group.countergauge(LAST_TABLE_FILES_COMPACTED_BEFORE_METRIC, new LastTableFilesCompactedBeforeGauge());
		...
	} 
}

...