Springboot 整合 skywalking

1. skywalking

官網(wǎng):https://skywalking.apache.org/

特點(diǎn):

1.SkyWalking: 一個(gè)開源的可觀測平臺(tái), 用于從服務(wù)和云原生基礎(chǔ)設(shè)施收集, 分析, 聚合及可視化數(shù)據(jù)。
2.SkyWalking 更是一個(gè)現(xiàn)代化的應(yīng)用程序性能監(jiān)控(Application Performance Monitoring)系統(tǒng), 尤其專為云原生、基于容器的分布式系統(tǒng)設(shè)計(jì).

2.架構(gòu)

skywalking.png

2.1 架構(gòu)組件簡介

1. 上部分Agent: 負(fù)責(zé)從應(yīng)用中,收集鏈路信息,發(fā)給Skywalking  oap 服務(wù)器.
2. 下部分Skywalking oap: 負(fù)責(zé)接收到Agent 發(fā)送的Tracing 的數(shù)據(jù)信息,然后進(jìn)行分析(Analysis platform) ,存儲(chǔ)到外部存儲(chǔ)器最終提供query  查詢功能.
3.左邊Storage: Tracing數(shù)據(jù)存儲(chǔ)碘饼,目前支持ES烁峭、MySQL、Sharding Sphere郊尝、TiDB二跋、H2多種存儲(chǔ)器,目前采用較多的是ES流昏,主要考慮是SkyWalking開發(fā)團(tuán)隊(duì)自己的生產(chǎn)環(huán)境采用ES為主.
4.右邊UI:負(fù)責(zé)提供控制臺(tái)扎即,查看鏈路等等吞获;

2.2 目錄簡介

在這里插入圖片描述

3. 啟動(dòng)skywalking 默認(rèn)的配置服務(wù)

[root@basenode bin]# ./startup.sh 
SkyWalking OAP started successfully!
SkyWalking Web Application started successfully!
[root@basenode bin]# pwd
/opt/module/skywalking-apm-bin-es7/bin
[root@basenode bin]# 

4. 頁面訪問地址

http://192.168.1.180:8080/

在這里插入圖片描述

4.1 有時(shí)候8080 的端口被占用后, 我們可以修改端口

直接修改8080 端口

[root@basenode webapp]# pwd
/opt/module/skywalking-apm-bin-es7/webapp
[root@basenode skywalking-apm-bin-es7]# cd webapp/
[root@basenode webapp]# ll
總用量 35360
-rw-r--r-- 1 1001 1002 36201156 7月  30 21:36 skywalking-webapp.jar
-rw-r--r-- 1 1001 1002     1346 7月  30 20:32 webapp.yml
[root@basenode webapp]# vi  webapp.yml 

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

server:
  port: 8080

