-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from yanghaiji/demo
add SkywalkingApp ➕ 🆕
- Loading branch information
Showing
8 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>advanced-demo</artifactId> | ||
<groupId>com.javayh.advanced</groupId> | ||
<version>1.0.0.RELEASE</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>skywalking-demo</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.skywalking</groupId> | ||
<artifactId>apm-toolkit-logback-1.x</artifactId> | ||
<version>8.5.0</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
22 changes: 22 additions & 0 deletions
22
skywalking-demo/src/main/java/com.javayh.skywalking.demo/SkywalkingApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.javayh.skywalking.demo; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
/** | ||
* <p> | ||
* | ||
* </p> | ||
* | ||
* @author Dylan | ||
* @version 1.0.0 | ||
* @since 2021-12-24 | ||
*/ | ||
@SpringBootApplication | ||
public class SkywalkingApp { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(SkywalkingApp.class, args); | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
skywalking-demo/src/main/java/com.javayh.skywalking.demo/SkywalkingDemoWeb.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.javayh.skywalking.demo; | ||
|
||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
/** | ||
* <p> | ||
* | ||
* </p> | ||
* | ||
* @author Dylan | ||
* @version 1.0.0 | ||
* @since 2021-12-24 | ||
*/ | ||
@RestController | ||
public class SkywalkingDemoWeb { | ||
|
||
@GetMapping | ||
public String getMapping() { | ||
return "SkywalkingApp"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
server: | ||
port: 8090 | ||
|
||
spring: | ||
application: | ||
name: Skywalking-demo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<configuration scan="true" scanPeriod="60 seconds" debug="false"> | ||
<contextName>logback</contextName> | ||
<property name="Log_Home" value="logs/javayh"/> | ||
<!--输出到控制台--> | ||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> | ||
<pattern>%d [%thread] %-5level %logger{36} - %msg%n</pattern> | ||
<charset>UTF-8</charset> | ||
</encoder> | ||
</appender> | ||
<!--按天生成日志--> | ||
<appender name="logFile" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<Prudent>true</Prudent> | ||
<!-- 过滤器,只打印ERROR级别的日志 --> | ||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | ||
<!--日志文件输出的文件名--> | ||
<FileNamePattern> | ||
${Log_Home}/profile_%d{yyyy-MM-dd}.log | ||
</FileNamePattern> | ||
<!--日志文件保留天数--> | ||
<MaxHistory>7</MaxHistory> | ||
</rollingPolicy> | ||
<layout class="ch.qos.logback.classic.PatternLayout"> | ||
<Pattern> | ||
%d [%thread] %-5level %logger - %msg%n | ||
</Pattern> | ||
</layout> | ||
</appender> | ||
<appender name="msystem-log" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender"> | ||
<!-- 日志输出编码 --> | ||
<encoder> | ||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> | ||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | ||
<charset>UTF-8</charset> | ||
</encoder> | ||
</appender> | ||
<root level="INFO"> | ||
<appender-ref ref="console"/> | ||
<appender-ref ref="logFile"/> | ||
<appender-ref ref="msystem-log"/> | ||
</root> | ||
|
||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
# SkyWalking Agent配置 | ||
## 需要在启动的脚本里加入如下参数,请将skywalking-agent 的路径指定到自己的安装路径 | ||
# skywalking-agent 的具体位置 | ||
#-javaagent:./apache-skywalking-apm-bin/agent/skywalking-agent.jar | ||
# 服务名称 | ||
#-Dskywalking.agent.service_name=${you service_name} | ||
# 采集的后端地址 当机器不在一个服务上时需要指定 | ||
#-Dskywalking.collector.backend_service=127.0.0.1:11800 | ||
export SW_AGENT_NAME=skywalking-demo #Agent名字,一般使用`spring.application.name` | ||
export SW_AGENT_COLLECTOR_BACKEND_SERVICES=192.168.1.180:11800 #配置 Collector 地址。 | ||
export SW_AGENT_SPAN_LIMIT=2000 #配置链路的最大Span数量,默认为 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启动 | ||
|
||
|
||
|