Javascript (Node.JS and Browser)
Please follow the steps outlined in the following documents:
Once your application is emitting metrics, your POD in K8s will need to be annotated to enable the agent to scrape the metrics. Following are the relevant annotations:
OpenTelemetry is the recommended approach to instrument for tracing. Please follow the instructions in the following document to instrument your Node application:
When your tracing.js file (from above) is created, make sure to edit the traceExporter: to export using the Zipkin exporter to this location:
The Zipkin URL above (http://otel collector.devopsnow.svc.cluster.local:9411) is available on all your clusters to which you installed the OpsVerse agent
This will allow the Node app to emit spans which will be collected by the OpenTelemetry collector installed as part of the OpsVerse agent and forwarded to the tracing backend.
It is very simple to configure traceId, spanId, and trace flags data injection into user logs in JavaScript applications. Based on the logging framework that is in use, follow the below mentioned steps to print the trace_id to the logs:
The following steps can be followed to to inject trace context with winston logger with OpenTelemetry instrumentation:
Step 1: Install the following dependency.
Step 2: Add the following block of code where OpenTelemetry JS instrumentation is configured (usually tracing.js file).
The examples below apply to OpenTelemetry JS instrumentation version 0.23.0 or above.
More information available here.
The following steps can be followed to to inject trace context with bunyan logger with OpenTelemetry instrumentation:
Step 1: Install the following dependency.
Step 2: Add the following block of code where OpenTelemetry JS instrumentation is configured (usually tracing.js file).
The following steps can be followed to to inject trace context with pino logger with OpenTelemetry instrumentation:
Step 1: Install the following dependency.
Step 2: Add the following block of code where OpenTelemetry JS instrumentation is configured (usually tracing.js file).
In the case of custom loggers, the most important thing is to know how to obtain the traceId, spanId, and trace flag. Follow the steps below:
Step 1: Install the following dependency.
Step 2: Extract the trace context (traceId, spanId, and trace flag) using the following snippet:
Example usage:
OpenTelemetry is the recommended approach to instrument for tracing. Please follow the instructions in the following document to instrument your HTML/JS browser application:
To start emitting spans to your observability backend, your document-load.js file (from above) should look like the following to export in Zipkin format to a TBA trace proxy host:
This will allow your browser app to emit events to a proxy collector (which validates events are coming from your whitelisted URLs) directly to your Jaeger collector (https://<jaeger-collector-host>/api/v2/spans). There are processors running on the collector that will generate the RUM metrics.