diff options
| author | Saumit <justsaumit@protonmail.com> | 2025-09-27 02:14:26 +0530 |
|---|---|---|
| committer | Saumit <justsaumit@protonmail.com> | 2025-09-27 02:14:26 +0530 |
| commit | 82e03978b89938219958032efb1448cc76baa181 (patch) | |
| tree | 626f3e54d52ecd49be0ed3bee30abacc0453d081 /src/accounting/Helpers.cs | |
Initial snapshot - OpenTelemetry demo 2.1.3 -f
Diffstat (limited to 'src/accounting/Helpers.cs')
| -rw-r--r-- | src/accounting/Helpers.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/accounting/Helpers.cs b/src/accounting/Helpers.cs new file mode 100644 index 0000000..d167aae --- /dev/null +++ b/src/accounting/Helpers.cs @@ -0,0 +1,34 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +using System.Collections; + +namespace Accounting +{ + internal static class Helpers + { + private static List<string> RelevantPrefixes = ["DOTNET_", "CORECLR_", "OTEL_", "KAFKA_"]; + + public static IEnumerable<DictionaryEntry> FilterRelevant(this IDictionary envs) + { + foreach (DictionaryEntry env in envs) + { + foreach (var prefix in RelevantPrefixes) + { + if (env.Key.ToString()?.StartsWith(prefix, StringComparison.InvariantCultureIgnoreCase) ?? false) + { + yield return env; + } + } + } + } + + public static void OutputInOrder(this IEnumerable<DictionaryEntry> envs) + { + foreach (var env in envs.OrderBy(x => x.Key)) + { + Console.WriteLine(env); + } + } + } +} |
