Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.3.x'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/maven-ci.yml
#	cat-core/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
#	cat-home/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
#	docker/datasources.xml
#	docs/scripts/cat-init-3.3.0.sql
  • Loading branch information
guoyuanlu committed Sep 27, 2023
2 parents d747aa0 + 26f9cbd commit f887fa4
Show file tree
Hide file tree
Showing 26 changed files with 439 additions and 187 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/maven-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Build with Maven
run: |
chmod +x mvnw
./mvnw -ntp package -DskipTests -T 4C -s $GITHUB_WORKSPACE/settings.xml
./mvnw -ntp package -DskipTests -U -T 4C -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}

Expand All @@ -55,4 +55,4 @@ jobs:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_IMAGE: shiyindaxiaojie/cat-home
DOCKER_VERSION: 3.3.1
DOCKER_VERSION: v3.3.1
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ CAT 是美团点评开源的实时应用监控平台,提供了 `Tracsaction`

![](https://cdn.jsdelivr.net/gh/shiyindaxiaojie/images/cat/dashboard.png)

![](https://cdn.jsdelivr.net/gh/shiyindaxiaojie/images/cat/dashboard-app.png)
![](https://cdn.jsdelivr.net/gh/shiyindaxiaojie/images/cat/app-dashboard.png)

![](https://cdn.jsdelivr.net/gh/shiyindaxiaojie/images/cat/database-dashboard.png)

![](https://cdn.jsdelivr.net/gh/shiyindaxiaojie/images/cat/cache-dashboard.png)

![](https://cdn.jsdelivr.net/gh/shiyindaxiaojie/images/cat/rpc-dashboard.png)

#### Tracing

Expand Down Expand Up @@ -74,18 +80,24 @@ public Response listAsset(Cust cust) {

可以搜索某个 RPC 接口被调用的情况

![](https://cdn.jsdelivr.net/gh/shiyindaxiaojie/images/cat/cross.png)
![](https://cdn.jsdelivr.net/gh/shiyindaxiaojie/images/cat/rpc.png)

#### Heart Beat

![](https://cdn.jsdelivr.net/gh/shiyindaxiaojie/images/cat/heartbeat.png)

#### Dependency

相对 Zipkin 较为简陋,后续有空可以优化下

![](https://cdn.jsdelivr.net/gh/shiyindaxiaojie/images/cat/dependency.png)

#### Browser

![](https://cdn.jsdelivr.net/gh/shiyindaxiaojie/images/cat/browser.png)

#### Mobile

![](https://cdn.jsdelivr.net/gh/shiyindaxiaojie/images/cat/mobile.png)

#### State

查看当前 CAT 和应用节点的状态
Expand Down Expand Up @@ -116,11 +128,13 @@ public Response listAsset(Cust cust) {
本项目已发布到 [Docker Hub](https://hub.docker.com/repository/docker/shiyindaxiaojie/cat-home),请参考以下命令运行。

```bash
docker run -e JAVA_OPTS="-Xmx2g -Xms2g -Xmn1g" -e MYSQL_URL="127.0.0.1" -e MYSQL_PORT="3306" -e MYSQL_SCHEMA="cat" -e MYSQL_USERNAME="" -e MYSQL_PASSWD="" -e SERVER_URL="127.0.0.1" -p 8090:8090 --name=cat-home -d shiyindaxiaojie/cat-home
docker run -e MYSQL_URL="127.0.0.1" -e MYSQL_PORT="3306" -e MYSQL_SCHEMA="cat" -e MYSQL_USERNAME="" -e MYSQL_PASSWD="" -p 8080:8080 --name=cat-home -d shiyindaxiaojie/cat-home
```

## 如何部署

> 注意:除了 Helm 部署,在停止 CAT 进程之前最好调用 `curl http://localhost:8080/cat/r/home?op=checkpoint` ,将内存数据持久化磁盘,避免重启后丢失。

### Tomcat 部署

拷贝本项目的 `docs/config` 到用户目录 `~/.cat/appdatas/cat` 中,按需调整数据库配置。执行 `mvn clean package` 打包成cat-home.war,部署在目标 Tomcat 的 `webapps` 目录下,启动 Tomcat 即可。
Expand Down
2 changes: 1 addition & 1 deletion cat-alarm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.dianping.cat</groupId>
<artifactId>cat-parent</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>3.3.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cat-alarm</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion cat-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.dianping.cat</groupId>
<artifactId>cat-parent</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>3.3.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cat-client</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion cat-consumer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.dianping.cat</groupId>
<artifactId>cat-parent</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>3.3.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cat-consumer</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion cat-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.dianping.cat</groupId>
<artifactId>cat-parent</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>3.3.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cat-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@
import java.util.Collection;
import java.util.List;

import com.dianping.cat.config.app.*;
import com.dianping.cat.config.app.command.CommandFormatConfigManager;
import com.dianping.cat.config.app.command.DefaultCommandFormatlHandler;
import com.dianping.cat.config.web.AjaxDataTableProvider;
import com.dianping.cat.config.web.WebConfigManager;
import com.dianping.cat.config.web.WebSpeedConfigManager;
import com.dianping.cat.config.web.js.DefaultAggregationHandler;
import com.dianping.cat.config.web.url.DefaultUrlPatternHandler;
import com.dianping.cat.config.web.url.UrlPatternConfigManager;
import org.unidal.dal.jdbc.configuration.AbstractJdbcResourceConfigurator;
import org.unidal.lookup.configuration.Component;
import com.dianping.cat.CatConstants;
Expand Down Expand Up @@ -89,38 +80,17 @@ public List<Component> defineComponents() {

all.add(A(DefaultMessageHandler.class));

all.add(A(DefaultAggregationHandler.class));
all.add(A(DefaultCommandFormatlHandler.class));
all.add(A(CommandFormatConfigManager.class));
all.add(A(SampleConfigManager.class));
all.add(A(AppCommandConfigManager.class));
all.add(A(AppCommandGroupConfigManager.class));
all.add(A(WebConfigManager.class));
all.add(A(WebSpeedConfigManager.class));
all.add(A(AppSpeedConfigManager.class));
all.add(A(BusinessConfigManager.class));
all.add(A(MobileConfigManager.class));
all.add(A(CrashLogConfigManager.class));
all.add(A(SdkConfigManager.class));
all.add(A(ReportReloadConfigManager.class));

all.add(A(DefaultUrlPatternHandler.class));
all.add(A(UrlPatternConfigManager.class));

all.add(A(CatCoreModule.class));

all.addAll(defineStorageComponents());

all.add(A(RemoteServersManager.class));
all.add(A(ServersUpdaterManager.class));

all.add(A(AppCommandTableProvider.class));
all.add(A(AppConnectionTableProvider.class));
all.add(A(AppSpeedTableProvider.class));
all.add(A(AjaxDataTableProvider.class));
all.add(A(CrashLogTableProvider.class));
all.add(A(CrashLogContentTableProvider.class));

all.add(A(TpValueStatisticConfigManager.class));
all.add(A(AtomicMessageConfigManager.class));

Expand All @@ -130,9 +100,6 @@ public List<Component> defineComponents() {

all.addAll(new CatCoreDatabaseConfigurator().defineComponents());
all.addAll(new CatDatabaseConfigurator().defineComponents());
all.addAll(new AppDatabaseConfigurator().defineComponents());
all.addAll(new AppCrashDatabaseConfigurator().defineComponents());
all.addAll(new WebDatabaseConfigurator().defineComponents());

return all;
}
Expand Down
2 changes: 1 addition & 1 deletion cat-hadoop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.dianping.cat</groupId>
<artifactId>cat-parent</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>3.3.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cat-hadoop</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion cat-home/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.dianping.cat</groupId>
<artifactId>cat-parent</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>3.3.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cat-home</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,22 @@
import java.util.ArrayList;
import java.util.List;

import com.dianping.cat.build.report.*;
import org.unidal.dal.jdbc.configuration.AbstractJdbcResourceConfigurator;
import org.unidal.initialization.DefaultModuleManager;
import org.unidal.initialization.ModuleManager;
import org.unidal.lookup.configuration.Component;

import com.dianping.cat.CatConstants;
import com.dianping.cat.CatHomeModule;
import com.dianping.cat.build.report.DependencyComponentConfigurator;
import com.dianping.cat.build.report.EventComponentConfigurator;
import com.dianping.cat.build.report.HeartbeatComponentConfigurator;
import com.dianping.cat.build.report.MetricComponentConfigurator;
import com.dianping.cat.build.report.OfflineComponentConfigurator;
import com.dianping.cat.build.report.ProblemComponentConfigurator;
import com.dianping.cat.build.report.ReportComponentConfigurator;
import com.dianping.cat.build.report.StorageComponentConfigurator;
import com.dianping.cat.build.report.TransactionComponentConfigurator;
import com.dianping.cat.helper.JsonBuilder;
import com.dianping.cat.mvc.PayloadNormalizer;
import com.dianping.cat.report.HourlyReportContentTableProvider;
Expand Down Expand Up @@ -105,8 +113,6 @@ public List<Component> defineComponents() {
all.add(C(ModuleManager.class, DefaultModuleManager.class) //
.config(E("topLevelModules").value(CatHomeModule.ID)));

all.addAll(new AppComponentConfigurator().defineComponents());

all.addAll(new TransactionComponentConfigurator().defineComponents());

all.addAll(new EventComponentConfigurator().defineComponents());
Expand Down
19 changes: 14 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
FROM tomcat:8.5.78-jdk8

MAINTAINER gyl "shiyindaxiaojie@gmail.com"
LABEL maintainer="梦想歌 <shiyindaxiaojie@gmail.com>"
LABEL version="3.3.1"

ENV TZ="Asia/Shanghai" \
JAVA_OPTS='-Xmx1024m -Xms1024m -Xmn512m' \
WORKDIR='/usr/local/tomcat/bin' \
JVM_DEBUG='n' \
JVM_XMS='1g' \
JVM_XMX='1g' \
JVM_XMN='512m' \
JVM_MS='128m' \
JVM_MMS='320m' \
MYSQL_URL='' \
MYSQL_PORT='3306' \
MYSQL_USERNAME='' \
MYSQL_PASSWD='' \
MYSQL_PASSWORD='' \
MYSQL_SCHEMA='cat' \
SERVER_URL='127.0.0.1'

Expand All @@ -17,8 +24,10 @@ COPY docker/datasources.xml /data/appdatas/cat/datasources.xml
COPY docker/datasources.sh datasources.sh
COPY docker/client.xml /data/appdatas/cat/client.xml
COPY docker/client.sh client.sh
COPY docker/env.sh env.sh

RUN chmod +x datasources.sh \
&& chmod +x client.sh
&& chmod +x client.sh \
&& chmod +x env.sh

CMD ["/bin/sh", "-c", "./datasources.sh && ./client.sh && catalina.sh run"]
CMD ["/bin/sh", "-c", "./env.sh && ./datasources.sh && ./client.sh && catalina.sh run"]
2 changes: 1 addition & 1 deletion docker/datasources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ echo "initialize datasources.xml"
sed -i "s/MYSQL_URL/${MYSQL_URL}/g" /data/appdatas/cat/datasources.xml;
sed -i "s/MYSQL_PORT/${MYSQL_PORT}/g" /data/appdatas/cat/datasources.xml;
sed -i "s/MYSQL_USERNAME/${MYSQL_USERNAME}/g" /data/appdatas/cat/datasources.xml;
sed -i "s/MYSQL_PASSWD/${MYSQL_PASSWD}/g" /data/appdatas/cat/datasources.xml;
sed -i "s/MYSQL_PASSWORD/${MYSQL_PASSWORD}/g" /data/appdatas/cat/datasources.xml;
sed -i "s/MYSQL_SCHEMA/${MYSQL_SCHEMA}/g" /data/appdatas/cat/datasources.xml;
6 changes: 3 additions & 3 deletions docker/datasources.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<driver>com.mysql.jdbc.Driver</driver>
<url><![CDATA[jdbc:mysql://MYSQL_URL:MYSQL_PORT/MYSQL_SCHEMA]]></url>
<user>MYSQL_USERNAME</user>
<password>MYSQL_PASSWD</password>
<password>MYSQL_PASSWORD</password>
<connectionProperties><![CDATA[useUnicode=true&autoReconnect=true&socketTimeout=120000]]></connectionProperties>
</properties>
</data-source>
Expand All @@ -23,7 +23,7 @@
<driver>com.mysql.jdbc.Driver</driver>
<url><![CDATA[jdbc:mysql://MYSQL_URL:MYSQL_PORT/MYSQL_SCHEMA]]></url>
<user>MYSQL_USERNAME</user>
<password>MYSQL_PASSWD</password>
<password>MYSQL_PASSWORD</password>
<connectionProperties><![CDATA[useUnicode=true&autoReconnect=true&socketTimeout=120000]]></connectionProperties>
</properties>
</data-source>
Expand All @@ -36,7 +36,7 @@
<driver>com.mysql.jdbc.Driver</driver>
<url><![CDATA[jdbc:mysql://MYSQL_URL:MYSQL_PORT/MYSQL_SCHEMA]]></url>
<user>MYSQL_USERNAME</user>
<password>MYSQL_PASSWD</password>
<password>MYSQL_PASSWORD</password>
<connectionProperties><![CDATA[useUnicode=true&autoReconnect=true&socketTimeout=120000]]></connectionProperties>
</properties>
</data-source>
Expand Down
9 changes: 9 additions & 0 deletions docker/env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

JAVA_OPTS="${JAVA_OPTS} -XX:+UseG1GC"
JAVA_OPTS="${JAVA_OPTS} -server -Xms${JVM_XMS} -Xmx${JVM_XMX} -Xmn${JVM_XMN} -XX:MetaspaceSize=${JVM_MS} -XX:MaxMetaspaceSize=${JVM_MMS}"
JAVA_OPTS="${JAVA_OPTS} -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${WORKDIR}/logs/java_heapdump.hprof"
JAVA_OPTS="${JAVA_OPTS} -XX:-UseLargePages"
if [[ "${JVM_DEBUG}" == "y" ]]; then
JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n"
fi
Loading

0 comments on commit f887fa4

Please sign in to comment.