This commit is contained in:
Sourabh Jain 2023-09-12 16:30:41 +05:30 коммит произвёл GitHub
Родитель b909bd7ee4
Коммит be0c0981b8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 18 добавлений и 1 удалений

Просмотреть файл

@ -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;
}
}
}