Span compression does not work with `trace_methods`
OrangeDog opened this issue · comments
Describe the bug
When many consecutive spans are created from trace_methods
configuration, they are not compressed into a single span.
Steps to reproduce
span_compression_enabled=true
trace_methods=org.postgresql.fastpath.Fastpath\#fastpath(java.lang.String\, *.FastpathArg[])
Then, in a Spring application, I made a request that involves reading a postgres large object.
Other spans are combined, but not the custom ones:
On larger data, it will hit the max span limit and stop recording entirely.
Expected behavior
All spans are subject to compression. regardless of how they are configured.
Debug logs
https://gist.github.com/OrangeDog/ba3b1d9649ee1233f688108c5f208183
Span-compression is only enabled for exit-spans. Exit-spans are spans which are known to not have any local child spans, such as DB-calls.
Because the trace-method spans are not marked as exit spans, they are not eligible for compression.
Therefore, your only options here are to live with the uncompressed spans and increase the span-limit or to write a custom plugin where you create the fastpath
-spans explicitly as exit spans.