-
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
Open
baronfel
wants to merge
22
commits into
dotnet:main
Choose a base branch
from
baronfel:otel-maybe
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
OTel experimentation #49409
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
7137c7f
Minimal work to make System.Diagnostics.Activity usable by the dotnet…
baronfel fe9ae3e
WIP: rip and tear
baronfel 77d6f2b
WIP: tool install
baronfel 28d2c9f
more WIP
baronfel bdc05c1
get context flowing across dotnet CLI calls
baronfel 5d659f8
get good tool install telemetry
baronfel 073549b
get events tracked as otel activity events!
baronfel 18f74f7
add traces to dotnet new instantiation
baronfel ebce863
better command attribution
baronfel 7947a8e
activities for tool execution
baronfel 9fea5c7
azure monitor config
baronfel 9fa8217
drop old telemetry channel stuff
baronfel 270c207
remove telemetry infrastructure tests that are no longer in use
baronfel 44d6f1a
In-progress of reviewing the Otel Maybe PR. Doing formatting adjustme…
MiYanni a740306
Cleaned up the remaining changed src files. Avoided ToolPackageDownlo…
MiYanni a01b1e6
activities for dnx
baronfel 72b150a
flow otel context through to called processes in more scenarios
baronfel 8def4a7
more traces
baronfel 28461ff
minimize diff
baronfel 08e0b60
unify some diagnosticsoptions stuff
baronfel e540978
Fix rebase screwups
baronfel a587434
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.