commit af80a400aab74a2bcfb09e4dcdec86da54f0b92d
parent 7a729faea5eec61b9679318d02e3e2ec95045228
Author: JohnMcPMS <johnmcp@microsoft.com>
Date: Thu, 8 Aug 2024 15:10:09 -0700
Send unit telemetry on success (#4720)
## Change
Write the `ConfigUnitRun` event on success as well, which helps us
better understand the configuration units in use.
Diffstat:
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/Microsoft.Management.Configuration.UnitTests/Tests/ConfigurationProcessorTelemetryTests.cs b/src/Microsoft.Management.Configuration.UnitTests/Tests/ConfigurationProcessorTelemetryTests.cs
@@ -50,7 +50,8 @@ namespace Microsoft.Management.Configuration.UnitTests.Tests
GetConfigurationUnitSettingsResult result = testObjects.Processor.GetUnitSettings(testObjects.Unit);
- Assert.Empty(this.EventSink.Events);
+ Assert.Single(this.EventSink.Events);
+ Assert.Equal(TelemetryEvent.ConfigUnitRunName, this.EventSink.Events[0].Name);
}
/// <summary>
diff --git a/src/Microsoft.Management.Configuration/Telemetry/Telemetry.cpp b/src/Microsoft.Management.Configuration/Telemetry/Telemetry.cpp
@@ -263,12 +263,12 @@ namespace winrt::Microsoft::Management::Configuration::implementation
std::string_view action,
const IConfigurationUnitResultInformation& resultInformation) const noexcept try
{
- // We only want to send telemetry for failures of publicly available units.
- if (!IsTelemetryEnabled() || SUCCEEDED(static_cast<int32_t>(resultInformation.ResultCode())))
+ if (!IsTelemetryEnabled())
{
return;
}
+ // We only want to send telemetry for publicly available units.
IConfigurationUnitProcessorDetails details = unit.Details();
if (!details || !details.IsPublic())
{