-
Notifications
You must be signed in to change notification settings - Fork 606
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
implements context propagation for lambda invoke + tests #458
Conversation
For Py38, the instrumentation tests fail with:
Any hints regarding how to fix that? |
...pentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py
Show resolved
Hide resolved
@codeboten @ocelotl @owais please have a look at the PR :) |
@owais I finally run some microbenchmarking of the code and results are... interesting. They are heavily dependant on the input provided, as in case of "headers" property included in the payload the algo checks if it's actually a first-level children by counting curly braces. Test setup:
Results (in ms):
In general without headers property set or with property near the beginning improved (string-based) algorithm is much faster (3,5x - 8x). However for bigger payloads with headers near the end the situation changes - JSON based implementation becomes 5x faster. I believe that for most cases we should not expect "headers" property to appear in the lambda invoke payload as supplied by the customer. So in the end the decision which way to include should be based on our readiness to support slightly more complex code for a really small performance gain (100000 iterations - 4 ms vs 0,5 ms). |
@codeboten @ocelotl please have a look, it's been in review for last 16 days :) |
Given the small gains in only a subset of cases, I think we probably don't want the additional complexity of custom parsing. I'm inclined towards going with stock JSON module but happy to hear from others. |
@kubawach if you could take a look at the lint failure, we can get this PR merged as soon as it passes CI |
@codeboten fixed linting and rebased to current main, resolving some conflicts by the way |
Seems that all of the conflicts have been resolved, please merge as convenient :) |
@kubawach looks like there's still some issues that need resolving w/ lint and tests failing. |
@codeboten sorry for premature alarm. Now it really looks as ready to merge (I even took screenshot to be 101% sure ;) ) |
Thanks @kubawach! |
Description
Implements context propagation for lambda invoke (botocore) which needs to have the headers as a part of the payload.
Adds tests.
Bumps moto to ~2.0 - previous version had issues preventing lambda tests.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.