You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Response headers are missing in FeedReponse<T> when the query executed contains an OrderBy statement and is cross-partition.
To Reproduce
Here's a simplified case:
publicclassFamily{[JsonProperty(PropertyName ="id")]publicstringId{get;set;}publicstringLastName{get;set;}[JsonProperty(PropertyName ="_pk")]publicstringPartitionKey=> LastName;}private Task RunQuery(IQueryable<Family>query){variterator= query.ToFeedIterator();while(iterator.HasMoreResults){varresponse=await iterator.ReadNextAsync();
Console.WriteLine(response.Headers.Get("x-ms-documentdb-query-metrics")??"MISSING");}}// Writes "MISSING" to the console
RunQuery(container.GetItemLinqQueryable<Family>().OrderBy(f => f.Id));// Writes query metrics to the console
RunQuery(container.GetItemLinqQueryable<Family>());
Expected behavior
Headers from the response should be available in the FeedResponse
Actual behavior
There are no headers available in the FeedResponse
Environment summary
SDK Version: 3.17.1 (Also in 3.16, and possibly earlier)
OS Version (e.g. Windows, Linux, MacOSX): All
Additional context
The headers are available by adding a RequestHandler to the client. This is a complicated workaround when the client is used by multiple threads and you are trying to relate requests to one another.
Since the headers are available when running an ordered query in-partition, it seems to be an issue with additionalHeadersnot flowing through to the QueryPage result (also here)
Ultimately, though, I think this is indicative of a missing feature in the SDK, where it would be really nice to have the QueryMetrics class (or similar) publicly exposed on responses. Apparently, something similar was available in an earlier SDK version. Our particular use case is structured logging, where we enrich our logs with additional properties, including the index utilization ratio, request counts, and retrieved/output document counts.
The text was updated successfully, but these errors were encountered:
Response headers are missing in
FeedReponse<T>
when the query executed contains anOrderBy
statement and is cross-partition.To Reproduce
Here's a simplified case:
Expected behavior
Headers from the response should be available in the
FeedResponse
Actual behavior
There are no headers available in the
FeedResponse
Environment summary
SDK Version: 3.17.1 (Also in 3.16, and possibly earlier)
OS Version (e.g. Windows, Linux, MacOSX): All
Additional context
The headers are available by adding a
RequestHandler
to the client. This is a complicated workaround when the client is used by multiple threads and you are trying to relate requests to one another.Since the headers are available when running an ordered query in-partition, it seems to be an issue with
additionalHeaders
not flowing through to theQueryPage
result (also here)Ultimately, though, I think this is indicative of a missing feature in the SDK, where it would be really nice to have the
QueryMetrics
class (or similar) publicly exposed on responses. Apparently, something similar was available in an earlier SDK version. Our particular use case is structured logging, where we enrich our logs with additional properties, including the index utilization ratio, request counts, and retrieved/output document counts.The text was updated successfully, but these errors were encountered: