- 
                Notifications
    You must be signed in to change notification settings 
- Fork 15
refactor: split collect_chunks into two methods #1021
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
refactor: split collect_chunks into two methods #1021
Conversation
| BenchmarksComparisonBenchmark execution time: 2025-04-16 12:02:48 Comparing candidate commit edfc921 in PR branch  Found 0 performance improvements and 0 performance regressions! Performance is the same for 52 metrics, 2 unstable metrics. CandidateCandidate benchmark detailsGroup 1
 
 
 Group 2
 
 
 Group 3
 
 
 Group 4
 
 
 Group 5
 
 
 Group 6
 
 
 Group 7
 
 
 Group 8
 
 
 Group 9
 
 
 Group 10
 
 
 Group 11
 
 
 Group 12
 
 
 Group 13
 
 
 BaselineOmitted due to size. | 
This refactor is needed because the shared logic in collect_trace_chunks and TracerPayloadParams. The way these structs are created makes replacing ByteString with the slice harder due to shared lifetime. Furthermore, the enums encodes two different codepaths, the spanBytes and span pb which never interact with each other. So having function that handle both span bytes and pb spans is pure complexity overhead. This refactor also has the advnatage if removing a bunch of panics and lines of code that were here because of the "fake" pb spans and trace exporter spans overlap
0c8f800    to
    f6aae6b      
    Compare
  
    | Codecov ReportAttention: Patch coverage is  
 Additional details and impacted files@@            Coverage Diff             @@
##             main    #1021      +/-   ##
==========================================
- Coverage   71.52%   71.52%   -0.01%     
==========================================
  Files         339      339              
  Lines       50751    50628     -123     
==========================================
- Hits        36302    36214      -88     
+ Misses      14449    14414      -35     
 🚀 New features to boost your workflow:
 | 
| Artifact Size Benchmark Reportaarch64-alpine-linux-musl
 aarch64-unknown-linux-gnu
 libdatadog-x64-windows
 libdatadog-x86-windows
 x86_64-alpine-linux-musl
 x86_64-unknown-linux-gnu
 | 
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.
LGTM
fe35ab6    to
    5db3bf2      
    Compare
  
    # What does this PR do? This refactor splits the logic in `collect_trace_chunks` between the trace exporter spans (v04 and v05) and the mini agent spans (pb::Spans). it completely removes usage of the `TraceCollection` struct from data-pipeline, and instead introduces the `TraceChunks` enum to differentiate between v04 and v05. Currently the way the code is structured makes replacing ByteString with the slice harder due to shared lifetime. Furthermore, the enums encodes two different codepaths, the spanBytes and span pb which never interact with each other. So having function that handle both span bytes and pb spans is pure complexity overhead. This refactor also removes a bunch of panics and lines of code that were here because to handle the "fake" pb spans and trace exporter spans overlap, which is practice never happens. Lastly, this remove the TracerParams struct. Every occurence of if was creating it, and invoking `TryInto<TracerCollection>` just after on it. So replacing it by a simple function is a lot less complex for the same feature set. # Motivation Prepare for using `SpanSlice<'a>` instead of `SpanBytes` in the trace exporter.
What does this PR do?
This refactor splits the logic in
collect_trace_chunksbetween the trace exporter spans (v04 and v05) and the mini agent spans (pb::Spans).it completely removes usage of the
TraceCollectionstruct from data-pipeline, and instead introduces theTraceChunksenum to differentiate between v04 and v05.Currently the way the code is structured makes replacing ByteString with the slice harder due to shared lifetime.
Furthermore, the enums encodes two different codepaths, the spanBytes and span pb which never interact with each other. So having function that handle both span bytes and pb spans is pure complexity overhead.
This refactor also removes a bunch of panics and lines of code that were here because to handle the "fake" pb spans and trace exporter spans overlap, which is practice never happens.
Lastly, this remove the TracerParams struct. Every occurence of if was creating it, and invoking
TryInto<TracerCollection>just after on it. So replacing it by a simple function is a lot less complex for the same feature set.Motivation
Prepare for using
SpanSlice<'a>instead ofSpanBytesin the trace exporter.Additional Notes
Anything else we should know when reviewing?
How to test the change?
Describe here in detail how the change can be validated.