Skip to content

Commit

Permalink
feat(service): emit trace with shuttle dependencies (#1498)
Browse files Browse the repository at this point in the history
* feat(service): emit trace with shuttle dependencies

* fix: include semver requirement

* nit: better trace fields
  • Loading branch information
jonaro00 authored and oddgrd committed Jan 8, 2024
1 parent 7bc84b9 commit edff30f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
21 changes: 18 additions & 3 deletions service/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use anyhow::{anyhow, bail, Context};
use cargo_metadata::{Package, Target};
use shuttle_common::constants::{NEXT_NAME, RUNTIME_NAME};
use tokio::io::AsyncBufReadExt;
use tracing::{debug, error, trace};
use tracing::{debug, error, info, trace};

#[derive(Clone, Debug, Eq, PartialEq)]
/// This represents a compiled alpha or shuttle-next service.
Expand Down Expand Up @@ -128,10 +128,25 @@ pub async fn build_workspace(
let mut next_packages = Vec::new();

for member in metadata.workspace_packages() {
if is_next(member) {
let next = is_next(member);
let alpha = is_alpha(member);
if next || alpha {
let mut shuttle_deps = member
.dependencies
.iter()
.filter_map(|d| {
d.name
.starts_with("shuttle-")
.then(|| format!("{} '{}'", d.name, d.req))
})
.collect::<Vec<_>>();
shuttle_deps.sort();
info!(name = member.name, deps = ?shuttle_deps, "Compiled workspace member with shuttle dependencies");
}
if next {
ensure_cdylib(member)?;
next_packages.push(member);
} else if is_alpha(member) {
} else if alpha {
ensure_binary(member)?;
alpha_packages.push(member);
}
Expand Down
5 changes: 2 additions & 3 deletions service/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ pub async fn start(
};

info!(
"Spawning runtime process: {} {}",
runtime_executable.display(),
args.join(" ")
args = %format!("{} {}", runtime_executable.display(), args.join(" ")),
"Spawning runtime process",
);
let runtime = process::Command::new(
dunce::canonicalize(runtime_executable).context("canonicalize path of executable")?,
Expand Down

0 comments on commit edff30f

Please sign in to comment.