diff --git a/Fauna.Test/Integration.Tests.cs b/Fauna.Test/Integration.Tests.cs index ffcc05f2..93910dd1 100644 --- a/Fauna.Test/Integration.Tests.cs +++ b/Fauna.Test/Integration.Tests.cs @@ -649,10 +649,8 @@ await _client.QueryAsync( int pages = 0; await foreach (var page in feed) { - if (page.HasNext) - { - Assert.AreEqual(pageSize, page.Events.Count); - } + if (page.Events.Count > 0) Assert.NotNull(page.Events[0].Stats.ProcessingTimeMs); + if (page.HasNext) Assert.AreEqual(pageSize, page.Events.Count); pages++; } diff --git a/Fauna/Core/QueryStats.cs b/Fauna/Core/QueryStats.cs index d96e3610..a2ad6792 100644 --- a/Fauna/Core/QueryStats.cs +++ b/Fauna/Core/QueryStats.cs @@ -56,6 +56,12 @@ public readonly struct QueryStats [JsonPropertyName(Stats_RateLimitsHit)] public List RateLimitsHit { get; init; } + /// + /// Processing time in milliseconds, only returned on Events. + /// + [JsonPropertyName(Stats_ProcessingTimeMs)] + public int? ProcessingTimeMs { get; init; } + /// /// Returns a string representation of the query statistics. /// @@ -65,6 +71,7 @@ public override string ToString() return $"compute: {ComputeOps}, read: {ReadOps}, write: {WriteOps}, " + $"queryTime: {QueryTimeMs}, retries: {ContentionRetries}, " + $"storageRead: {StorageBytesRead}, storageWrite: {StorageBytesWrite}, " + + $"{(ProcessingTimeMs.HasValue ? $"processingTime: {ProcessingTimeMs}, " : "")}" + $"limits: [{string.Join(',', RateLimitsHit)}]"; } } diff --git a/Fauna/Core/ResponseFields.cs b/Fauna/Core/ResponseFields.cs index a99bf4fe..4adca825 100644 --- a/Fauna/Core/ResponseFields.cs +++ b/Fauna/Core/ResponseFields.cs @@ -106,6 +106,11 @@ internal readonly struct ResponseFields /// public const string Stats_RateLimitsHit = "rate_limits_hit"; + /// + /// Field name for the processing time in milliseconds. + /// + public const string Stats_ProcessingTimeMs = "processing_time_ms"; + #endregion #region "error" block