Skip to content

Commit

Permalink
fix: memory limit should be defined in Bytes, not MB
Browse files Browse the repository at this point in the history
  • Loading branch information
garysassano committed Dec 9, 2024
1 parent 0c3771a commit b654a9d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion opentelemetry-aws/src/detector/lambda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ impl ResourceDetector for LambdaResourceDetector {

let aws_region = env::var(AWS_REGION_ENV_VAR).unwrap_or_default();
let function_version = env::var(AWS_LAMBDA_FUNCTION_VERSION_ENV_VAR).unwrap_or_default();
let function_memory_limit = env::var(AWS_LAMBDA_MEMORY_LIMIT_ENV_VAR).unwrap_or_default();
// Convert memory limit from MB to Bytes as required by semantic conventions.
let function_memory_limit = env::var(AWS_LAMBDA_MEMORY_LIMIT_ENV_VAR)
.map(|s| s.parse::<i64>().unwrap_or_default() * 1024 * 1024)
.unwrap_or_default()
.to_string();
// Instance attributes corresponds to the log stream name for AWS Lambda;
// See the FaaS resource specification for more details.
let instance = env::var(AWS_LAMBDA_LOG_STREAM_NAME_ENV_VAR).unwrap_or_default();
Expand Down

0 comments on commit b654a9d

Please sign in to comment.