Interface CosmosDiagnosticsHandler

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface CosmosDiagnosticsHandler
And interface that can be implemented to add custom diagnostic processors
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    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
    Description
    void
    handleDiagnostics(CosmosDiagnosticsContext diagnosticsContext, com.azure.core.util.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

      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

      void handleDiagnostics(CosmosDiagnosticsContext diagnosticsContext, com.azure.core.util.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