Skip to content

[SLS-1594] Inferred spans for SQS & SNS #190

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

Merged

Conversation

hghotra
Copy link
Contributor

@hghotra hghotra commented Nov 3, 2021

What does this PR do?

  • Add inferred spans for SQS & SNS

image

Motivation

https://datadoghq.atlassian.net/browse/SLS-1594

Context: https://docs.google.com/document/d/1g50vbbDA-yog5RdQsRE8YAQ546Ve7J9inzn64S-ars8/edit#heading=h.mog4x98ex87z

Testing Guidelines

Run unit tests:

./scripts/run_tests.sh

Run integration tests:

BUILD_LAYERS=true DD_API_KEY=<api key here> aws-vault exec sandbox-account-admin -- ./scripts/run_integration_tests.sh

Run the inferred spans example in the cloud-integrations-lambdas repo.

https://github.com/DataDog/cloud-integrations-lambdas/commit/6922179f0fa6ff3c279ea737dd8a85b3b445b1cc

Additional Notes

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)

@hghotra hghotra requested a review from a team as a code owner November 3, 2021 14:31
@hghotra hghotra merged commit 361164c into inferred-spans-feature-branch Nov 3, 2021
@hghotra hghotra deleted the hsg/sls-1594-inferred-spans-sqs-sns branch November 3, 2021 22:02
agocs added a commit that referenced this pull request Feb 9, 2022
* Infer API Gateway spans (#172)

* Infer spans from API Gateway events

* Adding some prints. remove later

* Change some info on the API Gateway span

* Rename something

* black

* >:(

* black

* fix time

* Support various API Gateway, HTTPAPI, and Websocket events

* black

* Add DD_INFERRED_SPANS env var to turn inferred spans on and off

* infer spans in integration tests

* specify which env var to set true in order to enable inferred spans

* try setting inferred span name to inferred span URL

* s/beta/experimental/

* Correctly create spans in separate services, assuming the extension is running and the  tag is not set on the function

* Remove function_name

* Flush after closing spans

* black

* black

* update snapshots

* Make the snapshots valid json

* black

* Remove the inferredSpansFilter

* Refactor inferred-span event type detection to use the trigger event type code

* remove unused import

* lines too long >=(

* Finish refactor using _EventSource object

* lol, remove println debugging

* Update snapshots

* Inferred spans get meta.span_type:inferred

* [SLS-1594] Inferred spans for SQS & SNS (#190)

* Simplify event source parsing logic

* Add sns & sqs inferred spans

* Fix default evt source bug & update comments

* Use poetry for running unit tests

* Add additional api gateway trigger tests

* Fix bugs & refactor

* Add inferred spans unit tests

* Update integration tests

* Run all tests for all python versions

* Add missing change

* Update _dd.span_type to span_type

* Remove dependence on extension

* Additional api gateway test

* Remove log line & add todo

* Fix api gateway integration test

* Move call to get_first_record

* Revert to using pip inside docker

* [SLS-1671] Inferred Spans for Kineses, EventBridge, S3, DynamoDB (#191)

* Add kinesis inferred span

* Add dynamodb inferred span

* Add s3 inferred span

* Add eventbridge custom event inferred span

* Comment out flaky units tests (TODO)

* Add integration tests

* Remove log line

* Use timestamp instead of strftime (#194)

* [SLS-1683] Add sync/async tag and set inferred span end time based on value (#195)

* Add sync/async tag to inferred spans

* End inferred span based on sync/async tag

* Update tests

* Fix issue with comparison

* Fix small issues

* Update integration test snapshots

* [SLS-1713] Add tag for whether span should inherit service from lambda (#196)

* Use service arg rather than service.name tag
* Refactor inferred span metadata tags

* black

* Update inferred span keys

* [SLS-1674] Additional attributes for different managed services (#200)

* Additional attributes for sqs spans

* Add additional attributes for sns

* Add event subscription arn for sns

* Add additional attributes for kinesis spans

* Add additional attributes for dynamodb spans

* Add additional attributes for s3 spans

* Additional attribute for eventbridge spans

* Add additional attributes for websocket spans

* Fix websocket resource name

* Additional attributes for apigateway v1 spans

* Additional attributes for api-gateway v2 spans

* Fix api-gateway v1 resource name

* Fix merge issue

* Add space to resource name

* Update tests

* black

* Add typing_extensions to pyproject.toml

* Update snapshots

* Fix snapshots

Co-authored-by: chris.agocs <[email protected]>

* [SLS-1824] SNS trace extractor (#201)

* Extract trace context from sns payload

* Fix extractor issue

* Handle SNS message inside SQS event

* Add extractor for Eventbridge context (#202)

* Update expected breaking change date (#114)

* change inferred_span to _inferred_span

* Add extractor for eventbridge trace context

* Add another test to test eventbridge extraction

* Get tracing.Literal for pythons that don't have it already

* Add _datadog to eventbridge extractor

* Update integration tests

* Remove init complete and main start logs

Co-authored-by: Jorie Helwig <[email protected]>
Co-authored-by: Harvinder Ghotra <[email protected]>

* Remove duplicate entry

* Kinesis extractor plus small fixes

* Add snapshots

* Add tests

Co-authored-by: Christopher Agocs <[email protected]>
Co-authored-by: Jorie Helwig <[email protected]>

* Update stash

* Address feedback

* Default DD_TRACE_MANAGED_SERVICES to true

Co-authored-by: Christopher Agocs <[email protected]>
Co-authored-by: chris.agocs <[email protected]>
Co-authored-by: Jorie Helwig <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants