Skip to content

Commit 008a121

Browse files
committed
adding logs
1 parent 7a4688b commit 008a121

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

quickwit/quickwit-lambda-client/src/deployer.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use aws_sdk_lambda::operation::get_function::GetFunctionOutput;
2626
use aws_sdk_lambda::primitives::Blob;
2727
use aws_sdk_lambda::types::{Architecture, Environment, FunctionCode, Runtime};
2828
use quickwit_config::LambdaDeployConfig;
29-
use tracing::{debug, info, warn};
29+
use tracing::{debug, error, info, warn};
3030

3131
use crate::error::{LambdaClientError, LambdaClientResult};
3232

@@ -50,10 +50,10 @@ pub struct LambdaDeployer {
5050

5151
impl LambdaDeployer {
5252
/// Create a new Lambda deployer using default AWS configuration.
53-
pub async fn new() -> LambdaClientResult<Self> {
53+
pub async fn new() -> Self {
5454
let aws_config = aws_config::load_defaults(aws_config::BehaviorVersion::latest()).await;
5555
let client = LambdaClient::new(&aws_config);
56-
Ok(Self { client })
56+
Self { client }
5757
}
5858

5959
/// Deploy or update the Lambda function.
@@ -69,10 +69,12 @@ impl LambdaDeployer {
6969

7070
match self.get_function(function_name).await {
7171
Ok(existing) => {
72+
info!("update function if needed");
7273
self.update_function_if_needed(function_name, &existing, deploy_config)
7374
.await
7475
}
7576
Err(LambdaClientError::NotFound(_)) => {
77+
error!("function not found");
7678
// Function doesn't exist, try to create it
7779
match self
7880
.create_function(function_name, role_arn, deploy_config)
@@ -89,10 +91,16 @@ impl LambdaDeployer {
8991
self.update_function_if_needed(function_name, &existing, deploy_config)
9092
.await
9193
}
92-
Err(e) => Err(e),
94+
Err(e) => {
95+
tracing::error!(e=?e, "lambda client error on creation");
96+
Err(e)
97+
}
9398
}
9499
}
95-
Err(e) => Err(e),
100+
Err(e) => {
101+
tracing::error!(e=?e, "lambda client error on get");
102+
Err(e)
103+
}
96104
}
97105
}
98106

@@ -367,7 +375,7 @@ pub async fn deploy(
367375
function_name: &str,
368376
deploy_config: &LambdaDeployConfig,
369377
) -> LambdaClientResult<String> {
370-
let lambda_deployer = LambdaDeployer::new().await?;
378+
let lambda_deployer = LambdaDeployer::new().await;
371379
let lambda_arn = lambda_deployer.deploy(function_name, deploy_config).await?;
372380
info!("successfully deployed lambda function `{}`", lambda_arn);
373381
Ok(lambda_arn)

quickwit/quickwit-serve/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,8 @@ async fn setup_searcher(
10281028
use anyhow::Context;
10291029
quickwit_lambda_client::deploy(&lambda_config.function_name, deploy_config)
10301030
.await
1031-
.context("failed to deploy lambda function")?;
1031+
.context("failed to deploy lambda function")
1032+
.inspect_err(|err| error!(err=?err, "deploy lambda failed"))?;
10321033
}
10331034

10341035
use anyhow::Context;

0 commit comments

Comments
 (0)