Function get_lambda_resource

Source
pub fn get_lambda_resource() -> Resource
Expand description

Retrieves the Lambda resource with the service name.

This function attempts to retrieve the service name from the OTEL_SERVICE_NAME environment variable. If that variable is not set, it falls back to the AWS_LAMBDA_FUNCTION_NAME environment variable. If neither variable is set, it defaults to “unknown-service”.

The function then creates a new Resource with the detected Lambda resource information and merges it with a new Resource containing the service name key-value pair.

§Returns

A Resource representing the Lambda resource with the service name.