Skip to content

Commit 4169587

Browse files
committed
add dep
1 parent 2d07e64 commit 4169587

File tree

9 files changed

+48
-9
lines changed

9 files changed

+48
-9
lines changed

Cargo.lock

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

crates/audit/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ name = "tips-audit"
88
path = "src/bin/main.rs"
99

1010
[dependencies]
11+
tips-tracing = { workspace = true }
1112
tokio = { workspace = true }
1213
tracing = { workspace = true }
1314
tracing-subscriber = { workspace = true }

crates/audit/src/bin/main.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use rdkafka::consumer::Consumer;
77
use tips_audit::{
88
create_kafka_consumer, KafkaMempoolArchiver, KafkaMempoolReader, S3MempoolEventReaderWriter,
99
};
10+
use tips_tracing::init_tracing;
1011
use tracing::{info, warn};
1112
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
1213

@@ -48,6 +49,16 @@ struct Args {
4849

4950
#[arg(long, env = "TIPS_AUDIT_S3_SECRET_ACCESS_KEY")]
5051
s3_secret_access_key: Option<String>,
52+
53+
#[arg(long, env = "TIPS_AUDIT_TRACING_ENABLED", default_value = "false")]
54+
tracing_enabled: bool,
55+
56+
#[arg(
57+
long,
58+
env = "TIPS_AUDIT_TRACING_OTLP_ENDPOINT",
59+
default_value = "http://localhost:4317"
60+
)]
61+
tracing_otlp_endpoint: String,
5162
}
5263

5364
#[tokio::main]
@@ -91,7 +102,7 @@ async fn main() -> Result<()> {
91102
init_tracing(
92103
env!("CARGO_PKG_NAME").to_string(),
93104
env!("CARGO_PKG_VERSION").to_string(),
94-
args.tracing_otlp_endpoint,
105+
args.tracing_otlp_endpoint.clone(),
95106
)?;
96107
}
97108

crates/ingress-rpc/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use op_alloy_network::Optimism;
55
use rdkafka::ClientConfig;
66
use rdkafka::producer::FutureProducer;
77
use std::net::IpAddr;
8-
use tracing::{info, warn};
98
use tips_tracing::init_tracing;
9+
use tracing::{info, warn};
1010
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
1111
use url::Url;
1212

crates/ingress-writer/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ path = "src/main.rs"
1010
[dependencies]
1111
tips-datastore.workspace = true
1212
tips-audit.workspace=true
13+
tips-tracing.workspace = true
1314
alloy-rpc-types-mev.workspace = true
1415
tokio.workspace = true
1516
tracing.workspace = true

crates/ingress-writer/src/main.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use rdkafka::{
1010
};
1111
use tips_audit::{KafkaMempoolEventPublisher, MempoolEvent, MempoolEventPublisher};
1212
use tips_datastore::{BundleDatastore, postgres::PostgresDatastore};
13+
use tips_tracing::init_tracing;
1314
use tokio::time::Duration;
1415
use tracing::{debug, error, info, warn};
1516
use uuid::Uuid;
@@ -36,10 +37,18 @@ struct Args {
3637
#[arg(long, env = "TIPS_INGRESS_WRITER_LOG_LEVEL", default_value = "info")]
3738
log_level: String,
3839

39-
#[arg(long, env = "TIPS_INGRESS_WRITER_TRACING_ENABLED", default_value = "false")]
40+
#[arg(
41+
long,
42+
env = "TIPS_INGRESS_WRITER_TRACING_ENABLED",
43+
default_value = "false"
44+
)]
4045
tracing_enabled: bool,
4146

42-
#[arg(long, env = "TIPS_INGRESS_WRITER_TRACING_OTLP_ENDPOINT", default_value = "http://localhost:4317")]
47+
#[arg(
48+
long,
49+
env = "TIPS_INGRESS_WRITER_TRACING_OTLP_ENDPOINT",
50+
default_value = "http://localhost:4317"
51+
)]
4352
tracing_otlp_endpoint: String,
4453
}
4554

crates/maintenance/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ path = "src/main.rs"
1010
[dependencies]
1111
tips-datastore.workspace = true
1212
tips-audit.workspace = true
13+
tips-tracing.workspace = true
1314
alloy-provider.workspace = true
1415
alloy-primitives.workspace = true
1516
alloy-rpc-types.workspace = true

crates/maintenance/src/main.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use rdkafka::producer::FutureProducer;
99
use std::time::Duration;
1010
use tips_audit::{KafkaMempoolEventPublisher, MempoolEvent, MempoolEventPublisher};
1111
use tips_datastore::{BundleDatastore, PostgresDatastore};
12+
use tips_tracing::init_tracing;
1213
use tokio::time::sleep;
1314
use tracing::{error, info, warn};
1415
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
@@ -39,10 +40,18 @@ struct Args {
3940
#[arg(long, env = "TIPS_MAINTENANCE_LOG_LEVEL", default_value = "info")]
4041
log_level: String,
4142

42-
#[arg(long, env = "TIPS_MAINTENANCE_TRACING_ENABLED", default_value = "false")]
43+
#[arg(
44+
long,
45+
env = "TIPS_MAINTENANCE_TRACING_ENABLED",
46+
default_value = "false"
47+
)]
4348
tracing_enabled: bool,
4449

45-
#[arg(long, env = "TIPS_MAINTENANCE_TRACING_OTLP_ENDPOINT", default_value = "http://localhost:4317")]
50+
#[arg(
51+
long,
52+
env = "TIPS_MAINTENANCE_TRACING_OTLP_ENDPOINT",
53+
default_value = "http://localhost:4317"
54+
)]
4655
tracing_otlp_endpoint: String,
4756
}
4857

crates/tracing/src/lib.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
use anyhow::Context;
2+
use opentelemetry::trace::TracerProvider;
23
use opentelemetry::{global, KeyValue};
34
use opentelemetry_otlp::{SpanExporter, WithExportConfig};
45
use opentelemetry_sdk::{propagation::TraceContextPropagator, trace::SdkTracerProvider, Resource};
56
use tracing_opentelemetry::OpenTelemetryLayer;
6-
use tracing_subscriber::{filter::{LevelFilter, Targets}, layer::SubscriberExt};
7-
use opentelemetry::trace::TracerProvider;
7+
use tracing_subscriber::{
8+
filter::{LevelFilter, Targets},
9+
layer::SubscriberExt,
10+
};
811

12+
// from: https://github.com/flashbots/rollup-boost/blob/08ebd3e75a8f4c7ebc12db13b042dee04e132c05/crates/rollup-boost/src/tracing.rs#L127
913
pub fn init_tracing(
1014
service_name: String,
1115
service_version: String,
@@ -44,4 +48,4 @@ pub fn init_tracing(
4448
)?;
4549

4650
Ok(())
47-
}
51+
}

0 commit comments

Comments
 (0)