-
Notifications
You must be signed in to change notification settings - Fork 650
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
Importing opentelemetry.exporter.otlp.proto.http.trace_exporter.OTLPSpanExporter
is slow
#4171
Comments
Yeah, I think it would make sense to try prototyping one exporter using plain urllib3 instead of requests |
Let me add that the current implementation is tied to requests so eventually another one should be added instead of changing it to avoid breaking backwards compatibility. |
@xrmx Maybe we can implement OTLP JSON span exporter on top of |
I don't know, that would be something to bring to the weekly call and ask for feedback maybe? |
Was choosing |
@bhaskarbanerjee replacing Anyway, implementing lightweight versions of trace and metrics OTLP exporters to be used only by |
Given that it's a lambda and you care about the startup time, you probably also care about the teardown time, and OTEL needs to send out the traces before lambda is done (as it can get frozen or nuked). I guess that's more of an architectural issue (collected nearby, simple network; how much data is collected in a single lambda run). I kinda wish (and am willing to prorotype) a compiled OTEL (e.g. pyo3 extension using rust OTEL bindings, rust http client, etc) that's optimised to the minimal valuable feature set (http only or https? otlp via grpc or json?). Anyone with me? |
Describe your environment
Environment:
AWS Lambda
Python version:
Python 3.9
SDK version:
1.26.0
API version:
1.26.0
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.exporter.otlp.proto.http.trace_exporter.OTLPSpanExporter
is slow, because ofthe
requests
andopentelemetry.exporter.otlp.proto.common._internal
imports as shown below.opentelemetry.exporter.otlp.proto.common._internal
, but wanted to ask what we can do to improve for therequests
module import latency.request
library import delay.request
library import delay, might switching to lower level one likeurllib
orurllib3
be an option?Here is the portion of the module import timings related to
opentelemetry.exporter.otlp.proto.http.trace_exporter.OTLPSpanExporter
module import in a Lambda function with 512 MB memory. As you can see thatopentelemetry.exporter.otlp.proto.http.trace_exporter.OTLPSpanExporter
module import took367 ms
requests
module import took236 ms
(64%
)opentelemetry.exporter.otlp.proto.common._internal
took110 ms
(30%
)Steps to Reproduce
PYTHONPROFILEIMPORTTIME
env var totrue
in theotel-instrument
bash script of the OTEL Python Lambda layeropentelemetry.exporter.otlp.proto.http.trace_exporter.OTLPSpanExporter
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: