Skip to content
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

Fixed normalization for metric tag values #3281

Merged
merged 3 commits into from
Apr 12, 2024
Merged

Conversation

jamescrosswell
Copy link
Collaborator

new KeyValuePair<string, string>("\r", "<CR>"),
new KeyValuePair<string, string>("\t", "<HT>"),
new KeyValuePair<string, string>(@"\", @"\\"),
new KeyValuePair<string, string>("\n", @"\n"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too bad we can't use char here instead of strings.

Everything on the left is char though, could it be

new KeyValuePair<char, string>('\n', @"\r"),

prob on the right too actually

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first three replacements are replacing a single control character with a string of length 2 (so '/r' gets replaced with @"/r", for example).

So yes, potentially we could store the LazyTagValueReplacements as a list of KVP<char, string> but there's no overload of String.Replace that takes char as the first argument and string as the second... so we'd need to do an unecessary conversion every time the method was called, in that case... which doesn't seem very efficient.

I figured I'd use the types that were going to be used by method that makes use of them then.

@bitsandfoxes bitsandfoxes merged commit 025d60c into main Apr 12, 2024
20 checks passed
@bitsandfoxes bitsandfoxes deleted the fix/metrics-normalization branch April 12, 2024 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Metrics Normalization
3 participants