Skip to content

Commit 7274ce8

Browse files
committed
feat: add metric engine structure
1 parent b94c99e commit 7274ce8

File tree

8 files changed

+187
-0
lines changed

8 files changed

+187
-0
lines changed

Cargo.lock

+61
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ members = [
2929
"integration_tests",
3030
"integration_tests/sdk/rust",
3131
"src/analytic_engine",
32+
"src/metric_engine",
3233
"src/benchmarks",
3334
"src/catalog",
3435
"src/catalog_impls",
@@ -90,6 +91,7 @@ arrow = { version = "49.0.0", features = ["prettyprint"] }
9091
arrow_ipc = { version = "49.0.0" }
9192
arrow_ext = { path = "src/components/arrow_ext" }
9293
analytic_engine = { path = "src/analytic_engine" }
94+
metric_engine = { path = "src/metric_engine" }
9395
anyhow = { version = "1.0" }
9496
arena = { path = "src/components/arena" }
9597
async-stream = "0.3.4"

src/horaedb/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ logger = { workspace = true }
5151
meta_client = { workspace = true }
5252
moka = { version = "0.10", features = ["future"] }
5353
panic_ext = { workspace = true }
54+
metric_engine = { workspace = true }
5455
proxy = { workspace = true }
5556
query_engine = { workspace = true }
5657
router = { workspace = true }

src/horaedb/src/setup.rs

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use df_operator::registry::{FunctionRegistry, FunctionRegistryImpl};
3131
use interpreters::table_manipulator::{catalog_based, meta_based};
3232
use logger::{info, warn, RuntimeLevel};
3333
use meta_client::{meta_impl, types::NodeMetaInfo};
34+
use metric_engine::*;
3435
use proxy::{
3536
limiter::Limiter,
3637
schema_config_provider::{

src/metric_engine/Cargo.toml

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
[package]
19+
name = "metric_engine"
20+
21+
[package.license]
22+
workspace = true
23+
24+
[package.version]
25+
workspace = true
26+
27+
[package.authors]
28+
workspace = true
29+
30+
[package.edition]
31+
workspace = true
32+
33+
[features]
34+
test = ["tempfile"]
35+
wal-table-kv = ["wal/wal-table-kv"]
36+
wal-message-queue = ["wal/wal-message-queue"]
37+
wal-rocksdb = ["wal/wal-rocksdb"]
38+
wal-local-storage = ["wal/wal-local-storage"]
39+
40+
[dependencies]
41+
# In alphabetical order
42+
anyhow = { workspace = true }
43+
arc-swap = "1.4.0"
44+
arena = { workspace = true }
45+
arrow = { workspace = true }
46+
async-stream = { workspace = true }
47+
async-trait = { workspace = true }
48+
atomic_enum = { workspace = true }
49+
base64 = { workspace = true }
50+
bytes_ext = { workspace = true }
51+
codec = { workspace = true }
52+
common_types = { workspace = true }
53+
datafusion = { workspace = true }
54+
future_ext = { workspace = true }
55+
futures = { workspace = true }
56+
generic_error = { workspace = true }
57+
hash_ext = { workspace = true }
58+
hex = { workspace = true }
59+
horaedbproto = { workspace = true }
60+
hyperloglog = { workspace = true }
61+
id_allocator = { workspace = true }
62+
itertools = { workspace = true }
63+
lazy_static = { workspace = true }
64+
logger = { workspace = true }
65+
lru = { workspace = true }
66+
macros = { workspace = true }
67+
message_queue = { workspace = true }
68+
metric_ext = { workspace = true }
69+
object_store = { workspace = true }
70+
parquet = { workspace = true }
71+
parquet_ext = { workspace = true }
72+
prometheus = { workspace = true }
73+
prost = { workspace = true }
74+
remote_engine_client = { workspace = true }
75+
router = { workspace = true }
76+
runtime = { workspace = true }
77+
sampling_cache = { workspace = true }
78+
serde = { workspace = true }
79+
size_ext = { workspace = true }
80+
skiplist = { path = "../components/skiplist" }
81+
smallvec = { workspace = true }
82+
snafu = { workspace = true }
83+
table_engine = { workspace = true }
84+
table_kv = { workspace = true }
85+
tempfile = { workspace = true, optional = true }
86+
thiserror = { workspace = true }
87+
time_ext = { workspace = true }
88+
tokio = { workspace = true }
89+
trace_metric = { workspace = true }
90+
wal = { workspace = true }
91+
xorfilter-rs = { workspace = true }
92+
93+
[dev-dependencies]
94+
common_types = { workspace = true, features = ["test"] }
95+
env_logger = { workspace = true }
96+
pin-project-lite = { workspace = true }
97+
rand = { workspace = true }
98+
tempfile = { workspace = true }
99+
test_util = { workspace = true }
100+
wal = { workspace = true, features = ["wal-message-queue", "wal-rocksdb", "wal-table-kv"] }

src/metric_engine/README.md

Whitespace-only changes.

src/metric_engine/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//! Storage Engine for metrics.
2+
3+
pub mod table_storage;
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use wal::manager::WalManagerRef;
2+
3+
pub struct SSTable {
4+
id: u64,
5+
}
6+
7+
/// Storage to represent different components of the system.
8+
/// Such as: metrics, series, indexes, etc.
9+
///
10+
/// Columns for design:
11+
/// metrics: {MetricName}-{MetricID}-{FieldName}
12+
/// series: {TSID}-{SeriesKey}
13+
/// index: {TagKey}-{TagValue}-{TSID}
14+
pub struct TableStorage {
15+
name: String,
16+
id: u64,
17+
wal: WalManagerRef,
18+
sstables: Vec<SSTable>,
19+
}

0 commit comments

Comments
 (0)