This guide installs the Node.js Agent and sends traces to Apache SkyWalking OAP.
127.0.0.1:11800.See the agent and OAP compatibility guide when you choose an OAP version.
npm install skywalking-backend-js
The agent patches supported modules when agent.start() runs. Start it before loading your framework, HTTP client, database client, or other instrumented module.
import agent from 'skywalking-backend-js'; agent.start({ serviceName: 'checkout-service', serviceInstance: 'checkout-service-1', collectorAddress: '127.0.0.1:11800', }); // Load the application after agent.start().
Options passed to agent.start() replace environment values, including empty values. Do not pass an empty collector address.
The package includes a small entry file for Node.js --require. This is useful when you cannot change the first lines of the application.
SW_AGENT_NAME=checkout-service \ SW_AGENT_COLLECTOR_BACKEND_SERVICES=127.0.0.1:11800 \ node --require skywalking-backend-js/lib/egg app.js
This entry calls agent.start() with environment values. Despite the file name, it can be used as a general preload entry.
SW_AGENT_NAME.If no data appears, read Troubleshooting.