-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Change Activity Default IdFormat to W3C #37686
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
Change Activity Default IdFormat to W3C #37686
Conversation
|
I marked this PR with new-api-needs-documentation tag although we don't have API changes, we have a new config switch that needs to get documented. |
de3f240 to
c76568f
Compare
...raries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/LocalAppContextSwitches.cs
Outdated
Show resolved
Hide resolved
|
Looks dotnet-runtime-perf (Performance Windows_NT x64 release coreclr net5.0) failure is unrelated according to the report https://dev.azure.com/dnceng/public/_pipeline/analytics/stageawareoutcome?definitionId=783 as it is failed more than 33 times today. I logged #37732 to track the failure. |
noahfalk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good but I want to resolve two things:
- Getting the correct scope on the new default
- I want to ensure we are doing are due diligence in regards to breaking change notification and feedback. I think @shirhatti was looking into it but I don't recall if there was a conclusion? I am also going to loop in @richlander as well. I want to get a thumbs up from one of them.
src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs
Show resolved
Hide resolved
src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs
Outdated
Show resolved
Hide resolved
|
EDIT: Leaving my 🤦-worthy comment above. I just learned AppContext switches can be set via the runtimeconfig.json OR app.config. Looking at the SocketsHttpHandler, it looks like they've introduced a corresponding an environment variable to go with each AppContext switch. Perhaps we should do something similar here? EDIT: Are there any BCL guidelines on this? Should we introduce an env variable? |
right, editing the runtimeconfig.json will reflect on the app without recompiling.
By default, the environment variable is not supported. It depends on the scenario of the configuration if you think there are scenarios the apps will not be able to set the switch in runtimeconfig.json and need the environment variable, then yes we can support the environment variable too. one example of that is we have a globalization invariant switch which we need to set it for the whole docker image and not only for one app, at that time the only solution to set the switch is by the environment variable. |
…tivityDefaultIdFormatToW3C
|
@noahfalk @shirhatti I have scoped the change to .NET 5.0 only. I have introduced the environment variable @shirhatti thankfully already filled the breaking change template dotnet/docs#18953 too. I edited this breaking change issue to reflect the latest info. Please have a look and let me know if you have any more comments or we good to go? |
noahfalk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me modulo last few comments. Thanks @tarekgh and @shirhatti : )
| <DefineConstants Condition="'$(TargetFramework)' != 'netstandard1.1'">$(DefineConstants);EVENTSOURCE_ACTIVITY_SUPPORT</DefineConstants> | ||
| <DefineConstants Condition="'$(TargetFramework)' != 'netstandard1.1' and '$(TargetFramework)' != 'netstandard1.3'">$(DefineConstants);EVENTSOURCE_ENUMERATE_SUPPORT</DefineConstants> | ||
| <DefineConstants Condition="$(TargetFramework.StartsWith('net4'))">$(DefineConstants);ALLOW_PARTIALLY_TRUSTED_CALLERS;ENABLE_HTTP_HANDLER</DefineConstants> | ||
| <DefineConstants Condition="'$(TargetFramework)' == '$(NetCoreAppCurrent)'">$(DefineConstants);NET5</DefineConstants> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens in the future when NetCoreAppCurrent is > 5? Do we need to add netcoreapp5.0 to the TargetFrameworks list explicitly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to add netcoreapp5.0 to the TargetFrameworks list explicitly?
No
What happens in the future when NetCoreAppCurrent is > 5?
NetCoreAppCurrent will have the right next version of netcoreapp. so in 6.0 will have it as 6.0. in short this should work moving forward. I chose the defined name as NET5 to be clear when we have introduced this change when looking at the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @ericstj raised a similar concern. The scenario I am worried about is that this NuGet package is distributed as an OOB package. Assume in 2021 we ship a new version that targets netcoreapp6 and people keeping their netcoreapp5.0 app upgrade this package only. I assume that NuGet will resolve the reference to the netstandard implementation because the updated version no longer targets netcoreapp5.0. The netstandard implementation wouldn't have default W3C id so the upgrade will will cause them to lose the change. I'm no expert in NuGet resolution so if I am misunderstanding the mechanics here just let me know : )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've got it right. We need to include the net5.0 build in the package. We might also remove the netstandard2.0 build from this project. I don't see anywhere it would actually be used. We don't ship it in the package and it's not used in any other scenario.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, thanks @ericstj. I have done that. please have a quick look at the last commit just to confirm the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ericstj could you please have a quick look at last commit and let me know? I want to ensure we are good to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I am seeing tons of failures like
##[error].dotnet/sdk/5.0.100-preview.6.20310.4/Microsoft.Common.CurrentVersion.targets(2084,5): error MSB3245: (NETCORE_ENGINEERING_TELEMETRY=Build) Could not resolve this reference. Could not locate the assembly "System.Memory". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
/__w/1/s/.dotnet/sdk/5.0.100-preview.6.20310.4/Microsoft.Common.CurrentVersion.targets(2084,5): error MSB3245: Could not resolve this reference. Could not locate the assembly "System.Memory". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/__w/1/s/src/libraries/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that is because we actually need to keep ns2.0 configuration as it is used for Build From Source. In Build from source, apart from building the regular vertical, we also build the netstandard 2.0 vertical: https://github.com/dotnet/runtime/blob/master/src/libraries/Directory.Build.props#L288 and for that we were building the ns2.0 config on this project, but now the one that applies is ns1.3 which you can't build in build from source as we don't have the full ns1.3 targeting pack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I returned the netstandard 2.0 back for now.
...libraries/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj
Outdated
Show resolved
Hide resolved
|
What happens when a .NET5.0 application installs the DiagnosticSource from .NET5.1 or .NET5.0 servicing? The net5.0 build is not in the package: Lines 8 to 9 in 90af505
So the package would downgrade functionality. We may need to include the |
When removing it, caused a CI source build failure
|
Removing the The netstandard2.0 config here was building in source-build and preventing netstandard1.3 from being "best". Once we removed it that made ns1.3 as best, and the build fails due to source-build being unable to satisfy the reference assemblies for this target. |
Fixes #34787
This change will make the default Activity IdFormat set to W3C instead of Hierarchical. As this a breaking change, we are providing a config switch to turn back te old behavior if needed.
Also, the change is moving the file LocalAppContextSwitches.Common.cs from the System.Private.CoreLib subfolder to the common source folder as it is used by multiple libraries.
This breaking change will be applied to .NET 5.0 only.