Skip to content

Commit 941ea07

Browse files
authored
feat: add metric manager (#1621)
1 parent a8428d2 commit 941ea07

34 files changed

+633
-360
lines changed

Cargo.lock

Lines changed: 31 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ members = [
3131
"src/common",
3232
"src/metric_engine",
3333
"src/pb_types",
34-
"src/server"
34+
"src/server",
35+
"src/storage"
3536
]
3637

3738
[workspace.dependencies]
3839
anyhow = { version = "1.0" }
3940
metric_engine = { path = "src/metric_engine" }
41+
horaedb_storage = { package = "storage", path = "src/storage" }
4042
common = { path = "src/common" }
4143
thiserror = "1"
4244
bytes = "1"

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ udeps:
4747
cd $(DIR); cargo udeps --all-targets --all-features --workspace
4848

4949
clippy:
50-
cd $(DIR); cargo clippy --all-targets --all-features --workspace -- -D warnings -D clippy::dbg-macro -A clippy::too-many-arguments
50+
cd $(DIR); cargo clippy --all-targets --all-features --workspace -- -D warnings -D clippy::dbg-macro -A clippy::too-many-arguments \
51+
-A dead_code
5152

5253
ensure-disk-quota:
5354
bash ./scripts/free-disk-space.sh

src/benchmarks/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ description.workspace = true
2828
[dependencies]
2929
bytes = { workspace = true }
3030
common = { workspace = true }
31-
metric_engine = { workspace = true }
31+
horaedb_storage = { workspace = true }
3232
pb_types = { workspace = true }
3333
prost = { workspace = true }
3434
serde = { workspace = true }

src/benchmarks/src/encoding_bench.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
//! encoding bench.
1919
2020
use bytes::Bytes;
21-
use metric_engine::{
21+
use horaedb_storage::{
2222
manifest::Snapshot,
2323
sst::{FileMeta, SstFile},
2424
};

src/common/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,7 @@ homepage.workspace = true
2626
description.workspace = true
2727

2828
[dependencies]
29+
anyhow = { workspace = true }
2930
serde = { workspace = true }
31+
thiserror = { workspace = true }
3032
toml = { workspace = true }
File renamed without changes.

src/common/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
mod error;
1819
mod size_ext;
1920
mod time_ext;
2021

22+
pub use error::{AnyhowError, Error, Result};
2123
pub use size_ext::ReadableSize;
2224
pub use time_ext::{now, ReadableDuration};

src/metric_engine/Cargo.toml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,11 @@ description.workspace = true
2727

2828
[dependencies]
2929
anyhow = { workspace = true }
30-
arrow = { workspace = true }
31-
async-scoped = { workspace = true }
32-
async-trait = { workspace = true }
33-
byteorder = { workspace = true }
34-
bytes = { workspace = true }
35-
bytesize = { workspace = true }
3630
common = { workspace = true }
37-
datafusion = { workspace = true }
38-
futures = { workspace = true }
39-
itertools = { workspace = true }
40-
lazy_static = { workspace = true }
41-
object_store = { workspace = true }
42-
parquet = { workspace = true, features = ["object_store"] }
43-
pb_types = { workspace = true }
44-
prost = { workspace = true }
45-
serde = { workspace = true }
31+
horaedb_storage = { workspace = true }
4632
thiserror = { workspace = true }
4733
tokio = { workspace = true }
4834
tracing = { workspace = true }
49-
uuid = { workspace = true, features = ["v4", "fast-rng", "macro-diagnostics"] }
5035

5136
[dev-dependencies]
5237
temp-dir = { workspace = true }

src/metric_engine/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
* Metric Engine
2+
3+
The basic write process is as follows:
4+
5+
```plaintext
6+
+----------------+
7+
| start |
8+
+----------------+
9+
|
10+
|
11+
v
12+
+ - - - - - - - - - -+
13+
' Metric Engine '
14+
' '
15+
' +----------------+ '
16+
' | metric_manager | '
17+
' +----------------+ '
18+
' | '
19+
' | '
20+
' v '
21+
' +----------------+ '
22+
' | index_manager | '
23+
' +----------------+ '
24+
' | '
25+
' | '
26+
' v '
27+
' +----------------+ '
28+
' | data_manager | '
29+
' +----------------+ '
30+
' '
31+
+ - - - - - - - - - -+
32+
|
33+
|
34+
v
35+
+----------------+
36+
| end |
37+
+----------------+
38+
```
39+
40+
The structure pass between different module is `Sample`, modeled after [data model](https://prometheus.io/docs/concepts/data_model/) used in prometheus.

0 commit comments

Comments
 (0)