Skip to content
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

fix: span compression bug where a buffered span would not be sent when an incompressible sibling ended #3076

Merged
merged 4 commits into from
Dec 20, 2022

Commits on Dec 19, 2022

  1. fix: span compression bug where a buffered span would not be sent whe…

    …n an incompressible sibling ended
    
    https://github.com/elastic/apm/blob/main/specs/agents/handling-huge-traces/tracing-spans-compress.md#span-buffering says:
    > A buffered span gets reported when
    >  1. its parent ends
    >  2. a non-compressible sibling ends
    
    Before this change, case 2 was not being handled. Further, a possibly
    buffered span on the ending sibling would incorrectly get sent *twice*.
    The scenario is as follows:
    
       trans t0
         span s1: _bufferdSpan=s2
           span s2: ended, compressible -> buffered on s1
           span s3: incompressible, _bufferdSpan=s4
             span s4: ended, compressible -> buffered on s3
    
    What happens when s3 ends? We expect:
    - s4 is encoded and sent
    - s2 is encoded and sent
    - s3 is encoded and sent
    
    Before this change the agent would send: s4, s4, s3
    
    Refs: https://discuss.elastic.co/t/apm-agent-send-duplicate-record-in-mysql/321440
    trentm committed Dec 19, 2022
    Configuration menu
    Copy the full SHA
    b844ff3 View commit details
    Browse the repository at this point in the history
  2. changelog entry

    trentm committed Dec 19, 2022
    Configuration menu
    Copy the full SHA
    ed0d53a View commit details
    Browse the repository at this point in the history
  3. ensure we don't get .getBufferSpan() on a null parentSpan; also refac…

    …tor to avoid numerous calls to .getParentSpan()
    trentm committed Dec 19, 2022
    Configuration menu
    Copy the full SHA
    531cde9 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e5a497e View commit details
    Browse the repository at this point in the history