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

ActivityTraceFlags is not reflected in Activity Id when updated after activity start() #61857

Open
vishweshbankwar opened this issue Nov 19, 2021 · 3 comments

Comments

@vishweshbankwar
Copy link
Contributor

Description

ActivityTraceFlags can be updated after activity is started. However, doing so does not update the activity Id.

Reproduction Steps

var activity = new Activity("Test");
activity.Start();
Console.WriteLine("ActivityId Before TraceFlags are set: " + activity.Id);
Console.WriteLine("ActivityTraceFlags Before: " + activity.ActivityTraceFlags);
activity.ActivityTraceFlags |= ActivityTraceFlags.Recorded;
Console.WriteLine("ActivityId After TraceFlags are set: " + activity.Id);
Console.WriteLine("ActivityTraceFlags After: " + activity.ActivityTraceFlags);

---- sample output ----
ActivityId Before TraceFlags are set: 00-b33ee4ebf1fa3d81e0ab30363fe291e2-40f3aace946db1d2-00
ActivityTraceFlags Before: None
ActivityId After TraceFlags are set: 00-b33ee4ebf1fa3d81e0ab30363fe291e2-40f3aace946db1d2-00
ActivityTraceFlags After: Recorded

Expected behavior

Updated ActivityTraceFlags is reflected in Activity.Id

Actual behavior

Updated ActivityTraceFlags is not reflected in Activity.Id

Regression?

No

Known Workarounds

No response

Configuration

No response

Other information

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Diagnostics.Activity untriaged New issue has not been triaged by the area owner labels Nov 19, 2021
@ghost
Copy link

ghost commented Nov 19, 2021

Tagging subscribers to this area: @tarekgh
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

ActivityTraceFlags can be updated after activity is started. However, doing so does not update the activity Id.

Reproduction Steps

var activity = new Activity("Test");
activity.Start();
Console.WriteLine("ActivityId Before TraceFlags are set: " + activity.Id);
Console.WriteLine("ActivityTraceFlags Before: " + activity.ActivityTraceFlags);
activity.ActivityTraceFlags |= ActivityTraceFlags.Recorded;
Console.WriteLine("ActivityId After TraceFlags are set: " + activity.Id);
Console.WriteLine("ActivityTraceFlags After: " + activity.ActivityTraceFlags);

---- sample output ----
ActivityId Before TraceFlags are set: 00-b33ee4ebf1fa3d81e0ab30363fe291e2-40f3aace946db1d2-00
ActivityTraceFlags Before: None
ActivityId After TraceFlags are set: 00-b33ee4ebf1fa3d81e0ab30363fe291e2-40f3aace946db1d2-00
ActivityTraceFlags After: Recorded

Expected behavior

Updated ActivityTraceFlags is reflected in Activity.Id

Actual behavior

Updated ActivityTraceFlags is not reflected in Activity.Id

Regression?

No

Known Workarounds

No response

Configuration

No response

Other information

No response

Author: vishweshbankwar
Assignees: -
Labels:

untriaged, area-System.Diagnostics.Activity

Milestone: -

@vishweshbankwar
Copy link
Contributor Author

@cijothomas @tarekgh - Adding it here for tracking.

@tarekgh tarekgh removed the untriaged New issue has not been triaged by the area owner label Nov 19, 2021
@tarekgh tarekgh added this to the 7.0.0 milestone Nov 19, 2021
@cijothomas
Copy link
Contributor

For now, there are workarounds which needs to tried first. This issue requires no action, until the workarounds are tried in OpenTelemetry/ApplicationInsights.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants