featurized otel
This commit is contained in:
Generated
+2
@@ -5979,6 +5979,7 @@ dependencies = [
|
||||
"colored",
|
||||
"futures",
|
||||
"mime",
|
||||
"nym-bin-common",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_yaml",
|
||||
@@ -6989,6 +6990,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 2.0.17",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -46,7 +46,6 @@ nym-bandwidth-controller = { path = "../../common/bandwidth-controller" }
|
||||
nym-bin-common = { path = "../../common/bin-common", features = [
|
||||
"output_format",
|
||||
"clap",
|
||||
"basic_tracing",
|
||||
] }
|
||||
nym-client-core = { path = "../../common/client-core", features = [
|
||||
"fs-credentials-storage",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
use std::error::Error;
|
||||
|
||||
use clap::{crate_name, crate_version, Parser};
|
||||
use nym_bin_common::logging::{maybe_print_banner, setup_tracing_logger};
|
||||
use nym_bin_common::logging::{maybe_print_banner, setup_no_otel_logger};
|
||||
use nym_network_defaults::setup_env;
|
||||
|
||||
pub mod client;
|
||||
@@ -20,7 +20,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
|
||||
if !args.no_banner {
|
||||
maybe_print_banner(crate_name!(), crate_version!());
|
||||
}
|
||||
setup_tracing_logger();
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
if let Err(err) = commands::execute(args).await {
|
||||
log::error!("{err}");
|
||||
|
||||
@@ -27,7 +27,6 @@ zeroize = { workspace = true }
|
||||
nym-bin-common = { path = "../../common/bin-common", features = [
|
||||
"output_format",
|
||||
"clap",
|
||||
"basic_tracing",
|
||||
] }
|
||||
nym-client-core = { path = "../../common/client-core", features = [
|
||||
"fs-credentials-storage",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
use std::error::Error;
|
||||
|
||||
use clap::{crate_name, crate_version, Parser};
|
||||
use nym_bin_common::logging::{maybe_print_banner, setup_tracing_logger};
|
||||
use nym_bin_common::logging::{maybe_print_banner, setup_no_otel_logger};
|
||||
use nym_network_defaults::setup_env;
|
||||
|
||||
mod commands;
|
||||
@@ -19,7 +19,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
|
||||
if !args.no_banner {
|
||||
maybe_print_banner(crate_name!(), crate_version!());
|
||||
}
|
||||
setup_tracing_logger();
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
if let Err(err) = commands::execute(args).await {
|
||||
log::error!("{err}");
|
||||
|
||||
@@ -25,42 +25,33 @@ schemars = { workspace = true, features = ["preserve_order"], optional = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true, optional = true }
|
||||
thiserror = { workspace = true }
|
||||
tracing = { workspace = true, optional = true }
|
||||
tracing-core = { workspace = true, optional = true }
|
||||
tracing = { workspace = true }
|
||||
tracing-core = { workspace = true }
|
||||
tracing-opentelemetry = { workspace = true, optional = true }
|
||||
tracing-serde = { workspace = true, optional = true }
|
||||
tracing-subscriber = { workspace = true, features = ["env-filter", "json"], optional = true }
|
||||
tracing-tree = { workspace = true, optional = true }
|
||||
tracing-serde = { workspace = true }
|
||||
tracing-subscriber = { workspace = true, features = ["env-filter", "json"] }
|
||||
tracing-tree = { workspace = true }
|
||||
utoipa = { workspace = true, optional = true }
|
||||
|
||||
[build-dependencies]
|
||||
vergen = { workspace = true, features = ["build", "git", "gitcl", "rustc", "cargo"] }
|
||||
|
||||
[features]
|
||||
default = ["otel"] # 🚨🚨🚨 TODO: remove otel as a default feature 🚨🚨🚨
|
||||
default = []
|
||||
openapi = ["utoipa"]
|
||||
output_format = ["serde_json", "dep:clap"]
|
||||
bin_info_schema = ["schemars"]
|
||||
basic_tracing = ["dep:tracing", "tracing-subscriber"]
|
||||
tokio-console = ["dep:tracing", "tracing-subscriber"]
|
||||
tracing = [
|
||||
"basic_tracing",
|
||||
"chrono",
|
||||
"serde_json",
|
||||
"tracing-core",
|
||||
"tracing-opentelemetry",
|
||||
"tracing-serde",
|
||||
"tracing-subscriber",
|
||||
"tracing-tree",
|
||||
]
|
||||
tokio-console = ["otel"]
|
||||
otel = [
|
||||
"chrono",
|
||||
"tracing-opentelemetry",
|
||||
"opentelemetry",
|
||||
"opentelemetry-otlp",
|
||||
"opentelemetry-semantic-conventions",
|
||||
"opentelemetry-stdout",
|
||||
"opentelemetry_sdk",
|
||||
"serde_json",
|
||||
"rand",
|
||||
"tracing",
|
||||
]
|
||||
clap = ["dep:clap", "dep:clap_complete", "dep:clap_complete_fig"]
|
||||
models = []
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
pub mod build_information;
|
||||
pub mod logging;
|
||||
|
||||
#[cfg(feature = "otel")]
|
||||
pub mod opentelemetry;
|
||||
|
||||
#[cfg(feature = "clap")]
|
||||
|
||||
+2
-3
@@ -1,6 +1,6 @@
|
||||
// Copyright 2025 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#[cfg(feature = "otel")]
|
||||
use opentelemetry_otlp::ExporterBuildError;
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
@@ -8,11 +8,10 @@ pub enum TracingError {
|
||||
#[error("tracing logger already initialised")]
|
||||
TracingLoggerAlreadyInitialised,
|
||||
|
||||
// #[error("I/O error: {0}")]
|
||||
// IoError(#[from] std::io::Error),
|
||||
#[error("Logging error: {0}")]
|
||||
TracingTryInitError(tracing_subscriber::util::TryInitError),
|
||||
|
||||
#[cfg(feature = "otel")]
|
||||
#[error("{0}")]
|
||||
TracingExporterBuildError(#[from] ExporterBuildError),
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
// Copyright 2022-2023 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
pub mod error;
|
||||
|
||||
use error::TracingError;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::io::IsTerminal;
|
||||
use tracing_subscriber::{filter::Directive, layer::SubscriberExt, util::SubscriberInitExt};
|
||||
|
||||
#[derive(Debug, Default, Copy, Clone, Deserialize, PartialEq, Eq, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
@@ -11,7 +15,6 @@ pub struct LoggingSettings {
|
||||
}
|
||||
|
||||
// don't call init so that we could attach additional layers
|
||||
#[cfg(feature = "basic_tracing")]
|
||||
pub fn build_tracing_logger() -> impl tracing_subscriber::layer::SubscriberExt {
|
||||
use tracing_subscriber::prelude::*;
|
||||
|
||||
@@ -20,7 +23,6 @@ pub fn build_tracing_logger() -> impl tracing_subscriber::layer::SubscriberExt {
|
||||
.with(default_tracing_env_filter())
|
||||
}
|
||||
|
||||
#[cfg(feature = "basic_tracing")]
|
||||
pub fn default_tracing_env_filter() -> tracing_subscriber::filter::EnvFilter {
|
||||
if ::std::env::var("RUST_LOG").is_ok() {
|
||||
tracing_subscriber::filter::EnvFilter::from_default_env()
|
||||
@@ -32,7 +34,6 @@ pub fn default_tracing_env_filter() -> tracing_subscriber::filter::EnvFilter {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "basic_tracing")]
|
||||
pub fn default_tracing_fmt_layer<S, W>(
|
||||
writer: W,
|
||||
) -> impl tracing_subscriber::Layer<S> + Sync + Send + 'static
|
||||
@@ -52,18 +53,47 @@ where
|
||||
.with_target(false)
|
||||
}
|
||||
|
||||
#[cfg(feature = "basic_tracing")]
|
||||
pub fn setup_tracing_logger() {
|
||||
use tracing_subscriber::util::SubscriberInitExt;
|
||||
build_tracing_logger().init()
|
||||
/// Creates a tracing filter that sets more granular log levels for specific crates.
|
||||
/// This allows for finer control over logging verbosity.
|
||||
pub(crate) fn granual_filtered_env() -> Result<tracing_subscriber::filter::EnvFilter, TracingError>
|
||||
{
|
||||
fn directive_checked(directive: impl Into<String>) -> Result<Directive, TracingError> {
|
||||
directive.into().parse().map_err(From::from)
|
||||
}
|
||||
|
||||
let mut filter = default_tracing_env_filter();
|
||||
|
||||
// these crates are more granularly filtered
|
||||
let filter_crates = ["defguard_wireguard_rs"];
|
||||
for crate_name in filter_crates {
|
||||
filter = filter.add_directive(directive_checked(format!("{crate_name}=warn"))?);
|
||||
}
|
||||
Ok(filter)
|
||||
}
|
||||
|
||||
pub fn setup_no_otel_logger() -> Result<(), TracingError> {
|
||||
// Only set up if not already initialized
|
||||
if tracing::dispatcher::has_been_set() {
|
||||
// It shouldn't be - this is really checking that it is torn down between async command executions
|
||||
return Err(TracingError::TracingLoggerAlreadyInitialised);
|
||||
}
|
||||
|
||||
let registry = tracing_subscriber::registry()
|
||||
.with(default_tracing_fmt_layer(std::io::stderr))
|
||||
.with(granual_filtered_env()?);
|
||||
|
||||
registry
|
||||
.try_init()
|
||||
.map_err(|e| TracingError::TracingTryInitError(e))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// TODO: This has to be a macro, running it as a function does not work for the file_appender for some reason
|
||||
#[cfg(feature = "tracing")]
|
||||
#[macro_export]
|
||||
macro_rules! setup_tracing {
|
||||
($service_name: expr) => {
|
||||
crate::opentelemetry::setup_no_otel_logger()
|
||||
setup_no_otel_logger()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
pub mod context;
|
||||
pub mod error;
|
||||
pub mod compact_id_generator;
|
||||
mod trace_id_format;
|
||||
|
||||
@@ -9,8 +8,8 @@ use tracing_subscriber::layer::SubscriberExt;
|
||||
use tracing_subscriber::util::SubscriberInitExt;
|
||||
use tracing_subscriber::fmt;
|
||||
|
||||
use crate::logging::{default_tracing_env_filter, default_tracing_fmt_layer};
|
||||
use crate::opentelemetry::error::TracingError;
|
||||
use crate::logging::default_tracing_env_filter;
|
||||
use crate::logging::error::TracingError;
|
||||
use crate::opentelemetry::compact_id_generator::Compact13BytesIdGenerator;
|
||||
use opentelemetry::trace::TracerProvider;
|
||||
use opentelemetry::{global, KeyValue};
|
||||
@@ -54,10 +53,10 @@ pub(crate) fn granual_filtered_env() -> Result<tracing_subscriber::filter::EnvFi
|
||||
Ok(filter)
|
||||
}
|
||||
|
||||
pub fn setup_tracing_logger(service_name: String) -> Result<TracerProviderGuard, TracingError> {
|
||||
pub fn setup_tracing_logger(service_name: String) -> Result<(), TracingError> {
|
||||
if tracing::dispatcher::has_been_set() {
|
||||
// It shouldn't be - this is really checking that it is torn down between async command executions
|
||||
return Err(error::TracingError::TracingLoggerAlreadyInitialised);
|
||||
return Err(TracingError::TracingLoggerAlreadyInitialised);
|
||||
}
|
||||
|
||||
let key =
|
||||
@@ -103,29 +102,6 @@ pub fn setup_tracing_logger(service_name: String) -> Result<TracerProviderGuard,
|
||||
.map_err(|e| TracingError::TracingTryInitError(e))?;
|
||||
}}
|
||||
|
||||
let guard = TracerProviderGuard(Some(tracer_provider));
|
||||
|
||||
Ok(guard)
|
||||
}
|
||||
|
||||
pub fn setup_no_otel_logger() -> Result<(), TracingError> {
|
||||
// Only set up if not already initialized
|
||||
if tracing::dispatcher::has_been_set() {
|
||||
// It shouldn't be - this is really checking that it is torn down between async command executions
|
||||
return Err(TracingError::TracingLoggerAlreadyInitialised);
|
||||
}
|
||||
|
||||
let registry = tracing_subscriber::registry()
|
||||
.with(default_tracing_fmt_layer(std::io::stderr))
|
||||
.with(granual_filtered_env()?)
|
||||
.with(tracing_subscriber::filter::LevelFilter::from_level(
|
||||
Level::INFO,
|
||||
));
|
||||
|
||||
registry
|
||||
.try_init()
|
||||
.map_err(|e| TracingError::TracingTryInitError(e))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -121,6 +121,7 @@ pub struct ClientOutput {
|
||||
}
|
||||
|
||||
impl ClientOutput {
|
||||
#[instrument(name = "ClientOutput::register_receiver", skip_all)]
|
||||
pub fn register_receiver(
|
||||
&mut self,
|
||||
) -> Result<mpsc::UnboundedReceiver<Vec<ReconstructedMessage>>, ClientCoreError> {
|
||||
|
||||
+3
@@ -70,6 +70,7 @@ where
|
||||
.send_reply(recipient_tag, data, lane, max_retransmissions);
|
||||
}
|
||||
|
||||
#[instrument(skip_all)]
|
||||
async fn handle_plain_message(
|
||||
&mut self,
|
||||
recipient: Recipient,
|
||||
@@ -88,6 +89,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all)]
|
||||
async fn handle_repliable_message(
|
||||
&mut self,
|
||||
recipient: Recipient,
|
||||
@@ -234,6 +236,7 @@ where
|
||||
};
|
||||
}
|
||||
|
||||
#[instrument(skip_all)]
|
||||
pub(crate) async fn run(&mut self, shutdown_token: ShutdownToken) {
|
||||
debug!("Started InputMessageListener with graceful shutdown support");
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use thiserror::Error;
|
||||
use tracing::{debug, error, info, trace, warn};
|
||||
use tracing::{debug, error, info, instrument, trace, warn};
|
||||
|
||||
// TODO: move that error elsewhere since it seems to be contaminating different files
|
||||
#[derive(Debug, Error)]
|
||||
@@ -476,6 +476,7 @@ where
|
||||
self.forward_messages(msgs, lane).await;
|
||||
}
|
||||
|
||||
#[instrument(skip_all)]
|
||||
pub(crate) async fn try_send_plain_message(
|
||||
&mut self,
|
||||
recipient: Recipient,
|
||||
@@ -497,6 +498,7 @@ where
|
||||
.await
|
||||
}
|
||||
|
||||
#[instrument(skip_all)]
|
||||
pub(crate) async fn try_split_and_send_non_reply_message(
|
||||
&mut self,
|
||||
message: NymMessage,
|
||||
|
||||
@@ -35,8 +35,8 @@ nym-credentials = { path = "../credentials" }
|
||||
nym-credentials-interface = { path = "../credentials-interface" }
|
||||
|
||||
opentelemetry = { workspace = true, features = ["trace"], optional = true }
|
||||
opentelemetry_sdk = { workspace = true }
|
||||
tracing = { workspace = true, features = ["std", "attributes", "tracing-attributes"], optional = true }
|
||||
opentelemetry_sdk = { workspace = true, optional = true }
|
||||
tracing = { workspace = true, features = ["std", "attributes", "tracing-attributes"] }
|
||||
|
||||
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.tokio]
|
||||
workspace = true
|
||||
@@ -57,8 +57,9 @@ nym-test-utils = { path = "../test-utils" }
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
|
||||
[features]
|
||||
default = ["otel"] # 🚨🚨🚨 TODO: remove otel as a default feature 🚨🚨🚨
|
||||
default = []
|
||||
otel = [
|
||||
"nym-bin-common/otel",
|
||||
"opentelemetry",
|
||||
"tracing"
|
||||
"opentelemetry_sdk",
|
||||
]
|
||||
|
||||
@@ -8,6 +8,7 @@ use crate::{
|
||||
AUTHENTICATE_V2_PROTOCOL_VERSION, CREDENTIAL_UPDATE_V2_PROTOCOL_VERSION,
|
||||
INITIAL_PROTOCOL_VERSION,
|
||||
};
|
||||
#[cfg(feature = "otel")]
|
||||
use nym_bin_common::opentelemetry::context::ContextCarrier;
|
||||
use nym_credentials_interface::CredentialSpendingData;
|
||||
use nym_crypto::asymmetric::ed25519;
|
||||
@@ -135,15 +136,21 @@ impl ClientControlRequest {
|
||||
let nonce = shared_key.random_nonce_or_iv();
|
||||
let ciphertext = shared_key.encrypt_naive(address.as_bytes_ref(), Some(&nonce))?;
|
||||
|
||||
let context = opentelemetry::Context::current();
|
||||
let context_carrier = ContextCarrier::new_with_current_context(context).into_map();
|
||||
#[cfg(feature = "otel")]
|
||||
let context_carrier = {
|
||||
let context = opentelemetry::Context::current();
|
||||
ContextCarrier::new_with_current_context(context).into_map()
|
||||
};
|
||||
|
||||
Ok(ClientControlRequest::Authenticate {
|
||||
protocol_version,
|
||||
address: address.as_base58_string(),
|
||||
enc_address: bs58::encode(&ciphertext).into_string(),
|
||||
iv: bs58::encode(&nonce).into_string(),
|
||||
#[cfg(feature = "otel")]
|
||||
otel_context: Some(context_carrier),
|
||||
#[cfg(not(feature = "otel"))]
|
||||
otel_context: None,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -155,8 +162,13 @@ impl ClientControlRequest {
|
||||
// if we're using v2 authentication, we must announce at least that protocol version
|
||||
let protocol_version = AUTHENTICATE_V2_PROTOCOL_VERSION;
|
||||
|
||||
let otel_context = opentelemetry::Context::current();
|
||||
let context_carrier = ContextCarrier::new_with_current_context(otel_context).into_map();
|
||||
#[cfg(feature = "otel")]
|
||||
let context_carrier = {
|
||||
let otel_context = opentelemetry::Context::current();
|
||||
ContextCarrier::new_with_current_context(otel_context).into_map()
|
||||
};
|
||||
#[cfg(not(feature = "otel"))]
|
||||
let context_carrier = None;
|
||||
|
||||
Ok(ClientControlRequest::AuthenticateV2(Box::new(
|
||||
AuthenticateRequest::new(
|
||||
|
||||
@@ -12,8 +12,7 @@ license.workspace = true
|
||||
|
||||
[features]
|
||||
# TODO: Remove otel from default before release
|
||||
# Opentelemetry should remain an opt-in for debug purposes only
|
||||
default=["tunneling", "otel"]
|
||||
default=["tunneling"]
|
||||
tunneling=[]
|
||||
network-defaults = ["dep:nym-network-defaults"]
|
||||
otel = ["nym-bin-common/otel", "opentelemetry", "opentelemetry_sdk"]
|
||||
@@ -58,4 +57,3 @@ features = ["tokio"]
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { workspace = true, features = ["rt", "macros"] }
|
||||
|
||||
|
||||
@@ -987,16 +987,18 @@ impl ApiClientCore for Client {
|
||||
self.apply_hosts_to_req(&mut req);
|
||||
|
||||
// if opentelemetry is activated add the current trace context to the request
|
||||
// TODO featurize opentelemetry
|
||||
use opentelemetry::Context;
|
||||
use nym_bin_common::opentelemetry::context::ContextCarrier;
|
||||
#[cfg(feature = "otel")]
|
||||
{
|
||||
use opentelemetry::Context;
|
||||
use nym_bin_common::opentelemetry::context::ContextCarrier;
|
||||
|
||||
let carrier = ContextCarrier::new_with_current_context(Context::current());
|
||||
let carrier = ContextCarrier::new_with_current_context(Context::current());
|
||||
|
||||
if let Some(traceparent) = carrier.extract_traceparent() {
|
||||
if let Ok(header_value) = HeaderValue::from_str(&traceparent) {
|
||||
req.headers_mut()
|
||||
.insert("traceparent", header_value);
|
||||
if let Some(traceparent) = carrier.extract_traceparent() {
|
||||
if let Ok(header_value) = HeaderValue::from_str(&traceparent) {
|
||||
req.headers_mut()
|
||||
.insert("traceparent", header_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ bytes = { workspace = true, optional = true }
|
||||
colored = { workspace = true, optional = true }
|
||||
futures = { workspace = true, optional = true }
|
||||
mime = { workspace = true, optional = true }
|
||||
nym-bin-common = { path = "../bin-common" }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true }
|
||||
serde_yaml = { workspace = true, optional = true }
|
||||
@@ -49,6 +50,8 @@ middleware = [
|
||||
"zeroize"
|
||||
]
|
||||
|
||||
otel = ["nym-bin-common/otel"]
|
||||
|
||||
utoipa = ["dep:utoipa"]
|
||||
|
||||
[lints]
|
||||
|
||||
@@ -57,12 +57,15 @@ async fn log_request(
|
||||
let host = header_map(request.headers().get(HOST), "Unknown Host".to_string());
|
||||
|
||||
// Extract traceparent from headers if it exists
|
||||
#[cfg(feature = "otel")]
|
||||
let traceparent = request
|
||||
.headers()
|
||||
.get("traceparent")
|
||||
.and_then(|h| h.to_str().ok())
|
||||
.map(|s| s.to_string());
|
||||
|
||||
#[cfg(not(feature = "otel"))]
|
||||
let traceparent: Option<String> = None;
|
||||
|
||||
let start = Instant::now();
|
||||
// run request through all middleware, incl. extractors
|
||||
let res = next.run(request).await;
|
||||
@@ -89,7 +92,7 @@ async fn log_request(
|
||||
|
||||
match level {
|
||||
LogLevel::Debug => debug!(
|
||||
"[{addr} -> {host}] {method} '{uri}': {print_status} {time_taken} {agent_str}: {agent} traceparent: {traceparent:?}"
|
||||
"[{addr} -> {host}] {method} '{uri}': {print_status} {time_taken} {agent_str}: {agent} traceparent: {traceparent:?}",
|
||||
),
|
||||
LogLevel::Info => info!(
|
||||
"[{addr} -> {host}] {method} '{uri}': {print_status} {time_taken} {agent_str}: {agent} traceparent: {traceparent:?}"
|
||||
|
||||
@@ -57,3 +57,7 @@ outfox = [
|
||||
"nym-sphinx-params/outfox",
|
||||
"nym-sphinx-types/outfox",
|
||||
]
|
||||
|
||||
otel = [
|
||||
"nym-bin-common/otel",
|
||||
]
|
||||
@@ -13,10 +13,15 @@ nym-crypto = { path = "../../crypto", features = ["asymmetric", "sphinx"] } # al
|
||||
nym-sphinx-types = { path = "../types", features = ["sphinx"] } # we need to be able to refer to some types defined inside sphinx crate
|
||||
serde = { workspace = true } # implementing serialization/deserialization for some types, like `Recipient`
|
||||
thiserror = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
rand = { workspace = true }
|
||||
nym-crypto = { path = "../../crypto", features = ["rand"] }
|
||||
bincode = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
otel = ["nym-bin-common/otel"]
|
||||
@@ -154,12 +154,19 @@ impl Recipient {
|
||||
// it shouldn't be? Maybe it should be (for example) H(`ClientIdentity || ClientEncryptionKey`)
|
||||
// instead? That is an open question.
|
||||
pub fn as_sphinx_destination(&self, trace_id: Option<[u8; 12]>) -> Destination {
|
||||
#[cfg(feature = "otel")]
|
||||
use nym_bin_common::opentelemetry::compact_id_generator::decompress_trace_id;
|
||||
#[cfg(feature = "otel")]
|
||||
let trace_id_16 = if let Some(trace_id) = trace_id {
|
||||
decompress_trace_id(&trace_id)
|
||||
} else {
|
||||
decompress_trace_id(&[0u8; 12])
|
||||
};
|
||||
#[cfg(not(feature = "otel"))]
|
||||
let trace_id_16 = {
|
||||
_ = trace_id;
|
||||
[0u8; 16]
|
||||
};
|
||||
|
||||
// since the nym mix network differs slightly in design from loopix, we do not care
|
||||
// about "surb_id" field at all and just use the default value.
|
||||
|
||||
@@ -23,3 +23,7 @@ nym-sphinx-acknowledgements = { path = "../acknowledgements" }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
otel = ["nym-bin-common/otel"]
|
||||
@@ -2,8 +2,12 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::packet::FramedNymPacket;
|
||||
use nym_bin_common::opentelemetry::compact_id_generator::decompress_trace_id;
|
||||
use nym_bin_common::opentelemetry::context::ManualContextPropagator;
|
||||
#[cfg(feature = "otel")]
|
||||
use nym_bin_common::opentelemetry::{
|
||||
compact_id_generator::decompress_trace_id,
|
||||
context::ManualContextPropagator,
|
||||
};
|
||||
|
||||
use nym_sphinx_acknowledgements::surb_ack::{SurbAck, SurbAckRecoveryError};
|
||||
use nym_sphinx_addressing::nodes::{NymNodeRoutingAddress, NymNodeRoutingAddressError};
|
||||
use nym_sphinx_forwarding::packet::MixPacket;
|
||||
@@ -16,7 +20,9 @@ use nym_sphinx_types::{
|
||||
};
|
||||
use std::fmt::Display;
|
||||
use thiserror::Error;
|
||||
use tracing::{debug, error, info, instrument, trace, warn, warn_span};
|
||||
use tracing::{debug, error, info, instrument, trace, warn};
|
||||
#[cfg(feature = "otel")]
|
||||
use tracing::warn_span;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum MixProcessingResultData {
|
||||
@@ -261,21 +267,27 @@ fn wrap_processed_sphinx_packet(
|
||||
// sphinx all together?
|
||||
ProcessedPacketData::FinalHop {
|
||||
destination,
|
||||
#[cfg(feature = "otel")]
|
||||
identifier,
|
||||
#[cfg(not(feature = "otel"))]
|
||||
identifier: _,
|
||||
payload,
|
||||
} => {
|
||||
// if we have a trace id in the destination, we log it for easier correlation later on
|
||||
// TODO add feature for otel
|
||||
{
|
||||
let trace_bytes: [u8; 12] = identifier[0..12].try_into().unwrap();
|
||||
if !trace_bytes.iter().all(|b| *b == 0) {
|
||||
#[cfg(feature = "otel")]
|
||||
let span = match identifier[0..12].try_into().map(|b: [u8; 12]| b) {
|
||||
Ok(trace_bytes) if !trace_bytes.iter().all(|b| *b == 0) => {
|
||||
let full_trace_id_bytes = decompress_trace_id(&trace_bytes);
|
||||
let full_trace_id = opentelemetry::trace::TraceId::from_bytes(full_trace_id_bytes);
|
||||
let context_propagator = ManualContextPropagator::new_from_tid("final_hop", full_trace_id);
|
||||
let span = warn_span!(parent: &context_propagator.root_span, "final_hop_processing", trace_id=%full_trace_id);
|
||||
let _enter = span.enter();
|
||||
warn_span!(parent: &context_propagator.root_span, "final_hop_processing", trace_id=%full_trace_id)
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
warn_span!("final_hop_processing")
|
||||
}
|
||||
};
|
||||
#[cfg(feature = "otel")]
|
||||
let _entered_span = span.enter();
|
||||
|
||||
process_final_hop(
|
||||
destination,
|
||||
|
||||
@@ -168,7 +168,6 @@ pub trait FragmentPreparer {
|
||||
/// - compute sphinx_plaintext = SURB_ACK || g^x || v_b
|
||||
/// - compute sphinx_packet = Sphinx(recipient, sphinx_plaintext)
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[instrument(skip_all)]
|
||||
fn prepare_chunk_for_sending(
|
||||
&mut self,
|
||||
fragment: Fragment,
|
||||
@@ -264,8 +263,8 @@ pub trait FragmentPreparer {
|
||||
)?,
|
||||
};
|
||||
|
||||
/// - compute k = KDF(remote encryption key ^ x) this is equivalent to KDF( dh(remote, x) )
|
||||
/// from the previously constructed route extract the first hop
|
||||
// - compute k = KDF(remote encryption key ^ x) this is equivalent to KDF( dh(remote, x) )
|
||||
// from the previously constructed route extract the first hop
|
||||
let first_hop_address =
|
||||
NymNodeRoutingAddress::try_from(route.first().unwrap().address).unwrap();
|
||||
|
||||
|
||||
@@ -32,8 +32,6 @@ tracing.workspace = true
|
||||
url.workspace = true
|
||||
|
||||
|
||||
# TEMP
|
||||
#nym-bin-common = { path = "../bin-common", features = ["basic_tracing"]}
|
||||
|
||||
|
||||
[build-dependencies]
|
||||
|
||||
+13
-3
@@ -83,12 +83,22 @@ nym-service-provider-requests-common = { path = "../common/service-provider-requ
|
||||
|
||||
|
||||
defguard_wireguard_rs = { workspace = true }
|
||||
opentelemetry.workspace = true
|
||||
opentelemetry_sdk.workspace = true
|
||||
tracing-opentelemetry.workspace = true
|
||||
opentelemetry = { workspace = true, optional = true }
|
||||
opentelemetry_sdk = { workspace = true, optional = true }
|
||||
tracing-opentelemetry = { workspace = true, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
nym-gateway-storage = { path = "../common/gateway-storage", features = ["mock"] }
|
||||
nym-wireguard = { path = "../common/wireguard", features = ["mock"] }
|
||||
mock_instant = "0.6.0"
|
||||
time = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
otel = [
|
||||
"nym-bin-common/otel",
|
||||
"nym-gateway-requests/otel",
|
||||
"opentelemetry",
|
||||
"opentelemetry_sdk",
|
||||
"tracing-opentelemetry",
|
||||
]
|
||||
|
||||
@@ -14,6 +14,7 @@ use futures::{
|
||||
future::{FusedFuture, OptionFuture},
|
||||
FutureExt, StreamExt,
|
||||
};
|
||||
#[cfg(feature = "otel")]
|
||||
use nym_bin_common::opentelemetry::context::ManualContextPropagator;
|
||||
use nym_credential_verification::CredentialVerifier;
|
||||
use nym_credential_verification::{
|
||||
@@ -32,7 +33,9 @@ use nym_sphinx::forwarding::packet::MixPacket;
|
||||
use nym_statistics_common::{gateways::GatewaySessionEvent, types::SessionType};
|
||||
use nym_validator_client::coconut::EcashApiError;
|
||||
use rand::{random, CryptoRng, Rng};
|
||||
use std::{collections::HashMap, process, time::Duration};
|
||||
#[cfg(feature = "otel")]
|
||||
use std::collections::HashMap;
|
||||
use std::{process, time::Duration};
|
||||
use thiserror::Error;
|
||||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
use tokio_tungstenite::tungstenite::{protocol::Message, Error as WsError};
|
||||
@@ -148,6 +151,7 @@ pub(crate) struct AuthenticatedHandler<R, S> {
|
||||
// senders that are used to return the result of the ping to the handler requesting the ping.
|
||||
is_active_request_receiver: IsActiveRequestReceiver,
|
||||
is_active_ping_pending_reply: Option<(u64, IsActiveResultSender)>,
|
||||
#[cfg(feature = "otel")]
|
||||
otel_propagator: Option<ManualContextPropagator>,
|
||||
}
|
||||
|
||||
@@ -191,15 +195,19 @@ impl<R, S> AuthenticatedHandler<R, S> {
|
||||
client_address: client.address.as_base58_string(),
|
||||
})?;
|
||||
|
||||
let context = match client.otel_context {
|
||||
Some(ref ctx) => ctx.clone(),
|
||||
None => HashMap::new(),
|
||||
};
|
||||
#[cfg(feature = "otel")]
|
||||
let manual_ctx_propagator = {
|
||||
let context = match client.otel_context {
|
||||
Some(ref ctx) => ctx.clone(),
|
||||
None => HashMap::new(),
|
||||
};
|
||||
|
||||
let manual_ctx_propagator = if !context.is_empty() {
|
||||
Some(ManualContextPropagator::new("upgrading_fresh_to_authenticated", context))
|
||||
} else {
|
||||
None
|
||||
let manual_ctx_propagator = if !context.is_empty() {
|
||||
Some(ManualContextPropagator::new("upgrading_fresh_to_authenticated", context))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
manual_ctx_propagator
|
||||
};
|
||||
|
||||
let handler = AuthenticatedHandler {
|
||||
@@ -215,6 +223,7 @@ impl<R, S> AuthenticatedHandler<R, S> {
|
||||
mix_receiver,
|
||||
is_active_request_receiver,
|
||||
is_active_ping_pending_reply: None,
|
||||
#[cfg(feature = "otel")]
|
||||
otel_propagator: manual_ctx_propagator,
|
||||
};
|
||||
handler.send_metrics(GatewaySessionEvent::new_session_start(
|
||||
@@ -243,11 +252,14 @@ impl<R, S> AuthenticatedHandler<R, S> {
|
||||
/// * `mix_packet`: packet received from the client that should get forwarded into the network.
|
||||
#[instrument(skip_all)]
|
||||
fn forward_packet(&self, mix_packet: MixPacket) {
|
||||
let span = match &self.otel_propagator {
|
||||
Some(propagator) => info_span!(parent: &propagator.root_span, "forwarding_mix_packet"),
|
||||
None => info_span!("forwarding_mix_packet_no_otel"),
|
||||
};
|
||||
let _enter = span.enter();
|
||||
#[cfg(feature = "otel")]
|
||||
{
|
||||
let span = match &self.otel_propagator {
|
||||
Some(propagator) => info_span!(parent: &propagator.root_span, "forwarding_mix_packet"),
|
||||
None => info_span!("forwarding_mix_packet_no_otel"),
|
||||
};
|
||||
let _enter = span.enter();
|
||||
}
|
||||
|
||||
if let Err(err) = self
|
||||
.inner
|
||||
@@ -308,10 +320,16 @@ impl<R, S> AuthenticatedHandler<R, S> {
|
||||
&mut self,
|
||||
mix_packet: MixPacket,
|
||||
) -> Result<ServerResponse, RequestHandlingError> {
|
||||
let span = match &self.otel_propagator {
|
||||
Some(propagator) => info_span!(parent: &propagator.root_span, "handling_forward_sphinx"),
|
||||
None => info_span!("handling_forward_sphinx_no_otel"),
|
||||
trace!("forwarding sphinx packet");
|
||||
#[cfg(feature = "otel")]
|
||||
let span = {
|
||||
let span = match &self.otel_propagator {
|
||||
Some(propagator) => info_span!(parent: &propagator.root_span, "handling_forward_sphinx"),
|
||||
None => info_span!("handling_forward_sphinx_no_otel"),
|
||||
};
|
||||
span
|
||||
};
|
||||
#[cfg(feature = "otel")]
|
||||
let _enter = span.enter();
|
||||
|
||||
let required_bandwidth = mix_packet.packet().len() as i64;
|
||||
@@ -335,10 +353,15 @@ impl<R, S> AuthenticatedHandler<R, S> {
|
||||
#[instrument(skip_all)]
|
||||
async fn handle_binary(&mut self, bin_msg: Vec<u8>) -> Message {
|
||||
trace!("binary request");
|
||||
let span = match &self.otel_propagator {
|
||||
Some(propagator) => info_span!(parent: &propagator.root_span, "handling_binary_request"),
|
||||
None => info_span!("handling_binary_request_no_otel"),
|
||||
#[cfg(feature = "otel")]
|
||||
let span = {
|
||||
let span = match &self.otel_propagator {
|
||||
Some(propagator) => info_span!(parent: &propagator.root_span, "handling_binary_request"),
|
||||
None => info_span!("handling_binary_request_no_otel"),
|
||||
};
|
||||
span
|
||||
};
|
||||
#[cfg(feature = "otel")]
|
||||
let _enter = span.enter();
|
||||
|
||||
// this function decrypts the request and checks the MAC
|
||||
@@ -653,11 +676,17 @@ impl<R, S> AuthenticatedHandler<R, S> {
|
||||
self.handle_ping_timeout().await;
|
||||
},
|
||||
socket_msg = self.inner.read_websocket_message() => {
|
||||
let span = match &self.otel_propagator {
|
||||
Some(propagator) => info_span!(parent: &propagator.root_span, "client_message_received"),
|
||||
None => info_span!("client_message_received_no_otel"),
|
||||
#[cfg(feature = "otel")]
|
||||
let span = {
|
||||
let span = match &self.otel_propagator {
|
||||
Some(propagator) => info_span!(parent: &propagator.root_span, "client_message_received"),
|
||||
None => info_span!("client_message_received_no_otel"),
|
||||
};
|
||||
span
|
||||
};
|
||||
#[cfg(feature = "otel")]
|
||||
let _enter = span.enter();
|
||||
|
||||
let socket_msg = match socket_msg {
|
||||
None => break,
|
||||
Some(Ok(socket_msg)) => socket_msg,
|
||||
@@ -681,11 +710,17 @@ impl<R, S> AuthenticatedHandler<R, S> {
|
||||
}
|
||||
},
|
||||
mix_messages = self.mix_receiver.next() => {
|
||||
let span = match &self.otel_propagator {
|
||||
Some(propagator) => info_span!(parent: &propagator.root_span, "mix_message_received"),
|
||||
None => info_span!("mix_message_received_no_otel"),
|
||||
#[cfg(feature = "otel")]
|
||||
let span = {
|
||||
let span = match &self.otel_propagator {
|
||||
Some(propagator) => info_span!(parent: &propagator.root_span, "mix_message_received"),
|
||||
None => info_span!("mix_message_received_no_otel"),
|
||||
};
|
||||
span
|
||||
};
|
||||
#[cfg(feature = "otel")]
|
||||
let _enter = span.enter();
|
||||
|
||||
let mix_messages = match mix_messages {
|
||||
None => {
|
||||
debug!("mix receiver was closed! Assuming the connection is dead.");
|
||||
|
||||
@@ -13,6 +13,7 @@ use futures::{
|
||||
channel::{mpsc, oneshot},
|
||||
SinkExt, StreamExt,
|
||||
};
|
||||
#[cfg(feature = "otel")]
|
||||
use nym_bin_common::opentelemetry::context::ManualContextPropagator;
|
||||
use nym_credentials_interface::AvailableBandwidth;
|
||||
use nym_crypto::aes::cipher::crypto_common::rand_core::RngCore;
|
||||
@@ -35,6 +36,7 @@ use nym_node_metrics::events::MetricsEvent;
|
||||
use nym_sphinx::DestinationAddressBytes;
|
||||
use nym_task::ShutdownToken;
|
||||
use rand::CryptoRng;
|
||||
#[cfg(feature = "otel")]
|
||||
use std::collections::HashMap;
|
||||
use std::net::SocketAddr;
|
||||
use std::time::Duration;
|
||||
@@ -43,7 +45,9 @@ use time::OffsetDateTime;
|
||||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
use tokio::time::timeout;
|
||||
use tokio_tungstenite::tungstenite::{protocol::Message, Error as WsError};
|
||||
use tracing::{debug, error, info, info_span, instrument, warn};
|
||||
#[cfg(feature = "otel")]
|
||||
use tracing::info_span;
|
||||
use tracing::{debug, error, info, instrument, warn};
|
||||
|
||||
|
||||
|
||||
@@ -639,6 +643,7 @@ impl<R, S> FreshHandler<R, S> {
|
||||
address,
|
||||
shared_keys.key,
|
||||
session_request_start,
|
||||
#[cfg(feature = "otel")]
|
||||
None,
|
||||
)),
|
||||
ServerResponse::Authenticate {
|
||||
@@ -655,6 +660,7 @@ impl<R, S> FreshHandler<R, S> {
|
||||
async fn handle_authenticate_v2(
|
||||
&mut self,
|
||||
request: Box<AuthenticateRequest>,
|
||||
#[cfg(feature = "otel")]
|
||||
otel_context: Option<HashMap<String, String>>,
|
||||
) -> Result<InitialAuthResult, InitialAuthenticationError>
|
||||
where
|
||||
@@ -730,6 +736,7 @@ impl<R, S> FreshHandler<R, S> {
|
||||
address,
|
||||
shared_key.key,
|
||||
session_request_start,
|
||||
#[cfg(feature = "otel")]
|
||||
otel_context,
|
||||
)),
|
||||
ServerResponse::Authenticate {
|
||||
@@ -829,6 +836,7 @@ impl<R, S> FreshHandler<R, S> {
|
||||
remote_address,
|
||||
shared_keys,
|
||||
OffsetDateTime::now_utc(),
|
||||
#[cfg(feature = "otel")]
|
||||
None
|
||||
);
|
||||
|
||||
@@ -869,7 +877,12 @@ impl<R, S> FreshHandler<R, S> {
|
||||
S: AsyncRead + AsyncWrite + Unpin + Send,
|
||||
R: CryptoRng + RngCore + Send,
|
||||
{
|
||||
#[cfg(not(feature = "otel"))]
|
||||
info!("[DEBUG] received initial client request no otel");
|
||||
#[cfg(feature = "otel")]
|
||||
info!("[DEBUG] received initial client request with otel");
|
||||
// extract and set up opentelemetry context if provided
|
||||
#[cfg(feature = "otel")]
|
||||
let (context_propagator, otel_ctx) = if let ClientControlRequest::AuthenticateV2(ref auth_req) = request {
|
||||
if let Some(otel_context) = &auth_req.otel_context {
|
||||
warn!("OpenTelemetry context provided in the request: {otel_context:?}");
|
||||
@@ -882,7 +895,7 @@ impl<R, S> FreshHandler<R, S> {
|
||||
warn!("No OpenTelemetry context provided in the request");
|
||||
(None, None)
|
||||
};
|
||||
|
||||
#[cfg(feature = "otel")]
|
||||
let child_span = match context_propagator {
|
||||
Some(ref propagator) => {
|
||||
let span = info_span!(parent: &propagator.root_span, "=== Handling initial client request with otel context ===");
|
||||
@@ -890,7 +903,7 @@ impl<R, S> FreshHandler<R, S> {
|
||||
}
|
||||
None => info_span!("=== Handling initial client request without otel context ==="),
|
||||
};
|
||||
|
||||
#[cfg(feature = "otel")]
|
||||
let _enter = child_span.enter();
|
||||
|
||||
let auth_result = match request {
|
||||
@@ -904,7 +917,10 @@ impl<R, S> FreshHandler<R, S> {
|
||||
self.handle_legacy_authenticate(protocol_version, address, enc_address, iv)
|
||||
.await
|
||||
}
|
||||
#[cfg(feature = "otel")]
|
||||
ClientControlRequest::AuthenticateV2(req) => self.handle_authenticate_v2(req, otel_ctx).await,
|
||||
#[cfg(not(feature = "otel"))]
|
||||
ClientControlRequest::AuthenticateV2(req) => self.handle_authenticate_v2(req).await,
|
||||
ClientControlRequest::RegisterHandshakeInitRequest {
|
||||
protocol_version,
|
||||
data,
|
||||
|
||||
@@ -7,6 +7,7 @@ use nym_gateway_requests::shared_key::SharedGatewayKey;
|
||||
use nym_gateway_requests::ServerResponse;
|
||||
use nym_sphinx::DestinationAddressBytes;
|
||||
use rand::{CryptoRng, Rng};
|
||||
#[cfg(feature = "otel")]
|
||||
use std::collections::HashMap;
|
||||
use std::time::Duration;
|
||||
use time::OffsetDateTime;
|
||||
@@ -49,6 +50,7 @@ pub(crate) struct ClientDetails {
|
||||
// note, this does **NOT ALWAYS** indicate timestamp of when client connected
|
||||
// it is (for v2 auth) timestamp the client **signed** when it created the request
|
||||
pub(crate) session_request_timestamp: OffsetDateTime,
|
||||
#[cfg(feature = "otel")]
|
||||
pub(crate) otel_context: Option<HashMap<String, String>>,
|
||||
}
|
||||
|
||||
@@ -58,6 +60,7 @@ impl ClientDetails {
|
||||
address: DestinationAddressBytes,
|
||||
shared_keys: SharedGatewayKey,
|
||||
session_request_timestamp: OffsetDateTime,
|
||||
#[cfg(feature = "otel")]
|
||||
otel_context: Option<HashMap<String, String>>,
|
||||
) -> Self {
|
||||
ClientDetails {
|
||||
@@ -65,6 +68,7 @@ impl ClientDetails {
|
||||
id,
|
||||
shared_keys,
|
||||
session_request_timestamp,
|
||||
#[cfg(feature = "otel")]
|
||||
otel_context,
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ nym-topology = { path = "../common/topology" }
|
||||
nym-api-requests = { path = "nym-api-requests" }
|
||||
nym-validator-client = { path = "../common/client-libs/validator-client" }
|
||||
nym-http-api-client = { path = "../common/http-api-client" }
|
||||
nym-bin-common = { path = "../common/bin-common", features = ["output_format", "openapi", "basic_tracing"] }
|
||||
nym-bin-common = { path = "../common/bin-common", features = ["output_format", "openapi"] }
|
||||
nym-node-tester-utils = { path = "../common/node-tester-utils" }
|
||||
nym-node-requests = { path = "../nym-node/nym-node-requests" }
|
||||
nym-types = { path = "../common/types" }
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||
// instrument tokio console subscriber needs RUSTFLAGS="--cfg tokio_unstable" at build time
|
||||
console_subscriber::init();
|
||||
} else {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
}}
|
||||
|
||||
info!("Starting nym api...");
|
||||
|
||||
@@ -45,9 +45,7 @@ utoipa = { workspace = true, features = ["axum_extras", "time"] }
|
||||
utoipa-swagger-ui = { workspace = true, features = ["axum"] }
|
||||
zeroize.workspace = true
|
||||
|
||||
nym-bin-common = { path = "../../common/bin-common", features = [
|
||||
"basic_tracing",
|
||||
] }
|
||||
nym-bin-common = { path = "../../common/bin-common" }
|
||||
nym-compact-ecash = { path = "../../common/nym_offline_compact_ecash" }
|
||||
nym-config = { path = "../../common/config" }
|
||||
nym-crypto = { path = "../../common/crypto", features = [
|
||||
|
||||
@@ -6,7 +6,7 @@ cfg_if::cfg_if! {
|
||||
use crate::cli::Cli;
|
||||
use clap::Parser;
|
||||
use nym_bin_common::bin_info_owned;
|
||||
use nym_bin_common::logging::setup_tracing_logger;
|
||||
use nym_bin_common::logging::setup_no_otel_logger;
|
||||
use nym_network_defaults::setup_env;
|
||||
use tracing::{info, trace};
|
||||
|
||||
@@ -29,7 +29,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
trace!("args: {cli:#?}");
|
||||
|
||||
setup_env(cli.config_env_file.as_ref());
|
||||
setup_tracing_logger();
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
let bin_info = bin_info_owned!();
|
||||
info!("using the following version: {bin_info}");
|
||||
|
||||
@@ -30,7 +30,7 @@ utoipa-swagger-ui = { workspace = true, features = ["axum"] }
|
||||
tokio-postgres = { workspace = true }
|
||||
|
||||
# internal
|
||||
nym-bin-common = { path = "../common/bin-common", features = ["basic_tracing"] }
|
||||
nym-bin-common = { path = "../common/bin-common" }
|
||||
nym-client-core = { path = "../common/client-core" }
|
||||
nym-crypto = { path = "../common/crypto" }
|
||||
nym-network-defaults = { path = "../common/network-defaults" }
|
||||
|
||||
@@ -189,7 +189,7 @@ async fn nym_topology_from_env() -> anyhow::Result<NymTopology> {
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
let args = Args::parse();
|
||||
|
||||
|
||||
+8
-4
@@ -31,7 +31,7 @@ humantime-serde = { workspace = true }
|
||||
human-repr = { workspace = true }
|
||||
ipnetwork = { workspace = true }
|
||||
indicatif = { workspace = true }
|
||||
opentelemetry = { workspace = true } # make it optional later
|
||||
opentelemetry = { workspace = true, optional = true } # make it optional later
|
||||
rand = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json.workspace = true
|
||||
@@ -51,7 +51,6 @@ cupid = { workspace = true }
|
||||
sysinfo = { workspace = true }
|
||||
|
||||
nym-bin-common = { path = "../common/bin-common", features = [
|
||||
"basic_tracing",
|
||||
"output_format",
|
||||
] }
|
||||
nym-client-core-config-types = { path = "../common/client-core/config-types", features = [
|
||||
@@ -131,10 +130,15 @@ criterion = { workspace = true, features = ["async_tokio"] }
|
||||
rand_chacha = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = ["otel"] # 🚨🚨🚨 TODO: remove otel as a default feature 🚨🚨🚨
|
||||
default = []
|
||||
tokio-console = ["console-subscriber"]
|
||||
otel = [
|
||||
|
||||
"nym-bin-common/otel",
|
||||
"nym-gateway/otel",
|
||||
"nym-http-api-common/otel",
|
||||
"nym-sphinx-framing/otel",
|
||||
"nym-sphinx-addressing/otel",
|
||||
"opentelemetry",
|
||||
]
|
||||
|
||||
|
||||
|
||||
+26
-10
@@ -10,11 +10,13 @@ use crate::env::vars::{NYMNODE_CONFIG_ENV_FILE_ARG, NYMNODE_NO_BANNER_ARG};
|
||||
use clap::{Args, Parser, Subcommand};
|
||||
use nym_bin_common::{
|
||||
bin_info,
|
||||
opentelemetry::{
|
||||
setup_no_otel_logger,
|
||||
setup_tracing_logger,
|
||||
error::TracingError},
|
||||
logging::setup_no_otel_logger,
|
||||
};
|
||||
#[cfg(feature = "otel")]
|
||||
use nym_bin_common::logging::error::TracingError;
|
||||
#[cfg(feature = "otel")]
|
||||
use nym_bin_common::opentelemetry::setup_tracing_logger;
|
||||
#[cfg(feature = "otel")]
|
||||
use opentelemetry::{Context, global, trace::{TraceContextExt, Tracer}};
|
||||
use std::future::Future;
|
||||
use std::sync::OnceLock;
|
||||
@@ -89,33 +91,47 @@ impl Cli {
|
||||
},
|
||||
// SigNoz/OTEL run in async context
|
||||
Commands::BondingInformation(args) => Self::execute_async(async move {
|
||||
let _guard = setup_tracing_logger("nym-node".to_string())
|
||||
#[cfg(feature = "otel")]
|
||||
setup_tracing_logger("nym-node".to_string())
|
||||
.map_err(TracingError::from)?;
|
||||
|
||||
#[cfg(not(feature = "otel"))]
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
bonding_information::execute(args).await?;
|
||||
Ok::<(), anyhow::Error>(())
|
||||
})??,
|
||||
Commands::NodeDetails(args) => Self::execute_async(async move {
|
||||
let _guard = setup_tracing_logger("nym-node".to_string())
|
||||
#[cfg(feature = "otel")]
|
||||
setup_tracing_logger("nym-node".to_string())
|
||||
.map_err(TracingError::from)?;
|
||||
#[cfg(not(feature = "otel"))]
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
node_details::execute(args).await?;
|
||||
Ok::<(), anyhow::Error>(())
|
||||
})??,
|
||||
Commands::Run(args) => Self::execute_async(async move {
|
||||
let _guard = setup_tracing_logger("nym-node".to_string())
|
||||
#[cfg(feature = "otel")]
|
||||
setup_tracing_logger("nym-node".to_string())
|
||||
.map_err(TracingError::from)?;
|
||||
#[cfg(not(feature = "otel"))]
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
run::execute(*args).await?;
|
||||
Ok::<(), anyhow::Error>(())
|
||||
})??,
|
||||
Commands::Sign(args) => Self::execute_async(async move {
|
||||
let _guard = setup_tracing_logger("nym-node".to_string())
|
||||
#[cfg(feature = "otel")]
|
||||
setup_tracing_logger("nym-node".to_string())
|
||||
.map_err(TracingError::from)?;
|
||||
#[cfg(not(feature = "otel"))]
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
sign::execute(args).await?;
|
||||
Ok::<(), anyhow::Error>(())
|
||||
})??,
|
||||
Commands::UnsafeResetSphinxKeys(args) => Self::execute_async(async move {
|
||||
let _guard = setup_tracing_logger("nym-node".to_string())
|
||||
#[cfg(feature = "otel")]
|
||||
setup_tracing_logger("nym-node".to_string())
|
||||
.map_err(TracingError::from)?;
|
||||
#[cfg(not(feature = "otel"))]
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
reset_sphinx_keys::execute(args).await?;
|
||||
Ok::<(), anyhow::Error>(())
|
||||
})??,
|
||||
|
||||
@@ -20,7 +20,7 @@ tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
|
||||
tracing = { workspace = true }
|
||||
url = { workspace = true }
|
||||
|
||||
nym-bin-common = { path = "../common/bin-common", features = ["output_format", "basic_tracing"] }
|
||||
nym-bin-common = { path = "../common/bin-common", features = ["output_format"] }
|
||||
nym-ecash-signer-check = { path = "../common/ecash-signer-check" }
|
||||
nym-network-defaults = { path = "../common/network-defaults" }
|
||||
nym-task = { path = "../common/task" }
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
use crate::cli::Cli;
|
||||
use clap::Parser;
|
||||
use nym_bin_common::bin_info_owned;
|
||||
use nym_bin_common::logging::setup_tracing_logger;
|
||||
use nym_bin_common::logging::setup_no_otel_logger;
|
||||
use tracing::{info, trace};
|
||||
|
||||
mod cli;
|
||||
@@ -13,7 +13,7 @@ pub(crate) mod test_result;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
setup_tracing_logger();
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
let cli = Cli::parse();
|
||||
trace!("args: {cli:#?}");
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ humantime = { workspace = true }
|
||||
humantime-serde.workspace = true
|
||||
|
||||
# internal
|
||||
nym-bin-common = { path = "../common/bin-common", features = ["output_format", "basic_tracing"] }
|
||||
nym-config = { path = "../common/config" }
|
||||
nym-bin-common = { path = "../common/bin-common", features = ["output_format"] }
|
||||
nym-config = { path = "../common/config" }
|
||||
nym-ecash-time = { path = "../common/ecash-time" }
|
||||
nym-contracts-common = { path = "../common/cosmwasm-smart-contracts/contracts-common" }
|
||||
nym-compact-ecash = { path = "../common/nym_offline_compact_ecash" }
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
#![warn(clippy::dbg_macro)]
|
||||
|
||||
use crate::cli::Cli;
|
||||
use clap::{Parser, crate_name, crate_version};
|
||||
use nym_bin_common::logging::{maybe_print_banner, setup_tracing_logger};
|
||||
use clap::{crate_name, crate_version, Parser};
|
||||
use nym_bin_common::logging::{maybe_print_banner, setup_no_otel_logger};
|
||||
use nym_network_defaults::setup_env;
|
||||
|
||||
pub mod cli;
|
||||
@@ -25,7 +25,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
|
||||
let args = Cli::parse();
|
||||
setup_env(args.config_env_file.as_ref());
|
||||
setup_tracing_logger();
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
if !args.no_banner {
|
||||
maybe_print_banner(crate_name!(), crate_version!());
|
||||
|
||||
@@ -13,5 +13,5 @@ clap = { version = "4.0", features = ["derive"] }
|
||||
log = "0.4"
|
||||
serde_json = "1.0.0"
|
||||
|
||||
nym-bin-common = { path = "../../common/bin-common", features = ["basic_tracing"] }
|
||||
nym-bin-common = { path = "../../common/bin-common" }
|
||||
nym-store-cipher = { path = "../../common/store-cipher" }
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use clap::Parser;
|
||||
use nym_bin_common::logging::setup_tracing_logger;
|
||||
use nym_bin_common::logging::setup_no_otel_logger;
|
||||
use nym_store_cipher::{
|
||||
Aes256Gcm, Algorithm, EncryptedData, KdfInfo, Params, StoreCipher, Version, ARGON2_SALT_SIZE,
|
||||
CURRENT_VERSION,
|
||||
@@ -52,7 +52,7 @@ enum ParseMode {
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
setup_tracing_logger();
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
let args = Args::parse();
|
||||
let file = File::open(args.file)?;
|
||||
let parse = if args.raw {
|
||||
|
||||
@@ -13,7 +13,7 @@ crate-type = ["cdylib"]
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
# Nym clients, addressing, packet format, common tools (logging), ffi shared
|
||||
nym-sdk = { path = "../../rust/nym-sdk/" }
|
||||
nym-bin-common = { path = "../../../common/bin-common", features = ["basic_tracing"] }
|
||||
nym-bin-common = { path = "../../../common/bin-common" }
|
||||
nym-sphinx-anonymous-replies = { path = "../../../common/nymsphinx/anonymous-replies" }
|
||||
nym-ffi-shared = { path = "../shared" }
|
||||
lazy_static = { workspace = true }
|
||||
|
||||
@@ -12,7 +12,7 @@ use crate::types::types::{CMessageCallback, CStringCallback, ReceivedMessage, St
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn init_logging() {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
||||
@@ -14,7 +14,7 @@ uniffi = { workspace = true, features = ["cli"] }
|
||||
# Nym clients, addressing, packet format, common tools (logging), ffi shared
|
||||
nym-sdk = { path = "../../rust/nym-sdk/" }
|
||||
nym-crypto = { path = "../../../common/crypto" }
|
||||
nym-bin-common = { path = "../../../common/bin-common", features = ["basic_tracing"] }
|
||||
nym-bin-common = { path = "../../../common/bin-common" }
|
||||
nym-sphinx-anonymous-replies = { path = "../../../common/nymsphinx/anonymous-replies" }
|
||||
nym-ffi-shared = { path = "../shared" }
|
||||
# Async runtime
|
||||
|
||||
@@ -36,7 +36,7 @@ enum GoWrapError {
|
||||
|
||||
#[no_mangle]
|
||||
fn init_logging() {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
||||
@@ -43,9 +43,7 @@ nym-socks5-requests = { path = "../../../common/socks5/requests" }
|
||||
nym-ordered-buffer = { path = "../../../common/socks5/ordered-buffer" }
|
||||
nym-service-providers-common = { path = "../../../service-providers/common" }
|
||||
nym-sphinx-addressing = { path = "../../../common/nymsphinx/addressing" }
|
||||
nym-bin-common = { path = "../../../common/bin-common", features = [
|
||||
"basic_tracing",
|
||||
] }
|
||||
nym-bin-common = { path = "../../../common/bin-common" }
|
||||
bytecodec = { workspace = true }
|
||||
httpcodec = { workspace = true }
|
||||
bytes = { workspace = true }
|
||||
@@ -75,15 +73,15 @@ serde = { workspace = true, features = ["derive"] }
|
||||
# tracing-subscriber = { workspace = true, features = ["env-filter"] }
|
||||
dirs.workspace = true
|
||||
|
||||
opentelemetry = { workspace = true }
|
||||
opentelemetry_sdk = { workspace = true }
|
||||
opentelemetry = { workspace = true, optional = true}
|
||||
opentelemetry_sdk = { workspace = true, optional = true }
|
||||
|
||||
tracing = { workspace = true, features = ["std"] }
|
||||
tracing-subscriber = { workspace = true, features = ["registry", "std"] }
|
||||
tracing-core = { workspace = true }
|
||||
tracing-opentelemetry = { workspace = true }
|
||||
opentelemetry-otlp.workspace = true
|
||||
opentelemetry-semantic-conventions.workspace = true
|
||||
tracing-opentelemetry = { workspace = true, optional = true }
|
||||
opentelemetry-otlp = { workspace = true, optional = true }
|
||||
opentelemetry-semantic-conventions = { workspace = true, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
anyhow = { workspace = true }
|
||||
@@ -92,7 +90,7 @@ reqwest = { workspace = true, features = ["json", "socks"] }
|
||||
thiserror = { workspace = true }
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
time = { workspace = true }
|
||||
nym-bin-common = { path = "../../../common/bin-common", features = ["basic_tracing"] }
|
||||
nym-bin-common = { path = "../../../common/bin-common" }
|
||||
|
||||
# extra dependencies for libp2p examples
|
||||
#libp2p = { git = "https://github.com/ChainSafe/rust-libp2p.git", rev = "e3440d25681df380c9f0f8cfdcfd5ecc0a4f2fb6", features = [ "identify", "macros", "ping", "tokio", "tcp", "dns", "websocket", "noise", "mplex", "yamux", "gossipsub" ]}
|
||||
@@ -103,3 +101,12 @@ hex = { workspace = true }
|
||||
|
||||
[features]
|
||||
libp2p-vanilla = []
|
||||
otel = [
|
||||
"nym-bin-common/otel",
|
||||
"nym-gateway-requests/otel",
|
||||
"opentelemetry",
|
||||
"opentelemetry_sdk",
|
||||
"opentelemetry-otlp",
|
||||
"opentelemetry-semantic-conventions",
|
||||
"tracing-opentelemetry",
|
||||
]
|
||||
|
||||
@@ -6,7 +6,7 @@ use nym_sdk::mixnet::MixnetMessageSender;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
// right now, only sandbox has coconut setup
|
||||
// this should be run from the `sdk/rust/nym-sdk` directory
|
||||
setup_env(Some("../../../envs/sandbox.env"));
|
||||
|
||||
@@ -3,7 +3,7 @@ use nym_sdk::mixnet::MixnetMessageSender;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
// Create client builder, including ephemeral keys. The builder can be usable in the context
|
||||
// where you don't want to connect just yet.
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::path::PathBuf;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
// Specify some config options
|
||||
let config_dir = PathBuf::from("/tmp/mixnet-client");
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
todo!()
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ use tokio::signal::ctrl_c;
|
||||
// Run with: cargo run --example client_pool -- ../../../envs/<NETWORK>.env
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to setup logging");
|
||||
setup_env(std::env::args().nth(1));
|
||||
|
||||
let conn_pool = ClientPool::new(2); // Start the Client Pool with 2 Clients always being kept in reserve
|
||||
|
||||
@@ -3,83 +3,18 @@
|
||||
|
||||
use futures::StreamExt;
|
||||
use nym_sdk::mixnet::MixnetMessageSender;
|
||||
use nym_sdk::{mixnet, DebugConfig};
|
||||
use nym_topology::provider_trait::{async_trait, ToTopologyMetadata, TopologyProvider};
|
||||
use nym_sdk::{mixnet};
|
||||
use nym_topology::{
|
||||
CachedEpochRewardedSet, EntryDetails, EpochRewardedSet, HardcodedTopologyProvider, NymTopology,
|
||||
CachedEpochRewardedSet, EntryDetails, HardcodedTopologyProvider, NymTopology,
|
||||
NymTopologyMetadata, RoutingNode, SupportedRoles,
|
||||
};
|
||||
use nym_validator_client::nym_api::NymApiClientExt;
|
||||
use std::time::Duration;
|
||||
use time::OffsetDateTime;
|
||||
use tokio::time::sleep;
|
||||
use url::Url;
|
||||
//
|
||||
// struct MyTopologyProvider {
|
||||
// validator_client: nym_http_api_client::Client,
|
||||
// }
|
||||
//
|
||||
// impl MyTopologyProvider {
|
||||
// fn new(nym_api_url: Url) -> MyTopologyProvider {
|
||||
// let validator_client = nym_http_api_client::Client::builder(nym_api_url)
|
||||
// .expect("Failed to create API client builder")
|
||||
// .build()
|
||||
// .expect("Failed to build API client");
|
||||
//
|
||||
// MyTopologyProvider { validator_client }
|
||||
// }
|
||||
//
|
||||
// async fn get_topology(&self) -> NymTopology {
|
||||
// let rewarded_set = self
|
||||
// .validator_client
|
||||
// .get_current_rewarded_set()
|
||||
// .await
|
||||
// .unwrap();
|
||||
//
|
||||
// let mixnodes_response = self
|
||||
// .validator_client
|
||||
// .get_all_basic_active_mixing_assigned_nodes_with_metadata()
|
||||
// .await
|
||||
// .unwrap();
|
||||
//
|
||||
// let metadata = mixnodes_response.metadata.to_topology_metadata();
|
||||
//
|
||||
// let epoch_rewarded_set: EpochRewardedSet = rewarded_set.into();
|
||||
// let mut base_topology = NymTopology::new(metadata, epoch_rewarded_set, Vec::new());
|
||||
//
|
||||
// // in our topology provider only use mixnodes that have node_id divisible by 3
|
||||
// // and has exactly 100 performance score
|
||||
// // why? because this is just an example to showcase arbitrary uses and capabilities of this trait
|
||||
// let filtered_mixnodes = mixnodes_response
|
||||
// .nodes
|
||||
// .into_iter()
|
||||
// .filter(|mix| mix.node_id % 3 == 0 && mix.performance.is_hundred())
|
||||
// .collect::<Vec<_>>();
|
||||
//
|
||||
// let gateways = self
|
||||
// .validator_client
|
||||
// .get_all_basic_entry_assigned_nodes_with_metadata()
|
||||
// .await
|
||||
// .unwrap()
|
||||
// .nodes;
|
||||
//
|
||||
// base_topology.add_skimmed_nodes(&filtered_mixnodes);
|
||||
// base_topology.add_skimmed_nodes(&gateways);
|
||||
// base_topology
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// #[async_trait]
|
||||
// impl TopologyProvider for MyTopologyProvider {
|
||||
// // this will be manually refreshed on a timer specified inside mixnet client config
|
||||
// async fn get_new_topology(&mut self) -> Option<NymTopology> {
|
||||
// Some(self.get_topology().await)
|
||||
// }
|
||||
// }
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to setup logging");
|
||||
|
||||
// let nym_api = "https://validator.nymtech.net/api/".parse().unwrap();
|
||||
// let my_topology_provider = MyTopologyProvider::new(nym_api);
|
||||
|
||||
@@ -2,7 +2,9 @@ use nym_sdk::mixnet::{
|
||||
AnonymousSenderTag, MixnetClientBuilder, MixnetMessageSender, ReconstructedMessage,
|
||||
};
|
||||
use nym_topology::{CachedEpochRewardedSet, EntryDetails, HardcodedTopologyProvider, NymTopology, NymTopologyMetadata, RoutingNode, SupportedRoles};
|
||||
#[cfg(feature = "otel")]
|
||||
use opentelemetry::trace::{TraceContextExt, Tracer};
|
||||
#[cfg(feature = "otel")]
|
||||
use opentelemetry::{global, Context};
|
||||
use time::OffsetDateTime;
|
||||
use tracing::warn;
|
||||
@@ -11,15 +13,20 @@ use tracing::instrument;
|
||||
#[tokio::main]
|
||||
#[instrument(name = "sdk-example-surb-reply", skip_all)]
|
||||
async fn main() {
|
||||
nym_bin_common::opentelemetry::setup_tracing_logger("local-sdk-example-surb-reply".to_string()).unwrap();
|
||||
#[cfg(feature = "otel")]
|
||||
{
|
||||
nym_bin_common::opentelemetry::setup_tracing_logger("local-sdk-example-surb-reply".to_string()).unwrap();
|
||||
|
||||
let tracer = global::tracer("local-sdk-example-surb-reply");
|
||||
let span = tracer.start("client-root-span");
|
||||
let cx = Context::current_with_span(span);
|
||||
let _guard = cx.clone().attach();
|
||||
let tracer = global::tracer("local-sdk-example-surb-reply");
|
||||
let span = tracer.start("client-root-span");
|
||||
let cx = Context::current_with_span(span);
|
||||
let _guard = cx.clone().attach();
|
||||
|
||||
let trace_id = cx.span().span_context().trace_id();
|
||||
warn!("Main TRACE_ID: {:?}", trace_id);
|
||||
let trace_id = cx.span().span_context().trace_id();
|
||||
warn!("Main TRACE_ID: {:?}", trace_id);
|
||||
}
|
||||
#[cfg(not(feature = "otel"))]
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
// Create a mixnet client which connect to a local node
|
||||
let topology_metadata = NymTopologyMetadata::new(0, 0, OffsetDateTime::now_utc());
|
||||
@@ -38,10 +45,10 @@ async fn main() {
|
||||
hostname: None,
|
||||
clients_wss_port: None,
|
||||
}),
|
||||
identity_key: "Put Your Identity Key Here"
|
||||
identity_key: "put here identity_key"
|
||||
.parse()
|
||||
.unwrap(),
|
||||
sphinx_key: "Put Your Sphinx Key Here"
|
||||
sphinx_key: "put here sphinx_key"
|
||||
.parse()
|
||||
.unwrap(),
|
||||
supported_roles: SupportedRoles {
|
||||
|
||||
@@ -8,7 +8,7 @@ use nym_topology::provider_trait::async_trait;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
// Just some plain data to pretend we have some external storage that the application
|
||||
// implementer is using.
|
||||
|
||||
@@ -7,7 +7,7 @@ use nym_topology::{NymTopology, NymTopologyMetadata, RoutingNode, SupportedRoles
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
// Passing no config makes the client fire up an ephemeral session and figure shit out on its own
|
||||
let mut client = mixnet::MixnetClient::connect_new().await.unwrap();
|
||||
|
||||
@@ -7,7 +7,7 @@ use nym_sdk::mixnet::MixnetMessageSender;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
// Passing no config makes the client fire up an ephemeral session and figure stuff out on its own
|
||||
let mut client = mixnet::MixnetClient::connect_new().await.unwrap();
|
||||
|
||||
@@ -6,7 +6,7 @@ use nym_sdk::mixnet::MixnetMessageSender;
|
||||
// An example of creating a client relying on a testnet, in this case Sandbox.
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
// relative root is `sdk/rust/nym-sdk/` for fallback file path
|
||||
let env_path =
|
||||
std::env::var("NYM_ENV_PATH").unwrap_or_else(|_| "../../../envs/sandbox.env".to_string());
|
||||
|
||||
@@ -3,7 +3,7 @@ use nym_sdk::mixnet::MixnetMessageSender;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
// Passing no config makes the client fire up an ephemeral session and figure shit out on its own
|
||||
// let mut client = mixnet::MixnetClient::connect_new().await.unwrap();
|
||||
|
||||
@@ -2,7 +2,7 @@ use nym_sdk::mixnet;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
println!("Connecting receiver");
|
||||
let mut receiving_client = mixnet::MixnetClient::connect_new().await.unwrap();
|
||||
|
||||
@@ -2,7 +2,9 @@ use nym_sdk::mixnet::{
|
||||
AnonymousSenderTag, MixnetClientBuilder, MixnetMessageSender, ReconstructedMessage,
|
||||
};
|
||||
use nym_sdk::DebugConfig;
|
||||
#[cfg(feature = "otel")]
|
||||
use opentelemetry::trace::{TraceContextExt, Tracer};
|
||||
#[cfg(feature = "otel")]
|
||||
use opentelemetry::{global, Context};
|
||||
use tracing::warn;
|
||||
use tracing::instrument;
|
||||
@@ -10,18 +12,26 @@ use tracing::instrument;
|
||||
#[tokio::main]
|
||||
#[instrument(name = "sdk-example-surb-reply", skip_all)]
|
||||
async fn main() {
|
||||
let _guard = nym_bin_common::opentelemetry::setup_tracing_logger("sdk-example-surb-reply".to_string()).unwrap();
|
||||
// Setup OpenTelemetry tracing
|
||||
#[cfg(feature = "otel")]
|
||||
let _guard = {
|
||||
nym_bin_common::opentelemetry::setup_tracing_logger("sdk-example-surb-reply".to_string()).unwrap();
|
||||
|
||||
let tracer = global::tracer("sdk-example-surb-reply");
|
||||
let span = tracer.start("client-root-span");
|
||||
let cx = Context::current_with_span(span);
|
||||
let _guard = cx.clone().attach();
|
||||
let tracer = global::tracer("sdk-example-surb-reply");
|
||||
let span = tracer.start("client-root-span");
|
||||
let cx = Context::current_with_span(span);
|
||||
let _guard = cx.clone().attach();
|
||||
|
||||
let trace_id = cx.span().span_context().trace_id();
|
||||
warn!("Main TRACE_ID: {:?}", trace_id);
|
||||
let trace_id = cx.span().span_context().trace_id();
|
||||
warn!("Main TRACE_ID: {:?}", trace_id);
|
||||
|
||||
let context = Context::current();
|
||||
println!("Current OTEL context: {:?}", context);
|
||||
let context = Context::current();
|
||||
println!("Current OTEL context: {:?}", context);
|
||||
|
||||
_guard
|
||||
};
|
||||
#[cfg(not(feature = "otel"))]
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
// Ignore performance requirements for the sake of the example
|
||||
let mut debug_config = DebugConfig::default();
|
||||
|
||||
@@ -74,6 +74,7 @@ pub struct MixnetClientBuilder<S: MixnetClientStorage = Ephemeral> {
|
||||
impl MixnetClientBuilder<Ephemeral> {
|
||||
/// Creates a client builder with ephemeral storage.
|
||||
#[must_use]
|
||||
#[instrument(name = "MixnetClientBuilder::new_ephemeral", skip_all)]
|
||||
pub fn new_ephemeral() -> Self {
|
||||
MixnetClientBuilder {
|
||||
..Default::default()
|
||||
@@ -82,6 +83,7 @@ impl MixnetClientBuilder<Ephemeral> {
|
||||
|
||||
/// Create a client builder with default values.
|
||||
#[must_use]
|
||||
#[instrument(name = "MixnetClientBuilder::new", skip_all)]
|
||||
pub fn new() -> Self {
|
||||
Self::new_ephemeral()
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ use std::sync::Arc;
|
||||
use std::task::{Context, Poll};
|
||||
use tokio::sync::RwLockReadGuard;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
use tracing::instrument;
|
||||
|
||||
/// Client connected to the Nym mixnet.
|
||||
pub struct MixnetClient {
|
||||
@@ -64,6 +65,7 @@ pub struct MixnetClient {
|
||||
|
||||
impl MixnetClient {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[instrument(name = "MixnetClient::new", skip_all)]
|
||||
pub(crate) fn new(
|
||||
nym_address: Recipient,
|
||||
identity_keys: Arc<ed25519::KeyPair>,
|
||||
|
||||
@@ -5,10 +5,14 @@ use crate::mixnet::{AnonymousSenderTag, IncludedSurbs, Recipient};
|
||||
use crate::Result;
|
||||
use async_trait::async_trait;
|
||||
use nym_client_core::client::inbound_messages::InputMessage;
|
||||
#[cfg(feature = "otel"
|
||||
)]
|
||||
use nym_bin_common::opentelemetry::compact_id_generator::compress_trace_id;
|
||||
use nym_sphinx::params::PacketType;
|
||||
use nym_task::connections::TransmissionLane;
|
||||
#[cfg(feature = "otel")]
|
||||
use opentelemetry::trace::TraceContextExt;
|
||||
#[cfg(feature = "otel")]
|
||||
use opentelemetry::Context;
|
||||
use tracing::instrument;
|
||||
|
||||
@@ -77,10 +81,14 @@ pub trait MixnetMessageSender {
|
||||
{
|
||||
// In case of surb opentelemetry tracing, we extract the context and trace_id
|
||||
// in the 12 bytes format
|
||||
let context = Context::current();
|
||||
let trace_id = context.span().span_context().trace_id();
|
||||
tracing::warn!("Extracted trace_id from surb context: {:?}", trace_id);
|
||||
let trace_id = compress_trace_id(&trace_id);
|
||||
#[cfg(feature = "otel")]
|
||||
let trace_id = {
|
||||
let context = Context::current();
|
||||
let trace_id = context.span().span_context().trace_id();
|
||||
Some(compress_trace_id(&trace_id))
|
||||
};
|
||||
#[cfg(not(feature = "otel"))]
|
||||
let trace_id = None;
|
||||
|
||||
let lane = TransmissionLane::General;
|
||||
let input_msg = match surbs {
|
||||
@@ -90,14 +98,14 @@ pub trait MixnetMessageSender {
|
||||
surbs,
|
||||
lane,
|
||||
self.packet_type(),
|
||||
Some(trace_id)
|
||||
trace_id,
|
||||
),
|
||||
IncludedSurbs::ExposeSelfAddress => InputMessage::new_regular(
|
||||
address,
|
||||
message.as_ref().to_vec(),
|
||||
lane,
|
||||
self.packet_type(),
|
||||
Some(trace_id)
|
||||
trace_id,
|
||||
),
|
||||
};
|
||||
self.send(input_msg).await
|
||||
|
||||
@@ -32,7 +32,7 @@ struct Args {
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to setup logging");
|
||||
let args = Args::parse();
|
||||
|
||||
let nym_addr: Recipient =
|
||||
|
||||
@@ -23,7 +23,7 @@ struct Args {
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to setup logging");
|
||||
|
||||
let args = Args::parse();
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ clap.workspace = true
|
||||
etherparse = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
log = { workspace = true }
|
||||
nym-bin-common = { path = "../../common/bin-common", features = ["clap", "basic_tracing"] }
|
||||
nym-bin-common = { path = "../../common/bin-common", features = ["clap"] }
|
||||
nym-client-core = { path = "../../common/client-core" }
|
||||
nym-config = { path = "../../common/config" }
|
||||
nym-crypto = { path = "../../common/crypto" }
|
||||
|
||||
@@ -10,7 +10,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
use clap::Parser;
|
||||
|
||||
let args = cli::Cli::parse();
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
nym_network_defaults::setup_env(args.config_env_file.as_ref());
|
||||
|
||||
if !args.no_banner {
|
||||
|
||||
@@ -43,7 +43,7 @@ zeroize = { workspace = true }
|
||||
|
||||
# internal
|
||||
nym-async-file-watcher = { path = "../../common/async-file-watcher" }
|
||||
nym-bin-common = { path = "../../common/bin-common", features = ["output_format", "clap", "basic_tracing"] }
|
||||
nym-bin-common = { path = "../../common/bin-common", features = ["output_format", "clap"] }
|
||||
nym-client-core = { path = "../../common/client-core", features = ["cli", "fs-gateways-storage", "fs-surb-storage"] }
|
||||
nym-client-websocket-requests = { path = "../../clients/native/websocket-requests" }
|
||||
nym-config = { path = "../../common/config" }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use clap::{Parser, crate_name, crate_version};
|
||||
use nym_bin_common::logging::{maybe_print_banner, setup_tracing_logger};
|
||||
use nym_bin_common::logging::{maybe_print_banner, setup_no_otel_logger};
|
||||
use nym_network_defaults::setup_env;
|
||||
|
||||
mod cli;
|
||||
@@ -21,7 +21,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
if !args.no_banner {
|
||||
maybe_print_banner(crate_name!(), crate_version!());
|
||||
}
|
||||
setup_tracing_logger();
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
cli::execute(args).await?;
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ bytes.workspace = true
|
||||
dirs.workspace = true
|
||||
clap.workspace = true
|
||||
nym-bin-common = { path = "../../common/bin-common", features = [
|
||||
"basic_tracing",
|
||||
"output_format",
|
||||
] }
|
||||
nym-crypto = { path = "../../common/crypto", features = ["asymmetric"] }
|
||||
|
||||
@@ -28,7 +28,7 @@ struct Args {
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
let args = Args::parse();
|
||||
let mut echo_server = NymEchoServer::new(
|
||||
args.gateway,
|
||||
|
||||
@@ -22,7 +22,7 @@ tracing = { workspace = true }
|
||||
|
||||
importer-contract = { path = "../importer-contract" }
|
||||
nym-validator-client = { path = "../../../../common/client-libs/validator-client" }
|
||||
nym-bin-common = { path = "../../../../common/bin-common", features = ["basic_tracing"] }
|
||||
nym-bin-common = { path = "../../../../common/bin-common" }
|
||||
nym-network-defaults = { path = "../../../../common/network-defaults" }
|
||||
|
||||
nym-mixnet-contract-common = { path = "../../../../common/cosmwasm-smart-contracts/mixnet-contract" }
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
use crate::commands::Cli;
|
||||
use clap::Parser;
|
||||
use nym_bin_common::logging::setup_tracing_logger;
|
||||
use nym_bin_common::logging::setup_no_otel_logger;
|
||||
use nym_network_defaults::setup_env;
|
||||
|
||||
pub mod commands;
|
||||
@@ -15,6 +15,6 @@ async fn main() -> anyhow::Result<()> {
|
||||
let cli = Cli::parse();
|
||||
setup_env(cli.config_env_file.as_ref());
|
||||
|
||||
setup_tracing_logger();
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
cli.execute().await
|
||||
}
|
||||
|
||||
@@ -18,6 +18,6 @@ tracing = { workspace = true }
|
||||
tokio = { workspace = true, features = ["rt-multi-thread", "signal", "macros"] }
|
||||
|
||||
nym-network-defaults = { path = "../../../common/network-defaults" }
|
||||
nym-bin-common = { path = "../../../common/bin-common", features = ["basic_tracing", "output_format"] }
|
||||
nym-bin-common = { path = "../../../common/bin-common", features = ["output_format"] }
|
||||
nym-crypto = { path = "../../../common/crypto", features = ["asymmetric"] }
|
||||
nym-sdk = { path = "../../../sdk/rust/nym-sdk" }
|
||||
|
||||
@@ -152,7 +152,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
|
||||
let args = Cli::parse();
|
||||
setup_env(args.config_env_file.as_ref());
|
||||
// setup_tracing_logger();
|
||||
// setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
args.execute().await
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ url.workspace = true
|
||||
zeroize = { workspace = true, features = ["zeroize_derive"] }
|
||||
|
||||
|
||||
nym-bin-common = { path = "../../../common/bin-common", features = ["output_format", "basic_tracing"] }
|
||||
nym-bin-common = { path = "../../../common/bin-common", features = ["output_format"] }
|
||||
nym-crypto = { path = "../../../common/crypto", features = ["asymmetric", "rand", "serde"] }
|
||||
nym-config = { path = "../../../common/config" }
|
||||
nym-validator-client = { path = "../../../common/client-libs/validator-client" }
|
||||
|
||||
@@ -18,7 +18,7 @@ mod manager;
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
use crate::cli::Cli;
|
||||
use clap::Parser;
|
||||
use nym_bin_common::logging::setup_tracing_logger;
|
||||
use nym_bin_common::logging::setup_no_otel_logger;
|
||||
|
||||
// std::env::set_var(
|
||||
// "RUST_LOG",
|
||||
@@ -26,7 +26,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
// );
|
||||
|
||||
let cli = Cli::parse();
|
||||
setup_tracing_logger();
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
cli.execute().await?;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ time = { workspace = true }
|
||||
|
||||
|
||||
nym-validator-client = { path = "../../../common/client-libs/validator-client" }
|
||||
nym-bin-common = { path = "../../../common/bin-common", features = ["output_format", "basic_tracing"] }
|
||||
nym-bin-common = { path = "../../../common/bin-common", features = ["output_format"] }
|
||||
nym-network-defaults = { path = "../../../common/network-defaults" }
|
||||
nym-http-api-client = { path = "../../../common/http-api-client" }
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
use crate::commands::Cli;
|
||||
use clap::Parser;
|
||||
use nym_bin_common::logging::setup_tracing_logger;
|
||||
use nym_bin_common::logging::setup_no_otel_logger;
|
||||
use nym_network_defaults::setup_env;
|
||||
use tracing::trace;
|
||||
|
||||
@@ -17,7 +17,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
trace!("args: {cli:#?}");
|
||||
|
||||
setup_env(cli.config_env_file.as_ref());
|
||||
setup_tracing_logger();
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
cli.execute().await?;
|
||||
Ok(())
|
||||
|
||||
@@ -22,7 +22,7 @@ anyhow = { workspace = true }
|
||||
tap = { workspace = true }
|
||||
|
||||
nym-cli-commands = { path = "../../common/commands" }
|
||||
nym-bin-common = { path = "../../common/bin-common", features = ["basic_tracing"] }
|
||||
nym-bin-common = { path = "../../common/bin-common" }
|
||||
nym-validator-client = { path = "../../common/client-libs/validator-client", features = ["http-client"] }
|
||||
nym-network-defaults = { path = "../../common/network-defaults" }
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
use clap::{CommandFactory, Parser, Subcommand};
|
||||
use log::{error, warn};
|
||||
use nym_bin_common::logging::setup_tracing_logger;
|
||||
use nym_bin_common::logging::setup_no_otel_logger;
|
||||
use nym_cli_commands::context::{get_network_details, ClientArgs};
|
||||
use nym_validator_client::nyxd::AccountId;
|
||||
|
||||
@@ -147,7 +147,7 @@ async fn wait_for_interrupt() {
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
setup_tracing_logger();
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
|
||||
let cli = Cli::parse();
|
||||
|
||||
|
||||
@@ -17,6 +17,6 @@ clap = { workspace = true, features = ["derive"] }
|
||||
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
|
||||
tracing.workspace = true
|
||||
|
||||
nym-bin-common = { path = "../../common/bin-common", features = ["output_format", "basic_tracing"] }
|
||||
nym-bin-common = { path = "../../common/bin-common", features = ["output_format"] }
|
||||
nym-credential-storage = { path = "../../common/credential-storage" }
|
||||
nym-id = { path = "../../common/nym-id" }
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
|
||||
use crate::commands::Cli;
|
||||
use clap::Parser;
|
||||
use nym_bin_common::logging::setup_tracing_logger;
|
||||
use nym_bin_common::logging::setup_no_otel_logger;
|
||||
|
||||
mod commands;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
setup_tracing_logger();
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
let cli = Cli::parse();
|
||||
|
||||
cli.execute().await
|
||||
|
||||
@@ -10,7 +10,7 @@ license.workspace = true
|
||||
anyhow = { workspace = true }
|
||||
clap = { workspace = true, features = ["cargo", "derive"]}
|
||||
log = { workspace = true }
|
||||
nym-bin-common = { path = "../../common/bin-common", features = ["output_format", "basic_tracing"] }
|
||||
nym-bin-common = { path = "../../common/bin-common", features = ["output_format"] }
|
||||
nym-network-defaults = { path = "../../common/network-defaults" }
|
||||
nym-sdk = { path = "../../sdk/rust/nym-sdk" }
|
||||
nym-service-providers-common = { path = "../../service-providers/common" }
|
||||
|
||||
@@ -312,7 +312,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
let args = Cli::parse();
|
||||
|
||||
if args.debug {
|
||||
nym_bin_common::logging::setup_tracing_logger();
|
||||
nym_bin_common::logging::setup_no_otel_logger().expect("failed to initialize logging");
|
||||
}
|
||||
|
||||
nym_network_defaults::setup_env(args.config_env_file.as_ref());
|
||||
|
||||
@@ -33,7 +33,7 @@ tracing = { workspace = true }
|
||||
url = { workspace = true, features = ["serde"] }
|
||||
|
||||
nym-async-file-watcher = { path = "../../common/async-file-watcher" }
|
||||
nym-bin-common = { path = "../../common/bin-common", features = ["output_format", "basic_tracing"] }
|
||||
nym-bin-common = { path = "../../common/bin-common", features = ["output_format"] }
|
||||
nym-config = { path = "../../common/config" }
|
||||
nym-task = { path = "../../common/task"}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ use crate::error::NymvisorError;
|
||||
use crate::helpers::init_path;
|
||||
use crate::upgrades::types::{CurrentVersionInfo, UpgradeInfo, UpgradePlan};
|
||||
use nym_bin_common::build_information::BinaryBuildInformationOwned;
|
||||
use nym_bin_common::logging::setup_tracing_logger;
|
||||
use nym_bin_common::logging::setup_no_otel_logger;
|
||||
use nym_bin_common::output_format::OutputFormat;
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
@@ -414,7 +414,7 @@ pub(crate) fn execute(args: Args) -> Result<(), NymvisorError> {
|
||||
let env = Env::try_read()?;
|
||||
|
||||
if use_logs(args.disable_nymvisor_logs, &env) {
|
||||
setup_tracing_logger();
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
info!("enabled nymvisor logging");
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::error::NymvisorError;
|
||||
use crate::tasks::launcher::DaemonLauncher;
|
||||
use crate::tasks::upgrade_plan_watcher::start_upgrade_plan_watcher;
|
||||
use crate::tasks::upstream_poller::UpstreamPoller;
|
||||
use nym_bin_common::logging::setup_tracing_logger;
|
||||
use nym_bin_common::logging::setup_no_otel_logger;
|
||||
use std::future::Future;
|
||||
use std::time::Duration;
|
||||
use tokio::runtime;
|
||||
@@ -25,7 +25,7 @@ pub(crate) fn execute(args: Args) -> Result<(), NymvisorError> {
|
||||
let env = Env::try_read()?;
|
||||
let config = try_load_current_config(&env)?;
|
||||
if !config.nymvisor.debug.disable_logs {
|
||||
setup_tracing_logger();
|
||||
setup_no_otel_logger().expect("failed to initialize logging");
|
||||
}
|
||||
|
||||
info!("starting nymvisor for {}", config.daemon.name);
|
||||
|
||||
Reference in New Issue
Block a user