Importing opentelemetry.instrumentation.aws_lambda
module is slow because of pkg_resources
#2843
Labels
bug
Something isn't working
Describe your environment
Environment:
AWS Lambda
Python version:
Python 3.9
Package version:
0.47b0
What happened?
Initialization of the OTEL Python Lambda layer takes significant amount of time in the AWS Lambda environment because of module imports. When I have analyzed import timings, I have noticed that importing
opentelemetry.instrumentation.aws_lambda
is slow, because ofopentelemetry.instrumentation.instrumentor
>opentelemetry.instrumentation.dependencies
>pkg_resources
imports as shown below.Can we make importing
opentelemetry.instrumentation.dependencies
in theinstrumentor.py
lazy and optional (ignore whenskip_dep_check
arg isTrue
) here:opentelemetry-python-contrib/opentelemetry-instrumentation/src/opentelemetry/instrumentation/instrumentor.py
Line 84 in 98958b6
Portion of the module import timings related to
opentelemetry.instrumentation.aws_lambda
module import in a Lambda function with512 MB
memory.Steps to Reproduce
PYTHONPROFILEIMPORTTIME
env var totrue
in theotel-instrument
bash scriptopentelemetry.instrumentation.aws_lambda
moduleExpected Result
Actual Result
Additional context
No response
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: