1. 下載
官網下載地址 http://skywalking.apache.org/downloads/
本文選擇的是 https://www.apache.org/dyn/closer.cgi/skywalking/7.0.0/apache-skywalking-apm-7.0.0.tar.gz
2. 后端設置
In Java, .NetCore, Node.js, Istio agents/probe, you should set the gRPC service address to ip/host:11800, with ip/host where your backend is.
config/application.yml
gRPCHost: ${SW_CORE_GRPC_HOST:127.0.0.1}
gRPCPort: ${SW_CORE_GRPC_PORT:11800}
3. UI 設置
config/application.yml
restHost: ${SW_CORE_REST_HOST:127.0.0.1}
restPort: ${SW_CORE_REST_PORT:12800}
webapp/webapp.yml
server:
port: 8080
collector:
path: /graphql
ribbon:
ReadTimeout: 10000
# Point to all backend's restHost:restPort, split by ,
listOfServers: 127.0.0.1:12800
4. 安裝 nodejs agent
4.1 安裝 nodejs module
npm install skyapm-nodejs@latest --save
4.2 初始化
It’s important that the agent is started before you require any other modules in your Node.js application. and you should require and start the agent in your application’s main file.
重要:在您的Node.js應用程序中,需要任何其他模塊之前,啟動代理skyapm-nodejs。
require('skyapm-nodejs').start({
// Service name is showed in sky-walking-ui. Suggestion: set an unique name for each service, one
// service's nodes share the same code.
// this value cannot be empty.
serviceName: 'test',
// Collector agent_gRPC/grpc service addresses.
// default value: localhost:11800
directServers: 'localhost:11800'
});
api 項目:http://www.itdecent.cn/p/58f68efe3b3e
5. 啟動 SkyWalking 后臺和 SkyWalking UI
啟動 SkyWalking 后臺
~ cd bin
~ bin/ sh startup.sh
SkyWalking OAP started successfully!
SkyWalking Web Application started successfully!
啟動 SkyWalking UI
~ cd bin
~ bin/ sh webappService.sh
SkyWalking Web Application started successfully!
UI地址 http://127.0.0.1:8080
6. 測試
6.1 啟動node api
調用接口 http://localhost:7000/
6.2 查看SkyWalking UI
http://127.0.0.1:8080
參考
官網:https://skywalking.apache.org/zh/
文檔:https://github.com/apache/skywalking/tree/master/docs