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
* Documentation for OpenTelemetry support
* Update docs/observability.asciidoc
Co-authored-by: Miguel Grinberg <[email protected]>
* Fix docs typo
* Fix bad link references in asciidoc changelog
* Drop link to 8.15 changelog
For now. Link just doesn't work yet.
---------
Co-authored-by: Miguel Grinberg <[email protected]>
Copy file name to clipboardExpand all lines: docs/changelog.asciidoc
+14-1
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,19 @@
1
1
[[changelog-client]]
2
2
== Release notes
3
3
4
+
[discrete]
5
+
=== 8.15.0
6
+
7
+
[discrete]
8
+
==== Features
9
+
10
+
[discrete]
11
+
===== OpenTelemetry zero-code instrumentation support
12
+
13
+
For those that use an observability service that supports OpenTelemetry spans, the client will now automatically generate traces for each Elasticsearch request it makes.
14
+
See {jsclient}/observability.html#_opentelemetry[the docs]
===== Allow document to be overwritten in `onDocument` iteratee of bulk helper https://github.com/elastic/elasticsearch-js/pull/1732[#1732]
200
213
201
-
In the https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/client-helpers.html#bulk-helper[bulk helper], documents could not be modified before being sent to Elasticsearch. It is now possible to https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/client-helpers.html#_modifying_a_document_before_operation[modify a document] before sending it.
214
+
In the {jsclient}/client-helpers.html#bulk-helper[bulk helper], documents could not be modified before being sent to Elasticsearch. It is now possible to {jsclient}/client-helpers.html#_modifying_a_document_before_operation[modify a document] before sending it.
Copy file name to clipboardExpand all lines: docs/observability.asciidoc
+67-44
Original file line number
Diff line number
Diff line change
@@ -1,34 +1,61 @@
1
1
[[observability]]
2
2
=== Observability
3
3
4
-
The client does not provide a default logger, but instead it offers an event
5
-
emitter interface to hook into internal events, such as `request` and
6
-
`response`.
4
+
To observe and measure Elasticsearch client usage, several client features are provided.
7
5
8
-
Correlating those events can be hard, especially if your applications have a
9
-
large codebase with many events happening at the same time.
6
+
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.
10
7
11
-
To help you with this, the client offers you a correlation id system and other
12
-
features. Let's see them in action.
8
+
Also, rather than providing a default logger, the client offers an event
9
+
emitter interface to hook into internal events, such as `request` and
10
+
`response`, allowing you to log the events you care about, or otherwise react
11
+
to client usage however you might need.
13
12
13
+
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
14
+
features.
15
+
16
+
All of these observability features are documented below.
17
+
18
+
[discrete]
19
+
==== OpenTelemetry
20
+
21
+
The client supports OpenTelemetry's https://opentelemetry.io/docs/zero-code/js/[zero-code
22
+
instrumentation] to enable tracking each client request as an
23
+
https://opentelemetry.io/docs/concepts/signals/traces/#spans[OpenTelemetry span]. These spans
24
+
follow all of the https://opentelemetry.io/docs/specs/semconv/database/elasticsearch/[semantic
25
+
OpenTelemetry conventions for Elasticsearch] except for `db.query.text`.
26
+
27
+
To start sending Elasticsearch trace data to your OpenTelemetry endpoint, follow
helps you with https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-slowlog.html#_identifying_search_slow_log_origin[identifying search slow log origin]
400
+
To improve observability, the client offers an easy way to configure the
401
+
`X-Opaque-Id` header. If you set the `X-Opaque-Id` in a specific request, this
helps you with https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-slowlog.html#_identifying_search_slow_log_origin[identifying search slow log origin]
382
405
as well as https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html#_identifying_running_tasks[identifying running tasks].
383
406
384
-
The `X-Opaque-Id` should be configured in each request, for doing that you can
385
-
use the `opaqueId` option, as you can see in the following example. The
407
+
The `X-Opaque-Id` should be configured in each request, for doing that you can
408
+
use the `opaqueId` option, as you can see in the following example. The
386
409
resulting header will be `{ 'X-Opaque-Id': 'my-search' }`.
387
410
388
411
[source,js]
@@ -401,10 +424,10 @@ client.search({
401
424
}).then(console.log, console.log)
402
425
----
403
426
404
-
Sometimes it may be useful to prefix all the `X-Opaque-Id` headers with a
405
-
specific string, in case you need to identify a specific client or server. For
406
-
doing this, the client offers a top-level configuration option:
407
-
`opaqueIdPrefix`. In the following example, the resulting header will be
427
+
Sometimes it may be useful to prefix all the `X-Opaque-Id` headers with a
428
+
specific string, in case you need to identify a specific client or server. For
429
+
doing this, the client offers a top-level configuration option:
430
+
`opaqueIdPrefix`. In the following example, the resulting header will be
0 commit comments