OpenTelemetry Agent - JavaScript on Linux Installation



Installation Steps

  1. Install the OpenTelemetry JavaScript Packages
npm install --save @opentelemetry/api
npm install --save @opentelemetry/auto-instrumentations-node
  1. Run the JavaScript Application with OpenTelemetry Environment Variables
  • Find-and-replace $SERVICE_NAME with the name of the Service for the Application
  • Find-and-replace $PROTOCOL with http or https based on the VF Server configuration
  • Find-and-replace $VF_SERVER_ADDRESS with the URL for your organization’s vFunction Server
  • Find-and-replace $VF_APP_ID with the Application UUID created with the Installation Instructions from the vFunction Server UI
  • Find-and-replace $APP_NAME with the name of the JavaScript script
export OTEL_SERVICE_NAME="$MY_SERVICE"
export OTEL_EXPORTER_OTLP_ENDPOINT="http://$VF_SERVER_ADDRESS/api/unauth/otlp"
export OTEL_EXPORTER_OTLP_HEADERS="$VF_APP_ID"
export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
export OTEL_TRACES_EXPORTER="otlp"
export OTEL_LOGS_EXPORTER="none"
export NODE_OPTIONS="--require @opentelemetry/auto-instrumentations-node/register"
node $APP_NAME.js