feat(ddtrace/opentelemetry): add AddLink & RecordError#4462
Open
ablaine wants to merge 2 commits intoDataDog:mainfrom
Open
feat(ddtrace/opentelemetry): add AddLink & RecordError#4462ablaine wants to merge 2 commits intoDataDog:mainfrom
ablaine wants to merge 2 commits intoDataDog:mainfrom
Conversation
ablaine
commented
Feb 21, 2026
| @@ -206,6 +210,62 @@ func (s *span) AddEvent(name string, opts ...oteltrace.EventOption) { | |||
| s.events = append(s.events, e) | |||
Author
There was a problem hiding this comment.
side note, it looks as if s.events is missing mutex protection when being written on this line. Let me know and I am happy to add lock/unlock to the AddEvent method.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This implements AddLink and RecordError in the opentelemetry to DD adaptor span.
Motivation
I am trying to use OTel's
AddLinkand discovered that it currently delegates to thenoop.Spanhandler. I temporarily swappednoop.Spanwithembedded.Spanto also discoverRecordErrorwas missing.I looked at OpenTelemetry's
RecordErrorimplementation's for the appropriate attributes (exception.type,exception.messageandexception.stacktrace), for example: sdk/trace/span.goFor
AddLink, I re-used the basic logic from ddtrace/opentelemetry/tracer.go.Reviewer's Checklist
make lintlocally.make testlocally.make generatelocally.make fix-moduleslocally.Unsure? Have a question? Request a review!