Skip to content

Commit af310ab

Browse files
committed
Adapt to new file locations.
1 parent 37b9984 commit af310ab

File tree

10 files changed

+32
-16
lines changed

10 files changed

+32
-16
lines changed

Cargo.lock

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

metrics/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,10 @@ description = "Metrics API types"
44
version.workspace = true
55
edition.workspace = true
66
rust-version.workspace = true
7+
8+
[features]
9+
prometheus = ["dep:parking_lot", "dep:prometheus"]
10+
11+
[dependencies]
12+
parking_lot = { workspace = true, optional = true }
13+
prometheus = { workspace = true, optional = true }

metrics/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
//! - [`Histogram`]: stores multiple float values based for a graph (example usage: CPU %)
1515
//! - text: stores a constant string in the collected metrics
1616
17+
#[cfg(feature = "prometheus")]
18+
pub mod prometheus;
19+
1720
use std::fmt::Debug;
1821

1922
/// The metrics type.

metrics/src/prometheus.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{collections::HashMap, sync::Arc};
22

3-
use metrics::{
3+
use crate::{
44
Counter, CounterFamily, Gauge, GaugeFamily, Histogram, HistogramFamily, Metrics, TextFamily,
55
};
66
use parking_lot::RwLock;
@@ -64,7 +64,7 @@ impl TimeboostGauge {
6464
}
6565

6666
#[derive(Debug)]
67-
pub struct PrometheusError(anyhow::Error);
67+
pub struct PrometheusError(Box<dyn std::error::Error + Send + Sync>);
6868

6969
impl std::fmt::Display for PrometheusError {
7070
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
@@ -80,7 +80,7 @@ impl std::error::Error for PrometheusError {
8080

8181
impl From<prometheus::Error> for PrometheusError {
8282
fn from(source: prometheus::Error) -> Self {
83-
Self(anyhow::anyhow!(source))
83+
Self(Box::new(source))
8484
}
8585
}
8686

timeboost-utils/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ bincode = { workspace = true }
1818
blake3 = { workspace = true }
1919
bs58 = { workspace = true }
2020
bytes = { workspace = true }
21+
clap = { workspace = true }
2122
cliquenet = { path = "../cliquenet" }
2223
committable = { workspace = true, optional = true }
2324
crossbeam-queue = { workspace = true, optional = true }
@@ -31,6 +32,7 @@ prometheus = { workspace = true }
3132
rand = { workspace = true }
3233
reqwest = { workspace = true }
3334
sailfish-types = { path = "../sailfish-types", optional = true }
35+
secp256k1 = { workspace = true }
3436
serde = { workspace = true }
3537
serde_json = { workspace = true }
3638
thiserror = { workspace = true }
@@ -40,3 +42,8 @@ tokio = { workspace = true }
4042
toml = { workspace = true }
4143
tracing = { workspace = true }
4244
tracing-subscriber = { workspace = true }
45+
url = { workspace = true }
46+
47+
[[bin]]
48+
name = "mkconfig"
49+
path = "src/binaries/mkconfig.rs"

timeboost-utils/src/types/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
pub mod logging;
2-
pub mod prometheus;

timeboost/Cargo.toml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ path = "src/binaries/timeboost.rs"
1313
name = "sailfish"
1414
path = "src/binaries/sailfish.rs"
1515

16-
[[bin]]
17-
name = "mkconfig"
18-
path = "src/binaries/mkconfig.rs"
19-
2016
[features]
2117
until = []
2218

@@ -31,13 +27,11 @@ clap = { workspace = true }
3127
cliquenet = { path = "../cliquenet" }
3228
committable = { workspace = true }
3329
http = { workspace = true }
34-
jiff = { workspace = true }
35-
metrics = { path = "../metrics" }
30+
metrics = { path = "../metrics", features = ["prometheus"]}
3631
multisig = { path = "../multisig" }
3732
prost = { workspace = true }
3833
rand = { workspace = true }
3934
sailfish = { path = "../sailfish" }
40-
secp256k1 = { workspace = true }
4135
serde = { workspace = true }
4236
serde_bytes = { workspace = true }
4337
serde_json = { workspace = true }

timeboost/src/api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::{io, sync::Arc, time::Duration};
22

3+
use ::metrics::prometheus::PrometheusMetrics;
34
use axum::{
45
Json, Router,
56
body::Body,
@@ -11,7 +12,6 @@ use bon::Builder;
1112
use http::{Request, Response, StatusCode};
1213
use timeboost_crypto::prelude::ThresholdEncKey;
1314
use timeboost_types::{Bundle, BundleVariant, DecryptionKeyCell, SignedPriorityBundle};
14-
use timeboost_utils::types::prometheus::PrometheusMetrics;
1515
use tokio::{
1616
net::{TcpListener, ToSocketAddrs},
1717
sync::mpsc::Sender,

timeboost/src/binaries/sailfish.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::{iter::repeat_with, path::PathBuf, sync::Arc, time::Duration};
22

3+
use ::metrics::prometheus::PrometheusMetrics;
34
use alloy::providers::Provider;
45
use anyhow::{Context, Result};
56
use cliquenet::{Network, NetworkMetrics, Overlay};
@@ -14,7 +15,7 @@ use sailfish::{
1415
use serde::{Deserialize, Serialize};
1516
use timeboost_contract::{CommitteeMemberSol, KeyManager};
1617
use timeboost_utils::keyset::NodeConfig;
17-
use timeboost_utils::types::{logging, prometheus::PrometheusMetrics};
18+
use timeboost_utils::types::logging;
1819
use tokio::{select, signal, time::sleep};
1920
use tracing::{error, info};
2021

timeboost/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ mod config;
33
use std::iter::once;
44
use std::sync::Arc;
55

6+
use ::metrics::prometheus::PrometheusMetrics;
67
use anyhow::Result;
78
use metrics::TimeboostMetrics;
89
use multisig::PublicKey;
910
use timeboost_builder::{Certifier, CertifierDown, Submitter};
1011
use timeboost_sequencer::{Output, Sequencer};
1112
use timeboost_types::BundleVariant;
12-
use timeboost_utils::types::prometheus::PrometheusMetrics;
1313
use tokio::select;
1414
use tokio::sync::mpsc::{self, Receiver, Sender};
1515
use tracing::{info, warn};

0 commit comments

Comments
 (0)