Skip to content

Commit

Permalink
Added sanitize duration in the debug message and removed in EndProces…
Browse files Browse the repository at this point in the history
…sing. (#413)
  • Loading branch information
vidai-msft authored Mar 19, 2024
1 parent 0b6cb59 commit 1c5829b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/Common/AzurePSCmdlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ private void WriteSecretsWarningMessage()
{
WriteWarning(string.Format(Resources.DisplaySecretsWarningMessage, MyInvocation.InvocationName, string.Join(", ", sanitizerInfo.DetectedProperties)));
}
WriteDebug($"Sanitizer took {sanitizerInfo.SanitizeDuration.TotalMilliseconds}ms to process the object of cmdlet {MyInvocation.InvocationName}.");
}
}
}
Expand Down
19 changes: 12 additions & 7 deletions src/Common/MetricHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -690,22 +690,27 @@ public override string ToString()
StringBuilder sb = new StringBuilder("AzureQoSEvent: ");
if (ShowTelemetry)
{
foreach(PropertyDescriptor descriptor in TypeDescriptor.GetProperties((this)))
{
string name = descriptor.Name;
object value = descriptor.GetValue(this);
sb.Append($"{name}: {value}; ");
}
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties((this)))
{
string name = descriptor.Name;
object value = descriptor.GetValue(this);
sb.Append($"{name}: {value}; ");
}
//InstallationId and InternalCalledCmdlets are properties of MetricHelper and not in qosEventObject.
sb.Append($"InternalCalledCmdlets: {Microsoft.WindowsAzure.Commands.Common.MetricHelper.InternalCalledCmdlets}; InstallaionId: {Microsoft.WindowsAzure.Commands.Common.MetricHelper.InstallationId}");
}
else
{
sb = sb.Append($" Module: {ModuleName}:{ModuleVersion}; CommandName: {CommandName}; PSVersion: {PSVersion}");
sb.Append($" Module: {ModuleName}:{ModuleVersion}; CommandName: {CommandName}; PSVersion: {PSVersion}");
}

sb.Append($"; IsSuccess: {IsSuccess}; Duration: {Duration}");

if (SanitizerInfo?.ShowSecretsWarning == true)
{
sb.Append($"; SanitizeDuration: {SanitizerInfo.SanitizeDuration}");
}

if (Exception != null)
{
sb.Append($"; Exception: {Exception.Message};");
Expand Down

0 comments on commit 1c5829b

Please sign in to comment.