Show / Hide Table of Contents

Class FileCosmosQueryLogSink

An ICosmosQueryLogSink that appends each diagnostics event as a single line of JSON (NDJSON / JSON Lines) to a file.

Inheritance
object
FileCosmosQueryLogSink
Implements
ICosmosQueryLogSink
IDisposable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Benday.CosmosDb.Diagnostics
Assembly: Benday.CosmosDb.dll
Syntax
public sealed class FileCosmosQueryLogSink : ICosmosQueryLogSink, IDisposable
Remarks

Events are handed to an in-memory queue from Record(CosmosQueryDiagnostics) and written to disk by a single background thread, so the library's query-execution path is never blocked on file I/O. Dispose the sink (or let the host shut it down) to flush any queued events.

If the queue fills past QueueCapacity (default 10,000), new events are dropped. This keeps a stuck disk from growing memory without bound.

Constructors

| Edit this page View Source

FileCosmosQueryLogSink()

Declaration
public FileCosmosQueryLogSink()
| Edit this page View Source

FileCosmosQueryLogSink(CosmosFileLogSinkOptions)

Declaration
public FileCosmosQueryLogSink(CosmosFileLogSinkOptions options)
Parameters
Type Name Description
CosmosFileLogSinkOptions options
| Edit this page View Source

FileCosmosQueryLogSink(IOptions<CosmosFileLogSinkOptions>)

DI-friendly constructor. Resolves options via the IOptions<TOptions> pattern so consumers can register CosmosFileLogSinkOptions with services.Configure<CosmosFileLogSinkOptions>(...) or bind from IConfiguration.

Declaration
[ActivatorUtilitiesConstructor]
public FileCosmosQueryLogSink(IOptions<CosmosFileLogSinkOptions> options)
Parameters
Type Name Description
IOptions<CosmosFileLogSinkOptions> options
| Edit this page View Source

FileCosmosQueryLogSink(string)

Declaration
public FileCosmosQueryLogSink(string filePath)
Parameters
Type Name Description
string filePath

Properties

| Edit this page View Source

DroppedCount

Number of events dropped because the queue was full. Useful for surfacing back-pressure in tests or health checks.

Declaration
public int DroppedCount { get; }
Property Value
Type Description
int

Methods

| Edit this page View Source

Dispose()

Stops accepting new events and blocks until the background writer has flushed everything currently queued.

Declaration
public void Dispose()
| Edit this page View Source

Record(CosmosQueryDiagnostics)

Records a diagnostics event. Called synchronously from the library on the thread that executed the query.

Declaration
public void Record(CosmosQueryDiagnostics diagnostics)
Parameters
Type Name Description
CosmosQueryDiagnostics diagnostics

The diagnostics payload for this event. Never null.

Implements

ICosmosQueryLogSink
IDisposable
  • Edit this page
  • View Source
In this article
Back to top Copyright © www.benday.com | info@benday.com