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
The current release is **alpha**, and not yet recommended for production use.
13
+
We welcome your feedback! You can reach us either on the [issue tracker](https://github.com/elastic/elastic-otel-node/issues)
14
+
or on [Elastic's Discuss forum](https://discuss.elastic.co/tags/c/observability/apm/58/nodejs).
26
15
27
-
(TODO: update ^^ once published to npm.)
16
+
Some limitations / notes:
17
+
- We expect to support most every instrumentation included in [`@opentelemetry/auto-instrumentations-node`](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/metapackages/auto-instrumentations-node#supported-instrumentations). However, currently only a subset is supported. See [the supported instrumentations here](./docs/supported-technologies.md#instrumentations).
28
18
29
19
30
20
# Usage
31
21
32
-
To start the SDK, it must be loaded before any of your application code. The
33
-
recommended way to do that is via Node.js's [`-r, --require`
First, you will need an Elastic APM deployment. See: https://www.elastic.co/guide/en/apm/guide/current/apm-quick-start.html
58
-
You will need two pieces of information: the APM **server URL** (this is the OTLP endpoint) and your APM **secret code** (or **API key** if using API keys).
The Distro will automatically instrument popular modules (see [supported instrumentations](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/metapackages/auto-instrumentations-node#supported-instrumentations)))
34
+
used by your service, and send trace, metrics, and logs telemetry data (using
35
+
OTLP) to your configured observability backend.
66
36
67
-
Or if using an API key, then:
37
+
The Distro can be configured via `OTEL_*` environment variables, per the
Now running an application with this SDK will send to the mock endpoint, which
93
-
prints out any received telemetry data, for example:
52
+
As mentioned above, this Distro is a wrapper around the [OpenTelemetry Node
53
+
SDK (`@opentelemetry/sdk-node`)](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-sdk-node). So why the separate package?
This is the Elastic OpenTelemetry Distribution for Node.js (the "Distro"). It is
4
-
a Node.js package that provides:
5
-
- easy way to instrument your application with OpenTelemetry
6
-
- configuration defaults for best usage
3
+
The Elastic OpenTelemetry Distribution for Node.js (the "Distro") is a Node.js
4
+
package that provides:
5
+
6
+
- an easy way to instrument your application with OpenTelemetry, and
7
+
- configuration defaults for best usage.
7
8
8
9
Use the Distro to start the OpenTelemetry SDK with your Node.js application to automatically
9
10
capture tracing data, performance metrics, and logs. Traces, metrics, and logs are sent
@@ -16,45 +17,110 @@ and quickly identify root causes of service issues.
16
17
17
18
This getting started guide will show how to use this Distro to instrument your Node.js application and send OpenTelemetry data to an Elastic Observability deployment. Note, however, that as an OpenTelemetry SDK, it supports sending data to any OTLP endpoint, e.g. an [OpenTelemetry Collector](https://opentelemetry.io/docs/collector/).
18
19
19
-
An Elastic Observability deployment includes an OTLP endpoint to receive data. That data is processed and stored in Elasticsearch, and Kibana provides a web interface to visualize and analyze the date. If you do not already have
20
-
a deployment to use, follow [this Quick Start guide](https://www.elastic.co/blog/getting-started-with-elastic-cloud)
21
-
to create a free trial on Elastic's cloud. From this deployment you will need
22
-
the APM **`serverUrl`** and a configured **`apmAgentKey`** to use for configuring the SDK distribution.
23
-
24
20
## Installation
25
21
26
22
```sh
27
23
npm install --save @elastic/opentelemetry-node
28
24
```
29
25
30
-
## Initialization
26
+
The Distro is a single package that includes all the OpenTelemetry JS packages
27
+
that are needed for most cases.
28
+
29
+
<!-- TODO: refer to advanced section of "start the SDK" when we have that doc. -->
30
+
31
+
## Configuration
32
+
33
+
The Distro is a wrapper around the [OpenTelemetry Node.js SDK](https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-sdk-node)
34
+
and other OpenTelemetry JS packages. It is typically configured with `OTEL_*`
35
+
environment variables defined by the OpenTelemetry spec. The most common
36
+
configuration settings are `OTEL_EXPORTER_OTLP_*` to set the endpoint for
37
+
sending data and `OTEL_SERVICE_NAME` to identify your service.
38
+
39
+
The Distro will send telemetry data via OpenTelemetry's protocol (OTLP) to the
40
+
configured endpoint (by default it sends to <http://localhost:4317>). The
41
+
endpoint can be changed by setting the following environment vars:
31
42
32
-
It’s important that the agent is started before you require **any** other modules
33
-
in your Node.js application - i.e. before express, http, etc.
43
+
-`OTEL_EXPORTER_OTLP_ENDPOINT`: full URL of the endpoint where to send the data
44
+
-`OTEL_EXPORTER_OTLP_HEADERS`: Comma-separated list of `key=value` pairs which
45
+
will be added to the headers of every request. Typically this is used for
46
+
authentication information.
34
47
35
-
The preferred way to get the SDK started is by using the `--require`
You'll need somewhere to send the gathered OpenTelemetry data, so it can be
79
+
viewed and analyzed. The `@elastic/opentelemetry-node` package supports sending
80
+
to any OTLP endpoint (e.g. an OpenTelemetry collector instance). This section
81
+
shows create an [Elastic Observability](https://www.elastic.co/observability)
82
+
cloud deployment and get the data you need to configure the Distro to send
83
+
data to it.
84
+
85
+
1. Register at [cloud.elastic.co](https://cloud.elastic.co/registration), if you haven't already. This supports starting **free trial**.
86
+
87
+
2. After registering, click "Create deployment" at <https://cloud.elastic.co/home>. Once that is created, click "Open" to visit your Kibana home page, e.g. `https://{DEPLOYMENT_NAME}.kb.{REGION}.cloud.es.io/app/home#/getting_started`.
88
+
89
+
To configure the Distro you'll need the deployment's OTLP endpoint and
90
+
authorization data to set the appropriate `OTLP_*` environment variables. You
0 commit comments