You need to enable JavaScript to run this app.
Application Performance Management Plus

Application Performance Management Plus

Copy page
Download PDF
Integration guide
Nodejs application integration
Copy page
Download PDF
Nodejs application integration
Nodejs applications have different integration methods depending on the scenario. This article describes the detailed steps for integrating Nodejs applications with OpenTelemetry. After integration, you can automatically collect trace information, automatically generate metrics, and use features such as trace search, log search, and more.​
Integrate via OpenTelemetry​
OpenTelemetry is an observability project under CNCF that aims to provide standardized solutions in the observability domain. It addresses the standardization of data models, collection, processing, and export of observability data, and offers services independent of third-party vendors.​
If your application has already integrated the OpenTelemetry SDK, the APMPlus server side can receive data reported by OpenTelemetry. After integrating with APMPlus, you will gain capabilities such as RED metric generation, multidimensional trace search, single trace search, topology generation, and more.​
tip​
To isolate production and test data, see Isolate production and test data.​
Limits​
  • APMPlus uses Prometheus as the storage for OpenTelemetry metrics and supports querying metrics using PromQL. For specific applications, see custom dashboard and alert management.​
  • There are certain restrictions when converting OpenTelemetry metrics to Prometheus metrics:​
  • Data with the aggregation method set to delta is not supported. Do not modify the default aggregation configuration on the SDK side. Ensure that the aggregation method for SDK-side data is cumulative.​
  • Each workspace has its own data reporting credentials. To manage and isolate data using workspaces, ensure that the apmplus-opentelemetry-collector component has been upgraded to version v3.1.0 or above.​
Automatic integration​
APMPlus OpenTelemetry Collector is a data collector developed by APMPlus based on OpenTelemetry Collector. It complies with the Apache 2.0 license, supports the collection of OpenTelemetry monitoring data, and also supports the collection of Prometheus metrics, application monitoring data, and K8s resource metrics.​
  1. Install APM OpenTelemetry Collector.​
  • Use the VKE cluster component center to perform blank screen installation of the apmplus-opentelemetry-collector component. Go to the VKE cluster interface, select Component Management -> Monitoring, and click the Install button in the upper right corner of the apmplus-opentelemetry-collector component under ... to complete the deployment and management of Apmplus OpenTelemetry Collector.​
  1. Add the instrumentation.apmplus.volcengine.com/inject-nodejs and instrumentation.apmplus.volcengine.com/workspace annotations to the k8s deployment configuration of the service.​
  • The VKE blank screen configuration is shown below:​
  • The code example is as follows:​
  • ​
    apiVersion: apps/v1​
    kind: Deployment​
    metadata:​
    name: node-demo​
    labels:​
    app: node-demo​
    spec:​
    replicas: 1​
    selector:​
    matchLabels:​
    app: node-demo​
    template:​
    metadata:​
    labels:​
    app: node-demo​
    annotations:​
    instrumentation.apmplus.volcengine.com/inject-nodejs: 'true' # Turn on APMPlus observation injection​
    instrumentation.apmplus.volcengine.com/workspace: default # Specify the workspace to which the service belongs​
    spec:​
    containers:​
    - name: node-demo​
    image: node-demo:latest​
    imagePullPolicy: Always​
    env:​
    - name: CONTAINER_RUNTIME​
    value: "k8s"​
    ​
  1. Restart the application.​
  • ​
OpenTelemetry SDK integration​
Use the automatic instrumentation method provided by the community Opentelemetry Node.js SDK to report data. For details, see the community-provided integration documentation.​
Report data using Opentelemetry automatic instrumentation.​
tip​
For related information in the official Opentelemetry Node.js documentation, see: getting-started.​
  1. Install dependencies.​
​
npm install --save @opentelemetry/api​
npm install --save @opentelemetry/auto-instrumentations-node​
​
  1. Set environment variables and load the instrumentation script using the NODE_OPTIONS and --require mechanisms.​
tip​
The app_key for each workspace is different. To obtain it, see: How to obtain the AppKey for application performance monitor authentication information?.​
​
# Enter your-app-key as the App key displayed in the APMPlus platform access center. Enter your-service-name as the desired service name.​
# Adjust OTEL_EXPORTER_OTLP_ENDPOINT according to the access region.​
# If accessed via the public network, use http://apmplus-cn-beijing.volces.com:4317 for OTEL_EXPORTER_OTLP_ENDPOINT.​
export OTEL_TRACES_EXPORTER="otlp"​
export OTEL_METRICS_EXPORTER="otlp"​
export OTEL_LOGS_EXPORTER="otlp"​
export OTEL_EXPORTER_OTLP_PROTOCOL="grpc"​
export OTEL_EXPORTER_OTLP_ENDPOINT="http://apmplus-cn-beijing.ivolces.com:4317" ​
export OTEL_EXPORTER_OTLP_HEADERS=X-ByteAPM-AppKey="your-app-key"​
export OTEL_SERVICE_NAME="your-service-name"​
export OTEL_NODE_RESOURCE_DETECTORS="env,host,os"​
export OTEL_PROPAGATORS="tracecontext,baggage"​
export OTEL_METRIC_EXPORT_INTERVAL=30000 ​
export NODE_OPTIONS="--require @opentelemetry/auto-instrumentations-node/register"​
node app.js​
​
​
Last updated: 2026.07.01 15:15:18