Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 174 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ tracing-subscriber = { version = "0.3", default-features = false, features = [
"json",
"ansi",
] }

# OpenTelemetry
opentelemetry = { version = "0.31.0", features = ["trace", "logs"] }
opentelemetry-otlp = { version = "0.31.0", features = ["trace", "logs", "http-proto"] }
opentelemetry_sdk = { version = "0.31.0", features = ["rt-tokio", "trace", "logs"] }
opentelemetry-appender-tracing = { version = "0.31.0" }
tracing-opentelemetry = "0.32.0"
opentelemetry-semantic-conventions = "0.31.0"
tempfile = "3"
csv = "1"
jsonrpsee = "0.24"
Expand Down
1 change: 1 addition & 0 deletions crates/chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ path = "src/main.rs"
[features]
nvidia = ["irys-actors/nvidia"]
test-utils = []
telemetry = ["irys-utils/telemetry"]

[dependencies]
# Irys
Expand Down
20 changes: 19 additions & 1 deletion crates/chain/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ use tracing_subscriber::{
layer::SubscriberExt as _, util::SubscriberInitExt as _, EnvFilter, Layer as _, Registry,
};

#[cfg(feature = "telemetry")]
use irys_utils::telemetry;

#[global_allocator]
static ALLOC: reth_cli_util::allocator::Allocator = reth_cli_util::allocator::new_allocator();

Expand All @@ -17,7 +20,22 @@ async fn main() -> eyre::Result<()> {
}

// init logging
init_tracing().expect("initializing tracing should work");
#[cfg(feature = "telemetry")]
{
// Check if Axiom credentials are set
if std::env::var("AXIOM_API_TOKEN").is_ok() && std::env::var("AXIOM_DATASET").is_ok() {
info!("Axiom credentials detected, initializing OpenTelemetry");
telemetry::init_telemetry()?;
} else {
info!("Axiom credentials not set, using standard tracing");
init_tracing().expect("initializing tracing should work");
}
}
#[cfg(not(feature = "telemetry"))]
{
init_tracing().expect("initializing tracing should work");
}

setup_panic_hook().expect("custom panic hook installation to succeed");
reth_cli_util::sigsegv_handler::install();
// load the config
Expand Down
23 changes: 22 additions & 1 deletion crates/utils/utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,31 @@ repository.workspace = true
authors.workspace = true

[dependencies]
tokio.workspace = true
tokio = { workspace = true, features = ["signal"] }
tracing.workspace = true
eyre.workspace = true
socket2.workspace = true
opentelemetry = { workspace = true, optional = true }
opentelemetry-otlp = { workspace = true, optional = true }
opentelemetry_sdk = { workspace = true, optional = true }
tracing-opentelemetry = { workspace = true, optional = true }
opentelemetry-semantic-conventions = { workspace = true, optional = true }
opentelemetry-appender-tracing = { workspace = true, optional = true }
tracing-subscriber = { workspace = true, optional = true }
tracing-error = { workspace = true, optional = true }

[features]
default = []
telemetry = [
"opentelemetry",
"opentelemetry-otlp",
"opentelemetry_sdk",
"tracing-opentelemetry",
"opentelemetry-semantic-conventions",
"opentelemetry-appender-tracing",
"tracing-subscriber",
"tracing-error",
]


[lints]
Expand Down
1 change: 1 addition & 0 deletions crates/utils/utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pub mod listener;
pub mod signal;
pub mod telemetry;
Loading