-
Notifications
You must be signed in to change notification settings - Fork 1.2k
OTel experimentation #49409
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
Closed
Closed
OTel experimentation #49409
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
958507f
Minimal work to make System.Diagnostics.Activity usable by the dotnet…
baronfel e32eb64
WIP: rip and tear
baronfel 2276196
WIP: tool install
baronfel 0eeae50
more WIP
baronfel 16c33bc
get context flowing across dotnet CLI calls
baronfel c853d87
get good tool install telemetry
baronfel b5ae625
get events tracked as otel activity events!
baronfel d7fe58c
add traces to dotnet new instantiation
baronfel fb7129c
better command attribution
baronfel 3bb9f61
activities for tool execution
baronfel 797dfb2
azure monitor config
baronfel b7ed1f7
drop old telemetry channel stuff
baronfel 94a9b2d
remove telemetry infrastructure tests that are no longer in use
baronfel 5612415
In-progress of reviewing the Otel Maybe PR. Doing formatting adjustme…
MiYanni 260ce32
Cleaned up the remaining changed src files. Avoided ToolPackageDownlo…
MiYanni aec8701
activities for dnx
baronfel 8032641
flow otel context through to called processes in more scenarios
baronfel 8ea1682
more traces
baronfel 54a99dd
minimize diff
baronfel a20502c
unify some diagnosticsoptions stuff
baronfel 9e10431
Fix rebase screwups
baronfel b27594d
fix ordering of initialization
baronfel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 22 additions & 23 deletions
45
src/Cli/Microsoft.DotNet.InternalAbstractions/FilePath.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,33 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace Microsoft.Extensions.EnvironmentAbstractions | ||
| namespace Microsoft.Extensions.EnvironmentAbstractions; | ||
|
|
||
| public readonly struct FilePath | ||
| { | ||
| public struct FilePath | ||
| { | ||
| public string Value { get; } | ||
| public string Value { get; } | ||
|
|
||
| /// <summary> | ||
| /// Create FilePath to represent an absolute file path. Note it may not exist. | ||
| /// </summary> | ||
| /// <param name="value">If the value is not rooted. Path.GetFullPath will be called during the constructor.</param> | ||
| public FilePath(string value) | ||
| /// <summary> | ||
| /// Create FilePath to represent an absolute file path. Note: It may not exist. | ||
| /// </summary> | ||
| /// <param name="value">If the value is not rooted. Path.GetFullPath will be called during the constructor.</param> | ||
| public FilePath(string value) | ||
| { | ||
| if (!Path.IsPathRooted(value)) | ||
| { | ||
| if (!Path.IsPathRooted(value)) | ||
| { | ||
| value = Path.GetFullPath(value); | ||
| } | ||
|
|
||
| Value = value; | ||
| value = Path.GetFullPath(value); | ||
| } | ||
|
|
||
| public override string ToString() | ||
| { | ||
| return Value; | ||
| } | ||
| Value = value; | ||
| } | ||
|
|
||
| public DirectoryPath GetDirectoryPath() | ||
| { | ||
| return new DirectoryPath(Path.GetDirectoryName(Value)!); | ||
| } | ||
| public override string ToString() | ||
| { | ||
| return Value; | ||
| } | ||
|
|
||
| public DirectoryPath GetDirectoryPath() | ||
| { | ||
| return new DirectoryPath(Path.GetDirectoryName(Value)!); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/Cli/dotnet/CommandFactory/CommandResolution/ActivityContext.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
|
|
||
| using System.Diagnostics; | ||
| using Microsoft.DotNet.Cli.Utils; | ||
| using OpenTelemetry; | ||
| using OpenTelemetry.Context.Propagation; | ||
|
|
||
| namespace Microsoft.DotNet.Cli.CommandFactory.CommandResolution; | ||
|
|
||
| public static class ActivityContext | ||
| { | ||
| public static Dictionary<string, string>? MakeActivityContextEnvironment() | ||
| { | ||
| var currentActivity = Activity.Current; | ||
| var currentBaggage = Baggage.Current; | ||
| if (currentActivity == null) | ||
| { | ||
| return null; | ||
| } | ||
| var contextToInject = currentActivity.Context; | ||
| if (contextToInject.TraceId == default && contextToInject.SpanId == default && contextToInject.TraceState is null) | ||
| { | ||
| return null; | ||
| } | ||
| var propagationContext = new PropagationContext(contextToInject, currentBaggage); | ||
| var envDict = new Dictionary<string, string>(capacity: 2); | ||
| Propagators.DefaultTextMapPropagator.Inject(propagationContext, envDict, WriteTraceStateIntoEnv); | ||
| return envDict; | ||
| } | ||
|
|
||
| private static void WriteTraceStateIntoEnv(Dictionary<string, string> dictionary, string key, string value) | ||
| { | ||
| switch (key) | ||
| { | ||
| case "traceparent": | ||
| dictionary[Activities.TRACEPARENT] = value; | ||
| break; | ||
| case "tracestate": | ||
| dictionary[Activities.TRACESTATE] = value; | ||
| break; | ||
| } | ||
| } | ||
| } |
7 changes: 3 additions & 4 deletions
7
src/Cli/dotnet/CommandFactory/CommandResolution/MuxerCommandResolver.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The parameter 'eventName' is now non-nullable (removed the
?), but the method body still checks for null at line 18 withif (string.IsNullOrEmpty(eventName)). Either the parameter should remain nullable withstring?, or the null check should be removed since non-nullable parameters cannot be null when nullable reference types are enabled.