Browse Source

Add 'OldCli' flag to additional telemetry properties

Ensures the 'OldCli' flag is set in the AdditionalProperties dictionary within the telemetry context, creating the dictionary if it does not exist. This provides consistent telemetry data for identifying CLI usage.
pull/24395/head
SALİH ÖZKARA 10 months ago
parent
commit
354746ca73
  1. 13
      framework/src/Volo.Abp.Cli/Volo/Abp/Cli/Telemetry/TelemetryCliSessionProvider.cs

13
framework/src/Volo.Abp.Cli/Volo/Abp/Cli/Telemetry/TelemetryCliSessionProvider.cs

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
@ -26,6 +27,18 @@ public class TelemetryCliSessionProvider : TelemetryActivityEventEnricher
context.Current[ActivityPropertyNames.IsFirstSession] = !File.Exists(TelemetryPaths.ActivityStorage);
context.Current["OldCli"] = true;
if(context.Current.TryGetValue<Dictionary<string, object>>(ActivityPropertyNames.AdditionalProperties, out var additionalProperties))
{
additionalProperties["OldCli"] = true;
}
else
{
context.Current[ActivityPropertyNames.AdditionalProperties] = new Dictionary<string, object>
{
{ "OldCli", true }
};
}
return Task.CompletedTask;
}
}
Loading…
Cancel
Save