fix for ignoring recording status of spans#136978
Closed
jackshirazi wants to merge 1 commit intoelastic:mainfrom
Closed
fix for ignoring recording status of spans#136978jackshirazi wants to merge 1 commit intoelastic:mainfrom
jackshirazi wants to merge 1 commit intoelastic:mainfrom
Conversation
Contributor
jackshirazi
commented
Oct 22, 2025
- APMTracer receives the parent task's trace context and sets that as the parent of a new span.
- APMTracer requests a new span, setting the start time to the same as the transaction start time
- The span is created but is too many for the transaction because transaction_max_spans is exceeded for this span, so it is set as a non-recording span
- APMTracer stores the Context containing the span in its spans map, ie this new span is now the next parent span so will be stored as the task's trace context
- this is incorrect because the span is a non-recording span, so should be discarded
- the result of the incorrect approach is that you can have a chain of descendent spans in a transaction which can be unlimited in size, and all with the same start time
Collaborator
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
mosche
reviewed
Oct 23, 2025
| final Span span = spanBuilder.startSpan(); | ||
| // If the agent decided not to record this span (e.g., due to transaction_max_spans), isRecording() will be false. | ||
| if (span.isRecording() == false) { | ||
| logger.warn("Elastic APM agent has reached the transaction_max_spans limit. Span [{}] [{}] will not be recorded.", spanId, spanName); |
Contributor
There was a problem hiding this comment.
Unfortunately that would spam our logs massively thinking about the 500k discarded spams we've just seen.
I'll have a closer look, I think we need to track when we transition to not recording in the context somehow.
Contributor
|
Thanks a lot and great find @jackshirazi 💚 |
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.