refactor(ddtrace/{tracer,mocktracer}): remove SubmitChunk method fromTracer interface#3562
Conversation
… Tracer interface
e7ad507 to
906fda9
Compare
BenchmarksBenchmark execution time: 2025-05-28 15:31:32 Comparing candidate commit b0399e9 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 21 metrics, 0 unstable metrics. |
| if mtr, ok := tr.(interface{ SubmitChunk(*Chunk) }); ok { | ||
| mtr.SubmitChunk(ch) | ||
| } |
There was a problem hiding this comment.
This could be better, but it does the work without causing a performance regression.
In v1 we didn't do that but we casted the value from internal.GetGlobalTracer to (*tracer), so I think we are on the same situation, just a level deeper.
To remove this we'll need to work on the internal design of spans' finish flow.
We also use this "pry bar interface" pattern for supporting the mocktracer when finishing spans in v2, and we cast to (*tracer) in multiple points in v1 and v2:
Praise the crowbar:
There was a problem hiding this comment.
Since we are on a timeline, it is okay to cut corners.
However, let's fix this in the longer-term.
To remove this we'll need to work on the internal design of spans' finish flow.
As you suggested here.
We also use this "pry bar interface" pattern for supporting the mocktracer when finishing spans in v2, and we cast to (*tracer) in multiple points in v1 and v2.
We should fix there patterns, again in the long run.
kakkoyun
left a comment
There was a problem hiding this comment.
LGTM.
Thanks for simplifying the interface further.
| if mtr, ok := tr.(interface{ SubmitChunk(*Chunk) }); ok { | ||
| mtr.SubmitChunk(ch) | ||
| } |
There was a problem hiding this comment.
Since we are on a timeline, it is okay to cut corners.
However, let's fix this in the longer-term.
To remove this we'll need to work on the internal design of spans' finish flow.
As you suggested here.
We also use this "pry bar interface" pattern for supporting the mocktracer when finishing spans in v2, and we cast to (*tracer) in multiple points in v1 and v2.
We should fix there patterns, again in the long run.


What does this PR do?
Motivation
Reviewer's Checklist
golangci-lint runlocally.Unsure? Have a question? Request a review!