Skip to content

Commit

Permalink
feat(serverless): send error messages to logs (#626)
Browse files Browse the repository at this point in the history
  • Loading branch information
QuiiBz authored Feb 27, 2023
1 parent 046d04f commit 06093d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/loud-needles-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lagon/serverless': patch
---

Send error messages to logs
7 changes: 4 additions & 3 deletions crates/serverless/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use lagon_runtime::{options::RuntimeOptions, Runtime};
use lagon_runtime_http::{
Request, Response, RunResult, X_FORWARDED_FOR, X_LAGON_ID, X_LAGON_REGION, X_REAL_IP,
};
use lagon_runtime_isolate::CONSOLE_SOURCE;
use lagon_runtime_utils::response::{handle_response, ResponseEvent, FAVICON_URL, PAGE_404};
use lagon_runtime_utils::{
assets::{find_asset, handle_asset},
Expand Down Expand Up @@ -64,15 +65,15 @@ fn handle_error(
match result {
RunResult::Timeout => {
increment_counter!("lagon_isolate_timeouts", labels);
warn!(deployment = deployment_id, request = request_id; "Function execution timed out")
warn!(deployment = deployment_id, request = request_id, source = CONSOLE_SOURCE; "Function execution timed out")
}
RunResult::MemoryLimit => {
increment_counter!("lagon_isolate_memory_limits", labels);
warn!(deployment = deployment_id, request = request_id; "Function execution memory limit reached")
warn!(deployment = deployment_id, request = request_id, source = CONSOLE_SOURCE; "Function execution memory limit reached")
}
RunResult::Error(error) => {
increment_counter!("lagon_isolate_errors", labels);
error!(deployment = deployment_id, request = request_id; "Function execution error: {}", error);
error!(deployment = deployment_id, request = request_id, source = CONSOLE_SOURCE; "Function execution error: {}", error);
}
_ => {}
};
Expand Down

0 comments on commit 06093d0

Please sign in to comment.