mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-04 04:12:55 +00:00
chore: add manifest related metrics (#3634)
* chore: add two manifest related metrics * Update src/mito2/src/manifest/manager.rs Co-authored-by: Yingwen <realevenyag@gmail.com> * Update src/mito2/src/metrics.rs Co-authored-by: Yingwen <realevenyag@gmail.com> * fix: resolve PR comments * update cargo lock --------- Co-authored-by: Yingwen <realevenyag@gmail.com>
This commit is contained in:
19
Cargo.lock
generated
19
Cargo.lock
generated
@@ -3794,9 +3794,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.3.26"
|
||||
version = "0.3.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8"
|
||||
checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
@@ -10999,7 +10999,7 @@ version = "1.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"cfg-if 1.0.0",
|
||||
"rand",
|
||||
"static_assertions",
|
||||
]
|
||||
@@ -11447,12 +11447,6 @@ version = "0.11.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "wasite"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.89"
|
||||
@@ -11608,12 +11602,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "whoami"
|
||||
version = "1.5.1"
|
||||
version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9"
|
||||
checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50"
|
||||
dependencies = [
|
||||
"redox_syscall 0.4.1",
|
||||
"wasite",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
|
||||
@@ -22,13 +22,14 @@ use snafu::{OptionExt, ResultExt};
|
||||
use store_api::manifest::ManifestVersion;
|
||||
use store_api::metadata::RegionMetadataRef;
|
||||
use store_api::storage::{RegionId, SequenceNumber};
|
||||
use strum::Display;
|
||||
|
||||
use crate::error::{RegionMetadataNotFoundSnafu, Result, SerdeJsonSnafu, Utf8Snafu};
|
||||
use crate::sst::file::{FileId, FileMeta};
|
||||
use crate::wal::EntryId;
|
||||
|
||||
/// Actions that can be applied to region manifest.
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Display)]
|
||||
pub enum RegionMetaAction {
|
||||
/// Change region's metadata for request like ALTER
|
||||
Change(RegionChange),
|
||||
|
||||
@@ -29,6 +29,7 @@ use crate::manifest::action::{
|
||||
RegionMetaActionList,
|
||||
};
|
||||
use crate::manifest::storage::{file_version, is_delta_file, ManifestObjectStore};
|
||||
use crate::metrics::MANIFEST_OP_ELAPSED;
|
||||
|
||||
/// Options for [RegionManifestManager].
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -141,6 +142,10 @@ impl RegionManifestManager {
|
||||
|
||||
/// Update the manifest. Return the current manifest version number.
|
||||
pub async fn update(&self, action_list: RegionMetaActionList) -> Result<ManifestVersion> {
|
||||
let _t = MANIFEST_OP_ELAPSED
|
||||
.with_label_values(&["update"])
|
||||
.start_timer();
|
||||
|
||||
let mut inner = self.inner.write().await;
|
||||
inner.update(action_list).await
|
||||
}
|
||||
@@ -245,6 +250,10 @@ impl RegionManifestManagerInner {
|
||||
///
|
||||
/// Returns `Ok(None)` if no such manifest.
|
||||
async fn open(options: RegionManifestOptions) -> Result<Option<Self>> {
|
||||
let _t = MANIFEST_OP_ELAPSED
|
||||
.with_label_values(&["open"])
|
||||
.start_timer();
|
||||
|
||||
// construct storage
|
||||
let mut store = ManifestObjectStore::new(
|
||||
&options.manifest_dir,
|
||||
@@ -395,6 +404,10 @@ impl RegionManifestManagerInner {
|
||||
|
||||
/// Makes a new checkpoint. Return the fresh one if there are some actions to compact.
|
||||
async fn do_checkpoint(&mut self) -> Result<Option<RegionCheckpoint>> {
|
||||
let _t = MANIFEST_OP_ELAPSED
|
||||
.with_label_values(&["checkpoint"])
|
||||
.start_timer();
|
||||
|
||||
let last_checkpoint = Self::last_checkpoint(&mut self.store).await?;
|
||||
let current_version = self.last_version;
|
||||
|
||||
|
||||
@@ -297,4 +297,14 @@ lazy_static! {
|
||||
.unwrap();
|
||||
|
||||
// ------- End of partition tree memtable metrics.
|
||||
|
||||
|
||||
// Manifest related metrics:
|
||||
|
||||
/// Elapsed time of manifest operation. Labeled with "op".
|
||||
pub static ref MANIFEST_OP_ELAPSED: HistogramVec = register_histogram_vec!(
|
||||
"greptime_manifest_op_elapsed",
|
||||
"mito manifest operation elapsed",
|
||||
&["op"]
|
||||
).unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user