四:skywalking案例:
• 4.1.halo博客实现链路追踪案例:
java应用示例-java命令运行halo博客并实现链路追踪:
https://docs.halo.run/getting-started/prepare/
halo博客案例-准备skywalking java agent:
halo博客案例-准备skywalking java agent:
1 | root@skywalking-agent:~# ls /data/apache-skywalking-java-agent- 8.8.0.tgz |
halo博客案例-部署jdk 11环境:
#Halo 是一款现代化的个人独立博客系统,而且可能是最好的Java博客系统,从 1.4.3 起,版本要求为 11 以上的版本,1.4.3 以下需要 1.8 以上的版本。
1 | #apt install openjdk-11-jdk |
halo博客案例-skywalking-java-agent部署:
1 | root@skywalking-agent:/apps/skywalking-agent# tar -xvf apache-skywalking-java-agent |
halo博客案例-配置加载 servcie参数:
1 | root@skywalking-agent:/data/skywalking-agent# pwd |
halo博客案例-halo app下载:
1 | https://dl.halo.run/release/ |
halo博客案例-启动app:
演示案例:
1 | root@skywalking-agent:/data/skywalking-agent# pwd |
生产环境示例:
1 | # java -javaagent:/skywalking-agent/skywalking-agent.jar \ |
halo博客案例-注册账号:
halo博客案例-编写文章产生访问信息:
halo博客案例-验证skywalking界面:
skywalking仪表盘:
1 | Apdex全称是(Application Performance Index,应用性能指数),是由Apdex联盟开放的用于评估应用性能的标准,Apdex 联盟起源于2004年,Apdex标准从用户的角度出发,提供了一个统一的测量和报告用户体验的方法,将其量化为范围为0-1的满意度评价,把最终用户的体验和应用性能作为一个完整的指标进行统一度量. |
skywalking仪表盘:
1 | 服务(Service)-表示对请求提供相同行为的一系列或一组工作负载(服务名称),在使用Agent或SDK的时候,可以自定义服务的名字, 如果不定义的话,SkyWalking将会使用你在平台(例如说 Istio)上定义的名字。 |
halo博客案例-验证skywalking界面:
halo博客案例-验证skywalking界面:
skywalking追踪图:
#可以根据traceid来查看某次请求的链路
4.2.Tomcat运行Jenkins并实现链路追踪案例:
https://skywalking.apache.org/docs/skywalking-java/latest/en/setup/service-agent/java-agent/readme/
部署jdk环境: 参考halo示例
部署skywalking java客户端:参考halo示例
tomcat运行Jenkins -部署tomcat:
下载并部署tomcat,https://tomcat.apache.org/
1 | root@skywalking-agent:/apps# pwd |
tomcat运行Jenkins -配置tomcat中的javaagent参数:
1 | root@skywalking-agent:/apps# pwd |
tomcat运行Jenkins-skywalking web界面:
tomcat运行Jenkins-证skywalking web界面:
Service:
tomcat运行Jenkins-证skywalking web界面:
instance:
tomcat运行Jenkins-证skywalking web界面:
Endpoint:
拓扑图
• 4.3.微服务链路追踪案例:
java微服务示例-部署注册中心:
zookeeper注册中心部署:
node: 192.168.3.42
目录:/apps/apache-zookeeper-3.6.3-bin
1.java环境:
root@skywalking-agent:~# java -version
java version “1.8.0_251”
Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)
2:skywalking-agent
/data/skywalking-agent/config/agent.config
18 agent.namespace=${SW_AGENT_NAMESPACE:app}
21 agent.service_name=${SW_AGENT_NAME:dubbo-provider}
93 collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES:192.168.3.81:11800}
3.provider连接zookeeper配置:
/apps/dubbo-demo-provider-2.1.5 #目录
dubbo.registry.address=zookeeper://192.168.3.42:2181 #指定注册中心地址
4.启动provider:
root@skywalking-agent:/apps/skywalking-agent# pwd
/apps/skywalking-agent
1 | java -javaagent:/apps/skywalking-agent/skywalking-agent.jar -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -server -Xms1024m -Xmx1024m -XX:PermSize=128m -XX:SurvivorRatio=2 -XX:+UseParallelGC -classpath /apps/dubbo-demo-provider-2.1.5/conf:/apps/dubbo-demo-provider-2.1.5/lib/cache-api-0.4.jar:/apps/dubbo-demo-provider-2.1.5/lib/commons-codec-1.4.jar:/apps/dubbo-demo-provider-2.1.5/lib/commons-logging-1.1.1.jar:/apps/dubbo-demo-provider-2.1.5/lib/commons-pool-1.5.5.jar:/apps/dubbo-demo-provider-2.1.5/lib/dubbo-2.1.5.jar:/apps/dubbo-demo-provider-2.1.5/lib/dubbo-demo-2.1.5.jar:/apps/dubbo-demo-provider-2.1.5/lib/dubbo-demo-provider-2.1.5.jar:/apps/dubbo-demo-provider-2.1.5/lib/fastjson-1.1.8.jar:/apps/dubbo-demo-provider-2.1.5/lib/gmbal-api-only-3.0.0-b023.jar:/apps/dubbo-demo-provider-2.1.5/lib/grizzly-core-2.1.4.jar:/apps/dubbo-demo-provider-2.1.5/lib/grizzly-framework-2.1.4.jar:/apps/dubbo-demo-provider-2.1.5/lib/grizzly-portunif-2.1.4.jar:/apps/dubbo-demo-provider-2.1.5/lib/grizzly-rcm-2.1.4.jar:/apps/dubbo-demo-provider-2.1.5/lib/hessian-4.0.7.jar:/apps/dubbo-demo-provider-2.1.5/lib/hibernate-validator-4.2.0.Final.jar:/apps/dubbo-demo-provider-2.1.5/lib/httpclient-4.1.2.jar:/apps/dubbo-demo-provider-2.1.5/lib/httpcore-4.1.2.jar:/apps/dubbo-demo-provider-2.1.5/lib/javassist-3.15.0-GA.jar:/apps/dubbo-demo-provider-2.1.5/lib/jedis-2.0.0.jar:/apps/dubbo-demo-provider-2.1.5/lib/jetty-6.1.26.jar:/apps/dubbo-demo-provider-2.1.5/lib/jetty-util-6.1.26.jar:/apps/dubbo-demo-provider-2.1.5/lib/jline-0.9.94.jar:/apps/dubbo-demo-provider-2.1.5/lib/log4j-1.2.16.jar:/apps/dubbo-demo-provider-2.1.5/lib/management-api-3.0.0-b012.jar:/apps/dubbo-demo-provider-2.1.5/lib/mina-core-1.1.7.jar:/apps/dubbo-demo-provider-2.1.5/lib/netty-3.2.5.Final.jar:/apps/dubbo-demo-provider-2.1.5/lib/servlet-api-2.5-20081211.jar:/apps/dubbo-demo-provider-2.1.5/lib/slf4j-api-1.6.2.jar:/apps/dubbo-demo-provider-2.1.5/lib/spring-2.5.6.SEC03.jar:/apps/dubbo-demo-provider-2.1.5/lib/validation-api-1.0.0.GA.jar:/apps/dubbo-demo-provider-2.1.5/lib/zookeeper-3.3.3.jar: com.alibaba.dubbo.container.Main |
java微服务示例-consumer部署:
1.java环境:
root@skywalking-agent:~# java -version
java version “1.8.0_251”
Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)
2:skywalking-agent
/apps/skywalking-agent/config/agent.config
18 agent.namespace=${SW_AGENT_NAMESPACE:app}
21 agent.service_name=${SW_AGENT_NAME:dubbo-consumer}
93 collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES:192.168.3.81:11800}
java微服务示例-consumer部署:
3.provider连接zookeeper配置: /apps/dubbo-demo-consumer-2.1.5
dubbo.registry.address=zookeeper://192.168.3.43:2181
4.启动consumer
1 | root@skywalking-agent2:~# java -javaagent:/data/skywalking-agent/skywalking-agent.jar -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -server -Xmx2g -Xms2g - Xmn256m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection - XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 -classpath /apps/dubbo-demo- consumer-2.1.5/conf:/apps/dubbo-demo-consumer-2.1.5/lib/cache-api-0.4.jar:/apps/dubbo-demo-consumer-2.1.5/lib/commons-codec-1.4.jar:/apps/dubbo-demo-consumer- 2.1.5/lib/commons-logging-1.1.1.jar:/apps/dubbo-demo-consumer-2.1.5/lib/commons-pool-1.5.5.jar:/apps/dubbo-demo-consumer-2.1.5/lib/dubbo-2.1.5.jar:/apps/dubbo-demo- consumer-2.1.5/lib/dubbo-demo-2.1.5.jar:/apps/dubbo-demo-consumer-2.1.5/lib/dubbo-demo-consumer-2.1.5.jar:/apps/dubbo-demo-consumer-2.1.5/lib/fastjson- 1.1.8.jar:/apps/dubbo-demo-consumer-2.1.5/lib/gmbal-api-only-3.0.0-b023.jar:/apps/dubbo-demo-consumer-2.1.5/lib/grizzly-core-2.1.4.jar:/apps/dubbo-demo-consumer- 2.1.5/lib/grizzly-framework-2.1.4.jar:/apps/dubbo-demo-consumer-2.1.5/lib/grizzly-portunif-2.1.4.jar:/apps/dubbo-demo-consumer-2.1.5/lib/grizzly-rcm-2.1.4.jar:/apps/dubbo-demo- consumer-2.1.5/lib/hessian-4.0.7.jar:/apps/dubbo-demo-consumer-2.1.5/lib/hibernate-validator-4.2.0.Final.jar:/apps/dubbo-demo-consumer-2.1.5/lib/httpclient-4.1.2.jar:/apps/dubbo- demo-consumer-2.1.5/lib/httpcore-4.1.2.jar:/apps/dubbo-demo-consumer-2.1.5/lib/javassist-3.15.0-GA.jar:/apps/dubbo-demo-consumer-2.1.5/lib/jedis-2.0.0.jar:/apps/dubbo-demo- consumer-2.1.5/lib/jetty-6.1.26.jar:/apps/dubbo-demo-consumer-2.1.5/lib/jetty-util-6.1.26.jar:/apps/dubbo-demo-consumer-2.1.5/lib/jline-0.9.94.jar:/apps/dubbo-demo-consumer- 2.1.5/lib/log4j-1.2.16.jar:/apps/dubbo-demo-consumer-2.1.5/lib/management-api-3.0.0-b012.jar:/apps/dubbo-demo-consumer-2.1.5/lib/mina-core-1.1.7.jar:/apps/dubbo-demo- consumer-2.1.5/lib/netty-3.2.5.Final.jar:/apps/dubbo-demo-consumer-2.1.5/lib/servlet-api-2.5-20081211.jar:/apps/dubbo-demo-consumer-2.1.5/lib/slf4j-api-1.6.2.jar:/apps/dubbo- demo-consumer-2.1.5/lib/spring-2.5.6.SEC03.jar:/apps/dubbo-demo-consumer-2.1.5/lib/validation-api-1.0.0.GA.jar:/apps/dubbo-demo-consumer-2.1.5/lib/zookeeper-3.3.3.jar: com.alibaba.dubbo.container.Main |
java微服务示例-dubbo provider请求验证:
java微服务示例-skywalking web验证:
• 4.4.Python服务链路追踪案例-手动注册:
python应用示例-手动注册:
https://skywalking.apache.org/docs/skywalking-python/v0.7.0/en/setup/installation/
1 | root@ubuntu:~/skywalking-agent# apt install python3-pip |
python应用示例-验证服务:
4.5.Python服务链路追踪案例-自动注册:
python 应用-自动注册并实现链路追踪:
https://github.com/apache/skywalking-python
python 应用案例-准备django运行环境:
1 | root@skywalking-agent:/apps# pwd |
1 | 创建django项目mysite |
python 应用案例-环境变量及app配置:
1 | skywarking环境变量: |
python 应用案例-启动项目:
1 | 启动app服务 |
python 应用案例-验证django web页面:
python 应用案例-验证skywalking web界面:
python 应用案例-验证elasticsearch索引数据:
五.skywalking 告警:
https://github.com/apache/skywalking/blob/master/docs/en/setup/backend/backend-alarm.md
skywalking 告警-指标:
1 | # cat config/oal/core.oal |
skywalking 告警-指标:
skywalking 告警:
1 | # vim alarm-settings.yml |
1 | dingtalkHooks: |
skywalking 告警-验证: