CosmosDiagnosticsHandler Interface

public interface CosmosDiagnosticsHandler

And interface that can be implemented to add custom diagnostic processors

Field Summary

Modifier and Type Field and Description
static final CosmosDiagnosticsHandler DEFAULT_LOGGING_HANDLER

A Cosmos diagnostics handler which will log operations to log4j - Failures (contains diagnostics string) --> Error - Threshold violations (contains diagnostics string) --> Info - Successful operations --> Debug If Trace level is enabled also, the diagnostics string will be logged for successful operations.

Method Summary

Modifier and Type Method and Description
abstract void handleDiagnostics(CosmosDiagnosticsContext diagnosticsContext, Context traceContext)

This method will be invoked when an operation completed (successfully or failed) to allow diagnostic handlers to emit the diagnostics NOTE: Any code in handleDiagnostics should not execute any I/O operations, do thread switches or execute CPU intense work - if needed a diagnostics handler should queue this work asynchronously.

Field Details

DEFAULT_LOGGING_HANDLER

public static final CosmosDiagnosticsHandler DEFAULT_LOGGING_HANDLER

A Cosmos diagnostics handler which will log operations to log4j - Failures (contains diagnostics string) --> Error - Threshold violations (contains diagnostics string) --> Info - Successful operations --> Debug If Trace level is enabled also, the diagnostics string will be logged for successful operations.

Method Details

handleDiagnostics

public abstract void handleDiagnostics(CosmosDiagnosticsContext diagnosticsContext, Context traceContext)

This method will be invoked when an operation completed (successfully or failed) to allow diagnostic handlers to emit the diagnostics NOTE: Any code in handleDiagnostics should not execute any I/O operations, do thread switches or execute CPU intense work - if needed a diagnostics handler should queue this work asynchronously. The method handleDiagnostics will be invoked on the hot path - so, any inefficient diagnostics handler will increase end-to-end latency perceived by the application

Parameters:

diagnosticsContext - the Cosmos DB diagnostic context with metadata for the operation
traceContext - the Azure trace context

Applies to