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
4 changes: 4 additions & 0 deletions Cargo.lock

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

725 changes: 620 additions & 105 deletions crates/preloop-cli/src/main.rs

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions crates/preloop-observability/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `preloop-observability` — Step 2 of Plan 002.
//! `preloop-observability` — observability handle for Preloop.
//!
//! Small, explicit API with no dependency on server/orchestrator internals. Both
//! `preloop` and `preloop-server` construct one handle/runtime before building
Expand All @@ -11,6 +11,8 @@
//! - Always retain `stderr`/`journald` even when OTLP is configured.
//! - `Debug` on config never reveals headers or credential-bearing endpoint parts.

pub mod status;

use std::collections::HashMap;
use std::fmt;
use std::sync::Arc;
Expand Down Expand Up @@ -91,7 +93,7 @@ impl ObservabilityConfig {

// CLI defaults to `info` when unset; the standalone server historically
// used `EnvFilter::from_default_env()` with no fallback (silent when
// unset). We unify on `info` per Step 2.
// unset). We unify on `info`.
let rust_log = std::env::var("RUST_LOG").unwrap_or_else(|_| "info".to_string());

let service_name =
Expand Down Expand Up @@ -473,7 +475,7 @@ pub struct ObservabilityRuntime {

impl ObservabilityRuntime {
fn new(handle: Observability) -> Self {
// Step 2 does not install the global subscriber here — the binaries do
// Does not install the global subscriber here — the binaries do
// that via `install_fmt_subscriber`. This runtime is the place for the
// future OTel provider guards and the 2s flush on `Drop`.
Self {
Expand Down Expand Up @@ -511,10 +513,10 @@ impl ObservabilityRuntime {

/// Attempt to flush exporters for at most 2s. Export failure is logged, never propagated.
pub async fn shutdown(self) {
// Step 2 has no exporter worker yet; this is the bounded-flush seam for
// No exporter worker yet; this is the bounded-flush seam for
// the future OTel BatchSpanProcessor / metrics reader.
tokio::time::timeout(Duration::from_secs(2), async {
// No-op until OTel providers are wired in Step 3+.
// No-op until OTLP providers are wired.
tokio::task::yield_now().await;
})
.await
Expand All @@ -529,7 +531,7 @@ impl fmt::Debug for ObservabilityRuntime {
}

// ---------------------------------------------------------------------------
// Tests — Step 2 gates
// Tests
// ---------------------------------------------------------------------------

#[cfg(test)]
Expand Down
Loading
Loading