Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: faas.max_memory should be an int and converted to Bytes #135

Merged
merged 6 commits into from
Dec 11, 2024
Merged
Changes from 2 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
7 changes: 5 additions & 2 deletions opentelemetry-aws/src/detector/lambda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ 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();
// 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 Expand Up @@ -71,7 +74,7 @@ mod tests {
),
KeyValue::new(semconv::resource::FAAS_NAME, "my-lambda-function"),
KeyValue::new(semconv::resource::FAAS_VERSION, "$LATEST"),
KeyValue::new(semconv::resource::FAAS_MAX_MEMORY, "128"),
KeyValue::new(semconv::resource::FAAS_MAX_MEMORY, 128),
]);

let detector = LambdaResourceDetector {};
Expand Down
Loading