diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators/Uno.UI.SourceGenerators.csproj b/src/SourceGenerators/Uno.UI.SourceGenerators/Uno.UI.SourceGenerators.csproj index 2675e89377fa..b8db10ff6215 100644 --- a/src/SourceGenerators/Uno.UI.SourceGenerators/Uno.UI.SourceGenerators.csproj +++ b/src/SourceGenerators/Uno.UI.SourceGenerators/Uno.UI.SourceGenerators.csproj @@ -12,7 +12,7 @@ </PropertyGroup> <ItemGroup> - <PackageReference Include="Uno.DevTools.Telemetry" Version="1.0.0-dev.15" /> + <PackageReference Include="Uno.DevTools.Telemetry" Version="1.0.0-dev.18" /> </ItemGroup> <ItemGroup> diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlCodeGeneration.Telemetry.cs b/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlCodeGeneration.Telemetry.cs index ae4596b71890..2ea0800c995a 100644 --- a/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlCodeGeneration.Telemetry.cs +++ b/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlCodeGeneration.Telemetry.cs @@ -19,13 +19,6 @@ internal partial class XamlCodeGeneration private Telemetry _telemetry; - public bool IsRunningCI => - !Environment.GetEnvironmentVariable("TF_BUILD").IsNullOrEmpty() // https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?tabs=yaml&view=azure-devops#system-variables - || !Environment.GetEnvironmentVariable("TRAVIS").IsNullOrEmpty() // https://docs.travis-ci.com/user/environment-variables/#default-environment-variables - || !Environment.GetEnvironmentVariable("JENKINS_URL").IsNullOrEmpty() // https://wiki.jenkins.io/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-belowJenkinsSetEnvironmentVariables - || !Environment.GetEnvironmentVariable("GITHUB_REPOSITORY").IsNullOrEmpty() // https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables - || !Environment.GetEnvironmentVariable("APPVEYOR").IsNullOrEmpty(); // https://www.appveyor.com/docs/environment-variables/ - private void InitTelemetry(GeneratorExecutionContext context) { var telemetryOptOut = context.GetMSBuildPropertyValue("UnoPlatformTelemetryOptOut"); @@ -52,7 +45,7 @@ string getCurrentDirectory() return Environment.CurrentDirectory; } - _telemetry = new Telemetry(InstrumentationKey, enabledProvider: isTelemetryOptout, currentDirectoryProvider: getCurrentDirectory); + _telemetry = new Telemetry(InstrumentationKey, "uno/generation", enabledProvider: isTelemetryOptout, currentDirectoryProvider: getCurrentDirectory); } private bool IsTelemetryEnabled => _telemetry?.Enabled ?? false; @@ -66,9 +59,7 @@ private void TrackGenerationDone(TimeSpan elapsed) { _telemetry.TrackEvent( "generate-xaml-done", - new[] { - ("IsRunningCI", IsRunningCI.ToString()), - }, + [], new[] { ("Duration", elapsed.TotalSeconds) } ); } @@ -93,8 +84,7 @@ private void TrackGenerationFailed(Exception exception, TimeSpan elapsed) _telemetry.TrackEvent( "generate-xaml-failed", new[] { - ("ExceptionType", exception.GetType().ToString()), - ("IsRunningCI", IsRunningCI.ToString()), + ("ExceptionType", exception.GetType().ToString()) }, new[] { ("Duration", elapsed.TotalSeconds) } ); @@ -130,7 +120,6 @@ private void TrackStartGeneration(XamlFileDefinition[] files) ("IsBuildingUnoSolution", isBuildingUno.ToString()), ("IsUiAutomationMappingEnabled", _isUiAutomationMappingEnabled.ToString()), ("DefaultLanguage", _defaultLanguage ?? "Unknown"), - ("IsRunningCI", IsRunningCI.ToString()), ("BuildingInsideVisualStudio", _generatorContext.GetMSBuildPropertyValue("BuildingInsideVisualStudio")?.ToString().ToLowerInvariant()), ("IDE", BuildIDEName()), },