Skip to content

Avoid force-creating activities#2692

Open
ArtemSerostanov wants to merge 1 commit intogrpc:masterfrom
ArtemSerostanov:activity_creation_fix
Open

Avoid force-creating activities#2692
ArtemSerostanov wants to merge 1 commit intogrpc:masterfrom
ArtemSerostanov:activity_creation_fix

Conversation

@ArtemSerostanov
Copy link

The problem

Force-creating activities via new Activity(...) breaks fundamental Activity logic. You are replacing Activity.Current, but the other code does not expect this, because nobody listens to your activity source and nobody expects Activity.Current to suddenly change.

For example, if I roll a custom SubchannelPicker implementation and start creating activities there, these activities will be broken when exported to tracing collector. This happens because you have forcibly replaced Activity.Current, so my custom activity will have your activity as a parent. But nobody listens to your activity source, so your Activity is not exported, which means my custom activity will have an unknown parent activity id.

The solution

Do not create an activity if nobody listens to your activity source

@linux-foundation-easycla
Copy link

CLA Not Signed

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.

2 participants