From c4f1529d1ec024987089f4157e0764d606f3d2a2 Mon Sep 17 00:00:00 2001 From: Beisi Zhou Date: Tue, 18 Jun 2024 15:38:25 +0800 Subject: [PATCH] Change ConfigMetrics from Array to Dictionary (#422) * Change ConfigMetrics from array to dictionary * add telemetry key for config --- .../Models/ConfigMetrics.cs | 14 +++++++++++--- src/Common/MetricHelper.cs | 6 +++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Authentication.Abstractions/Models/ConfigMetrics.cs b/src/Authentication.Abstractions/Models/ConfigMetrics.cs index 9d7c594c62..4147e64cc1 100644 --- a/src/Authentication.Abstractions/Models/ConfigMetrics.cs +++ b/src/Authentication.Abstractions/Models/ConfigMetrics.cs @@ -28,6 +28,11 @@ public class ConfigMetrics: IExtensibleModel /// public string ConfigKey { get; private set; } + /// + /// The unique telemetry key of config. It's required for recording config telemetry. If not provided, it's same with ConfigKey. + /// + public string TelemetryKey { get; private set; } + /// /// Config value in string format. It's required for recording config telemetry. /// @@ -35,10 +40,13 @@ public class ConfigMetrics: IExtensibleModel public IDictionary ExtendedProperties { get; } = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase); - public ConfigMetrics(string ConfigKey, string ConfigValue) + public ConfigMetrics(string configKey, string configValue): this(configKey, configKey, configValue){} + + public ConfigMetrics(string configKey, string telemetryKey, string configValue) { - this.ConfigKey = ConfigKey; - this.ConfigValue = ConfigValue; + this.ConfigKey = configKey; + this.TelemetryKey = telemetryKey; + this.ConfigValue = configValue; } } } diff --git a/src/Common/MetricHelper.cs b/src/Common/MetricHelper.cs index 737f5ac23e..5b85c5043d 100644 --- a/src/Common/MetricHelper.cs +++ b/src/Common/MetricHelper.cs @@ -508,7 +508,7 @@ private void PopulateConfigMetricsFromQos(AzurePSQoSEvent qos, IDictionary ConfigMetrics { get; private set; } + public Dictionary ConfigMetrics { get; private set; } public Dictionary CustomProperties { get; private set; } @@ -683,7 +683,7 @@ public AzurePSQoSEvent() StartTime = DateTimeOffset.Now; _timer = new Stopwatch(); _timer.Start(); - ConfigMetrics = new List(); + ConfigMetrics = new Dictionary(); CustomProperties = new Dictionary(); }