Fix the issue that string is returned instead of object and add one more property in the telemetry #415
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request primarily focuses on improving the handling of secret detection in the Azure PowerShell Cmdlet. The changes include a more nuanced approach to secret detection warnings, improved null safety, and adjustments to the
SanitizerTelemetry
class.The most important changes are:
Improved Secret Detection Warnings:
src/Common/AzurePSCmdlet.cs
]: TheWriteSecretsWarningMessage()
method now checks forsanitizerInfo.SecretsDetected
before showing a secrets warning. It also differentiates the warning message based on whether any properties were detected.src/Common/Properties/Resources.Designer.cs
andsrc/Common/Properties/Resources.resx
: Added a new resource stringDisplaySecretsWarningMessageWithoutProperty
for the case where no specific properties were detected.Null Safety Improvements:
src/Common/AzurePSCmdlet.cs
]: Null safety has been improved in several places by using the null-conditional operator. This includes theOutputSanitizer
property and theSanitizeOutput()
andInitializeQosEvent()
methods.Changes to
SanitizerTelemetry
:src/Common/Sanitizer/SanitizerTelemetry.cs
]: Added a new propertySecretsDetected
to track whether secrets were detected. Also added a new constructor that takes ashowSecretsWarning
parameter.src/Common/MetricHelper.cs
]: ThePopulateSanitizerPropertiesFromQos()
method now uses the newSecretsDetected
property and adjusts thesecrets-detected-properties
value based on whether any properties were detected.