Skip to content

Commit

Permalink
[Enhancement] Add max_tablet_rowset_num metrcis (backport #36539) (#3…
Browse files Browse the repository at this point in the history
…6581)

Co-authored-by: Binglin Chang <[email protected]>
  • Loading branch information
mergify[bot] and decster authored Dec 7, 2023
1 parent 05413df commit 8deadae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions be/src/storage/tablet_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -916,13 +916,14 @@ Status TabletManager::report_all_tablets_info(std::map<TTabletId, TTablet>* tabl

StarRocksMetrics::instance()->report_all_tablets_requests_total.increment(1);

size_t max_tablet_rowset_num = 0;
for (const auto& tablets_shard : _tablets_shards) {
std::shared_lock rlock(tablets_shard.lock);
for (const auto& [tablet_id, tablet_ptr] : tablets_shard.tablet_map) {
TTablet t_tablet;
TTabletInfo tablet_info;
tablet_ptr->build_tablet_report_info(&tablet_info);

max_tablet_rowset_num = std::max(max_tablet_rowset_num, tablet_ptr->version_count());
// find expired transaction corresponding to this tablet
TabletInfo tinfo(tablet_id, tablet_ptr->schema_hash(), tablet_ptr->tablet_uid());
auto find = expire_txn_map.find(tinfo);
Expand All @@ -937,7 +938,9 @@ Status TabletManager::report_all_tablets_info(std::map<TTabletId, TTablet>* tabl
}
}
}
LOG(INFO) << "Report all " << tablets_info->size() << " tablets info";
LOG(INFO) << "Report all " << tablets_info->size()
<< " tablets info. max_tablet_rowset_num:" << max_tablet_rowset_num;
StarRocksMetrics::instance()->max_tablet_rowset_num.set_value(max_tablet_rowset_num);
return Status::OK();
}

Expand Down
2 changes: 2 additions & 0 deletions be/src/util/starrocks_metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ StarRocksMetrics::StarRocksMetrics() : _metrics(_s_registry_name) {
REGISTER_STARROCKS_METRIC(tablet_base_max_compaction_score);
REGISTER_STARROCKS_METRIC(tablet_update_max_compaction_score);

REGISTER_STARROCKS_METRIC(max_tablet_rowset_num);

REGISTER_STARROCKS_METRIC(push_request_write_bytes_per_second);
REGISTER_STARROCKS_METRIC(query_scan_bytes_per_second);
REGISTER_STARROCKS_METRIC(max_disk_io_util_percent);
Expand Down
1 change: 1 addition & 0 deletions be/src/util/starrocks_metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ class StarRocksMetrics {
METRIC_DEFINE_INT_GAUGE(tablet_cumulative_max_compaction_score, MetricUnit::NOUNIT);
METRIC_DEFINE_INT_GAUGE(tablet_base_max_compaction_score, MetricUnit::NOUNIT);
METRIC_DEFINE_INT_GAUGE(tablet_update_max_compaction_score, MetricUnit::NOUNIT);
METRIC_DEFINE_INT_GAUGE(max_tablet_rowset_num, MetricUnit::NOUNIT);

// The following metrics will be calculated
// by metric calculator
Expand Down

0 comments on commit 8deadae

Please sign in to comment.