Skip to content
Open
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
141 changes: 141 additions & 0 deletions Cargo.lock

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

12 changes: 12 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ git2 = { version = "0.20", default-features = false, features = ["vendored-libgi
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["fmt", "env-filter"] }
tracing-appender = "0.2"
# Opt-in OTLP/HTTP export of fabro's existing `tracing` spans (see
# fabro-cli/src/otel.rs). Additive and inert unless an OTLP endpoint env is set.
# Uses the BLOCKING OTLP client (the crate's own default) so the SDK batch
# processor's dedicated export thread needs no async runtime. NOTE:
# opentelemetry-otlp's `http-proto`/`http-json` features enable `metrics`
# unconditionally, so the trace+metrics SDK is compiled regardless — a trace-only
# reduction is not achievable while using the HTTP exporter. `opentelemetry-otlp`
# keeps `default-features = false` only to drop its unused OTLP logs exporter.
opentelemetry = "0.30"
opentelemetry_sdk = "0.30"
opentelemetry-otlp = { version = "0.30", default-features = false, features = ["trace", "http-proto", "http-json", "reqwest-blocking-client"] }
tracing-opentelemetry = "0.31"
rmcp = { version = "1.4", default-features = false }
walkdir = "2"
regex = "1"
Expand Down
4 changes: 4 additions & 0 deletions lib/crates/fabro-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ tokio-tungstenite.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
tracing-appender.workspace = true
opentelemetry.workspace = true
opentelemetry_sdk.workspace = true
opentelemetry-otlp.workspace = true
tracing-opentelemetry.workspace = true
chrono = { workspace = true, features = ["serde"] }
dirs.workspace = true
fs2.workspace = true
Expand Down
10 changes: 10 additions & 0 deletions lib/crates/fabro-cli/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ use tracing_subscriber::registry::LookupSpan;
use tracing_subscriber::util::SubscriberInitExt;
use tracing_subscriber::{EnvFilter, fmt};

use crate::otel;

const LOG_RETENTION_DAYS: u32 = 7;

#[derive(Clone, Debug, PartialEq, Eq)]
Expand Down Expand Up @@ -362,6 +364,8 @@ where
.with_target(true)
.with_ansi(false),
)
// Additive OTLP export: no-op unless an OTLP endpoint env is set.
.with(otel::otel_layer())
.init();
}

Expand All @@ -384,6 +388,8 @@ where
.with_ansi(ansi)
.event_format(TtyLogFormat::new(ansi)),
)
// Additive OTLP export: no-op unless an OTLP endpoint env is set.
.with(otel::otel_layer())
.init();
}

Expand All @@ -409,6 +415,8 @@ fn init_worker_subscriber<ServerWriter, RunWriter>(
.with_target(true)
.with_ansi(false),
)
// Additive OTLP export: no-op unless an OTLP endpoint env is set.
.with(otel::otel_layer())
.init();
}

Expand Down Expand Up @@ -441,6 +449,8 @@ fn init_worker_stdout_subscriber<ServerWriter, RunWriter>(
.with_target(true)
.with_ansi(false),
)
// Additive OTLP export: no-op unless an OTLP endpoint env is set.
.with(otel::otel_layer())
.init();
}

Expand Down
4 changes: 4 additions & 0 deletions lib/crates/fabro-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mod landing;
mod local_server;
mod logging;
mod manifest_args;
mod otel;
mod server_client;
mod server_runs;
mod shared;
Expand Down Expand Up @@ -113,6 +114,9 @@ async fn main() {
}
}
fabro_telemetry::shutdown();
// Best-effort final drain of the OTLP span batch on normal exit (no-op when
// OTLP is not configured; the batch processor also exports periodically).
otel::shutdown();

if let Err(err) = result {
let json_mode = raw_args.iter().any(|a| a == "--json");
Expand Down
Loading
Loading