-
Notifications
You must be signed in to change notification settings - Fork 385
Add support for System.Diagnostics.Metrics in dotnet-monitor's collector #3587
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
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
d55df48
[Dotnet Monitor] Ignore - Adding System.Diagnostics.Metrics Support (…
kkeirstead e6b5f21
[Dotnet Monitor] Revert To Logging a single payload (not a list) (#3538)
kkeirstead b52b4c4
Merge pull request #3545 from dotnet/main
wiktork ddf091e
[Feature branch changes, no review] Fixup counter apis (#3559)
wiktork 959ebd6
[Dotnet-Monitor] [Feature Branch] Switched quantile to Percentile (#3…
kkeirstead f3fd8a6
Merge pull request #3575 from dotnet/main
wiktork c822924
Merge pull request #3579 from dotnet/main
wiktork 5052752
Minor branch cleanup
wiktork 1b70d14
Merge pull request #3580 from wiktork/dev/wiktork/cleanupFeature
wiktork 308cffc
PR for feature branch
wiktork 6f01912
Merge pull request #3599 from wiktork/dev/wiktork/cleanupFeature
wiktork 149f3ad
PR feedback
wiktork 22ff644
Pr feedback feedback
wiktork 645c2d0
Merge pull request #3608 from wiktork/dev/wiktork/prFeedback
wiktork fe36113
Convert Histogram to single payload
wiktork 79172f9
Merge pull request #3614 from wiktork/dev/wiktork/prFeedback
wiktork b47a957
Tweaks to account for new All flag
kkeirstead 887c6d4
Fixed build/test failures from Wiktor's changes
kkeirstead ff4586f
Merge pull request #3615 from kkeirstead/kkeirstead/SDM_MetricsTypeCo…
kkeirstead 4970332
Merge pull request #3617 from dotnet/main
wiktork ba1fac5
Fix issue with empty quantiles
wiktork 2c1beab
Merge pull request #3618 from wiktork/dev/wiktork/prFeedback
wiktork 8f8bce2
Initial PR feedback (#3620)
wiktork b2971ce
Fixes outdated naming in test
kkeirstead 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
55 changes: 55 additions & 0 deletions
55
src/Microsoft.Diagnostics.Monitoring.EventPipe/Counters/CounterUtilities.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,55 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
|
|
||
| using System.Collections.Generic; | ||
| using System; | ||
|
|
||
| namespace Microsoft.Diagnostics.Monitoring.EventPipe | ||
| { | ||
| internal static class CounterUtilities | ||
| { | ||
| //The metadata payload is formatted as a string of comma separated key:value pairs. | ||
| //This limitation means that metadata values cannot include commas; otherwise, the | ||
| //metadata will be parsed incorrectly. If a value contains a comma, then all metadata | ||
| //is treated as invalid and excluded from the payload. | ||
| public static IDictionary<string, string> GetMetadata(string metadataPayload, char kvSeparator = ':') | ||
| { | ||
| var metadataDict = new Dictionary<string, string>(); | ||
|
|
||
| ReadOnlySpan<char> metadata = metadataPayload; | ||
|
|
||
| while (!metadata.IsEmpty) { | ||
| int commaIndex = metadata.IndexOf(','); | ||
|
|
||
| ReadOnlySpan<char> kvPair; | ||
|
|
||
| if (commaIndex < 0) { | ||
| kvPair = metadata; | ||
| metadata = default; | ||
| } | ||
| else { | ||
| kvPair = metadata[..commaIndex]; | ||
| metadata = metadata.Slice(commaIndex + 1); | ||
| } | ||
|
|
||
| int colonIndex = kvPair.IndexOf(kvSeparator); | ||
| if (colonIndex < 0) { | ||
| metadataDict.Clear(); | ||
| break; | ||
| } | ||
|
|
||
| string metadataKey = kvPair[..colonIndex].ToString(); | ||
| string metadataValue = kvPair.Slice(colonIndex + 1).ToString(); | ||
| metadataDict[metadataKey] = metadataValue; | ||
| } | ||
|
|
||
| return metadataDict; | ||
| } | ||
|
|
||
| public static string AppendPercentile(string tags, double quantile) => AppendPercentile(tags, FormattableString.Invariant($"Percentile={(int)(100 * quantile)}")); | ||
|
|
||
| private static string AppendPercentile(string tags, string percentile) => string.IsNullOrEmpty(tags) ? percentile : string.Concat(tags, ",", percentile); | ||
| } | ||
| } | ||
|
|
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.
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.
displayNameis not used; either remove it, or (preferably) have it set the DisplayName property, change the property to get-only, and call all upstreams to pass in the coerced display name value.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 is a separate change for cleaning up all these constructors.