Skip to content

Fix ContextManager.activeSpan() API usage error#3057

Merged
wu-sheng merged 2 commits into
apache:masterfrom
zhaoyuguang:fix-error-use-api
Jul 12, 2019
Merged

Fix ContextManager.activeSpan() API usage error#3057
wu-sheng merged 2 commits into
apache:masterfrom
zhaoyuguang:fix-error-use-api

Conversation

@zhaoyuguang
Copy link
Copy Markdown
Member

Please answer these questions before submitting pull request

Copy link
Copy Markdown
Member

@kezhenxu94 kezhenxu94 left a comment

Choose a reason for hiding this comment

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

Seems that there are more such usages, just to name a few:

I'd suggest fixing them all to defend future "potential bug" @zhaoyuguang

@wu-sheng wu-sheng added this to the 6.3.0 milestone Jul 12, 2019
@wu-sheng wu-sheng added agent Language agent related. bug Something isn't working and you are sure it's a bug! plugin Plugin for agent or collector. Be used to extend the capabilities of default implementor. labels Jul 12, 2019
@wu-sheng
Copy link
Copy Markdown
Member

+1 for code scan. I also think, we should check all ContextManager#activeSpan in plugin, and decide whether we should @Deprecated or delete. Let's check that and talk.

@dmsolr
Copy link
Copy Markdown
Member

dmsolr commented Jul 12, 2019

As I know, ContextManager#activeSpan() is used for handleMethodException

@dmsolr
Copy link
Copy Markdown
Member

dmsolr commented Jul 12, 2019

I think it cannot be deleted. Because it is useful sometimes.

@wu-sheng
Copy link
Copy Markdown
Member

From the current failures, I am thinking about, is this right using ContextManager#activeSpan() even for logging error? It could cause an NPE too, right?

@dmsolr
Copy link
Copy Markdown
Member

dmsolr commented Jul 12, 2019

Not NPE. It throws 'No active span.' exception when ContextManager#activeSpan() called.

@wu-sheng
Copy link
Copy Markdown
Member

Not NPE. It throws 'No active span.' exception when ContextManager#activeSpan() called.

But the exception should not happen in agent, it costs too much.

@dmsolr
Copy link
Copy Markdown
Member

dmsolr commented Jul 12, 2019

I entirely agree with you. Maybe I have a mistake. I mean we need ContextManager#activeSpan() in other scenario.

@zhaoyuguang
Copy link
Copy Markdown
Member Author

I scanned the code and found only the two places, which are obvious usage errors.

@wu-sheng wu-sheng merged commit d996d7b into apache:master Jul 12, 2019
@zhaoyuguang zhaoyuguang changed the title Fix 3055 Fix ContextManager.activeSpan() API usage error Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Language agent related. bug Something isn't working and you are sure it's a bug! plugin Plugin for agent or collector. Be used to extend the capabilities of default implementor.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ContextManager.activeSpan() API usage error

4 participants