spring:
  cloud:
    gateway:
      routes:
        - id: oap-route
          uri: lb://oap-service
          predicates:
            - Path=/graphql/**

5. 找一個(gè)spring boot 項(xiàng)目 運(yùn)行

命令:

java -javaagent:/opt/module/skywalking-apm-bin-es7/agent/skywalking-agent.jar -jar /opt/module/demo/user-center-0.0.1-SNAPSHOT.jar

5.1 然后訪問自己的spring boot 項(xiàng)目

在這里插入圖片描述

6. 然后看Syywalking

在這里插入圖片描述

在這里插入圖片描述

7. 或者寫一個(gè)腳本

[root@basenode demo]# vi startup.sh 

#!/bin/sh
# SkyWalking Agent配置
export SW_AGENT_NAME=springboot-skywalking-wudl #Agent名字,一般使用`spring.application.name`
export SW_AGENT_COLLECTOR_BACKEND_SERVICES=192.168.1.180:11800 #配置 Collector 地址。
export SW_AGENT_SPAN_LIMIT=2000 #配置鏈路的最大Span數(shù)量谚鄙,默認(rèn)為 300各拷。
export JAVA_AGENT=-javaagent:/opt/module/skywalking-apm-bin-es7/agent/skywalking-agent.jar
java $JAVA_AGENT -jar /opt/module/demo/user-center-0.0.1-SNAPSHOT.jar #jar啟動(dòng)

7.1 運(yùn)行 : sh startup.sh

[root@basenode demo]# sh startup.sh 
DEBUG 2021-09-12 18:01:30:050 main AgentPackagePath : The beacon class location is jar:file:/opt/module/skywalking-apm-bin-es7/agent/skywalking-agent.jar!/org/apache/skywalking/apm/agent/core/boot/AgentPackagePath.class. 
INFO 2021-09-12 18:01:30:051 main SnifferConfigInitializer : Config file found in /opt/module/skywalking-apm-bin-es7/agent/config/agent.config. 

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.2.RELEASE)

2021-09-12 18:01:39.170  INFO 5590 --- [           main] c.wudl.usercenter.UserCenterApplication  : Starting UserCenterApplication v0.0.1-SNAPSHOT on basenode with PID 5590 (/opt/module/demo/user-center-0.0.1-SNAPSHOT.jar started by root in /opt/module/demo)
2021-09-12 18:01:39.177  INFO 5590 --- [           main] c.wudl.usercenter.UserCenterApplication  : The following profiles are active: dev
2021-09-12 18:01:43.948  INFO 5590 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 9909 (http)
2021-09-12 18:01:44.050  INFO 5590 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-09-12 18:01:44.050  INFO 5590 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.29]
2021-09-12 18:01:44.196  INFO 5590 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-09-12 18:01:44.197  INFO 5590 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 4819 ms
2021-09-12 18:01:47.260  INFO 5590 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2021-09-12 18:01:47.956  INFO 5590 --- [           main] t.m.m.autoconfigure.MapperCacheDisabler  : Clear tk.mybatis.mapper.util.MsUtil CLASS_CACHE cache.
2021-09-12 18:01:47.956  INFO 5590 --- [           main] t.m.m.autoconfigure.MapperCacheDisabler  : Clear tk.mybatis.mapper.genid.GenIdUtil CACHE cache.
2021-09-12 18:01:47.957  INFO 5590 --- [           main] t.m.m.autoconfigure.MapperCacheDisabler  : Clear tk.mybatis.mapper.version.VersionUtil CACHE cache.
2021-09-12 18:01:47.957  INFO 5590 --- [           main] t.m.m.autoconfigure.MapperCacheDisabler  : Clear EntityHelper entityTableMap cache.
2021-09-12 18:01:48.365  INFO 5590 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 9909 (http) with context path ''
2021-09-12 18:01:48.370  INFO 5590 --- [           main] c.wudl.usercenter.UserCenterApplication  : Started UserCenterApplication in 11.576 seconds (JVM running for 18.419)

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市闷营,隨后出現(xiàn)的幾起案子烤黍,更是在濱河造成了極大的恐慌,老刑警劉巖傻盟,帶你破解...
    沈念sama閱讀 218,607評(píng)論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件速蕊,死亡現(xiàn)場離奇詭異,居然都是意外死亡娘赴,警方通過查閱死者的電腦和手機(jī)规哲,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,239評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來诽表,“玉大人唉锌,你說我怎么就攤上這事」厍辏” “怎么了糊秆?”我有些...
    開封第一講書人閱讀 164,960評(píng)論 0 355
  • 文/不壞的土叔 我叫張陵,是天一觀的道長议双。 經(jīng)常有香客問我痘番,道長,這世上最難降的妖魔是什么平痰? 我笑而不...
    開封第一講書人閱讀 58,750評(píng)論 1 294
  • 正文 為了忘掉前任汞舱,我火速辦了婚禮,結(jié)果婚禮上宗雇,老公的妹妹穿的比我還像新娘昂芜。我一直安慰自己,他們只是感情好赔蒲,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,764評(píng)論 6 392
  • 文/花漫 我一把揭開白布泌神。 她就那樣靜靜地躺著,像睡著了一般舞虱。 火紅的嫁衣襯著肌膚如雪欢际。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,604評(píng)論 1 305
  • 那天矾兜,我揣著相機(jī)與錄音损趋,去河邊找鬼。 笑死椅寺,一個(gè)胖子當(dāng)著我的面吹牛浑槽,可吹牛的內(nèi)容都是我干的蒋失。 我是一名探鬼主播,決...
    沈念sama閱讀 40,347評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼桐玻,長吁一口氣:“原來是場噩夢(mèng)啊……” “哼篙挽!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起镊靴,我...
    開封第一講書人閱讀 39,253評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤嫉髓,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后邑闲,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體算行,經(jīng)...
    沈念sama閱讀 45,702評(píng)論 1 315
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,893評(píng)論 3 336
  • 正文 我和宋清朗相戀三年苫耸,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了州邢。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,015評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡褪子,死狀恐怖量淌,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情嫌褪,我是刑警寧澤呀枢,帶...
    沈念sama閱讀 35,734評(píng)論 5 346
  • 正文 年R本政府宣布,位于F島的核電站笼痛,受9級(jí)特大地震影響裙秋,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜缨伊,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,352評(píng)論 3 330
  • 文/蒙蒙 一摘刑、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧刻坊,春花似錦枷恕、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,934評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽楔敌。三九已至番宁,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間熔脂,已是汗流浹背绰疤。 一陣腳步聲響...
    開封第一講書人閱讀 33,052評(píng)論 1 270
  • 我被黑心中介騙來泰國打工铜犬, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留舞终,地道東北人轻庆。 一個(gè)月前我還...
    沈念sama閱讀 48,216評(píng)論 3 371
  • 正文 我出身青樓癣猾,卻偏偏與公主長得像,于是被迫代替她去往敵國和親余爆。 傳聞我的和親對(duì)象是個(gè)殘疾皇子纷宇,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,969評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容