Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,111 +55,111 @@ public class TableOptimizingMetrics {
// table optimizing status duration metrics
public static final MetricDefine TABLE_OPTIMIZING_STATUS_IDLE_DURATION =
defineGauge("table_optimizing_status_idle_duration_mills")
.withDescription("Duration in seconds after table be in idle status")
.withDescription("Duration in milliseconds after table be in idle status")
.withTags("catalog", "database", "table")
.build();

public static final MetricDefine TABLE_OPTIMIZING_STATUS_PENDING_DURATION =
defineGauge("table_optimizing_status_pending_duration_mills")
.withDescription("Duration in seconds after table be in pending status")
.withDescription("Duration in milliseconds after table be in pending status")
.withTags("catalog", "database", "table")
.build();

public static final MetricDefine TABLE_OPTIMIZING_STATUS_PLANNING_DURATION =
defineGauge("table_optimizing_status_planning_duration_mills")
.withDescription("Duration in seconds after table be in planning status")
.withDescription("Duration in milliseconds after table be in planning status")
.withTags("catalog", "database", "table")
.build();

public static final MetricDefine TABLE_OPTIMIZING_STATUS_EXECUTING_DURATION =
defineGauge("table_optimizing_status_executing_duration_mills")
.withDescription("Duration in seconds after table be in executing status")
.withDescription("Duration in milliseconds after table be in executing status")
.withTags("catalog", "database", "table")
.build();

public static final MetricDefine TABLE_OPTIMIZING_STATUS_COMMITTING_DURATION =
defineGauge("table_optimizing_status_committing_duration_mills")
.withDescription("Duration in seconds after table be in committing status")
.withDescription("Duration in milliseconds after table be in committing status")
.withTags("catalog", "database", "table")
.build();

// table optimizing process count metrics
public static final MetricDefine TABLE_OPTIMIZING_PROCESS_TOTAL_COUNT =
defineCounter("table_optimizing_process_total_count")
.withDescription("Count of all process since ams started")
.withDescription("Count of all optimizing process since ams started")
.withTags("catalog", "database", "table")
.build();

public static final MetricDefine TABLE_OPTIMIZING_PROCESS_FAILED_COUNT =
defineCounter("table_optimizing_process_failed_count")
.withDescription("Count of failed process since ams started")
.withDescription("Count of failed optimizing process since ams started")
.withTags("catalog", "database", "table")
.build();

public static final MetricDefine TABLE_OPTIMIZING_MINOR_TOTAL_COUNT =
defineCounter("table_optimizing_minor_total_count")
.withDescription("Count of minor process since ams started")
.withDescription("Count of minor optimizing process since ams started")
.withTags("catalog", "database", "table")
.build();

public static final MetricDefine TABLE_OPTIMIZING_MINOR_FAILED_COUNT =
defineCounter("table_optimizing_minor_failed_count")
.withDescription("Count of failed minor process since ams started")
.withDescription("Count of failed minor optimizing process since ams started")
.withTags("catalog", "database", "table")
.build();

public static final MetricDefine TABLE_OPTIMIZING_MAJOR_TOTAL_COUNT =
defineCounter("table_optimizing_major_total_count")
.withDescription("Count of major process since ams started")
.withDescription("Count of major optimizing process since ams started")
.withTags("catalog", "database", "table")
.build();

public static final MetricDefine TABLE_OPTIMIZING_MAJOR_FAILED_COUNT =
defineCounter("table_optimizing_major_failed_count")
.withDescription("Count of failed major process since ams started")
.withDescription("Count of failed major optimizing process since ams started")
.withTags("catalog", "database", "table")
.build();

public static final MetricDefine TABLE_OPTIMIZING_FULL_TOTAL_COUNT =
defineCounter("table_optimizing_full_total_count")
.withDescription("Count of full process since ams started")
.withDescription("Count of full optimizing process since ams started")
.withTags("catalog", "database", "table")
.build();

public static final MetricDefine TABLE_OPTIMIZING_FULL_FAILED_COUNT =
defineCounter("table_optimizing_full_failed_count")
.withDescription("Count of failed full process since ams started")
.withDescription("Count of failed full optimizing process since ams started")
.withTags("catalog", "database", "table")
.build();

// table optimizing process status metrics
public static final MetricDefine TABLE_OPTIMIZING_STATUS_IN_IDLE =
defineGauge("table_optimizing_status_in_idle")
.withDescription("If currently table is in status idle")
.withDescription("If currently table is in idle status")
.withTags("catalog", "database", "table")
.build();

public static final MetricDefine TABLE_OPTIMIZING_STATUS_IN_PENDING =
defineGauge("table_optimizing_status_in_pending")
.withDescription("If currently table is in status pending")
.withDescription("If currently table is in pending status")
.withTags("catalog", "database", "table")
.build();

public static final MetricDefine TABLE_OPTIMIZING_STATUS_IN_PLANNING =
defineGauge("table_optimizing_status_in_planning")
.withDescription("If currently table is in status planning")
.withDescription("If currently table is in planning status")
.withTags("catalog", "database", "table")
.build();

public static final MetricDefine TABLE_OPTIMIZING_STATUS_IN_EXECUTING =
defineGauge("table_optimizing_status_in_executing")
.withDescription("If currently table is in status executing")
.withDescription("If currently table is in executing status")
.withTags("catalog", "database", "table")
.build();

public static final MetricDefine TABLE_OPTIMIZING_STATUS_IN_COMMITTING =
defineGauge("table_optimizing_status_in_committing")
.withDescription("If currently table is in status committing")
.withDescription("If currently table is in committing status")
.withTags("catalog", "database", "table")
.build();

Expand All @@ -175,7 +175,7 @@ public class TableOptimizingMetrics {
private final ServerTableIdentifier identifier;

private OptimizingStatus optimizingStatus;
private long stateSetTimestamp = System.currentTimeMillis();
private long statusSetTimestamp = System.currentTimeMillis();
private final List<MetricKey> registeredMetricKeys = Lists.newArrayList();
private MetricRegistry globalRegistry;

Expand All @@ -200,7 +200,7 @@ private void registerMetric(MetricRegistry registry, MetricDefine define, Metric

public void register(MetricRegistry registry) {
if (globalRegistry == null) {
// register state duration metrics
// register status duration metrics
registerMetric(
registry, TABLE_OPTIMIZING_STATUS_IDLE_DURATION, new StatusDurationGauge(STATUS_IDLE));
registerMetric(
Expand Down Expand Up @@ -252,14 +252,14 @@ public void unregister() {
}

/**
* Handle table self optimizing state change event.
* Handle table self optimizing status change event.
*
* @param optimizingStatus new optimizing status
* @param stateSetTimestamp timestamp of status changed.
* @param statusSetTimestamp timestamp of status changed.
*/
public void statusChanged(OptimizingStatus optimizingStatus, long stateSetTimestamp) {
public void statusChanged(OptimizingStatus optimizingStatus, long statusSetTimestamp) {
this.optimizingStatus = optimizingStatus;
this.stateSetTimestamp = stateSetTimestamp;
this.statusSetTimestamp = statusSetTimestamp;
}

/**
Expand Down Expand Up @@ -322,15 +322,15 @@ class StatusDurationGauge implements Gauge<Long> {

@Override
public Long getValue() {
String state = getOptimizingStatusDesc(optimizingStatus);
if (targetStatus.equals(state)) {
return stateDuration();
String status = getOptimizingStatusDesc(optimizingStatus);
if (targetStatus.equals(status)) {
return statusDuration();
}
return 0L;
}

private Long stateDuration() {
return System.currentTimeMillis() - stateSetTimestamp;
private Long statusDuration() {
return System.currentTimeMillis() - statusSetTimestamp;
}
}

Expand All @@ -343,8 +343,8 @@ class IsInStatusGauge implements Gauge<Long> {

@Override
public Long getValue() {
String state = getOptimizingStatusDesc(optimizingStatus);
if (targetStatus.equals(state)) {
String status = getOptimizingStatusDesc(optimizingStatus);
if (targetStatus.equals(status)) {
return 1L;
}
return 0L;
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guides/configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Self-optimizing configurations are applicable to both Iceberg Format and Mixed s
| self-optimizing.max-task-size-bytes | 134217728(128MB) | Maximum file size bytes in a single task for splitting tasks |
| self-optimizing.fragment-ratio | 8 | The fragment file size threshold. We could divide self-optimizing.target-size by this ratio to get the actual fragment file size |
| self-optimizing.min-target-size-ratio | 0.75 | The undersized segment file size threshold. Segment files under this threshold will be considered for rewriting |
| self-optimizing.minor.trigger.file-count | 12 | The minimum number of files to trigger minor optimizing is determined by the sum of fragment file count and equality delete file count |
| self-optimizing.minor.trigger.file-count | 12 | The minimum number of files to trigger minor optimizing is determined by the sum of fragment file count and equality delete file count |
| self-optimizing.minor.trigger.interval | 3600000(1 hour) | The time interval in milliseconds to trigger minor optimizing |
| self-optimizing.major.trigger.duplicate-ratio | 0.1 | The ratio of duplicate data of segment files to trigger major optimizing |
| self-optimizing.full.trigger.interval | -1(closed) | The time interval in milliseconds to trigger full optimizing |
Expand Down
56 changes: 37 additions & 19 deletions docs/user-guides/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,48 @@ menu:
weight: 500
---
# Metrics
Amoro provides both table-level and platform-level metrics to help users understand the runtime status of the current table.
## Table metrics
The Amoro Tables details page provides multiple tabs to display the status of the table from various dimensions, mainly including:

| **Tab Name** | **Description** |
| ------------ | ------------------------------------------------------------ |
| Details | Display the table's schema, primary key configuration, partition configuration, properties; as well as the metric information of the files stored in ChangeStore and BaseStore, including the number of files and average file size, as well as the latest submission time of the files. |
| Transactions | The displayed transaction list does not include snapshots generated by Self-optimizing. |
| Optimized | Display all the historical Optimize records of the table, each record shows the number and average size of files before and after Optimize, as well as the execution time of each Optimize. |
| Operations | Display the current table's DDL historical change records. |
Amoro build a metrics system to measure the behaviours of table management processes, like how long has it been since a table last performed self-optimizing process, and how much resources does a optimizer group currently has?

![table-details](../images/admin/table_metrics.png)
There are two types of metrics provided in the Amoro metric system: Gauge and Counter.

![table-optimize-history](../images/admin/table_optimizer_history.png)
Gauge: Provides a value of any type at a point in time.
Counter: Used to count values by incrementing and decrementing.

Amoro has supported built-in metrics to measure status of table self-optimizing processes and optimizer resources, which can be [reported to external metric system like Prometheus etc](../deployment/#configure-metric-reporter).

## Self-optimizing metrics
The Optimizers page displays platform-level Self-optimizing information, including the total amount and usage of resources under different groups, as well as the status and resource usage of all tables that have executed Self-optimizing under the group.
![optimizing-metrics](../images/admin/optimizer_metrics.png)

| Metric Name | Type | Tags | Description |
|---------------------------------------------------|---------|--------------------------|--------------------------------------------------------------|
| table_optimizing_status_idle_duration_mills | Gauge | catalog, database, table | Duration in milliseconds after table be in idle status |
| table_optimizing_status_pending_duration_mills | Gauge | catalog, database, table | Duration in milliseconds after table be in pending status |
| table_optimizing_status_planning_duration_mills | Gauge | catalog, database, table | Duration in milliseconds after table be in planning status |
| table_optimizing_status_executing_duration_mills | Gauge | catalog, database, table | Duration in milliseconds after table be in executing status |
| table_optimizing_status_committing_duration_mills | Gauge | catalog, database, table | Duration in milliseconds after table be in committing status |
| table_optimizing_process_total_count | Counter | catalog, database, table | Count of all optimizing process since ams started |
| table_optimizing_process_failed_count | Counter | catalog, database, table | Count of failed optimizing process since ams started |
| table_optimizing_minor_total_count | Counter | catalog, database, table | Count of minor optimizing process since ams started |
| table_optimizing_minor_failed_count | Counter | catalog, database, table | Count of failed minor optimizing process since ams started |
| table_optimizing_major_total_count | Counter | catalog, database, table | Count of major optimizing process since ams started |
| table_optimizing_major_failed_count | Counter | catalog, database, table | Count of failed major optimizing process since ams started |
| table_optimizing_full_total_count | Counter | catalog, database, table | Count of full optimizing rocess since ams started |
| table_optimizing_full_failed_count | Counter | catalog, database, table | Count of failed full optimizing process since ams started |
| table_optimizing_status_in_idle | Gauge | catalog, database, table | If currently table is in idle status |
| table_optimizing_status_in_pending | Gauge | catalog, database, table | If currently table is in pending status |
| table_optimizing_status_in_planning | Gauge | catalog, database, table | If currently table is in planning status |
| table_optimizing_status_in_executing | Gauge | catalog, database, table | If currently table is in executing status |
| table_optimizing_status_in_committing | Gauge | catalog, database, table | If currently table is in committing status |

- **Optimizing Status**: The current optimizing status of the table, including minor, major, full, idle, and pending.
- **Duration**: The duration of the current status.
- **File Count**: The total number of files involved in the current Self-optimizing, including base, insert, eq-delete, and pos-delete file types.
- **File Size**: The total size of files involved in the current Self-optimizing.
- **Quota**: The proportion of self-optimizing execution time executed per unit time.
- **Quota Occupation**: The actual Quota used for self-optimizing during execution of the table in the last hour. When optimizer resources are sufficient and the table requires more resources for self-optimizing, this value will be greater than 100%. When resources are scarce or the table requires fewer resources for self-optimizing, this value will be less than 100%.
## Optimizer Group metrics

| Metric Name | Type | Tags | Description |
|----------------------------------------|--------|-------|--------------------------------------------------|
| optimizer_group_pending_tasks | Gauge | group | Number of pending tasks in optimizer group |
| optimizer_group_executing_tasks | Gauge | group | Number of executing tasks in optimizer group |
| optimizer_group_planing_tables | Gauge | group | Number of planing tables in optimizer group |
| optimizer_group_pending_tables | Gauge | group | Number of pending tables in optimizer group |
| optimizer_group_executing_tables | Gauge | group | Number of executing tables in optimizer group |
| optimizer_group_optimizer_instances | Gauge | group | Number of optimizer instances in optimizer group |
| optimizer_group_memory_bytes_allocated | Gauge | group | Memory bytes allocated in optimizer group |
| optimizer_group_threads | Gauge | group | Number of total threads in optimizer group |
Loading