-
-
Notifications
You must be signed in to change notification settings - Fork 435
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
MaxSpans is ignored for nested spans #3058
Comments
Thank you for the detailed report 🙏 we discussed this and will follow up here |
Thanks for the report @bignoncedric. We do agree this limit should apply to all spans including child spans. While this is technically a breaking change we do think this should be fixed even without a new major in case we can't fix it in time for 7.0.0. @kahest would you agree? The current implementation misses the point of limiting memory consumption. Other SDKs seem to use a concept of a |
Closed by #3065 |
Thanks! |
We're gonna ship it this week, stay tuned! |
Integration
sentry
Java Version
17
Version
6.33.1
Steps to Reproduce
The following code generates a high number of spans (1500) nested in a transaction (as direct parent) -
testInTransaction()
, or nested in a span -testInNestedSpan
.The Hub is configured with MaxSpan = 1000.
Execute both methods:
testInTransaction()
andtestInNestedSpan()
Expected Result
Given the configuration set to limit MaxSpan to 1000 spans, we should not more than 1000 spans in both transactions.
Actual Result
While the first case (
testInTransaction
) works as expected. See:The second case (
testInNestedSpan
) do not follow the 1000 Max spans constraints:When looking at the code, the check to
getMaxSpans()
is done inSentryTrace.createChild
:441 but the actual add of child is done inSentryTrace.createChild
:346.Here is the stack trace for calls to
SentryTracer.children.add()
for the first case:createChild(SpanId, String, String, SentryDate, Instrumenter, SpanOptions)
:393,SentryTracer
(io.sentry), SentryTracer.javastartChild(SpanId, String, String, SentryDate, Instrumenter, SpanOptions)
:324,SentryTracer
(io.sentry), SentryTracer.javastartChild(String, String, SentryDate, Instrumenter, SpanOptions)
:121,Span
(io.sentry), Span.javacreateChild(String, String, SentryDate, Instrumenter, SpanOptions)
:456,SentryTracer
(io.sentry), SentryTracer.java (<-- check on MaxSpans is done here)startChild(String, String, SentryDate, Instrumenter, SpanOptions)
:418,SentryTracer
(io.sentry), SentryTracer.javastartChild(String, String)
:432,SentryTracer
(io.sentry), SentryTracer.javacreateManySpans(ISpan)
testInTransaction()
And here is the stack trace for the second case:
createChild(SpanId, String, String, SentryDate, Instrumenter, SpanOptions)
:393,SentryTracer
(io.sentry), SentryTracer.javacreateChild(SpanId, String, String, SpanOptions)
:342,SentryTracer
(io.sentry), SentryTracer.javastartChild(SpanId, String, String, SpanOptions)
:302,SentryTracer
(io.sentry), SentryTracer.javastartChild(SpanId, String, String)
:284,SentryTracer
(io.sentry), SentryTracer.javastartChild(String, String)
:132,Span
(io.sentry), Span.javacreateManySpans(ISpan)
testInNestedSpan()
We can see that in the second case, the
Span.startChild
"bypasses" the check on MaxSpans.The text was updated successfully, but these errors were encountered: