-
Notifications
You must be signed in to change notification settings - Fork 44
Populate feature flag telemetry metadata when feature flag telemetry is enabled #517
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
amerjusupovic
merged 19 commits into
preview
from
ajusupovic/populate-telemetry-metadata
Feb 14, 2024
Merged
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
429ec6e
design questions for Id format pending
amerjusupovic 8ce6409
first draft adding ffid and ffref
amerjusupovic e068121
fix telemetry test bug
amerjusupovic 9f5f126
fix telemetry test and only populate when telemetry is enabled
amerjusupovic 8ed359d
give priority to provider populated metadata values
amerjusupovic 1a95a53
test label in telemetry test
amerjusupovic 5e36fe3
keep metadata values together in output
amerjusupovic 74553d8
remove unnecessary code for checking client manager endpoint
amerjusupovic d208f2e
fix base64url logic
amerjusupovic 35e2741
check for whitespace in label
amerjusupovic 07f7c7f
use stringbuilder over replace and trim for performance
amerjusupovic c166081
use indexof to check for equals
amerjusupovic d916ad4
use static value for capacity in loop
amerjusupovic e7ba889
resolve comments
amerjusupovic c068492
fix extension
amerjusupovic 5815b5c
pull out id calculation to private method
amerjusupovic 790e412
add summary comments
amerjusupovic a47f147
add base64 spec
amerjusupovic 80178fb
Update src/Microsoft.Extensions.Configuration.AzureAppConfiguration/E…
amerjusupovic 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
40 changes: 40 additions & 0 deletions
40
src/Microsoft.Extensions.Configuration.AzureAppConfiguration/Extensions/BytesExtensions.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,40 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT license. | ||
| // | ||
| using System.Text; | ||
| using System; | ||
|
|
||
| namespace Microsoft.Extensions.Configuration.AzureAppConfiguration.Extensions | ||
| { | ||
| internal static class BytesExtensions | ||
| { | ||
| public static string ToBase64Url(this byte[] bytes) | ||
| { | ||
| string featureFlagIdBase64 = Convert.ToBase64String(bytes); | ||
|
amerjusupovic marked this conversation as resolved.
Outdated
|
||
|
|
||
| int indexOfEquals = featureFlagIdBase64.IndexOf("="); | ||
|
|
||
| int stringBuilderCapacity = indexOfEquals != -1 ? indexOfEquals : featureFlagIdBase64.Length; | ||
|
|
||
| StringBuilder featureFlagIdBuilder = new StringBuilder(stringBuilderCapacity); | ||
|
|
||
| for (int i = 0; i < stringBuilderCapacity; i++) | ||
| { | ||
| if (featureFlagIdBase64[i] == '+') | ||
| { | ||
| featureFlagIdBuilder.Append('-'); | ||
| } | ||
| else if (featureFlagIdBase64[i] == '/') | ||
| { | ||
| featureFlagIdBuilder.Append('_'); | ||
| } | ||
| else | ||
| { | ||
| featureFlagIdBuilder.Append(featureFlagIdBase64[i]); | ||
| } | ||
| } | ||
|
|
||
| return featureFlagIdBuilder.ToString(); | ||
| } | ||
| } | ||
| } | ||
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Can you put a summary that mentions it converts byte array to b64 URL. Using the trim trailing
=characters strategy and also link to b64 spec.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 link to the spec: https://datatracker.ietf.org/doc/html/rfc4648#section-5