Threshold Logging Tracing through the SDK

Why Tracing?

Tracing is recording details about discrete steps or phases of a request lifecycle, such as request encoding / decoding, or dispatching to server. These phases are timed independently, and contain additional contextual information. A single request is typically made up of multiple tracing points.

Open Tracing

OpenTracing is a standardised API to structure tracing information in a consistent and predictable manner.

Threshold Configuration Settings

The threshold tracer receives completed spans and verifies if an operation has exceeded the given threshold for the operation type. Operations that exceed the threshold are periodically logged with a total count and a sample of the slowest ones. The following are SDK configuration properties, also found in the Client Settings page of some SDKs.

Table 1. Threshold Logging Tracer Properties
Property Name Description Default Value


Boolean used to determine tracing is enabled. Defaults to using the ThesholdLoggingTracer if enabled. When false a Noop or similar tracing implementation should be used instead.



Boolean used to instruct the SDK to try and retrieve duration metrics from the server for KV operations.



The interval between executions that process the collected operation spans. Expressed in milliseconds.

10,000 (10 seconds)


The maximum number of items to log per service.



The KV operation operation threshold. Expressed in microseconds.

500,000 (500 milliseconds)


The View query operation threshold. Expressed in microseconds.

1,000,000 (1 second)


The N1QL query operation threshold. Expressed in microseconds.

1,000,000 (1 second)


The FTS query operation threshold. Expressed in microseconds.

1,000,000 (1 second)


The Analytics query operation threshold. Expressed in microseconds.

1,000,000 (1 second)


Boolean used to determine if orphaned response logging is enabled.



The interval used to flush orphaned response information to the log. Expressed in microseconds.

10,000 (10 seconds)


The number of sample orphaned responses whose to log additional information for per execution.


Threshold Logging in .NET

Here is the code to override the default values of the tracer:

var tracer = new ThresholdLoggingTracer
    Interval = 5000, // 5 seconds
    SampleSize = 5,
    KvThreshold = 500000, // 500 ms
    ViewThreshold = 1000000, // 1 second
    N1qlThreshold = 1000000, // 1 second
    SearchThreshold = 1000000, // 1 second
    AnalyticsThreshold = 1000000 // 1 second
var config = new ClientConfiguration();
config.Tracer = tracer;

var cluster = new Cluster(config);