参考
安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| export SKYWALKING_RELEASE_VERSION=4.5.0 export SKYWALKING_RELEASE_NAME=skywalking export SKYWALKING_RELEASE_NAMESPACE=skywalking
helm install "${SKYWALKING_RELEASE_NAME}" \ oci://registry-1.docker.io/apache/skywalking-helm \ --version "${SKYWALKING_RELEASE_VERSION}" \ -n "${SKYWALKING_RELEASE_NAMESPACE}" \ --set oap.image.tag=9.2.0 \ --set oap.storageType=elasticsearch \ --set ui.image.tag=9.2.0
http://10.193.36.41:30017
skywalking-skywalking-helm-oap.skywalking:11800 10.193.36.41:30018
|
应用改造
Dockerfile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| FROM harbor.dubhe:30002/dubhe-base/amazoncorretto:8u372
MAINTAINER dubhe
ENV TZ=Asia/Shanghai
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && \ echo $TZ > /etc/timezone && \ mkdir -p /app
WORKDIR /app
EXPOSE 8600
ADD ./dubhe-metadata/dubhe-metadata-biz/target/dubhe-metadata-biz.jar ./
ADD ./deploy/apache-skywalking-java-agent-8.16.0.tgz /
CMD java -Xms2048m -Xmx2048m -javaagent:/skywalking-agent/skywalking-agent.jar -jar dubhe-metadata-biz.jar
|
HelmChart
1 2 3 4 5
| env: - name: SW_AGENT_NAME value: dubhe-metadata - name: SW_AGENT_COLLECTOR_BACKEND_SERVICES value: skywalking-skywalking-helm-oap.skywalking:11800
|
忽略部分路径
- 拷贝skywalking-agent/optional-plugins目录中的apm-trace-ignore-plugin-8.13.0.jar到pulgins
- 在config目录中新建apm-trace-ignore-plugin.config文件存放忽略端点配置
apm-trace-ignore-plugin.config:
1
| trace.ignore_path=${SW_AGENT_TRACE_IGNORE_PATH:GET:/actuator,GET:/actuator/**,/actuator/**,/eureka/**,Druid/**,Mysql/**,Lettuce/**,Gson/**}
|
日志改造
pom.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| <dependency> <groupId>net.logstash.logback</groupId> <artifactId>logstash-logback-encoder</artifactId> <version>7.0.1</version> </dependency> <dependency> <groupId>org.apache.skywalking</groupId> <artifactId>apm-toolkit-trace</artifactId> <version>8.16.0</version> </dependency> <dependency> <groupId>org.apache.skywalking</groupId> <artifactId>apm-toolkit-logback-1.x</artifactId> <version>8.16.0</version> </dependency>
|
logback-springboot.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| <conversionRule conversionWord="tid" converterClass="org.apache.skywalking.apm.toolkit.log.logback.v1.x.LogbackPatternConverter"/> <conversionRule conversionWord="sw_ctx" converterClass="org.apache.skywalking.apm.toolkit.log.logback.v1.x.LogbackSkyWalkingContextPatternConverter"/>
<appender name="grpc-log" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender"> <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder"> <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.mdc.TraceIdMDCPatternLogbackLayout"> <Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%tid] [%thread] %-5level %logger{36} -%msg%n</Pattern> </layout> </encoder> </appender>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder"> <providers> <timestamp> <timeZone>UTC</timeZone> </timestamp> <pattern> <pattern> { "level": "%level", "tid": "%tid", "skyWalkingContext": "%sw_ctx", "thread": "%thread", "class": "%logger{1.}:%L", "message": "%message", "stackTrace": "%exception{10}" } </pattern> </pattern> </providers> </encoder> </appender>
|
本机临时测试
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| cd /Users/bluexiii/Documents/code/devops/dubhe-app/dubhe-metadata/dubhe-metadata-biz/target export NACOS_HOST=10.193.36.41 export NACOS_PORT=30101 export NACOS_USERNAME=nacos export NACOS_PASSWORD=nacos export SW_AGENT_NAME=dubhe-metadata export SW_AGENT_COLLECTOR_BACKEND_SERVICES=10.193.36.41:30018 export SW_AGENT_TRACE_IGNORE_PATH="GET:/actuator/**,Lettuce/**,Druid/**" java -javaagent:/Users/bluexiii/opt/skywalking-agent/skywalking-agent.jar -jar dubhe-metadata-biz.jar
CMD java -Xms2048m -Xmx2048m \ -Dskywalking.trace.ignore_path=\*/actuator/health,\*/actuator \ -javaagent:/Users/bluexiii/opt/skywalking-agent/skywalking-agent.jar \ -jar dubhe-metadata-biz.jar
|