Skip to content

Commit b3bbd0d

Browse files
committed
feat: improve metrics
1 parent bf274d2 commit b3bbd0d

26 files changed

+402
-256
lines changed

Diff for: Cargo.lock

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

Diff for: Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ members = [
1919
"reqpool",
2020
"reqactor",
2121
"ballot",
22+
"metrics",
2223
]
2324

2425
# Always optimize; building and running the guest takes much longer without optimization.
@@ -45,6 +46,7 @@ raiko-redis-derive = { path = "./redis-derive" }
4546
raiko-reqpool = { path = "./reqpool" }
4647
raiko-reqactor = { path = "./reqactor" }
4748
raiko-ballot = { path = "./ballot" }
49+
raiko-metrics = { path = "./metrics" }
4850

4951
# reth
5052
reth-primitives = { git = "https://github.com/taikoxyz/taiko-reth.git", branch = "v1.0.0-rc.2-taiko", default-features = false, features = [

Diff for: docker/docker-compose.metrics.yml

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ services:
1818
- "3000:3000"
1919
volumes:
2020
- 'grafana_storage:/var/lib/grafana'
21+
depends_on:
22+
- prometheus
2123
volumes:
2224
grafana_storage: {}
2325
prometheus_storage: {}

Diff for: host/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ raiko-tasks = { workspace = true }
1818
raiko-reqpool = { workspace = true }
1919
raiko-reqactor = { workspace = true }
2020
raiko-ballot = { workspace = true }
21+
raiko-metrics = { workspace = true }
2122

2223
# alloy
2324
alloy-rlp = { workspace = true }
@@ -72,6 +73,7 @@ url = { workspace = true }
7273
cfg-if = { workspace = true }
7374
cap = { workspace = true }
7475
dotenv = { workspace = true }
76+
chrono = { workspace = true }
7577

7678

7779
# reth

Diff for: host/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use crate::interfaces::HostResult;
1515

1616
pub mod cache;
1717
pub mod interfaces;
18-
pub mod metrics;
1918
pub mod server;
2019

2120
#[derive(Default, Clone, Serialize, Deserialize, Debug, Parser)]

Diff for: host/src/metrics.rs

-169
This file was deleted.
File renamed without changes.

Diff for: host/src/server/api/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use tower_http::{
1313
};
1414

1515
pub mod admin;
16+
pub mod metrics;
1617
pub mod v1;
1718
pub mod v2;
1819
pub mod v3;
@@ -39,12 +40,14 @@ pub fn create_router(concurrency_limit: usize, jwt_secret: Option<&str>) -> Rout
3940
let v2_api = v2::create_router();
4041
let v3_api = v3::create_router();
4142
let admin_api = admin::create_router();
43+
let metrics_api = metrics::create_router();
4244
let router = Router::new()
4345
.nest("/v1", v1_api)
4446
.nest("/v2", v2_api)
4547
.nest("/v3", v3_api.clone())
4648
.merge(v3_api)
4749
.nest("/admin", admin_api)
50+
.nest("/metrics", metrics_api)
4851
.layer(middleware)
4952
.layer(DefaultBodyLimit::max(MAX_BODY_SIZE))
5053
.layer(trace)

Diff for: host/src/server/api/v1/mod.rs

+6-15
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use crate::interfaces::HostError;
1111
use raiko_reqactor::Actor;
1212

1313
pub mod health;
14-
pub mod metrics;
1514
pub mod proof;
1615

1716
#[derive(OpenApi)]
@@ -43,7 +42,6 @@ pub mod proof;
4342
tags(
4443
(name = "Proving", description = "Routes that handle proving requests"),
4544
(name = "Health", description = "Routes that report the server health status"),
46-
(name = "Metrics", description = "Routes that give detailed insight into the server")
4745
)
4846
)]
4947
/// The root API struct which is generated from the `OpenApi` derive macro.
@@ -105,31 +103,24 @@ pub struct GuestOutputDoc {
105103

106104
#[must_use]
107105
pub fn create_docs() -> utoipa::openapi::OpenApi {
108-
[
109-
health::create_docs(),
110-
metrics::create_docs(),
111-
proof::create_docs(),
112-
]
113-
.into_iter()
114-
.fold(Docs::openapi(), |mut doc, sub_doc| {
115-
doc.merge(sub_doc);
116-
doc
117-
})
106+
[health::create_docs(), proof::create_docs()]
107+
.into_iter()
108+
.fold(Docs::openapi(), |mut doc, sub_doc| {
109+
doc.merge(sub_doc);
110+
doc
111+
})
118112
}
119113

120114
pub fn create_router(concurrency_limit: usize) -> Router<Actor> {
121115
let docs = create_docs();
122116

123117
Router::new()
124-
// Only add the concurrency limit to the proof route. We want to still be able to call
125-
// healthchecks and metrics to have insight into the system.
126118
.nest(
127119
"/proof",
128120
proof::create_router()
129121
.layer(ServiceBuilder::new().concurrency_limit(concurrency_limit)),
130122
)
131123
.nest("/health", health::create_router())
132-
.nest("/metrics", metrics::create_router())
133124
.merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", docs.clone()))
134125
.merge(Scalar::with_url("/scalar", docs))
135126
}

Diff for: host/src/server/api/v2/mod.rs

+6-14
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ pub mod proof;
4444
tags(
4545
(name = "Proving", description = "Routes that handle proving requests"),
4646
(name = "Health", description = "Routes that report the server health status"),
47-
(name = "Metrics", description = "Routes that give detailed insight into the server")
4847
)
4948
)]
5049
/// The root API struct which is generated from the `OpenApi` derive macro.
@@ -119,29 +118,22 @@ impl IntoResponse for PruneStatus {
119118

120119
#[must_use]
121120
pub fn create_docs() -> utoipa::openapi::OpenApi {
122-
[
123-
v1::health::create_docs(),
124-
v1::metrics::create_docs(),
125-
proof::create_docs(),
126-
]
127-
.into_iter()
128-
.fold(Docs::openapi(), |mut doc, sub_doc| {
129-
doc.merge(sub_doc);
130-
doc
131-
})
121+
[v1::health::create_docs(), proof::create_docs()]
122+
.into_iter()
123+
.fold(Docs::openapi(), |mut doc, sub_doc| {
124+
doc.merge(sub_doc);
125+
doc
126+
})
132127
}
133128

134129
pub fn create_router() -> Router<Actor> {
135130
let docs = create_docs();
136131

137132
Router::new()
138-
// Only add the concurrency limit to the proof route. We want to still be able to call
139-
// healthchecks and metrics to have insight into the system.
140133
.nest("/proof", proof::create_router())
141134
// TODO: Separate task or try to get it into /proof somehow? Probably separate
142135
.nest("/aggregate", proof::create_router())
143136
.nest("/health", v1::health::create_router())
144-
.nest("/metrics", v1::metrics::create_router())
145137
.merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", docs.clone()))
146138
.merge(Scalar::with_url("/scalar", docs))
147139
}

0 commit comments

Comments
 (0)