first draft (#4079)
This commit is contained in:
Родитель
b909bd7ee4
Коммит
be0c0981b8
|
@ -6,6 +6,7 @@ namespace Microsoft.Azure.Cosmos.Telemetry.Diagnostics
|
|||
{
|
||||
using System;
|
||||
using Documents;
|
||||
using static Antlr4.Runtime.TokenStreamRewriter;
|
||||
|
||||
internal static class DiagnosticsFilterHelper
|
||||
{
|
||||
|
@ -26,7 +27,9 @@ namespace Microsoft.Azure.Cosmos.Telemetry.Diagnostics
|
|||
}
|
||||
else
|
||||
{
|
||||
latencyThreshold = operationType == OperationType.Query ? DistributedTracingOptions.DefaultQueryTimeoutThreshold : DistributedTracingOptions.DefaultCrudLatencyThreshold;
|
||||
latencyThreshold = DiagnosticsFilterHelper.IsPointOperation(operationType) ?
|
||||
DistributedTracingOptions.DefaultCrudLatencyThreshold :
|
||||
DistributedTracingOptions.DefaultQueryTimeoutThreshold;
|
||||
}
|
||||
|
||||
return response.Diagnostics.GetClientElapsedTime() > latencyThreshold;
|
||||
|
@ -44,5 +47,19 @@ namespace Microsoft.Azure.Cosmos.Telemetry.Diagnostics
|
|||
|| (response.StatusCode == System.Net.HttpStatusCode.Conflict && response.SubStatusCode == 0)
|
||||
|| (response.StatusCode == System.Net.HttpStatusCode.PreconditionFailed && response.SubStatusCode == 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if passed operation type is a point operation
|
||||
/// </summary>
|
||||
/// <param name="operationType"></param>
|
||||
public static bool IsPointOperation(OperationType operationType)
|
||||
{
|
||||
return operationType == OperationType.Create ||
|
||||
operationType == OperationType.Delete ||
|
||||
operationType == OperationType.Replace ||
|
||||
operationType == OperationType.Upsert ||
|
||||
operationType == OperationType.Patch ||
|
||||
operationType == OperationType.Read;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче