Class OpenTelemetryForElasticsearch

java.lang.Object
co.elastic.clients.transport.instrumentation.OpenTelemetryForElasticsearch
All Implemented Interfaces:
Instrumentation

public class OpenTelemetryForElasticsearch extends Object implements Instrumentation
An OpenTelemetry instrumentation for the Elasticsearch client.
See Also:
  • Constructor Details

    • OpenTelemetryForElasticsearch

      public OpenTelemetryForElasticsearch(io.opentelemetry.api.OpenTelemetry openTelemetry, boolean captureSearchBody)
      Creates an OpenTelemetry instrumentation.
      Parameters:
      openTelemetry - the OpenTelemetry implementation
      captureSearchBody - should search requests bodies be captured?
  • Method Details

    • getDefault

      @Nullable public static OpenTelemetryForElasticsearch getDefault()
      Creates an OpenTelemetry instrumentation based on systems settings:
      • otel.instrumentation.elasticsearch.enabled system property or OTEL_INSTRUMENTATION_ELASTICSEARCH_ENABLED environnement variable: if true instrumentation is enabled. Defaults to true.
      • otel.instrumentation.elasticsearch.capture-search-query system property or OTEL_INSTRUMENTATION_ELASTICSEARCH_CAPTURE_SEARCH_QUERY environment variable: if true the request body of search requests will be captured. Defaults to false.
      Returns:
      an instrumentation, or null if instrumentation is disabled or no OTel agent has been configured.
    • newContext

      public <TRequest> Instrumentation.Context newContext(TRequest request, Endpoint<TRequest,?,?> endpoint)
      Description copied from interface: Instrumentation
      Create a context for a given request and the corresponding endpoint.
      Specified by:
      newContext in interface Instrumentation