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

Add limit to trace scope depth #1177

Merged
merged 1 commit into from
Jan 22, 2020
Merged

Add limit to trace scope depth #1177

merged 1 commit into from
Jan 22, 2020

Conversation

tylerbenson
Copy link
Contributor

When limit is exceeded, a NoopScope is returned.
Allow custom ScopeManager to be provided, with the plan to remove ScopeContext customization in the future.

When limit is exceeded, a NoopScope is returned.
Allow custom ScopeManager to be provided, with the plan to remove `ScopeContext` customization in the future.
@@ -510,7 +516,9 @@ public boolean addTraceInterceptor(final TraceInterceptor interceptor) {

@Override
public void addScopeListener(final ScopeListener listener) {
scopeManager.addScopeListener(listener);
if (scopeManager instanceof ContextualScopeManager) {
Copy link
Contributor

@dougqh dougqh Jan 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to cast?
I assuming because the Nop variant doesn't have addScopeListener.
I think it would be cleaner to addScopeListener to the Nop variant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, this is because ScopeListener is purely something we added, not part of OpenTracing. If we accept any OpenTracing ScopeManager, we can't support this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. Although, we could address that by having our own Nop with addScopeListener.
But for now, I think it is fine. We can address it after we split from OpenTracing.

if (active instanceof DDScope) {
final int currentDepth = ((DDScope) active).depth();
if (depthLimit <= currentDepth) {
log.debug("Scope depth limit exceeded ({}). Returning NoopScope.", currentDepth);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be debug or error?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would also be nice to have a health metric, but we haven't made getting to the statsd object easy yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally it would be a rate limited warning, but this can be very high throughput, so I kept it at debug.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree a health metric would make sense. Should that work be in this PR or a separate one?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can wait for now. I need to finish my PR where I make health metrics more accessible, but other things took priority.

@tylerbenson tylerbenson merged commit 5c6f74f into master Jan 22, 2020
@tylerbenson tylerbenson deleted the tyler/scope-depth-limit branch January 22, 2020 20:13
@devinsba devinsba added this to the 0.42.0 milestone Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants