-
Notifications
You must be signed in to change notification settings - Fork 444
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
[serverless] Add S3 span pointers #3083
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
BenchmarksBenchmark execution time: 2025-02-07 22:01:06 Comparing candidate commit dee04b6 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 61 metrics, 1 unstable metrics. |
51071ce
to
98a1df8
Compare
span_pointers.HandleS3Operation(in, out, span) | ||
} | ||
|
||
span.Finish() |
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.
the aws span should live until we receive a response, not when the request is sent. (this is how AWS spans work in other tracers)
(from my testing this has barely any actual impact on the span end time)
This has to be done because we can't add links to a span that has already finished.
682ef0f
to
9790821
Compare
This comment was marked as outdated.
This comment was marked as outdated.
b7983fa
to
ad15495
Compare
ad15495
to
81f4054
Compare
What does this PR do?
Part 2 of #3123
Adds span pointers in S3 for
putObject
,copyObject
, andcompleteMultipartUpload
requests.Span pointers are similar to Span Links, but for cases when it is impossible to pass the Trace ID and Span ID between the spans that need to be linked.
The changes in this tracer handle the 'upstream' case, for when a Lambda/EC2 instance/anything else using the tracer makes an S3 request. The changes in this PR in the serverless agent handles the 'downstream' case, for when a Lambda is triggered by an S3 update.
Both sides calculate a unique hash for the S3 update. When the calculated hashes for the upstream and downstream sides match, the Datadog backend will automatically link the two traces together.
When clicking on the linked span, a new tab opens linking to the downstream Lambda function that was triggered by this S3 object update. When the link in the downstream Lambda is clicked, it links back to the upstream trace.
Also, this PR moves the
span.Finish()
call fromstartTraceMiddleware
todeserializeTraceMiddleware
. We must do this because we can't add span links to a span that has already finished. Also, the span should be finished once the request has received a response (that's how the other tracers work), not when the request is sent.Motivation
This is a new feature the Serverless team is implementing in every Lambda runtime.
Reviewer's Checklist
v2-dev
branch and reviewed by @DataDog/apm-go.Unsure? Have a question? Request a review!