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
ConstructorDescriptionOpenTelemetryForElasticsearch
(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.enabled
system property orOTEL_INSTRUMENTATION_ELASTICSEARCH_ENABLED
environnement variable: iftrue
instrumentation is enabled.<TRequest> Instrumentation.Context
newContext
(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.enabled
system property orOTEL_INSTRUMENTATION_ELASTICSEARCH_ENABLED
environnement variable: iftrue
instrumentation is enabled. Defaults totrue
.otel.instrumentation.elasticsearch.capture-search-query
system property orOTEL_INSTRUMENTATION_ELASTICSEARCH_CAPTURE_SEARCH_QUERY
environment variable: iftrue
the request body of search requests will be captured. Defaults tofalse
.
- 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 interfaceInstrumentation
-