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
2 changes: 1 addition & 1 deletion bottlecap/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion bottlecap/src/lifecycle/invocation/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,10 @@ impl Processor {
/// This is used to create a cold start span, since this telemetry event does not
/// provide a `request_id`, we try to guess which invocation is the cold start.
pub fn on_platform_init_start(&mut self, time: DateTime<Utc>, runtime_version: Option<String>) {
if runtime_version.as_deref().map_or(false, |rv| rv.contains("DurableFunction")) {
if runtime_version
.as_deref()
.is_some_and(|rv| rv.contains("DurableFunction"))
{
self.enhanced_metrics.set_durable_function_tag();
}
let start_time: i64 = SystemTime::from(time)
Expand Down
11 changes: 7 additions & 4 deletions bottlecap/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ where

let message = format!("DD_EXTENSION | {level} | {span_prefix}{}", visitor.0);

write!(writer, "{{\"level\":\"{level}\",\"message\":\"")?;
// Setting specifically `status` as opposed to `level` since AWS
// filters out logs by the `level` field. This allows our logs to
// appear in CWL regardless of the log level.
write!(writer, "{{\"status\":\"{level}\",\"message\":\"")?;
write_json_escaped(&mut writer, &message)?;
writeln!(writer, "\"}}")
}
Expand Down Expand Up @@ -187,7 +190,7 @@ mod tests {
let parsed: serde_json::Value =
serde_json::from_str(output.trim()).expect("output should be valid JSON");

assert_eq!(parsed["level"], "INFO");
assert_eq!(parsed["status"], "INFO");
assert!(
parsed["message"]
.as_str()
Expand All @@ -204,7 +207,7 @@ mod tests {

let parsed: serde_json::Value =
serde_json::from_str(output.trim()).expect("output should be valid JSON");
assert_eq!(parsed["level"], "ERROR");
assert_eq!(parsed["status"], "ERROR");
assert!(
parsed["message"]
.as_str()
Expand All @@ -221,7 +224,7 @@ mod tests {

let parsed: serde_json::Value =
serde_json::from_str(output.trim()).expect("output should be valid JSON");
assert_eq!(parsed["level"], "DEBUG");
assert_eq!(parsed["status"], "DEBUG");
assert!(
parsed["message"]
.as_str()
Expand Down
Loading