Class CosmosQueryDiagnostics
Structured payload describing a single Cosmos DB query execution event.
Delivered to CosmosRepository<T>.OnQueryDiagnostics for point
operations, per-page feed responses, and query totals.
Inherited Members
Namespace: Benday.CosmosDb.Diagnostics
Assembly: Benday.CosmosDb.dll
Syntax
public sealed class CosmosQueryDiagnostics
Properties
| Edit this page View SourceDuration
Wall-clock duration of the SDK round trip. For QueryTotal this is the aggregated duration across all pages.
Declaration
public TimeSpan Duration { get; init; }
Property Value
| Type | Description |
|---|---|
| TimeSpan |
EventKind
Which kind of event this is. Drives how sinks route and aggregate.
Declaration
public CosmosQueryEventKind EventKind { get; init; }
Property Value
| Type | Description |
|---|---|
| CosmosQueryEventKind |
IsCrossPartition
True if this event (or any page of a multi-page query) was detected as a cross-partition execution. For QueryTotal events this is the OR across all pages.
Declaration
public bool IsCrossPartition { get; init; }
Property Value
| Type | Description |
|---|---|
| bool |
Parameters
Query parameters. Null for PointOperation. Populated for LINQ and raw-SQL queries from the underlying QueryDefinition.
Declaration
public IReadOnlyDictionary<string, object?>? Parameters { get; init; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, object> |
PartitionKey
Partition key scope for the operation. Uses a default PartitionKey value (no partition) for cross-partition queries.
Declaration
public PartitionKey PartitionKey { get; init; }
Property Value
| Type | Description |
|---|---|
| PartitionKey |
QueryDescription
Logging description for the operation, typically the repository name plus the caller method name, e.g. "CocktailRecipeRepository - SearchByTitleAsync".
Declaration
public string QueryDescription { get; init; }
Property Value
| Type | Description |
|---|---|
| string |
QueryText
The generated SQL text. Null for PointOperation events (point operations don't have a query text — just an id and a partition key). Populated for FeedResponsePage and QueryTotal events.
Declaration
public string? QueryText { get; init; }
Property Value
| Type | Description |
|---|---|
| string |
RepositoryName
Name of the repository type (e.g. "CocktailRecipeRepository").
Declaration
public string RepositoryName { get; init; }
Property Value
| Type | Description |
|---|---|
| string |
RequestCharge
RU consumed. For QueryTotal, this is the accumulated charge across all pages. For FeedResponsePage, just that page. For PointOperation, the single-operation charge.
Declaration
public double RequestCharge { get; init; }
Property Value
| Type | Description |
|---|---|
| double |
ResultCount
Number of documents or rows returned. For scalar operations this reflects the scalar result (1 for a successful value, 0 for a null FirstOrDefault, etc.). For FeedResponsePage, the count for that page. For QueryTotal on a feed, the total across pages.
Declaration
public int ResultCount { get; init; }
Property Value
| Type | Description |
|---|---|
| int |
Timestamp
When the event was captured, in UTC.
Declaration
public DateTimeOffset Timestamp { get; init; }
Property Value
| Type | Description |
|---|---|
| DateTimeOffset |