diff --git a/lambda-extension/src/events.rs b/lambda-extension/src/events.rs index c61fc9f0..db872d96 100644 --- a/lambda-extension/src/events.rs +++ b/lambda-extension/src/events.rs @@ -1,7 +1,7 @@ use serde::Deserialize; /// Request tracing information -#[derive(Debug, Deserialize)] +#[derive(Debug, Default, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Tracing { /// The type of tracing exposed to the extension @@ -20,6 +20,7 @@ pub struct InvokeEvent { /// The function's Amazon Resource Name pub invoked_function_arn: String, /// The request tracing information + #[serde(default)] pub tracing: Tracing, } diff --git a/lambda-extension/src/extension.rs b/lambda-extension/src/extension.rs index cac1c7ec..e57940ae 100644 --- a/lambda-extension/src/extension.rs +++ b/lambda-extension/src/extension.rs @@ -272,7 +272,7 @@ where self.log_port_number, )?; let res = client.call(req).await?; - if res.status() != http::StatusCode::OK { + if !res.status().is_success() { let err = format!("unable to initialize the logs api: {}", res.status()); return Err(ExtensionError::boxed(err)); } @@ -318,7 +318,7 @@ where self.telemetry_port_number, )?; let res = client.call(req).await?; - if res.status() != http::StatusCode::OK { + if !res.status().is_success() { let err = format!("unable to initialize the telemetry api: {}", res.status()); return Err(ExtensionError::boxed(err)); } @@ -491,7 +491,7 @@ async fn register<'a>( let req = requests::register_request(&name, events)?; let res = client.call(req).await?; - if res.status() != http::StatusCode::OK { + if !res.status().is_success() { let err = format!("unable to register the extension: {}", res.status()); return Err(ExtensionError::boxed(err)); }