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
4 changes: 2 additions & 2 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
edition = "2018"
edition = "2021"
# imports_granularity is unstable
# # https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#merge_imports
# imports_granularity = "Crate"
# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#max_width
max_width = 120
max_width = 120
16 changes: 13 additions & 3 deletions lambda-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,26 @@ default = ["simulated"]
simulated = []

[dependencies]
tokio = { version = "1.0", features = ["macros", "io-util", "sync", "rt-multi-thread"] }
tokio = { version = "1.0", features = [
"macros",
"io-util",
"sync",
"rt-multi-thread",
] }
# Hyper requires the `server` feature to work on nightly
hyper = { version = "0.14.20", features = ["http1", "client", "stream", "server"] }
hyper = { version = "0.14.20", features = [
"http1",
"client",
"stream",
"server",
] }
futures = "0.3"
serde = { version = "1", features = ["derive"] }
serde_json = "^1"
bytes = "1.0"
http = "0.2"
async-stream = "0.3"
tracing = { version = "0.1", features = ["log"] }
tracing = { version = "0.1.37", features = ["log"] }
tower = { version = "0.4", features = ["util"] }
tokio-stream = "0.1.2"
lambda_runtime_api_client = { version = "0.7", path = "../lambda-runtime-api-client" }
22 changes: 9 additions & 13 deletions lambda-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,15 @@ where
let ctx: Context = ctx.with_config(config);
let request_id = &ctx.request_id.clone();

let xray_trace_id = &ctx.xray_trace_id.clone();
match xray_trace_id {
Some(trace_id) => env::set_var("_X_AMZN_TRACE_ID", trace_id),
None => env::remove_var("_X_AMZN_TRACE_ID"),
}
let request_span = match xray_trace_id {
Some(trace_id) => tracing::span!(
tracing::Level::INFO,
"Lambda runtime invoke",
requestId = request_id,
xrayTraceId = trace_id
),
None => tracing::span!(tracing::Level::INFO, "Lambda runtime invoke", requestId = request_id),
let request_span = match &ctx.xray_trace_id {
Some(trace_id) => {
env::set_var("_X_AMZN_TRACE_ID", trace_id);
tracing::info_span!("Lambda runtime invoke", requestId = request_id, xrayTraceId = trace_id)
}
None => {
env::remove_var("_X_AMZN_TRACE_ID");
tracing::info_span!("Lambda runtime invoke", requestId = request_id)
}
};

// Group the handling in one future and instrument it with the span
Expand Down