-
Notifications
You must be signed in to change notification settings - Fork 624
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
adding additional event sources #926
Conversation
# https://docs.aws.amazon.com/lambda/latest/dg/with-sns.html | ||
# https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-content-structure.html | ||
# https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html | ||
span_kind = SpanKind.SERVER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any case when this default is incorrect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now the default is implicitly set to null which doesn't allow the code to even proceed past the usage of span_kind downstream. Seems like the original intent was to look for SQS and call it a consumer if it didn't exist in the map. I'm interested to hear @NathanielRN 's opinion though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this was an oversight on my part, appreciate your deep dive into the code @brett-bim! In general we assumed that we wanted all spans to be Server spans.
(This is important for AWS X-Ray because only Server spans get converted to segments).
ping @NathanielRN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! Just small comments but it's good as is for the fix.
Do you think you could add a test? I thought I had one but I guess I never did for that code path.
The instrumentation/opentelemetry-instrumentation-aws-lambda/tests/test_aws_lambda_instrumentation_manual.py
file should be completely set up for your to do that. You can copy a test like the test_parent_context_from_lambda_event
test to create a SQS/DynamoDB/etc. test event.
# https://docs.aws.amazon.com/lambda/latest/dg/with-sns.html | ||
# https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-content-structure.html | ||
# https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html | ||
span_kind = SpanKind.SERVER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this was an oversight on my part, appreciate your deep dive into the code @brett-bim! In general we assumed that we wanted all spans to be Server spans.
(This is important for AWS X-Ray because only Server spans get converted to segments).
...elemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/__init__.py
Outdated
Show resolved
Hide resolved
...elemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/__init__.py
Outdated
Show resolved
Hide resolved
* Added test to prove change * Reduced some boilerplate
…y-python-contrib into 902-add-aws-consumers
…opentelemetry-python-contrib into 902-add-aws-consumers
I think I've addressed @NathanielRN 's comments and suggestions. |
Seems that several of the actions failed after I added a test. I was able to execute the test locally with pytest both before my changes and after to prove it worked. As I and several others have noted in the Slack channel, I haven't been able to follow the set up documentation to run tox locally. Not sure how to proceed. |
There were some failures outside your changes. That should be fixed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brett-bim please sign the cla
CLA is signed. |
@brett-bim please fix conflicts so we can merge |
@ocelotl fixed in my fork. |
Description
Fixes 902. Current behavior is not setting a default for SpanKind in the lambda library. When an event arrives that is not of type SQS, no exception is triggered and
span_kind
is accessed later when not set.This PR does two things:
Fixes # (issue)
#902
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
span_kind
being accessed before it is set.Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.