You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/observability.md
+8-28Lines changed: 8 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,41 +5,21 @@ mapped_pages:
5
5
6
6
# Observability [observability]
7
7
8
-
To observe and measure {{es}} client usage, several client features are provided.
8
+
Several client features help you observe and measure {{es}} client usage. As of version 8.15.0, the JS client provides native support for OpenTelemetry, which allows you to send client usage data to any endpoint that supports OpenTelemetry without having to make any changes to your JavaScript codebase.
9
9
10
-
First, as of 8.15.0, the client provides native support for OpenTelemetry, which allows you to send client usage data to any endpoint that supports OpenTelemetry without having to make any changes to your JavaScript codebase.
11
-
12
-
Also, rather than providing a default logger, the client offers an event emitter interface to hook into internal events, such as `request` and `response`, allowing you to log the events you care about, or otherwise react to client usage however you might need.
13
-
14
-
Correlating events can be hard, especially if your applications have a large codebase with many events happening at the same time. To help you with this, the client provides a correlation ID system, and other features.
15
-
16
-
All of these observability features are documented below.
10
+
Rather than providing a default logger, the client offers an event emitter interface to hook into internal events, such as `request` and `response`, allowing you to log the events you care about, or otherwise react to client usage however you might need. Because correlating events can be hard, the client provides a correlation ID system, and other features.
17
11
18
12
## OpenTelemetry [_opentelemetry]
19
13
20
14
The client supports OpenTelemetry’s [zero-code instrumentation](https://opentelemetry.io/docs/zero-code/js/) to enable tracking each client request as an [OpenTelemetry span](https://opentelemetry.io/docs/concepts/signals/traces/#spans). These spans follow all of the [semantic OpenTelemetry conventions for {{es}}](https://opentelemetry.io/docs/specs/semconv/database/elasticsearch/) except for `db.query.text`.
21
15
22
-
To start sending {{es}} trace data to your OpenTelemetry endpoint, follow [OpenTelemetry’s zero-code instrumentation guide](https://opentelemetry.io/docs/zero-code/js/), or the following steps:
23
-
24
-
1. Install `@opentelemetry/api` and `@opentelemetry/auto-instrumentations-node` as Node.js dependencies
25
-
2. Export the following environment variables with the appropriate values:
26
-
27
-
*`OTEL_EXPORTER_OTLP_ENDPOINT`
28
-
*`OTEL_EXPORTER_OTLP_HEADERS`
29
-
*`OTEL_RESOURCE_ATTRIBUTES`
30
-
*`OTEL_SERVICE_NAME`
31
-
32
-
3.`require` the Node.js auto-instrumentation library at startup:
To start sending {{es}} trace data to your OpenTelemetry endpoint, instrument the client using the [Elastic Distribution of OpenTelemetry (EDOT) JavaScript](elastic-otel-node://reference/edot-node/index.md), or follow [OpenTelemetry’s zero-code instrumentation guide](https://opentelemetry.io/docs/zero-code/js/).
### Turn off OpenTelemetry collection [disable-otel]
39
19
40
-
As of `@elastic/transport` version 9.1.0—or 8.10.0 when using `@elastic/elasticsearch` 8.x—OpenTelemetry tracing can be disabled in multiple ways.
20
+
As of `@elastic/transport` version 9.1.0—or 8.10.0 when using `@elastic/elasticsearch` 8.x—you can turn off OpenTelemetry tracing in several ways.
41
21
42
-
To entirely disable OpenTelemetry collection, you can provide a custom `Transport` at client instantiation time that sets `openTelemetry.enabled` to `false`:
22
+
To entirely turn off OpenTelemetry collection, you can provide a custom `Transport` at client instantiation time that sets `openTelemetry.enabled` to `false`:
43
23
44
24
```typescript
45
25
import { Transport } from'@elastic/transport'
@@ -60,9 +40,9 @@ const client = new Client({
60
40
61
41
Alternatively, you can also export an environment variable `OTEL_ELASTICSEARCH_ENABLED=false` to achieve the same effect.
62
42
63
-
If you would not like OpenTelemetry to be disabled entirely, but would like the client to suppress tracing, you can use the option `openTelemetry.suppressInternalInstrumentation = true` instead.
43
+
If you would not like OpenTelemetry to be turned off entirely, but would like the client to suppress tracing, use the option `openTelemetry.suppressInternalInstrumentation = true` instead.
64
44
65
-
If you would like to keep either option enabled by default, but want to disable them for a single API call, you can pass `Transport` options as a second argument to any API function call:
45
+
If you would like to keep either option enabled by default, but want to turn them off for a single API call, pass `Transport` options as a second argument to any API function call:
0 commit comments