Tracing using OpenTelemetry
This document provides information on how to use OpenTelemetry for tracing in N|Solid. It covers the OpenTelemetry support in N|Solid, using the JavaScript OpenTelemetry API via N|Solid, and exporting traces via OTLP over HTTP.
OpenTelemetry Support
N|Solid has added support for some OpenTelemetry features:
- It provides an implementation of the OpenTelemetry TraceAPI which allows the user to instrument their own code using the de-facto standard API.
- It also supports the use of lots of instrumentation modules available in the OpenTelemetry ecosystem.
- It supports exporting traces using the OpenTelemetry Protocol (OTLP) over HTTP.
Using the JavaScript OpenTelemetry API via N|Solid
To integrate the OpenTelemetry APIs directly with N|Solid, refer to the N|Solid Runtime's JS API for instructions.
Exporting Traces via OTLP over HTTP
N|Solid now allows exporting traces to endpoints supporting the OpenTelemetry Protocol (OTLP) over HTTP. Additionally, it provides easy integration with specific vendors' endpoints such as Datadog
, DynaTrace
, and NewRelic
. It also supports exporting the metrics generated by N|Solid to these vendors' solutions without the need for their agents.
To configure the OTLP endpoint, there are two options:
- Set the
NSOLID_OTLP
andNSOLID_OTLP_CONFIG
environment variables. - Use other configuration methods provided by N|Solid. Refer to the runtime configuration documentation for more details.
The NSOLID_OTLP
environment variable defines the type of endpoint to export the traces to. The allowed values are:
datadog
dynatrace
newrelic
otlp
The NSOLID_OTLP_CONFIG
environment variable defines the configuration for the selected endpoint type. It should be a string containing a serialized JavaScript object in JSON format. The format of this object depends on the type of endpoint.
Here are the formats for each endpoint type:
Endpoint Type | Format |
---|---|
datadog | {"zone": "us" | "eu", "key": "your_datadog_key", "url": "otlp_endpoint_url"} |
dynatrace | {"site": "your_dynatrace_site", "token": "your_dynatrace_token"} |
newrelic | {"zone": "us" | "eu", "key": "your_newrelic_key"} |
otlp | {"url": "otlp_endpoint_url"} |
Here is an example of how to configure N|Solid to export data to Dynatrace
. Notice you need N|Solid to be licensed.
$ NSOLID_OTLP=dynatrace NSOLID_OTLP_CONFIG='{"site":"my_site","token":"my_token"}' NSOLID_LICENSE_TOKEN=my_nsolid_license nsolid my_process.js