Web JS installation instructions

Use the installation instructions below if you're installing Helios in a standard Web JS service.

Get your JS services auto-instrumented with Helios by following the installation instructions provided below.

Installing Helios in your JavaScript web application

Navigate to your project's root directory, and install the latest Helios OpenTelemetry Web SDK:

npm install --save helios-web-sdk

Initializing Helios in the code

Add the following code snippet at the top of your web page's header (or where you initialize your application):

const { initialize } = require('helios-web-sdk');

    apiToken: <HS_TOKEN>,        // TODO: Insert your API token',
    serviceName: <SERVICE_NAME>, // TODO: Insert service name.
    enable: true,                // Defaults to false if omitted.
    environment: <ENVIRONMENT>   // TODO: Insert environment name.


All set

After setup is complete and once the web page is loaded, it will show up in the Helios application.

Troubleshooting tips

Installing the Helios OpenTelemetry SDK is usually a simple process; nonetheless, we've aggregated here some useful tips based on common issues we've encountered in the field so that you can complete the installation quickly.

Enable traceparent header in your server-side CORS policy

Instrumenting your Web JS service adds some Opentelemetry-specific headers to requests made by the browser. Make sure to add the traceparent header to the allowed list of headers on your server side.

Include your backend APIs hostname in the SDK config

In case your backend's hostname is different than the hostname of your web application's URL, Helios doesn't automatically add the traceparent header, to avoid failures caused by cross origin policies. To avoid that that, add another parameter to the SDK's initialize call, backendHostnames, and specify your backend hostname as an item in an array (e.g., [my.api.io]