Skip to content

Commit

Permalink
Merge pull request #19047 from unoplatform/dev/jela/telemetry-update
Browse files Browse the repository at this point in the history
chore: Remove duplicate attribute
  • Loading branch information
jeromelaban authored Dec 10, 2024
2 parents 67913e6 + d1a905d commit fa98e1a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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;
Expand All @@ -66,9 +59,7 @@ private void TrackGenerationDone(TimeSpan elapsed)
{
_telemetry.TrackEvent(
"generate-xaml-done",
new[] {
("IsRunningCI", IsRunningCI.ToString()),
},
[],
new[] { ("Duration", elapsed.TotalSeconds) }
);
}
Expand All @@ -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) }
);
Expand Down Expand Up @@ -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()),
},
Expand Down

0 comments on commit fa98e1a

Please sign in to comment.