Skip to content

Add tracing sqlite db file support so we can connect from python #807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion hyperactor/src/mailbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ impl MailboxSender for MailboxClient {
return_handle: PortHandle<Undeliverable<MessageEnvelope>>,
) {
// tracing::trace!(name = "post", "posting message to {}", envelope.dest);
tracing::event!(target:"message", tracing::Level::DEBUG, "crc"=envelope.data.crc(), "size"=envelope.data.len(), "sender"= %envelope.sender, "dest" = %envelope.dest.0, "port"= envelope.dest.1, "message_type" = envelope.data.typename().unwrap_or("unknown"), "send_message");
tracing::event!(target:"messages", tracing::Level::DEBUG, "crc"=envelope.data.crc(), "size"=envelope.data.len(), "sender"= %envelope.sender, "dest" = %envelope.dest.0, "port"= envelope.dest.1, "message_type" = envelope.data.typename().unwrap_or("unknown"), "send_message");

if let Err(mpsc::error::SendError((envelope, return_handle))) =
self.buffer.send((envelope, return_handle))
Expand Down
2 changes: 2 additions & 0 deletions hyperactor_telemetry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ lazy_static = "1.5"
opentelemetry = "0.29"
opentelemetry_sdk = { version = "0.29.0", features = ["rt-tokio"] }
rand = { version = "0.8", features = ["small_rng"] }
rusqlite = { version = "0.36.0", features = ["backup", "blob", "bundled", "column_decltype", "functions", "limits", "modern_sqlite", "serde_json"] }
scuba = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main", optional = true }
serde = { version = "1.0.219", features = ["derive", "rc"] }
serde_json = { version = "1.0.140", features = ["alloc", "float_roundtrip", "unbounded_depth"] }
serde_rusqlite = "0.39.3"
tokio = { version = "1.46.1", features = ["full", "test-util", "tracing"] }
tracing = { version = "0.1.41", features = ["attributes", "valuable"] }
tracing-appender = "0.2.3"
Expand Down
5 changes: 5 additions & 0 deletions hyperactor_telemetry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ mod otel;
mod pool;
pub mod recorder;
mod spool;
pub mod sqlite;
use std::io::IsTerminal;
use std::io::Write;
use std::str::FromStr;
Expand Down Expand Up @@ -63,6 +64,7 @@ use tracing_subscriber::fmt::format::Writer;
use tracing_subscriber::registry::LookupSpan;

use crate::recorder::Recorder;
use crate::sqlite::get_reloadable_sqlite_layer;

pub trait TelemetryClock {
fn now(&self) -> tokio::time::Instant;
Expand Down Expand Up @@ -562,6 +564,8 @@ pub fn initialize_logging_with_log_prefix(
.with_target("opentelemetry", LevelFilter::OFF), // otel has some log span under debug that we don't care about
);

let sqlite_layer = get_reloadable_sqlite_layer().unwrap();

use tracing_subscriber::Registry;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
Expand All @@ -573,6 +577,7 @@ pub fn initialize_logging_with_log_prefix(
std::env::var(env_var).unwrap_or_default() != "1"
}
if let Err(err) = Registry::default()
.with(sqlite_layer)
.with(if is_layer_enabled(DISABLE_OTEL_TRACING) {
Some(otel::tracing_layer())
} else {
Expand Down
Loading