Skip to content

Commit

Permalink
Send unit telemetry on success (#4720)
Browse files Browse the repository at this point in the history
## Change
Write the `ConfigUnitRun` event on success as well, which helps us
better understand the configuration units in use.
  • Loading branch information
JohnMcPMS authored Aug 8, 2024
1 parent 7a729fa commit af80a40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public void Telemetry_NoUnitEventOnSuccess()

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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down

0 comments on commit af80a40

Please sign in to comment.