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 = new ArrayList<>();

	/** The metrics group. */  
	private final Map<String, MetricGroup>List<MetricGroup> metricGroups = new HashMap<>ArrayList<>();   

	/** Add a metrics reporter. */
	public void addReporter(MetricsReporter reporter) {};

	/** Add a metric group. */
	public void addGroup(String groupName, MetricGroup group) {};

	/** Get metrics reporters. */
	public List<MetricsReporter> getReporters() {};

	/** Get metric groups. */
	public Map<String, MetricGroup>List<MetricGroup> getMetricGroups() {};
}

MetricGroup

...

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

	  /** ConstructorRegister ofgauge MetricGroupmetric. */
 	public void MetricGroupgauge(String groupNamename, Gauge gauge) {}

		this.groupName = groupName;
   		Metrics.getInstance().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/** Register counter metric. */
	public void histogramcounter(String name, HistogramCounter counter) {}

	/** AddRegister tag forhistogram metric group. */
	public void addTaghistogram(String tagname, StringHistogram valuecounter) {}
}

Paimon support to add tags for metric groups, the tags is likely to scopes in Flink's metric group. The tagged metrics group will report metric value with tags as a part of prefix of the metric name. 

Table partition and bucket can be added as tag for some metric groups. Like the number of files monitoring in committing / scan / compaction, users can monitor the files of different buckets to check the data skew, and by checking the commit compaction duration of different buckets to see which unexpected bucket caused the long commit compaction duration.

MetricsReporter

MetricsReporter  is used to report metrics to external backend, Paimon will implement an out of box reporter as JMX `MetricsReporter` MetricsReporter .

Code Block
languagejava
public interface MetricsReporter {
	/** Configure reporter after instantiating it.*/
     void open();

    /** Closes this reporter. */
    void close();

	/** Report the current measurements. This method is called periodically by the Metrics. */
	void report();
}

...