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

Filter by extension

Filter by extension


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

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resolver = "2"

[workspace.package]
edition = "2021"
version = "0.3.46"
version = "0.3.47"
description = "Tower is the best way to host Python data apps in production"
rust-version = "1.81"
authors = ["Brad Heller <brad@tower.dev>"]
Expand Down
4 changes: 2 additions & 2 deletions crates/tower-cmd/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ fn build_cli_execution_spec(
run_id: String,
) -> ExecutionSpec {
let spec = ExecutionSpec {
id: run_id,
id: run_id.clone(),
package_stream: Box::new(package_stream),
runtime: ExecRuntimeConfig {
image: "local".to_string(),
Expand Down Expand Up @@ -278,7 +278,7 @@ fn build_cli_execution_spec(
timeout_seconds: 3600,
},
networking: None,
telemetry_ctx: Context::new(),
telemetry_ctx: Context::new("local-runner".to_string()).with_runid(&run_id),
};
spec
}
Expand Down
12 changes: 6 additions & 6 deletions crates/tower-runtime/tests/local_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async fn test_running_hello_world_json_logs() {

// We need to create the package, which will load the app
let opts = StartOptions {
ctx: tower_telemetry::Context::new(),
ctx: tower_telemetry::Context::new("runner-id".to_string()),
package,
output_sender: sender,
cwd: None,
Expand Down Expand Up @@ -97,7 +97,7 @@ async fn test_running_hello_world() {

// We need to create the package, which will load the app
let opts = StartOptions {
ctx: tower_telemetry::Context::new(),
ctx: tower_telemetry::Context::new("runner-id".to_string()),
package,
output_sender: sender,
cwd: None,
Expand Down Expand Up @@ -142,7 +142,7 @@ async fn test_running_use_faker() {

// We need to create the package, which will load the app
let opts = StartOptions {
ctx: tower_telemetry::Context::new(),
ctx: tower_telemetry::Context::new("runner-id".to_string()),
package,
output_sender: sender,
cwd: None,
Expand Down Expand Up @@ -194,7 +194,7 @@ async fn test_running_legacy_app() {

// We need to create the package, which will load the app
let opts = StartOptions {
ctx: tower_telemetry::Context::new(),
ctx: tower_telemetry::Context::new("runner-id".to_string()),
package,
output_sender: sender,
cwd: None,
Expand Down Expand Up @@ -260,7 +260,7 @@ async fn test_running_app_with_secret() {

// We need to create the package, which will load the app
let opts = StartOptions {
ctx: tower_telemetry::Context::new(),
ctx: tower_telemetry::Context::new("runner-id".to_string()),
package,
output_sender: sender,
cwd: None,
Expand Down Expand Up @@ -339,7 +339,7 @@ async fn test_abort_on_dependency_installation_failure() {
let (sender, mut receiver) = unbounded_channel();

let opts = StartOptions {
ctx: tower_telemetry::Context::new(),
ctx: tower_telemetry::Context::new("runner-id".to_string()),
package,
output_sender: sender,
cwd: None,
Expand Down
2 changes: 1 addition & 1 deletion crates/tower-runtime/tests/subprocess_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async fn create_execution_spec(id: String, package: Package) -> ExecutionSpec {

ExecutionSpec {
id,
telemetry_ctx: tower_telemetry::Context::new(),
telemetry_ctx: tower_telemetry::Context::new("runner-id".to_string()),
package_stream: Box::new(file),
environment: "test".to_string(),
secrets: HashMap::new(),
Expand Down
12 changes: 8 additions & 4 deletions crates/tower-telemetry/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@
pub struct Context {
/// runid is the ID of the run in the current context.
pub runid: Option<String>,
/// runner_id is the ID of the runner instance in the current context.
pub runner_id: String,
}

impl Context {
pub fn from_runid(runid: &str) -> Self {
pub fn new(runner_id: String) -> Self {
Self {
runid: Some(runid.to_string()),
runid: None,
runner_id,
}
}

pub fn new() -> Self {
Self { runid: None }
pub fn with_runid(mut self, runid: &str) -> Self {
self.runid = Some(runid.to_string());
self
}
}
4 changes: 2 additions & 2 deletions crates/tower-telemetry/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ macro_rules! event_with_level {
// With context
($level:expr, ctx: $ctx:expr, $fmt:expr, $($arg:tt)+) => {
if let Some(runid) = &$ctx.runid {
$crate::tracing::event!($level, "tower.runid" = %runid, "{}", format!($fmt, $($arg)+))
$crate::tracing::event!($level, "tower.runid" = %runid, "tower.runner_id" = %$ctx.runner_id, "{}", format!($fmt, $($arg)+))
} else {
$crate::tracing::event!($level, "{}", format!($fmt, $($arg)+))
$crate::tracing::event!($level, "tower.runner_id" = %$ctx.runner_id, "{}", format!($fmt, $($arg)+))
}
};

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "tower"
version = "0.3.46"
version = "0.3.47"
description = "Tower CLI and runtime environment for Tower."
authors = [{ name = "Tower Computing Inc.", email = "brad@tower.dev" }]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

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