Skywalking Node.js 探针

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 项目:https://www.jianshu.com/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

你可能感兴趣的:(Skywalking Node.js 探针)