Versions Compared

Key

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

...

Class Metrics  is the core of metrics system, there are  MetricRegistryMetricGroup  and  MetricsReporter  container in it. When the Metrics  instance is initiating, the MetricRegistry MetricGroup  is instantiated and metrics reporters are started. 

...

Code Block
languagejava
public class Metrics {

    /** The registry that holds the metrics. */
 	private final MetricRegistry registry;

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

	/** The metrics group. */
	private final MetricGroup metricGroup;

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

...

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 {

	/** 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 Registerof gaugecounter metricmetrics. */
 	public void gauge(String name, 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 Addhistogram tag for metrics. */
	public void addTag(String tag, String value) {}  
}metric. */
	public void histogram(String name, Histogram counter) {}    

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

Paimon support to add tags for metrics, the tagged metrics will report metric value with tags. Table partition and bucket can be added as tag for some metrics. 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 duration of different buckets to see which unexpected bucket caused the long commit duration.

MetricsReporter

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

...

Take CommitMetrics as example, the CommitMetrics will be instantiated by FileStoreCommitImpl, then commit related metrics will be registered by MetricRegistry MetricGroup in singleton Metrics

The Metrics has instance of MetricRegistry MetricGroup and MetricsReporters set. MetricRegistry MetricGroup maintains metrics map containers. Metrics registering is a process of putting metrics instances into the metric (gauge, counter) map container. 

...

Metric Name

Description

Type

Tagged

Unit

Update at

lastCommitDuration

The time it took to complete the last commit.

Gauge

Partition, Bucket

Ms

Timer starts before commit starting, update commit duration after the last commit finished.

commitDuration

Distributions of the time taken by the last few commits.

Histogram

Partition, Bucket

Ms

Timer starts before commit starting, update commit duration after each commit finished.

lastCommitAttempts

The number of attempts the last commit made.

Counter

Partition, Bucket

Number

Increment by 1 when trying to commit once, clear the counter after the last commit finished.

lastTableFilesAdded

Number of added table files in last commit, including newly created data files and compacted after.

Gauge

Partition, Bucket

Number

Collecting changes from committables

lastTableFilesDeleted

Number of deleted table files in last commit, which comes from compacted before.

Gauge

Partition, Bucket

Number

Collecting changes from committables

lastTableFilesAppended

Number of appended table files in last commit, which means the newly created data files.

Gauge

Partition, Bucket

Number

Collecting changes from committables

lastTableFilesCommitCompated

Number of compacted table files in last commit, including compacted before and after.

Gauge

Partition, Bucket

Number

Collecting changes from committables

lastChangelogFilesAppended

Number of appended changelog files in last commit

Gauge

Partition, Bucket

Number

Collecting changes from committables

lastChangelogFileCommitCompacted

Number of compacted changelog files in last commit

Gauge

Partition, Bucket

Number

Collecting changes from committables

totalTablesFiles

Number of total data files currently maintained on storage.

Counter

Partition, Bucket

Number

Collecting changes from committables

totalChangelogFiles

Number of total changelog files currently maintained on storage.

Counter

Partition, Bucket

Number

Collecting changes from committables

lastGeneratedSnapshots

Number of snapshot files generated in last commit, maybe 1 snapshot or 2 snapshots.

Gauge

Partition, Bucket

Number

After collecting changes from committables

totalSnapshots

Number of currently retained total snapshots.

Counter

none

Number

When trying to commit, the counter will increment by the number of snapshots generated

When expiring snapshots, the counter will decrement by the number of expiring snapshots.

lastTotalRecordsAppended

Total records count in last commit with APPEND commit kind

Gauge

none

Number

Preparing snapshot file with APPEND commit kind

lastDeltaRecordsAppended

Delta records count in last commit with APPEND commit kind

Gauge

Partition, Bucket

Number

Preparing snapshot file with APPEND commit kind

lastChangelogRecordsAppended

Changelog records count in last commit with APPEND commit kind

Gauge

Partition, Bucket

Number

Preparing snapshot file with APPEND commit kind

lastTotalRecordsCommitCompated

Total records count in last commit with COMPACT commit kind

Gauge

Partition, Bucket

Number

Preparing snapshot file with COMPACT commit kind

lastDeltaRecordsCommitCompated

Delta records count in last commit with COMPACT commit kind

Gauge

Partition, Bucket

Number

Preparing snapshot file with COMPACT commit kind

lastChangelogRecordsCommitCompated

Changelog records count in last commit with COMPACT commit kind

GaugeGauge

Partition, Bucket

Number

Preparing snapshot file with COMPACT commit kind

lastPartitionsWritten

Number of partitions written in last commit

Gauge

none

Number

After collecting changes from committables

lastBucketsWritten

Number of buckets written in last commit

Gauge

none

Number

After collecting changes from committables

...

Metric Name

Description

Type

Tagged

Unit

Update at

lastScanDuration

The time it took to complete the last scan planning.

Gauge

Partition, Bucket

Ms

Timer starts before the scan planning starts, update after the last scan planning operation finished

scanDuration

Distributions of the time taken by the last few scan planning operations.

Histogram

Partition, Bucket

Ms

Timer starts before the scan planning starts, update after each planning finished

lastScannedManifests

Number of scanned manifests files in the last scan planning.

Gauge

Partition, Bucket

Number

Scan planning

lastScanSkippedManifests

Number of skipped manifests files in the last scan planning.

Gauge

Partition, Bucket

Number

Scan planning

lastScanResultTableFiles

Number of result table files in the last scan planning.

Gauge

Partition, Bucket

Number

Scan planning

lastScanGenerateSplits

Number of splits generated by the last scan planning.

Gauge

Partition, Bucket

Number

Scan planning

CompactionMetrics

...

Metric Name

Description

Type

Tagged

Unit

Update at

lastCompactionDuration

The time it took to complete the last compaction.

Gauge

Partition, Bucket

Ms

Timer starts before compaction, update after the last compaction finished

compactionDuration

Distributions of the time taken by the last few compactions.

Histogram

Partition, Bucket

Ms

Timer starts before compaction, update after each compaction finished

lastTableFilesCompactedBefore

Number of deleted files in last compaction

Gauge

Partition, Bucket

Number

After getting compaction result.

lastTableFilesCompactedAfter

Number of added files in last compaction

Gauge

Partition, Bucket

Number

After getting compaction result.

lastChangelogFilesCompacted

Number of changelog files compacted in last compaction

Gauge

Partition, Bucket

Number

After getting compaction result.

lastSortedRuns

Number of total sorted runs of all levels at last compaction

Gauge

Partition, Bucket

Number

Updating levels after getting compaction result.

lastLevel0Files

Number of files at level 0 at last compaction

Gauge

Partition, Bucket

Number

Updating levels after getting compaction result.

...