Class OpenTelemetryForElasticsearch
java.lang.Object
co.elastic.clients.transport.instrumentation.OpenTelemetryForElasticsearch
- All Implemented Interfaces:
Instrumentation
An OpenTelemetry instrumentation for the Elasticsearch client.
-
Nested Class Summary
Nested classes/interfaces inherited from interface co.elastic.clients.transport.instrumentation.Instrumentation
Instrumentation.Context, Instrumentation.ThreadScope -
Constructor Summary
ConstructorsConstructorDescriptionOpenTelemetryForElasticsearch(io.opentelemetry.api.OpenTelemetry openTelemetry, boolean captureSearchBody) Creates an OpenTelemetry instrumentation. -
Method Summary
Modifier and TypeMethodDescriptionCreates an OpenTelemetry instrumentation based on systems settings:otel.instrumentation.elasticsearch.enabledsystem property orOTEL_INSTRUMENTATION_ELASTICSEARCH_ENABLEDenvironnement variable: iftrueinstrumentation is enabled.<TRequest> Instrumentation.ContextnewContext(TRequest request, Endpoint<TRequest, ?, ?> endpoint) Create a context for a given request and the corresponding endpoint.
-
Constructor Details
-
OpenTelemetryForElasticsearch
public OpenTelemetryForElasticsearch(io.opentelemetry.api.OpenTelemetry openTelemetry, boolean captureSearchBody) Creates an OpenTelemetry instrumentation.- Parameters:
openTelemetry- the OpenTelemetry implementationcaptureSearchBody- should search requests bodies be captured?
-
-
Method Details
-
getDefault
Creates an OpenTelemetry instrumentation based on systems settings:otel.instrumentation.elasticsearch.enabledsystem property orOTEL_INSTRUMENTATION_ELASTICSEARCH_ENABLEDenvironnement variable: iftrueinstrumentation is enabled. Defaults totrue.otel.instrumentation.elasticsearch.capture-search-querysystem property orOTEL_INSTRUMENTATION_ELASTICSEARCH_CAPTURE_SEARCH_QUERYenvironment variable: iftruethe request body of search requests will be captured. Defaults tofalse.
- Returns:
- an instrumentation, or
nullif 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:InstrumentationCreate a context for a given request and the corresponding endpoint.- Specified by:
newContextin interfaceInstrumentation
-