Skip to content

Commit af80a40

Browse files
authored
Send unit telemetry on success (microsoft#4720)
## Change Write the `ConfigUnitRun` event on success as well, which helps us better understand the configuration units in use.
1 parent 7a729fa commit af80a40

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Microsoft.Management.Configuration.UnitTests/Tests/ConfigurationProcessorTelemetryTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public void Telemetry_NoUnitEventOnSuccess()
5050

5151
GetConfigurationUnitSettingsResult result = testObjects.Processor.GetUnitSettings(testObjects.Unit);
5252

53-
Assert.Empty(this.EventSink.Events);
53+
Assert.Single(this.EventSink.Events);
54+
Assert.Equal(TelemetryEvent.ConfigUnitRunName, this.EventSink.Events[0].Name);
5455
}
5556

5657
/// <summary>

src/Microsoft.Management.Configuration/Telemetry/Telemetry.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,12 @@ namespace winrt::Microsoft::Management::Configuration::implementation
263263
std::string_view action,
264264
const IConfigurationUnitResultInformation& resultInformation) const noexcept try
265265
{
266-
// We only want to send telemetry for failures of publicly available units.
267-
if (!IsTelemetryEnabled() || SUCCEEDED(static_cast<int32_t>(resultInformation.ResultCode())))
266+
if (!IsTelemetryEnabled())
268267
{
269268
return;
270269
}
271270

271+
// We only want to send telemetry for publicly available units.
272272
IConfigurationUnitProcessorDetails details = unit.Details();
273273
if (!details || !details.IsPublic())
274274
{

0 commit comments

Comments
 (0)