Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Internal] Client Telemetry: Fixes loggers #4594

Merged
merged 3 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ internal static async Task RunProcessorTaskAsync(string telemetryDate, Task proc
Task resultTask = await Task.WhenAny(processingTask, delayTask);
if (resultTask == delayTask)
{
DefaultTrace.TraceError($"Processor task with date as {0} is cancelled as it did not finish in {1} milliseconds", telemetryDate, timeout.TotalMilliseconds);
DefaultTrace.TraceError("Processor task with date as {0} is cancelled as it did not finish in {1} milliseconds", telemetryDate, timeout.TotalMilliseconds);
}
else
{
Expand All @@ -244,12 +244,12 @@ internal void PushCacheDatapoint(string cacheName, TelemetryInformation data)
// If latency information is not available. Ignore this datapoint. It is not expected but putting this safety check
if (!data.RequestLatency.HasValue)
{
DefaultTrace.TraceWarning($"Latency data point is not available for {0} cache call", cacheName);
DefaultTrace.TraceWarning("Latency data point is not available for {0} cache call", cacheName);

return;
}

DefaultTrace.TraceVerbose($"Collecting cacheRefreshSource {0} data for Telemetry.", cacheName);
DefaultTrace.TraceVerbose("Collecting cacheRefreshSource {0} data for Telemetry.", cacheName);

string regionsContacted = ClientTelemetryHelper.GetContactedRegions(data.RegionsContactedList);

Expand Down Expand Up @@ -322,7 +322,7 @@ internal void PushOperationDatapoint(TelemetryInformation data)
}
else
{
DefaultTrace.TraceWarning($"Latency data point is not available for an operation");
DefaultTrace.TraceWarning("Latency data point is not available for an operation");
}

long requestChargeToRecord = (long)(data.RequestCharge * ClientTelemetryOptions.HistogramPrecisionFactor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void CollectCacheInfo(string cacheName, Func<TelemetryInformation> functi
}
catch (Exception ex)
{
DefaultTrace.TraceError($"Error while collecting cache {0} telemetry. Exception : {1}", cacheName, ex);
DefaultTrace.TraceError("Error while collecting cache {0} telemetry. Exception : {1}", cacheName, ex);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if there's an overload that takes the ex arg first, that should be used instead (same for others)

}
}

Expand All @@ -63,7 +63,7 @@ public void CollectOperationAndNetworkInfo(Func<TelemetryInformation> functionFo
}
catch (Exception ex)
{
DefaultTrace.TraceError($"Error while collecting operation telemetry. Exception : {1}", ex);
DefaultTrace.TraceError("Error while collecting operation telemetry. Exception : {0}", ex);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ private void StopClientTelemetry()
}
catch (Exception ex)
{
DefaultTrace.TraceWarning($"Error While stopping Telemetry Job : {0}", ex);
DefaultTrace.TraceWarning("Error While stopping Telemetry Job : {0}", ex);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ static ValueTask<HttpRequestMessage> CreateRequestMessage()

azMetadata = await VmMetadataApiHandler.ProcessResponseAsync(response);

DefaultTrace.TraceInformation($"Succesfully get Instance Metadata Response : {0}", azMetadata.Compute.VMId);
DefaultTrace.TraceInformation("Successfully get Instance Metadata Response : {0}", azMetadata.Compute.VMId);
}
catch (Exception e)
{
DefaultTrace.TraceInformation($"Azure Environment metadata information not available. {0}", e.Message);
DefaultTrace.TraceInformation("Azure Environment metadata information not available. {0}", e.Message);
}
}

Expand Down Expand Up @@ -167,7 +167,7 @@ internal static string GetCloudInformation()
}
catch (Exception ex)
{
DefaultTrace.TraceWarning($"Error while generating hashed machine name {0}", ex.Message);
DefaultTrace.TraceWarning("Error while generating hashed machine name {0}", ex.Message);
}

return $"{VmMetadataApiHandler.UuidPrefix}{Guid.NewGuid()}";
Expand Down
Loading