diff --git a/jcommon/aop/pom.xml b/jcommon/aop/pom.xml index de050eb32..bfa30b9a7 100644 --- a/jcommon/aop/pom.xml +++ b/jcommon/aop/pom.xml @@ -8,7 +8,7 @@ 1.4-jdk20-SNAPSHOT aop - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT javax.annotation diff --git a/jcommon/buddy/pom.xml b/jcommon/buddy/pom.xml index b10b99dc1..bd3f53258 100644 --- a/jcommon/buddy/pom.xml +++ b/jcommon/buddy/pom.xml @@ -33,7 +33,7 @@ org.projectlombok lombok - 1.18.28 + 1.18.30 provided diff --git a/jcommon/catPlugin/pom.xml b/jcommon/catPlugin/pom.xml index 75123ad29..d9b750c94 100644 --- a/jcommon/catPlugin/pom.xml +++ b/jcommon/catPlugin/pom.xml @@ -5,7 +5,7 @@ run.mone jcommon - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT catPlugin diff --git a/jcommon/codecheck/pom.xml b/jcommon/codecheck/pom.xml index 61aa086ac..44fe1a40e 100644 --- a/jcommon/codecheck/pom.xml +++ b/jcommon/codecheck/pom.xml @@ -8,7 +8,7 @@ 1.4-jdk20-SNAPSHOT codecheck - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT dom4j @@ -18,7 +18,7 @@ run.mone infra-result - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT org.apache.commons @@ -33,8 +33,8 @@ maven-compiler-plugin 3.11.0 - 20 - 20 + 21 + 21 UTF-8 --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED diff --git a/jcommon/codegen/pom.xml b/jcommon/codegen/pom.xml index f62fe5559..0498007e6 100644 --- a/jcommon/codegen/pom.xml +++ b/jcommon/codegen/pom.xml @@ -8,7 +8,7 @@ 1.4-jdk20-SNAPSHOT codegen - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT commons-io @@ -36,7 +36,7 @@ run.mone infra-result - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT thrift diff --git a/jcommon/common/pom.xml b/jcommon/common/pom.xml index c861f63da..65fe2d6c7 100644 --- a/jcommon/common/pom.xml +++ b/jcommon/common/pom.xml @@ -93,7 +93,7 @@ org.projectlombok lombok - 1.18.28 + 1.18.30 provided diff --git a/jcommon/crypto/pom.xml b/jcommon/crypto/pom.xml index 0f8b5083f..211fc718b 100644 --- a/jcommon/crypto/pom.xml +++ b/jcommon/crypto/pom.xml @@ -12,7 +12,7 @@ org.projectlombok lombok - 1.18.28 + 1.18.30 provided diff --git a/jcommon/docean-plugin/docean-plugin-akka/pom.xml b/jcommon/docean-plugin/docean-plugin-akka/pom.xml index 7d219be9a..1a8e5d08b 100644 --- a/jcommon/docean-plugin/docean-plugin-akka/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-akka/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-akka diff --git a/jcommon/docean-plugin/docean-plugin-aop/pom.xml b/jcommon/docean-plugin/docean-plugin-aop/pom.xml index 47b11c417..c19ba5632 100644 --- a/jcommon/docean-plugin/docean-plugin-aop/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-aop/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-aop diff --git a/jcommon/docean-plugin/docean-plugin-api/pom.xml b/jcommon/docean-plugin/docean-plugin-api/pom.xml index 8e85be8bd..b40699f2d 100644 --- a/jcommon/docean-plugin/docean-plugin-api/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-api/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-api diff --git a/jcommon/docean-plugin/docean-plugin-cat/pom.xml b/jcommon/docean-plugin/docean-plugin-cat/pom.xml index b549d08ec..446f9c85a 100644 --- a/jcommon/docean-plugin/docean-plugin-cat/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-cat/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-cat diff --git a/jcommon/docean-plugin/docean-plugin-classloader/pom.xml b/jcommon/docean-plugin/docean-plugin-classloader/pom.xml index 3e6addcb2..2912a792a 100644 --- a/jcommon/docean-plugin/docean-plugin-classloader/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-classloader/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-classloader diff --git a/jcommon/docean-plugin/docean-plugin-config/pom.xml b/jcommon/docean-plugin/docean-plugin-config/pom.xml index 1e427a5a0..05963f094 100644 --- a/jcommon/docean-plugin/docean-plugin-config/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-config/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-config diff --git a/jcommon/docean-plugin/docean-plugin-configuration/pom.xml b/jcommon/docean-plugin/docean-plugin-configuration/pom.xml index 49345c7a3..ad4d759ea 100644 --- a/jcommon/docean-plugin/docean-plugin-configuration/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-configuration/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-configuration @@ -16,7 +16,7 @@ run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT compile diff --git a/jcommon/docean-plugin/docean-plugin-datasource-serverless/pom.xml b/jcommon/docean-plugin/docean-plugin-datasource-serverless/pom.xml index fe323b51c..247518d2d 100644 --- a/jcommon/docean-plugin/docean-plugin-datasource-serverless/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-datasource-serverless/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-datasource-serverless @@ -16,7 +16,7 @@ run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT diff --git a/jcommon/docean-plugin/docean-plugin-datasource/pom.xml b/jcommon/docean-plugin/docean-plugin-datasource/pom.xml index 1cf7c14a2..2a8925722 100644 --- a/jcommon/docean-plugin/docean-plugin-datasource/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-datasource/pom.xml @@ -5,14 +5,14 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-datasource run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT com.mchange diff --git a/jcommon/docean-plugin/docean-plugin-db/pom.xml b/jcommon/docean-plugin/docean-plugin-db/pom.xml index 7d20afb33..928e87fea 100644 --- a/jcommon/docean-plugin/docean-plugin-db/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-db/pom.xml @@ -5,19 +5,19 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-db run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-datasource - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone diff --git a/jcommon/docean-plugin/docean-plugin-dmesh/pom.xml b/jcommon/docean-plugin/docean-plugin-dmesh/pom.xml index 245b8fb16..57a4529b5 100644 --- a/jcommon/docean-plugin/docean-plugin-dmesh/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-dmesh/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-dmesh @@ -24,17 +24,17 @@ run.mone docean - 1.4-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-api - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone @@ -50,7 +50,7 @@ run.mone docean-plugin-db - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT provided diff --git a/jcommon/docean-plugin/docean-plugin-dubbo-serverless/pom.xml b/jcommon/docean-plugin/docean-plugin-dubbo-serverless/pom.xml index 223eb070d..2673792e8 100644 --- a/jcommon/docean-plugin/docean-plugin-dubbo-serverless/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-dubbo-serverless/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-dubbo-serverless @@ -16,7 +16,7 @@ run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone diff --git a/jcommon/docean-plugin/docean-plugin-dubbo/pom.xml b/jcommon/docean-plugin/docean-plugin-dubbo/pom.xml index 638eeea1e..c6dc8fe75 100644 --- a/jcommon/docean-plugin/docean-plugin-dubbo/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-dubbo/pom.xml @@ -5,14 +5,14 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-dubbo run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone diff --git a/jcommon/docean-plugin/docean-plugin-es-antlr4/pom.xml b/jcommon/docean-plugin/docean-plugin-es-antlr4/pom.xml index 85cb70b96..5f1458c1f 100644 --- a/jcommon/docean-plugin/docean-plugin-es-antlr4/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-es-antlr4/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-es-antlr4 @@ -22,7 +22,7 @@ run.mone es - 1.4-SNAPSHOT + 1.5-jdk21-SNAPSHOT compile diff --git a/jcommon/docean-plugin/docean-plugin-es/pom.xml b/jcommon/docean-plugin/docean-plugin-es/pom.xml index 032313bd2..706fc7b9e 100644 --- a/jcommon/docean-plugin/docean-plugin-es/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-es/pom.xml @@ -5,19 +5,19 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-es run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone es - 1.5-jdk20-SNAPSHOT + 1.5-jdk21-SNAPSHOT compile diff --git a/jcommon/docean-plugin/docean-plugin-etcd/pom.xml b/jcommon/docean-plugin/docean-plugin-etcd/pom.xml index 255dfead6..916f9b470 100644 --- a/jcommon/docean-plugin/docean-plugin-etcd/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-etcd/pom.xml @@ -5,14 +5,14 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-etcd run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT io.etcd diff --git a/jcommon/docean-plugin/docean-plugin-grpc/pom.xml b/jcommon/docean-plugin/docean-plugin-grpc/pom.xml index f55c317d1..b430e6456 100644 --- a/jcommon/docean-plugin/docean-plugin-grpc/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-grpc/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-grpc @@ -27,7 +27,7 @@ run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT diff --git a/jcommon/docean-plugin/docean-plugin-http-server/pom.xml b/jcommon/docean-plugin/docean-plugin-http-server/pom.xml index 0b811a0fc..06de21ffc 100644 --- a/jcommon/docean-plugin/docean-plugin-http-server/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-http-server/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-http-server @@ -16,12 +16,12 @@ run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT diff --git a/jcommon/docean-plugin/docean-plugin-http/pom.xml b/jcommon/docean-plugin/docean-plugin-http/pom.xml index d5d842f81..1b404281b 100644 --- a/jcommon/docean-plugin/docean-plugin-http/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-http/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-http diff --git a/jcommon/docean-plugin/docean-plugin-influxdb/pom.xml b/jcommon/docean-plugin/docean-plugin-influxdb/pom.xml index 8a00a904c..8db10237f 100644 --- a/jcommon/docean-plugin/docean-plugin-influxdb/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-influxdb/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-influxdb @@ -17,7 +17,7 @@ run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT diff --git a/jcommon/docean-plugin/docean-plugin-json/pom.xml b/jcommon/docean-plugin/docean-plugin-json/pom.xml index 2f799d4d3..a8b17d950 100644 --- a/jcommon/docean-plugin/docean-plugin-json/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-json/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-json diff --git a/jcommon/docean-plugin/docean-plugin-k8s/pom.xml b/jcommon/docean-plugin/docean-plugin-k8s/pom.xml index 4562b60e8..369a947e7 100644 --- a/jcommon/docean-plugin/docean-plugin-k8s/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-k8s/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-k8s @@ -17,7 +17,7 @@ run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT io.fabric8 diff --git a/jcommon/docean-plugin/docean-plugin-log/pom.xml b/jcommon/docean-plugin/docean-plugin-log/pom.xml index 144362d37..56cb73511 100644 --- a/jcommon/docean-plugin/docean-plugin-log/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-log/pom.xml @@ -5,14 +5,14 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-log run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT com.lmax diff --git a/jcommon/docean-plugin/docean-plugin-mesh-dubbo/pom.xml b/jcommon/docean-plugin/docean-plugin-mesh-dubbo/pom.xml index bb9529711..39544699c 100644 --- a/jcommon/docean-plugin/docean-plugin-mesh-dubbo/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-mesh-dubbo/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-mesh-dubbo diff --git a/jcommon/docean-plugin/docean-plugin-mongodb/pom.xml b/jcommon/docean-plugin/docean-plugin-mongodb/pom.xml index 34f0a8396..f1d5f0fb6 100644 --- a/jcommon/docean-plugin/docean-plugin-mongodb/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-mongodb/pom.xml @@ -5,14 +5,14 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-mongodb run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT org.mongodb @@ -22,7 +22,7 @@ run.mone catPlugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT diff --git a/jcommon/docean-plugin/docean-plugin-mvc/pom.xml b/jcommon/docean-plugin/docean-plugin-mvc/pom.xml index 32773fe1e..da153dd0a 100644 --- a/jcommon/docean-plugin/docean-plugin-mvc/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-mvc/pom.xml @@ -5,14 +5,14 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-mvc run.mone docean-plugin-nacos - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT diff --git a/jcommon/docean-plugin/docean-plugin-mybatis-plus/pom.xml b/jcommon/docean-plugin/docean-plugin-mybatis-plus/pom.xml index 9ff84cf46..148aa9fd8 100644 --- a/jcommon/docean-plugin/docean-plugin-mybatis-plus/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-mybatis-plus/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-mybatis-plus @@ -16,17 +16,17 @@ run.mone docean-plugin-datasource - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-cat - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT com.mchange diff --git a/jcommon/docean-plugin/docean-plugin-mybatis/pom.xml b/jcommon/docean-plugin/docean-plugin-mybatis/pom.xml index 6ec75d217..8a3ac817e 100644 --- a/jcommon/docean-plugin/docean-plugin-mybatis/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-mybatis/pom.xml @@ -5,10 +5,9 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-mybatis - 1.4.8-jdk20-SNAPSHOT com.alibaba @@ -19,18 +18,18 @@ run.mone docean-plugin-datasource - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT provided run.mone docean-plugin-cat - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT org.mybatis diff --git a/jcommon/docean-plugin/docean-plugin-nacos/pom.xml b/jcommon/docean-plugin/docean-plugin-nacos/pom.xml index bd87309df..095189f06 100644 --- a/jcommon/docean-plugin/docean-plugin-nacos/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-nacos/pom.xml @@ -5,14 +5,14 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-nacos run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone diff --git a/jcommon/docean-plugin/docean-plugin-redis/pom.xml b/jcommon/docean-plugin/docean-plugin-redis/pom.xml index ea847443a..c314a0113 100644 --- a/jcommon/docean-plugin/docean-plugin-redis/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-redis/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-redis @@ -18,7 +18,7 @@ run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT redis.clients diff --git a/jcommon/docean-plugin/docean-plugin-rocketmq/pom.xml b/jcommon/docean-plugin/docean-plugin-rocketmq/pom.xml index 8d738804a..ec26a793e 100644 --- a/jcommon/docean-plugin/docean-plugin-rocketmq/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-rocketmq/pom.xml @@ -5,15 +5,14 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-rocketmq - 1.4.1-jdk20-SNAPSHOT run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT com.alibaba diff --git a/jcommon/docean-plugin/docean-plugin-rpc/pom.xml b/jcommon/docean-plugin/docean-plugin-rpc/pom.xml index 16ec0e0fc..291ef2348 100644 --- a/jcommon/docean-plugin/docean-plugin-rpc/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-rpc/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-rpc @@ -16,12 +16,12 @@ run.mone rpc - 1.7-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT diff --git a/jcommon/docean-plugin/docean-plugin-sentinel/pom.xml b/jcommon/docean-plugin/docean-plugin-sentinel/pom.xml index afb4d7ff5..6b98a5a12 100644 --- a/jcommon/docean-plugin/docean-plugin-sentinel/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-sentinel/pom.xml @@ -5,14 +5,14 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-sentinel run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone diff --git a/jcommon/docean-plugin/docean-plugin-shardingSphere/pom.xml b/jcommon/docean-plugin/docean-plugin-shardingSphere/pom.xml index 2f1bd0628..76f2d7a32 100644 --- a/jcommon/docean-plugin/docean-plugin-shardingSphere/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-shardingSphere/pom.xml @@ -5,19 +5,19 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-shardingSphere run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-datasource - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone diff --git a/jcommon/docean-plugin/docean-plugin-sidecar/pom.xml b/jcommon/docean-plugin/docean-plugin-sidecar/pom.xml index 86dc31f19..b0a171491 100644 --- a/jcommon/docean-plugin/docean-plugin-sidecar/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-sidecar/pom.xml @@ -5,11 +5,10 @@ run.mone jcommon - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT ../../pom.xml docean-plugin-sidecar - 1.4.2-jdk20-SNAPSHOT 8 8 @@ -18,7 +17,7 @@ run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone @@ -28,7 +27,7 @@ run.mone grpc - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT api @@ -39,7 +38,7 @@ run.mone infra-result - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT provided diff --git a/jcommon/docean-plugin/docean-plugin-spring/pom.xml b/jcommon/docean-plugin/docean-plugin-spring/pom.xml index 9b9670c1c..ef7b75c55 100644 --- a/jcommon/docean-plugin/docean-plugin-spring/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-spring/pom.xml @@ -5,7 +5,7 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-spring diff --git a/jcommon/docean-plugin/docean-plugin-sql/pom.xml b/jcommon/docean-plugin/docean-plugin-sql/pom.xml index dc7244d44..899309638 100644 --- a/jcommon/docean-plugin/docean-plugin-sql/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-sql/pom.xml @@ -5,24 +5,24 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-sql run.mone docean-plugin-api - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-datasource - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT diff --git a/jcommon/docean-plugin/docean-plugin-test/pom.xml b/jcommon/docean-plugin/docean-plugin-test/pom.xml index 318e75249..c43d03cd7 100644 --- a/jcommon/docean-plugin/docean-plugin-test/pom.xml +++ b/jcommon/docean-plugin/docean-plugin-test/pom.xml @@ -5,14 +5,14 @@ run.mone docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-plugin-test run.mone docean - 1.4-SNAPSHOT + 1.4-jdk21-SNAPSHOT org.msgpack @@ -22,102 +22,102 @@ run.mone docean-plugin-api - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-config - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-db - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-spring - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-rpc - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-dubbo - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-nacos - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-http - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-rocketmq - 1.4.1-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-sql - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-aop - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-json - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-redis - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-mybatis - 1.4-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-datasource - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-log - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-mvc - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-dmesh - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-sidecar - 1.4-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone docean-plugin-http-server - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT diff --git a/jcommon/docean-plugin/docean-plugin-test/src/test/java/com/xiaomi/youpin/docean/plugin/test/ConfigPluginTest.java b/jcommon/docean-plugin/docean-plugin-test/src/test/java/com/xiaomi/youpin/docean/plugin/test/ConfigPluginTest.java new file mode 100644 index 000000000..4c226d576 --- /dev/null +++ b/jcommon/docean-plugin/docean-plugin-test/src/test/java/com/xiaomi/youpin/docean/plugin/test/ConfigPluginTest.java @@ -0,0 +1,22 @@ +package com.xiaomi.youpin.docean.plugin.test; + +import com.xiaomi.youpin.docean.Ioc; +import com.xiaomi.youpin.docean.plugin.test.config.ConfigService; +import org.junit.Test; + +/** + * @author goodjava@qq.com + * @date 2023/12/8 13:46 + */ +public class ConfigPluginTest { + + + @Test + public void testConfigPlugin() { + Ioc ioc = Ioc.ins().init("com.xiaomi.youpin.docean.plugin.test.config","com.xiaomi.youpin.docean.plugin.config"); + ConfigService configService = ioc.getBean(ConfigService.class); + System.out.println(configService.getVal()); + System.out.println(configService.hi()); + } + +} diff --git a/jcommon/docean-plugin/docean-plugin-test/src/test/java/com/xiaomi/youpin/docean/plugin/test/config/ConfigService.java b/jcommon/docean-plugin/docean-plugin-test/src/test/java/com/xiaomi/youpin/docean/plugin/test/config/ConfigService.java new file mode 100644 index 000000000..1514888bb --- /dev/null +++ b/jcommon/docean-plugin/docean-plugin-test/src/test/java/com/xiaomi/youpin/docean/plugin/test/config/ConfigService.java @@ -0,0 +1,30 @@ +package com.xiaomi.youpin.docean.plugin.test.config; + +import com.xiaomi.youpin.docean.anno.Service; +import com.xiaomi.youpin.docean.plugin.config.anno.Value; +import lombok.Getter; + +import javax.annotation.Resource; + +/** + * @author goodjava@qq.com + * @date 2023/12/8 13:47 + */ + +@Service +public class ConfigService { + + @Resource(name = "^ddd") + private Demo demo; + + @Getter + @Value("$ddd") + private String val; + + public String hi() { + return demo.hi(); + } + + + +} diff --git a/jcommon/docean-plugin/docean-plugin-test/src/test/java/com/xiaomi/youpin/docean/plugin/test/config/Demo.java b/jcommon/docean-plugin/docean-plugin-test/src/test/java/com/xiaomi/youpin/docean/plugin/test/config/Demo.java new file mode 100644 index 000000000..f05bb2bb8 --- /dev/null +++ b/jcommon/docean-plugin/docean-plugin-test/src/test/java/com/xiaomi/youpin/docean/plugin/test/config/Demo.java @@ -0,0 +1,16 @@ +package com.xiaomi.youpin.docean.plugin.test.config; + +import com.xiaomi.youpin.docean.anno.Component; + +/** + * @author goodjava@qq.com + * @date 2023/12/8 14:04 + */ +@Component +public class Demo { + + public String hi() { + return "hi"; + } + +} diff --git a/jcommon/docean-plugin/docean-plugin-test/src/test/resources/config.properties b/jcommon/docean-plugin/docean-plugin-test/src/test/resources/config.properties index d2cfaaa0a..91f22526a 100644 --- a/jcommon/docean-plugin/docean-plugin-test/src/test/resources/config.properties +++ b/jcommon/docean-plugin/docean-plugin-test/src/test/resources/config.properties @@ -54,3 +54,6 @@ influx_rententionPolicy=1h #uds_path=/tmp/test.sock #uds_app=test_app + +val=123 +ddd=com.xiaomi.youpin.docean.plugin.test.config.Demo diff --git a/jcommon/docean-plugin/pom.xml b/jcommon/docean-plugin/pom.xml index e66643554..9ecc0a8cb 100644 --- a/jcommon/docean-plugin/pom.xml +++ b/jcommon/docean-plugin/pom.xml @@ -8,7 +8,7 @@ 1.4-jdk20-SNAPSHOT docean-plugin - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT pom docean-plugin-aop @@ -52,7 +52,7 @@ run.mone docean - 1.4-SNAPSHOT + 1.4-jdk21-SNAPSHOT diff --git a/jcommon/docean-spring-starter/pom.xml b/jcommon/docean-spring-starter/pom.xml index dcc4f1173..f16f479bc 100644 --- a/jcommon/docean-spring-starter/pom.xml +++ b/jcommon/docean-spring-starter/pom.xml @@ -8,6 +8,7 @@ jcommon 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT docean-spring-starter @@ -31,7 +32,7 @@ run.mone docean - 1.4-java20-SNAPSHOT + 1.4-jdk21-SNAPSHOT provided @@ -47,12 +48,11 @@ 3.11.0 - --add-modules=jdk.incubator.concurrent --enable-preview - 20 - 20 - 20 + 21 + 21 + 21 diff --git a/jcommon/docean/pom.xml b/jcommon/docean/pom.xml index 86378317b..464159cfb 100644 --- a/jcommon/docean/pom.xml +++ b/jcommon/docean/pom.xml @@ -8,7 +8,7 @@ 1.4-jdk20-SNAPSHOT docean - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT 4.1.97.Final @@ -16,7 +16,7 @@ run.mone easy - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT cglib @@ -58,12 +58,11 @@ 3.11.0 - --add-modules=jdk.incubator.concurrent --enable-preview - 20 - 20 - 20 + 21 + 21 + 21 diff --git a/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/Ioc.java b/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/Ioc.java index 9c8781d10..308737084 100644 --- a/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/Ioc.java +++ b/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/Ioc.java @@ -307,7 +307,7 @@ public void removeBean(String name) { private void initIoc0(String name, Bean bean, Field field) { String realName = getRealName(name); Bean b = this.beans.get(realName); - + //If it is an implemented interface, check whether a unique implementation class can be matched. if (!Optional.ofNullable(b).isPresent() && getBean(Cons.AUTO_FIND_IMPL, "false").equals("true")) { Class clazz = field.getType(); @@ -334,8 +334,9 @@ private void initIoc0(String name, Bean bean, Field field) { } private String getRealName(String name) { - //替换成配置中的值 - if (name.startsWith("$")) { + //替换成配置中的值(Resource中的name) + if (name.startsWith("^")) { + name = "$" + name.substring(1); Bean bean = this.beans.get(name); if (null != bean) { return bean.getObj().toString(); diff --git a/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/Get.java b/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/Get.java index 2f5e929ae..4330d22a9 100644 --- a/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/Get.java +++ b/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/Get.java @@ -17,9 +17,7 @@ package com.xiaomi.youpin.docean.mvc; import com.google.gson.JsonArray; -import com.google.gson.JsonElement; import com.xiaomi.youpin.docean.anno.RequestParam; -import com.xiaomi.youpin.docean.exception.DoceanException; import com.xiaomi.youpin.docean.mvc.httpmethod.HttpMethodUtils; import io.netty.handler.codec.http.QueryStringDecoder; @@ -47,9 +45,11 @@ public static JsonArray getParams(HttpRequestMethod method, String uri) { RequestParam param = getRequestParam(it); String name = param.value(); if (!params.containsKey(name)) { - throw new DoceanException("Missing parameter:" + name); + array.add(""); +// throw new DoceanException("Missing parameter:" + name); + } else { + array.add(params.get(name)); } - array.add(params.get(name)); } }); return array; diff --git a/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/MvcRunnable.java b/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/MvcRunnable.java index c250a6493..20a94e674 100644 --- a/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/MvcRunnable.java +++ b/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/MvcRunnable.java @@ -14,7 +14,6 @@ import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; -import jdk.incubator.concurrent.ScopedValue; import lombok.extern.slf4j.Slf4j; import java.util.concurrent.ConcurrentHashMap; @@ -60,6 +59,7 @@ public MvcRunnable(Mvc mvc, HttpServerConfig config, ChannelHandlerContext ctx, this.request.setUri(httpRequest.uri()); this.context.setHeaders(this.request.getHeaders()); this.context.setVirtualThread(mvc.getMvcConfig().isVirtualThread()); + this.context.setPath(path); this.request.setMethod(method); this.request.setPath(path); this.request.setBody(body); diff --git a/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/common/MvcConst.java b/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/common/MvcConst.java index 2e81ca2c4..0d01c175d 100644 --- a/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/common/MvcConst.java +++ b/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/common/MvcConst.java @@ -1,7 +1,6 @@ package com.xiaomi.youpin.docean.mvc.common; import com.xiaomi.youpin.docean.mvc.MvcContext; -import jdk.incubator.concurrent.ScopedValue; /** * @author goodjava@qq.com diff --git a/jcommon/docean/src/test/java/com/xiaomi/youpin/docean/test/IocTest.java b/jcommon/docean/src/test/java/com/xiaomi/youpin/docean/test/IocTest.java index d25614da2..6759723f5 100644 --- a/jcommon/docean/src/test/java/com/xiaomi/youpin/docean/test/IocTest.java +++ b/jcommon/docean/src/test/java/com/xiaomi/youpin/docean/test/IocTest.java @@ -146,13 +146,12 @@ public void testIoc6() { @Test public void testIoc7() { - Ioc ioc = Ioc.ins() .putBean("$demoName", "com.xiaomi.youpin.docean.test.demo.mydemo.MyDemo1") .init("com.xiaomi.youpin.docean.test.demo.mydemo"); - DemoCall dc = ioc.getBean(DemoCall.class); System.out.println(dc.hi()); + System.out.println(dc.getVal()); } diff --git a/jcommon/docean/src/test/java/com/xiaomi/youpin/docean/test/ScopedTest.java b/jcommon/docean/src/test/java/com/xiaomi/youpin/docean/test/ScopedTest.java index cb82d7194..4d69b6904 100644 --- a/jcommon/docean/src/test/java/com/xiaomi/youpin/docean/test/ScopedTest.java +++ b/jcommon/docean/src/test/java/com/xiaomi/youpin/docean/test/ScopedTest.java @@ -1,9 +1,7 @@ package com.xiaomi.youpin.docean.test; import com.xiaomi.youpin.docean.test.bo.M; -import jdk.incubator.concurrent.ScopedValue; import lombok.SneakyThrows; -import org.checkerframework.checker.units.qual.C; import org.junit.Test; import java.util.concurrent.CountDownLatch; @@ -30,23 +28,21 @@ public void test1() { ScopedValue sv = ScopedValue.newInstance(); - IntStream.range(0, num).parallel().forEach(it -> { - pool.submit(() -> { - M m = new M(); - m.setId(it); - ScopedValue.where(sv, m).run(() -> { - try { - TimeUnit.SECONDS.sleep(1); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - i.incrementAndGet(); - System.out.println(sv.get().getId()); - latch.countDown(); - }); - + IntStream.range(0, num).parallel().forEach(it -> pool.submit(() -> { + M m = new M(); + m.setId(it); + ScopedValue.where(sv, m).run(() -> { + try { + TimeUnit.SECONDS.sleep(1); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + i.incrementAndGet(); + System.out.println(sv.get().getId()); + latch.countDown(); }); - }); + + })); latch.await(); ; System.out.println(i); diff --git a/jcommon/docean/src/test/java/com/xiaomi/youpin/docean/test/demo/mydemo/DefaultDemoInterface.java b/jcommon/docean/src/test/java/com/xiaomi/youpin/docean/test/demo/mydemo/DefaultDemoInterface.java new file mode 100644 index 000000000..81cde2590 --- /dev/null +++ b/jcommon/docean/src/test/java/com/xiaomi/youpin/docean/test/demo/mydemo/DefaultDemoInterface.java @@ -0,0 +1,17 @@ +package com.xiaomi.youpin.docean.test.demo.mydemo; + +import com.xiaomi.youpin.docean.anno.Component; + +/** + * @author wtt + * @version 1.0 + * @description + * @date 2023/11/20 10:19 + */ +@Component +public class DefaultDemoInterface implements DemoInterface { + @Override + public String hi() { + return "test"; + } +} diff --git a/jcommon/docean/src/test/java/com/xiaomi/youpin/docean/test/demo/mydemo/DemoCall.java b/jcommon/docean/src/test/java/com/xiaomi/youpin/docean/test/demo/mydemo/DemoCall.java index ef53068bb..fe00af668 100644 --- a/jcommon/docean/src/test/java/com/xiaomi/youpin/docean/test/demo/mydemo/DemoCall.java +++ b/jcommon/docean/src/test/java/com/xiaomi/youpin/docean/test/demo/mydemo/DemoCall.java @@ -1,6 +1,8 @@ package com.xiaomi.youpin.docean.test.demo.mydemo; import com.xiaomi.youpin.docean.anno.Service; +import lombok.Getter; +import org.springframework.beans.factory.annotation.Value; import javax.annotation.Resource; @@ -17,6 +19,14 @@ public class DemoCall { private MyDemo demo; + @Getter + @Value("$val") + private String val; + + @Resource + private DemoInterface demoInterface; + + //This is just an interface, but if it only has one implementation class, then Ioc will automatically find this unique implementation class. @Resource private ICall call; @@ -24,6 +34,7 @@ public class DemoCall { public String hi() { + System.out.println(demoInterface.hi()); return demo.hi(); } diff --git a/jcommon/docean/src/test/java/com/xiaomi/youpin/docean/test/demo/mydemo/DemoInterface.java b/jcommon/docean/src/test/java/com/xiaomi/youpin/docean/test/demo/mydemo/DemoInterface.java new file mode 100644 index 000000000..270b274a4 --- /dev/null +++ b/jcommon/docean/src/test/java/com/xiaomi/youpin/docean/test/demo/mydemo/DemoInterface.java @@ -0,0 +1,11 @@ +package com.xiaomi.youpin.docean.test.demo.mydemo; + +/** + * @author goodjava@qq.com + * @date 2023/11/18 14:50 + */ +public interface DemoInterface { + + String hi(); + +} diff --git a/jcommon/docean/src/test/resources/config.properties b/jcommon/docean/src/test/resources/config.properties index 0940249c2..cc623e74e 100644 --- a/jcommon/docean/src/test/resources/config.properties +++ b/jcommon/docean/src/test/resources/config.properties @@ -6,5 +6,7 @@ download_file_path=/tmp/v demoVo=com.xiaomi.youpin.docean.test.demo.DemoVo +val=123 + diff --git a/jcommon/easy/pom.xml b/jcommon/easy/pom.xml index 96afb7742..c192bbfac 100644 --- a/jcommon/easy/pom.xml +++ b/jcommon/easy/pom.xml @@ -8,6 +8,7 @@ 1.4-jdk20-SNAPSHOT easy + 1.4-jdk21-SNAPSHOT cglib diff --git a/jcommon/es/pom.xml b/jcommon/es/pom.xml index 734d620d9..c3a69291f 100644 --- a/jcommon/es/pom.xml +++ b/jcommon/es/pom.xml @@ -8,17 +8,7 @@ 1.4-jdk20-SNAPSHOT es - 1.5-jdk20-SNAPSHOT - - - ossrh - https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ - - - ossrh - https://s01.oss.sonatype.org/content/repositories/snapshots - - + 1.5-jdk21-SNAPSHOT org.elasticsearch.client @@ -72,8 +62,8 @@ maven-compiler-plugin 3.11.0 - 20 - 20 + 21 + 21 true UTF-8 diff --git a/jcommon/file/pom.xml b/jcommon/file/pom.xml index 3a9b97364..8f4a84f9a 100644 --- a/jcommon/file/pom.xml +++ b/jcommon/file/pom.xml @@ -9,7 +9,7 @@ 1.4-jdk20-SNAPSHOT file - + 1.4-jdk21-SNAPSHOT @@ -26,16 +26,13 @@ + org.apache.maven.plugins maven-compiler-plugin 3.11.0 - - --add-modules=jdk.incubator.concurrent - --enable-preview - - 20 - 20 - 20 + 21 + 21 + 21 diff --git a/jcommon/file/src/main/java/com/xiaomi/mone/file/LogFile.java b/jcommon/file/src/main/java/com/xiaomi/mone/file/LogFile.java index 05e8fe902..5f8b82b61 100644 --- a/jcommon/file/src/main/java/com/xiaomi/mone/file/LogFile.java +++ b/jcommon/file/src/main/java/com/xiaomi/mone/file/LogFile.java @@ -17,10 +17,10 @@ * @author goodjava@qq.com */ @Slf4j -public class LogFile implements ILogFile{ +public class LogFile implements ILogFile { @Getter - private String file; + private String file; private MoneRandomAccessFile raf; @@ -38,13 +38,15 @@ public class LogFile implements ILogFile{ @Getter private int beforePointerHashCode; - private long pointer; + @Getter + private volatile long pointer; //行号 private long lineNumber; //每次读取时文件的最大偏移量 - private long maxPointer; + @Getter + private volatile long maxPointer; private String md5; @@ -71,14 +73,14 @@ public LogFile(String file, ReadListener listener, long pointer, long lineNumber private void open() { try { - //日志文件进行切分时,减少FileNotFoundException概率 - TimeUnit.SECONDS.sleep(5); + //日志文件进行切分时,减少FileNotFoundException概率,这个应该删掉了,在使用前保证就好了,由于历史原因,降低了休眠时间 +// TimeUnit.SECONDS.sleep(1); //4kb this.raf = new MoneRandomAccessFile(file, "r", 1024 * 4); reOpen = false; reFresh = false; - } catch (InterruptedException e) { - log.error("open file InterruptedException", e); +// } catch (InterruptedException e) { +// log.error("open file InterruptedException", e); } catch (FileNotFoundException e) { log.error("open file FileNotFoundException", e); } catch (IOException e) { @@ -238,7 +240,7 @@ public String md5(String msg) { md.update(msg.getBytes()); byte[] digest = md.digest(); StringBuilder sb = new StringBuilder(2 * digest.length); - for(byte b : digest) { + for (byte b : digest) { sb.append(String.format("%02x", b & 0xff)); } return sb.toString().toUpperCase(); diff --git a/jcommon/file/src/main/java/com/xiaomi/mone/file/LogFile2.java b/jcommon/file/src/main/java/com/xiaomi/mone/file/LogFile2.java index 83e12ca20..27a921211 100644 --- a/jcommon/file/src/main/java/com/xiaomi/mone/file/LogFile2.java +++ b/jcommon/file/src/main/java/com/xiaomi/mone/file/LogFile2.java @@ -46,7 +46,7 @@ public class LogFile2 implements ILogFile { private int beforePointerHashCode; @Setter - private long pointer; + private volatile long pointer; //行号 private long lineNumber; @@ -79,6 +79,15 @@ public LogFile2(String file) { this.pointer = readPointer(); } + public LogFile2(String file, long pointer, long lineNumber) { + this.file = file; + File f = new File(this.file); + this.fileKey = FileUtils.fileKey(f); + this.md5 = md5(file); + this.pointer = pointer; + this.lineNumber = lineNumber; + } + public LogFile2(String file, ReadListener listener, long pointer, long lineNumber) { this.file = file; @@ -114,6 +123,7 @@ public void readLine() throws IOException { } catch (Exception e) { log.error("file.length() IOException, file:{}", this.file, e); } + log.info("rel open file:{},pointer:{}", file, this.pointer); raf.seek(pointer); while (true) { @@ -164,7 +174,6 @@ public void readLine() throws IOException { continue; } - try { pointer = raf.getFilePointer(); maxPointer = raf.length(); @@ -184,8 +193,8 @@ public void readLine() throws IOException { } raf.close(); if (stop) { - log.info("stop:{}", this.file); - FileInfoCache.ins().put(this.fileKey.toString(), FileInfo.builder().pointer(this.pointer).build()); + log.info("stop:{},pointer:{},fileKey:{}", this.file, this.pointer, this.fileKey); + FileInfoCache.ins().put(this.fileKey.toString(), FileInfo.builder().pointer(this.pointer).fileName(this.file).build()); break; } } @@ -235,11 +244,16 @@ private boolean contentHasCutting(String line) throws IOException { return false; } + public void saveProgress() { + if (!stop) { + FileInfoCache.ins().put(this.fileKey.toString(), FileInfo.builder().pointer(this.pointer).fileName(this.file).build()); + } + } public void shutdown() { try { this.stop = true; - FileInfoCache.ins().put(this.fileKey.toString(), FileInfo.builder().pointer(this.pointer).build()); + FileInfoCache.ins().put(this.fileKey.toString(), FileInfo.builder().pointer(this.pointer).fileName(this.file).build()); } catch (Throwable ex) { log.error(ex.getMessage()); } diff --git a/jcommon/file/src/main/java/com/xiaomi/mone/file/MLog.java b/jcommon/file/src/main/java/com/xiaomi/mone/file/MLog.java index bf0807914..2f83fca3c 100644 --- a/jcommon/file/src/main/java/com/xiaomi/mone/file/MLog.java +++ b/jcommon/file/src/main/java/com/xiaomi/mone/file/MLog.java @@ -24,6 +24,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import java.util.concurrent.locks.ReentrantLock; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -43,6 +44,8 @@ public class MLog { */ private Pattern customLinePattern; + private ReentrantLock lock = new ReentrantLock(); + /** * 匹配 20xx or [20xx */ @@ -52,8 +55,7 @@ public class MLog { /** * 最多聚合200行错误栈,避免queue无限增长 */ - private static final int MAX_MERGE_LINE = 200; - private byte[] lock = new byte[0]; + private static final int MAX_MERGE_LINE = 400; @Deprecated public List append(String msg) { @@ -61,7 +63,8 @@ public List append(String msg) { List res = new ArrayList<>(); boolean isNew = isNew(msg); if (isNew) { - synchronized (lock) { + try { + lock.lock(); if (msgQueue.size() > 0) { String e = msgQueue.stream().collect(Collectors.joining("\r\n")); res.add(e); @@ -69,9 +72,12 @@ public List append(String msg) { } //消息入队列 msgQueue.offer(msg); + } finally { + lock.unlock(); } } else { - synchronized (lock) { + try { + lock.lock(); //最大错误栈行数判断 if (msgQueue.size() >= MAX_MERGE_LINE) { String e = msgQueue.stream().collect(Collectors.joining("\r\n")); @@ -80,6 +86,8 @@ public List append(String msg) { } //消息入队列 msgQueue.offer(msg); + } finally { + lock.unlock(); } } @@ -91,16 +99,21 @@ public String append2(String msg) { String res = null; boolean isNew = isNew(msg); if (isNew) { - synchronized (lock) { + + try { + lock.lock(); if (msgQueue.size() > 0) { res = msgQueue.stream().collect(Collectors.joining("\r\n")); msgQueue.clear(); } //消息入队列 msgQueue.offer(msg); + } finally { + lock.unlock(); } } else { - synchronized (lock) { + try { + lock.lock(); //最大错误栈行数判断 if (msgQueue.size() >= MAX_MERGE_LINE) { res = msgQueue.stream().collect(Collectors.joining("\r\n")); @@ -108,6 +121,8 @@ public String append2(String msg) { } //消息入队列 msgQueue.offer(msg); + } finally { + lock.unlock(); } } @@ -122,26 +137,30 @@ public String append2(String msg) { @Deprecated public List takeRemainMsg() { List res = new ArrayList<>(); - synchronized (lock) { + try { + lock.lock(); if (msgQueue.size() > 0) { String e = msgQueue.stream().collect(Collectors.joining("\r\n")); res.add(e); msgQueue.clear(); } + } finally { + lock.unlock(); } - return res; } public String takeRemainMsg2() { String res = null; - synchronized (lock) { + try { + lock.lock(); if (msgQueue.size() > 0) { res = msgQueue.stream().collect(Collectors.joining("\r\n")); msgQueue.clear(); } + } finally { + lock.unlock(); } - return res; } diff --git a/jcommon/file/src/main/java/com/xiaomi/mone/file/ReadListener.java b/jcommon/file/src/main/java/com/xiaomi/mone/file/ReadListener.java index 2f5d10ee9..0329b66bf 100644 --- a/jcommon/file/src/main/java/com/xiaomi/mone/file/ReadListener.java +++ b/jcommon/file/src/main/java/com/xiaomi/mone/file/ReadListener.java @@ -34,4 +34,7 @@ default void setPointer(Object obj) { } + default void saveProgress() { + } + } diff --git a/jcommon/file/src/main/java/com/xiaomi/mone/file/common/FileInfo.java b/jcommon/file/src/main/java/com/xiaomi/mone/file/common/FileInfo.java index 98ac9bd68..7a50f817e 100644 --- a/jcommon/file/src/main/java/com/xiaomi/mone/file/common/FileInfo.java +++ b/jcommon/file/src/main/java/com/xiaomi/mone/file/common/FileInfo.java @@ -13,4 +13,6 @@ public class FileInfo { private long pointer; + private String fileName; + } diff --git a/jcommon/file/src/main/java/com/xiaomi/mone/file/common/FileInfoCache.java b/jcommon/file/src/main/java/com/xiaomi/mone/file/common/FileInfoCache.java index c9b395ad9..968a5a83a 100644 --- a/jcommon/file/src/main/java/com/xiaomi/mone/file/common/FileInfoCache.java +++ b/jcommon/file/src/main/java/com/xiaomi/mone/file/common/FileInfoCache.java @@ -3,35 +3,40 @@ import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import lombok.Setter; import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; import java.io.File; +import java.io.FileWriter; import java.lang.reflect.Type; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Map; +import java.util.concurrent.ConcurrentMap; /** * @author goodjava@qq.com * @date 2023/9/26 11:50 */ +@Slf4j public class FileInfoCache { + private Cache cache = CacheBuilder.newBuilder().maximumSize(50000).build(); - private Cache cache = CacheBuilder.newBuilder().maximumSize(10000).build(); - - private Gson gson = new Gson(); + private Gson gson = new GsonBuilder().setLenient().create(); @Setter private String filePath = "/tmp/.ozhera_pointer"; + private volatile boolean loaded = false; + private static final class LazyHolder { private static final FileInfoCache ins = new FileInfoCache(); } - public static final FileInfoCache ins() { return LazyHolder.ins; } @@ -45,15 +50,26 @@ public FileInfo get(String key) { return cache.getIfPresent(key); } + public void remove(String key) { + cache.invalidate(key); + } + + public ConcurrentMap caches() { + return cache.asMap(); + } + @SneakyThrows public void shutdown() { String str = gson.toJson(cache.asMap()); - Files.write(Paths.get(filePath), str.getBytes()); + FileWriter writer = new FileWriter(filePath, false); + writer.append(str); + writer.flush(); } @SneakyThrows public void load() { - if (new File(filePath).exists()) { + if (!loaded && new File(filePath).exists()) { + loaded = true; String str = new String(Files.readAllBytes(Paths.get(filePath))); Type typeOfT = new TypeToken>() { }.getType(); diff --git a/jcommon/file/src/main/java/com/xiaomi/mone/file/listener/DefaultMonitorListener.java b/jcommon/file/src/main/java/com/xiaomi/mone/file/listener/DefaultMonitorListener.java index 5592c651f..5347cd10f 100644 --- a/jcommon/file/src/main/java/com/xiaomi/mone/file/listener/DefaultMonitorListener.java +++ b/jcommon/file/src/main/java/com/xiaomi/mone/file/listener/DefaultMonitorListener.java @@ -2,13 +2,17 @@ import com.xiaomi.mone.file.LogFile2; import com.xiaomi.mone.file.ReadEvent; +import com.xiaomi.mone.file.ReadListener; import com.xiaomi.mone.file.common.SafeRun; import com.xiaomi.mone.file.event.EventListener; import com.xiaomi.mone.file.event.EventType; import com.xiaomi.mone.file.event.FileEvent; import com.xiaomi.mone.file.ozhera.HeraFileMonitor; +import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.function.Consumer; @@ -24,6 +28,9 @@ public class DefaultMonitorListener implements EventListener { private Consumer consumer; + @Getter + private List readListenerList = new CopyOnWriteArrayList<>(); + private ExecutorService pool = Executors.newVirtualThreadPerTaskExecutor(); public DefaultMonitorListener(HeraFileMonitor monitor, Consumer consumer) { @@ -36,9 +43,11 @@ public void onEvent(FileEvent event) { if (event.getType().equals(EventType.init)) { log.info("log file:{}", event.getFileName()); LogFile2 logFile = new LogFile2(event.getFileName()); + OzHeraReadListener ozHeraReadListener = new OzHeraReadListener(monitor, logFile, consumer); + readListenerList.add(ozHeraReadListener); pool.submit(() -> { - logFile.setListener(new OzHeraReadListener(monitor, logFile, consumer)); - SafeRun.run(() -> logFile.readLine()); + logFile.setListener(ozHeraReadListener); + SafeRun.run(logFile::readLine); }); } @@ -58,10 +67,14 @@ public void onEvent(FileEvent event) { if (event.getType().equals(EventType.create)) { log.info("create:{}", event.getFileName()); - LogFile2 logFile = new LogFile2(event.getFileName()); + +// LogFile2 logFile = new LogFile2(event.getFileName()); + LogFile2 logFile = new LogFile2(event.getFileName(), 0, 0); + OzHeraReadListener ozHeraReadListener = new OzHeraReadListener(monitor, logFile, consumer); + readListenerList.add(ozHeraReadListener); pool.submit(() -> { - logFile.setListener(new OzHeraReadListener(monitor, logFile, consumer)); - SafeRun.run(() -> logFile.readLine()); + logFile.setListener(ozHeraReadListener); + SafeRun.run(logFile::readLine); }); } } diff --git a/jcommon/file/src/main/java/com/xiaomi/mone/file/listener/OzHeraReadListener.java b/jcommon/file/src/main/java/com/xiaomi/mone/file/listener/OzHeraReadListener.java index 1e8eca36a..e2b3c2d42 100644 --- a/jcommon/file/src/main/java/com/xiaomi/mone/file/listener/OzHeraReadListener.java +++ b/jcommon/file/src/main/java/com/xiaomi/mone/file/listener/OzHeraReadListener.java @@ -44,11 +44,17 @@ public boolean isContinue(String line) { return false; } + @Override + public void saveProgress() { + logFile.saveProgress(); + } + @Override public boolean isBreak(String line) { if (null == line) { HeraFile f = monitor.getMap().get(logFile.getFileKey()); if (null == f || f.getState().get() == 1) { + log.info("file isBreak,file:{},f:{}", logFile.getFile(), f); return true; } } diff --git a/jcommon/file/src/main/java/com/xiaomi/mone/file/ozhera/HeraFileMonitor.java b/jcommon/file/src/main/java/com/xiaomi/mone/file/ozhera/HeraFileMonitor.java index 124a52293..aa3a841b2 100644 --- a/jcommon/file/src/main/java/com/xiaomi/mone/file/ozhera/HeraFileMonitor.java +++ b/jcommon/file/src/main/java/com/xiaomi/mone/file/ozhera/HeraFileMonitor.java @@ -31,7 +31,6 @@ @Slf4j public class HeraFileMonitor { - @Getter private ConcurrentHashMap map = new ConcurrentHashMap<>(); @@ -92,7 +91,6 @@ public void reg(String path, Predicate predicate) throws IOException, In if (!predicate.test(filePath) || modifiedFile.getFileName().toString().startsWith(".")) { continue; } - log.debug("epoll result,path:{}", event.kind() + filePath); HeraFile hfile = fileMap.get(filePath); if (event.kind() == StandardWatchEventKinds.ENTRY_MODIFY) { @@ -111,17 +109,20 @@ public void reg(String path, Predicate predicate) throws IOException, In } if (event.kind() == StandardWatchEventKinds.ENTRY_CREATE) { - File file = new File(path + "" + modifiedFile.getFileName()); + File file = new File(filePath); Object k = FileUtils.fileKey(file); + if (map.containsKey(k)) { log.info("change name " + map.get(k) + "--->" + file); listener.onEvent(FileEvent.builder().fileKey(k).type(EventType.rename).build()); } else { + log.info("ENTRY_CREATE filePath:{},fileKey:{}", filePath, k); + HeraFile hf = HeraFile.builder().file(file).fileKey(k).fileName(filePath).build(); + map.putIfAbsent(k, hf); + fileMap.put(filePath, hf); + listener.onEvent(FileEvent.builder().type(EventType.create).fileName(file.getPath()).build()); } - HeraFile hf = HeraFile.builder().file(file).fileKey(k).fileName(filePath).build(); - map.putIfAbsent(k, hf); - fileMap.put(filePath, hf); } } key.reset(); @@ -136,9 +137,9 @@ private HeraFile initFile(File it) { if (name.startsWith(".")) { return null; } - Object fileKey = FileUtils.fileKey(it); lock.lock(); try { + Object fileKey = FileUtils.fileKey(it); if (map.containsKey(fileKey)) { return map.get(fileKey); } @@ -148,10 +149,13 @@ private HeraFile initFile(File it) { if (null != fi) { pointer = fi.getPointer(); } + log.info("initFile fileName:{},fileKey:{}", name, fileKey); map.put(hf.getFileKey(), hf); fileMap.put(hf.getFileName(), hf); this.listener.onEvent(FileEvent.builder().pointer(pointer).type(EventType.init).fileName(hf.getFileName()).build()); return hf; + } catch (Exception e) { + log.error("init file error,fileName:{}", name, e); } finally { lock.unlock(); } diff --git a/jcommon/graalvm/pom.xml b/jcommon/graalvm/pom.xml index 63f76ede7..4ae3a8015 100644 --- a/jcommon/graalvm/pom.xml +++ b/jcommon/graalvm/pom.xml @@ -27,7 +27,7 @@ org.projectlombok lombok - 1.18.28 + 1.18.30 provided diff --git a/jcommon/grpc/pom.xml b/jcommon/grpc/pom.xml index e08a05607..282275f55 100644 --- a/jcommon/grpc/pom.xml +++ b/jcommon/grpc/pom.xml @@ -8,6 +8,7 @@ 1.4-jdk20-SNAPSHOT grpc + 1.4-jdk21-SNAPSHOT javax.annotation diff --git a/jcommon/health/pom.xml b/jcommon/health/pom.xml index 56aa6531d..f65eea2dc 100644 --- a/jcommon/health/pom.xml +++ b/jcommon/health/pom.xml @@ -8,6 +8,7 @@ 1.4-jdk20-SNAPSHOT health + 1.4-jdk21-SNAPSHOT run.mone @@ -34,7 +35,7 @@ run.mone aop - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT diff --git a/jcommon/hera/hera-trace/pom.xml b/jcommon/hera/hera-trace/pom.xml index 0cf983252..b5fb4e6eb 100644 --- a/jcommon/hera/hera-trace/pom.xml +++ b/jcommon/hera/hera-trace/pom.xml @@ -8,4 +8,5 @@ 1.4-jdk20-SNAPSHOT hera-trace + 1.4-jdk21-SNAPSHOT diff --git a/jcommon/infra-result/pom.xml b/jcommon/infra-result/pom.xml index 98b418cc5..4c1086b1d 100644 --- a/jcommon/infra-result/pom.xml +++ b/jcommon/infra-result/pom.xml @@ -8,11 +8,12 @@ 1.4-jdk20-SNAPSHOT infra-result + 1.4-jdk21-SNAPSHOT org.projectlombok lombok - 1.18.28 + 1.18.30 provided diff --git a/jcommon/mistarter/pom.xml b/jcommon/mistarter/pom.xml index f0388b14a..e77db26a0 100644 --- a/jcommon/mistarter/pom.xml +++ b/jcommon/mistarter/pom.xml @@ -8,12 +8,12 @@ 1.4-jdk20-SNAPSHOT mistarter - 1.6-jdk20-SNAPSHOT + 1.6-jdk21-SNAPSHOT run.mone aop - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT org.springframework.boot @@ -24,7 +24,7 @@ run.mone health - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone diff --git a/jcommon/mquic/pom.xml b/jcommon/mquic/pom.xml index 9cdf9c14a..eb63fce7b 100644 --- a/jcommon/mquic/pom.xml +++ b/jcommon/mquic/pom.xml @@ -18,18 +18,13 @@ org.projectlombok lombok - 1.18.28 + 1.18.30 provided ch.qos.logback logback-classic - 1.1.2 - - - ch.qos.logback - logback-core - 1.1.2 + 1.2.3 diff --git a/jcommon/pom.xml b/jcommon/pom.xml index c52b7c002..e6bf86c2c 100644 --- a/jcommon/pom.xml +++ b/jcommon/pom.xml @@ -117,7 +117,7 @@ org.projectlombok lombok - 1.18.28 + 1.18.30 ch.qos.logback diff --git a/jcommon/prometheus/prometheus-sql/pom.xml b/jcommon/prometheus/prometheus-sql/pom.xml index 56ea053bf..b7192d819 100644 --- a/jcommon/prometheus/prometheus-sql/pom.xml +++ b/jcommon/prometheus/prometheus-sql/pom.xml @@ -24,7 +24,7 @@ org.projectlombok lombok - 1.18.28 + 1.18.30 compile diff --git a/jcommon/raft/pom.xml b/jcommon/raft/pom.xml index 34b6fbf85..ef472c95f 100644 --- a/jcommon/raft/pom.xml +++ b/jcommon/raft/pom.xml @@ -46,7 +46,7 @@ org.projectlombok lombok - 1.18.28 + 1.18.30 provided diff --git a/jcommon/rcurve/pom.xml b/jcommon/rcurve/pom.xml index 4314e3595..9709316f9 100644 --- a/jcommon/rcurve/pom.xml +++ b/jcommon/rcurve/pom.xml @@ -8,12 +8,12 @@ 1.4-jdk20-SNAPSHOT rcurve - 1.4.2-jdk20-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone hera-trace - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT io.protostuff @@ -39,7 +39,7 @@ run.mone easy - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT io.netty @@ -49,13 +49,7 @@ ch.qos.logback logback-classic - 1.1.2 - provided - - - ch.qos.logback - logback-core - 1.1.2 + 1.2.3 provided @@ -69,9 +63,9 @@ --enable-preview - 20 - 20 - 20 + 21 + 21 + 21 diff --git a/jcommon/rpc-codes/pom.xml b/jcommon/rpc-codes/pom.xml index f230abf0a..85189989b 100644 --- a/jcommon/rpc-codes/pom.xml +++ b/jcommon/rpc-codes/pom.xml @@ -8,6 +8,7 @@ 1.4-jdk20-SNAPSHOT rpc-codes + 1.4-jdk21-SNAPSHOT UTF-8 8 @@ -33,7 +34,7 @@ run.mone easy - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT io.netty diff --git a/jcommon/rpc/pom.xml b/jcommon/rpc/pom.xml index 996a4fcef..06cc19bbb 100644 --- a/jcommon/rpc/pom.xml +++ b/jcommon/rpc/pom.xml @@ -8,7 +8,7 @@ 1.4-jdk20-SNAPSHOT rpc - 1.7-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT javax.annotation @@ -19,12 +19,7 @@ ch.qos.logback logback-classic - 1.1.2 - - - ch.qos.logback - logback-core - 1.1.2 + 1.2.3 io.netty @@ -34,7 +29,7 @@ org.projectlombok lombok - 1.18.28 + 1.18.30 provided @@ -50,12 +45,12 @@ run.mone easy - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT run.mone rpc-codes - 1.4-jdk20-SNAPSHOT + 1.4-jdk21-SNAPSHOT diff --git a/jcommon/sre/pom.xml b/jcommon/sre/pom.xml index 52c577353..007a8f96a 100644 --- a/jcommon/sre/pom.xml +++ b/jcommon/sre/pom.xml @@ -17,7 +17,7 @@ org.projectlombok lombok - 1.18.28 + 1.18.30 provided diff --git a/ozburst-all/mimeter-dashboard/README.md b/ozburst-all/mimeter-dashboard/README.md new file mode 100644 index 000000000..6d30898fc --- /dev/null +++ b/ozburst-all/mimeter-dashboard/README.md @@ -0,0 +1 @@ +# 概述 \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/pom.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/pom.xml new file mode 100644 index 000000000..7b91d6731 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/pom.xml @@ -0,0 +1,43 @@ + + + + + mimeter-dashboard + run.mone + 1.0.0-SNAPSHOT + + 4.0.0 + + mimeter-dashboard-api + + + com.xiaomi.youpin + youpin-infra-rpc + 1.28-SNAPSHOT + provided + + + + com.xiaomi.mone + http-docs-core + 2.7.12-mone-v5-SNAPSHOT + provided + + + org.projectlombok + lombok + 1.18.24 + + + + com.xiaomi + dayu-api + 0.3.1-SNAPSHOT + + + + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentApplyDTO.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentApplyDTO.java new file mode 100644 index 000000000..d4e8d1ba3 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentApplyDTO.java @@ -0,0 +1,32 @@ +package run.mone.mimeter.dashboard.bo.agent; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class AgentApplyDTO implements Serializable { + private Integer id; + + @HttpApiDocClassDefine(value = "applyUser", required = true, description = "申请人", defaultValue = "dzx") + private String applyUser; + + @HttpApiDocClassDefine(value = "applyOrgId", required = true, description = "申请组织id", defaultValue = "DSGKBW") + private String applyOrgId; + + @HttpApiDocClassDefine(value = "applyOrgName", required = true, description = "申请组织中文名", defaultValue = "研发效能组") + private String applyOrgName; + + @HttpApiDocClassDefine(value = "agentIp", required = true, description = "压测机ip", defaultValue = "127.0.0.1") + private String agentIp; + + @HttpApiDocClassDefine(value = "agentHostname", required = true, description = "主机名", defaultValue = "xdwqd") + private String agentHostname; + + @HttpApiDocClassDefine(value = "applyStatus", required = true, description = "申请状态", defaultValue = "0:待审核 1:审核完成 2:拒绝") + private Integer applyStatus; + + @HttpApiDocClassDefine(value = "ctime", required = true, description = "申请时间", defaultValue = "") + private Long ctime; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentApplyList.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentApplyList.java new file mode 100644 index 000000000..f58a7c918 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentApplyList.java @@ -0,0 +1,35 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.bo.agent; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; +import run.mone.mimeter.dashboard.bo.common.PageBase; + +import java.io.Serializable; +import java.util.List; + +@Data +public class AgentApplyList extends PageBase implements Serializable { + + /** + * 返回的信息列表 + */ + @HttpApiDocClassDefine(value = "list", required = false, description = "申请记录列表") + private List list; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentApplyReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentApplyReq.java new file mode 100644 index 000000000..c015c0a8d --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentApplyReq.java @@ -0,0 +1,16 @@ +package run.mone.mimeter.dashboard.bo.agent; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class AgentApplyReq implements Serializable { + @HttpApiDocClassDefine(value = "agentIDs", required = true, description = "发压机Id列表", defaultValue = "") + List agentIDs; + + @HttpApiDocClassDefine(value = "applier", ignore = true) + String applier; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentDTO.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentDTO.java new file mode 100644 index 000000000..25532abeb --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentDTO.java @@ -0,0 +1,42 @@ +package run.mone.mimeter.dashboard.bo.agent; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class AgentDTO implements Serializable { + + private Integer id; + + private String serverName; + + private String ip; + + private Integer port; + + private Integer cpu; + + private Long mem; + + private Integer useCpu; + + private Long useMem; + + private String hostname; + + private String clientDesc; + + private Long ctime; + + private Long utime; + + private Boolean enable; + + private String tenant; + + private String tenantCn; + + private List domainConfs; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentDTOList.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentDTOList.java new file mode 100644 index 000000000..fb4f939b7 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentDTOList.java @@ -0,0 +1,35 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.bo.agent; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; +import run.mone.mimeter.dashboard.bo.common.PageBase; + +import java.io.Serializable; +import java.util.List; + +@Data +public class AgentDTOList extends PageBase implements Serializable { + + /** + * 返回的信息列表 + */ + @HttpApiDocClassDefine(value = "list", required = false, description = "发压机信息列表") + private List list; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentHostsConf.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentHostsConf.java new file mode 100644 index 000000000..45608c767 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentHostsConf.java @@ -0,0 +1,12 @@ +package run.mone.mimeter.dashboard.bo.agent; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class AgentHostsConf implements Serializable { + private String agentIp; + private List domainConfs; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentMonitorBo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentMonitorBo.java new file mode 100644 index 000000000..a09f33cb5 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentMonitorBo.java @@ -0,0 +1,13 @@ +package run.mone.mimeter.dashboard.bo.agent; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class AgentMonitorBo implements Serializable { + private Long fromTime; + private Long toTime; + private List agentMonitorInfos; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentMonitorInfo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentMonitorInfo.java new file mode 100644 index 000000000..c7351a004 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/AgentMonitorInfo.java @@ -0,0 +1,11 @@ +package run.mone.mimeter.dashboard.bo.agent; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class AgentMonitorInfo implements Serializable { + private String podIp; + private String nodeIp; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/ApplyStatusEnum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/ApplyStatusEnum.java new file mode 100644 index 000000000..5e29d0045 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/ApplyStatusEnum.java @@ -0,0 +1,22 @@ +package run.mone.mimeter.dashboard.bo.agent; + +public enum ApplyStatusEnum { + + UnAuditing(0, "UnAuditing"), + ApplyPass(1, "ApplyPass"), + + ApplyRefuse(2, "ApplyRefuse"), + + ; + + + + public final int statusCode; + public final String statusName; + + ApplyStatusEnum(int statusCode, String statusName) { + this.statusCode = statusCode; + this.statusName = statusName; + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DelHostForAgentsReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DelHostForAgentsReq.java new file mode 100644 index 000000000..485e9eaab --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DelHostForAgentsReq.java @@ -0,0 +1,15 @@ +package run.mone.mimeter.dashboard.bo.agent; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class DelHostForAgentsReq implements Serializable { + @HttpApiDocClassDefine(value = "agentIps", required = true, description = "发压机Ip列表", defaultValue = "127.0.0.1") + List agentIps; + @HttpApiDocClassDefine(value = "domain", required = true, description = "域名", defaultValue = "com.test.xxx") + String domain; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DomainApplyByRateReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DomainApplyByRateReq.java new file mode 100644 index 000000000..978194c84 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DomainApplyByRateReq.java @@ -0,0 +1,23 @@ +package run.mone.mimeter.dashboard.bo.agent; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class DomainApplyByRateReq implements Serializable { + @HttpApiDocClassDefine(value = "agentIPs", required = true, description = "发压机Ip列表", defaultValue = "") + List agentIPs; + + @HttpApiDocClassDefine(value = "applier",ignore = true) + String applier; + + @HttpApiDocClassDefine(value = "domain",required = true,description = "要绑定的域名") + String domain; + + @HttpApiDocClassDefine(value = "domainIpAndRates",required = true,description = "ip和比例") + List domainIpAndRates; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DomainApplyDTO.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DomainApplyDTO.java new file mode 100644 index 000000000..71f6328ac --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DomainApplyDTO.java @@ -0,0 +1,30 @@ +package run.mone.mimeter.dashboard.bo.agent; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class DomainApplyDTO implements Serializable { + private Integer id; + + @HttpApiDocClassDefine(value = "applyUser", required = true, description = "申请人", defaultValue = "dzx") + private String applyUser; + + @HttpApiDocClassDefine(value = "ip", required = true, description = "绑定的ip", defaultValue = "127.0.0.1") + private String ip; + + @HttpApiDocClassDefine(value = "domain", required = true, description = "域名", defaultValue = "com.xiao.xxx") + private String domain; + + @HttpApiDocClassDefine(value = "applyStatus", required = true, description = "申请状态", defaultValue = "0:待审核 1:审核完成 2:拒绝") + private Integer applyStatus; + + @HttpApiDocClassDefine(value = "agentIpList", required = true, description = "绑定的机器ip列表", defaultValue = "") + private List agentIpList; + + @HttpApiDocClassDefine(value = "ctime", required = true, description = "申请时间", defaultValue = "") + private Long ctime; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DomainApplyList.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DomainApplyList.java new file mode 100644 index 000000000..53bf25050 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DomainApplyList.java @@ -0,0 +1,36 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.bo.agent; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; +import run.mone.mimeter.dashboard.bo.common.PageBase; + +import java.io.Serializable; +import java.util.List; + +@Data +public class DomainApplyList extends PageBase implements Serializable { + + + /** + * 返回的信息列表 + */ + @HttpApiDocClassDefine(value = "list", required = false, description = "申请记录列表") + private List list; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DomainApplyReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DomainApplyReq.java new file mode 100644 index 000000000..e950ca638 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DomainApplyReq.java @@ -0,0 +1,23 @@ +package run.mone.mimeter.dashboard.bo.agent; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class DomainApplyReq implements Serializable { + @HttpApiDocClassDefine(value = "agentIPs", required = true, description = "发压机Ip列表", defaultValue = "") + List agentIPs; + + @HttpApiDocClassDefine(value = "applier",ignore = true) + String applier; + + @HttpApiDocClassDefine(value = "domain",required = true,description = "要绑定的域名") + String domain; + + @HttpApiDocClassDefine(value = "ip",required = true,description = "要绑定的ip",defaultValue = "127.0.0.1") + String ip; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DomainConf.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DomainConf.java new file mode 100644 index 000000000..46d0fc20f --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DomainConf.java @@ -0,0 +1,10 @@ +package run.mone.mimeter.dashboard.bo.agent; + +import lombok.Data; + +import java.io.Serializable; +@Data +public class DomainConf implements Serializable { + private String domain; + private String ip; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DomainIpAndRate.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DomainIpAndRate.java new file mode 100644 index 000000000..3cca3e144 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/DomainIpAndRate.java @@ -0,0 +1,14 @@ +package run.mone.mimeter.dashboard.bo.agent; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class DomainIpAndRate implements Serializable { + @HttpApiDocClassDefine(value = "ip",required = true,description = "要绑定的ip") + private String ip; + @HttpApiDocClassDefine(value = "rate",required = true,description = "比例,只能整数 10、20..100") + private Integer rate; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/GetAgentListReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/GetAgentListReq.java new file mode 100644 index 000000000..514474567 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/GetAgentListReq.java @@ -0,0 +1,15 @@ +package run.mone.mimeter.dashboard.bo.agent; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class GetAgentListReq implements Serializable { + @HttpApiDocClassDefine(value = "page", required = true, description = "当前的页码", defaultValue = "1") + private int page; + + @HttpApiDocClassDefine(value = "pageSize", required = true, description = "每页条数", defaultValue = "10") + private int pageSize; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/GetApplyListReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/GetApplyListReq.java new file mode 100644 index 000000000..4034f0171 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/GetApplyListReq.java @@ -0,0 +1,39 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.bo.agent; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class GetApplyListReq implements Serializable { + + @HttpApiDocClassDefine(value = "applyUser", required = false, description = "申请人", defaultValue = "dzx") + private String applyUser; + + @HttpApiDocClassDefine(value = "applyStatus", required = true, description = "申请状态", defaultValue = "0:待审核 1:审核完成") + private Integer applyStatus; + + @HttpApiDocClassDefine(value = "page", required = true, description = "当前的页码", defaultValue = "1") + private int page; + + @HttpApiDocClassDefine(value = "pageSize", required = true, description = "每页条数", defaultValue = "10") + private int pageSize; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/HostForAgentReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/HostForAgentReq.java new file mode 100644 index 000000000..e4a0dc3d0 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/HostForAgentReq.java @@ -0,0 +1,17 @@ +package run.mone.mimeter.dashboard.bo.agent; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class HostForAgentReq implements Serializable { + @HttpApiDocClassDefine(value = "agentIp", required = true, description = "发压机Ip", defaultValue = "127.0.0.1") + String agentIp; + @HttpApiDocClassDefine(value = "domain", required = true, description = "域名", defaultValue = "com.test.xxx") + String domain; + @HttpApiDocClassDefine(value = "ip", required = true, description = "绑定的ip", defaultValue = "127.0.0.1") + String ip; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/LoadHostsFileReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/LoadHostsFileReq.java new file mode 100644 index 000000000..c852a3ad3 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/LoadHostsFileReq.java @@ -0,0 +1,12 @@ +package run.mone.mimeter.dashboard.bo.agent; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class LoadHostsFileReq implements Serializable { + @HttpApiDocClassDefine(value = "agentIp", required = true, description = "要获取发压机Ip", defaultValue = "127.0.0.1") + private String agentIp; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/SyncHostsReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/SyncHostsReq.java new file mode 100644 index 000000000..2eaa0f331 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/SyncHostsReq.java @@ -0,0 +1,11 @@ +package run.mone.mimeter.dashboard.bo.agent; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class SyncHostsReq implements Serializable { + private List agentHostsConfList; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/TenantForAgentReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/TenantForAgentReq.java new file mode 100644 index 000000000..a5cc63a7a --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/agent/TenantForAgentReq.java @@ -0,0 +1,16 @@ +package run.mone.mimeter.dashboard.bo.agent; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class TenantForAgentReq implements Serializable { + @HttpApiDocClassDefine(value = "agentID", required = true, description = "发压机Id", defaultValue = "66") + Integer agentID; + @HttpApiDocClassDefine(value = "tenant", required = true, description = "租户id", defaultValue = "xx/yy") + String tenant; + @HttpApiDocClassDefine(value = "tenantCn", required = true, description = "租户id 中文路径", defaultValue = ".../效能组") + String tenantCn; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/CheckPointConditionEnum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/CheckPointConditionEnum.java new file mode 100644 index 000000000..1bf541c79 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/CheckPointConditionEnum.java @@ -0,0 +1,21 @@ +package run.mone.mimeter.dashboard.bo.common; + + +public enum CheckPointConditionEnum { + + BIGGER(1), + BIGGER_AND_EQ(2), + SMLLER(3), + SMALLER_AND_EQ(4), + EQ(5), + CONTAIN(6), + NOT_CONTAIN(7), + NOT_EQ(8), + ; + + public final int code; + + CheckPointConditionEnum(int code) { + this.code = code; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/CheckPointTypeEnum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/CheckPointTypeEnum.java new file mode 100644 index 000000000..a139a5af7 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/CheckPointTypeEnum.java @@ -0,0 +1,15 @@ +package run.mone.mimeter.dashboard.bo.common; + + +public enum CheckPointTypeEnum { + + STATUS_CODE(1), + HEADER_CODE(2), + OUTPUT_CODE(3); + + public final int code; + + CheckPointTypeEnum(int code) { + this.code = code; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/CommonEnum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/CommonEnum.java new file mode 100644 index 000000000..6169f404a --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/CommonEnum.java @@ -0,0 +1,37 @@ +package run.mone.mimeter.dashboard.bo.common; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CommonEnum implements Serializable { + private int code; + private String ChineseDesc; + private String EnglishDesc; + + private String unit; + + + public CommonEnum(int code, String ChineseDesc, String EnglishDesc) { + this.code = code; + this.ChineseDesc = ChineseDesc; + this.EnglishDesc = EnglishDesc; + } + + public CommonEnum(int code, String ChineseDesc) { + this.code = code; + this.ChineseDesc = ChineseDesc; + } + + public CommonEnum(String ChineseDesc, String EnglishDesc) { + this.ChineseDesc = ChineseDesc; + this.EnglishDesc = EnglishDesc; + } + + public CommonEnum(String ChineseDesc, String EnglishDesc, String unit) { + this.ChineseDesc = ChineseDesc; + this.EnglishDesc = EnglishDesc; + this.unit = unit; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/Constants.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/Constants.java new file mode 100644 index 000000000..06cc7ef5e --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/Constants.java @@ -0,0 +1,161 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.bo.common; + + +public class Constants { + + public static final String MiOne_Tenant = "TEST"; + + public static final int STATUS_ON = 1; + public static final int STATUS_OFF = 2; + + public static final int DEGREE_WARN = 1; + public static final int DEGREE_ERROR = 2; + + public static final int TRUE = 1; + public static final int FALSE = 0; + + public static final int ROLE_ADMIN = 1; + public static final int ROLE_WORK = 2; + public static final int ROLE_GUEST = 3; + + public static final int HTTP_REQ_GET = 0; + public static final int HTTP_REQ_POST = 1; + + public static final int MI_API_HTTP_REQ_GET = 1; + public static final int MI_API_HTTP_REQ_POST = 0; + + public static final int REPORT_STATUS_RUNNING = 0; + + public static final int REPORT_STATUS_INACTIVE = 1; + + public static final int REPORT_STATUS_FINISH = 3; + + public static final int DEFAULT_PAGE_SIZE = 20; + + public static final int SINGLE_API_DEBUG = 0; + public static final int SCENE_DEBUG = 1; + public static final int SCENE_BENCH = 2; + + public static final int HTTP_API_TYPE = 1; + public static final int DUBBO_API_TYPE = 3; + public static final int GATEWAY_API_TYPE = 4; + + public static final String DEFAULT_EXPR_PREX = "params.toMap()"; + + public static final String DEFAULT_EXPR_JSON_PREX = "params.json()"; + + public static final String EXPR_INT_FLAG = "::int"; + + public static final String EXPR_BOOLEAN_FLAG = "::boolean"; + + public static final String EXPR_STRING_FLAG = "::string"; + + public static final String EXPR_LIST_FLAG = "::list["; + + public static final int SCENE_TYPE_HTTP = 0; + public static final int SCENE_TYPE_DUBBO = 1; + + + public static final int NACOS_TYPE_ST = 0; + public static final int NACOS_TYPE_OL = 1; + + public static final int SCENE_PARAM_DATA_TYPE_GLOBAL = 0; + public static final int SCENE_PARAM_DATA_TYPE_LINK = 1; + + public static final String CONTENT_TYPE_APP_JSON= "application/json"; + public static final String CONTENT_TYPE_APP_FORM= "application/x-www-form-urlencoded"; + public static final String CONTENT_TYPE_APP_FORM2= "x-www-form-urlencoded"; + + public static final String SKIP_MI_DUN_USER_NAME = "mone-skip-mi-dun-username"; + + public static final String PROJECT_NAME = "MiMeter"; + + public static final String NACOS_ST = "staging"; + public static final String NACOS_CN_ONLINE = "online"; + + public static final int CASE_TYPE_HTTP = 0; + public static final int CASE_TYPE_RPCX = 1; + + public static final int DEFAULT_SCENE_GROUP = 30001; + + public static final Long DEFAULT_API_TIMEOUT = 6000L; + + public static final int SCENE_ENV_ST = 0; + + public static final int SCENE_ENV_OL = 1; + + public static final long ONE_YEAR_MS = 1000 * 60 * 60 * 24 * 365L; + + + public static final String BENCH_BEGIN_MSG = "{\n" + + " \"config\": {\n" + + " \"wide_screen_mode\": true\n" + + " },\n" + + " \"header\": {\n" + + " \"title\": {\n" + + " \"tag\": \"plain_text\",\n" + + " \"content\": \"MiMeter压测平台消息通知\"\n" + + " }\n" + + " },\n" + + " \"elements\": [\n" + + " {\n" + + " \"tag\": \"hr\"\n" + + " },\n" + + " {\n" + + " \"tag\": \"div\",\n" + + " \"text\": {\n" + + " \"tag\": \"plain_text\",\n" + + " \"content\": \"场景名: ${sceneName}\"\n" + + " }\n" + + " },\n" + + " {\n" + + " \"tag\": \"div\",\n" + + " \"text\": {\n" + + " \"tag\": \"plain_text\",\n" + + " \"content\": \"操作人: ${opUser}\"\n" + + " }\n" + + " },\n" + + " {\n" + + " \"tag\": \"div\",\n" + + " \"text\": {\n" + + " \"tag\": \"plain_text\",\n" + + " \"content\": \"压测时长:${benchTime}\"\n" + + " }\n" + + " },\n" + + " {\n" + + " \"tag\": \"div\",\n" + + " \"text\": {\n" + + " \"tag\": \"plain_text\",\n" + + " \"content\": \"压测量级:${totalRps}\"\n" + + " }\n" + + " },\n" + + " {\n" + + " \"tag\": \"hr\"\n" + + " },\n" + + " {\n" + + " \"tag\": \"div\",\n" + + " \"text\": {\n" + + " \"tag\": \"lark_md\",\n" + + " \"content\": \"压测报告链接:https://test.com/report-detail?reportId=${reportId}&isRunning=1\"\n" + + " }\n" + + " }\n" + + " ]\n" + + "}"; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/EmitterTypeEnum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/EmitterTypeEnum.java new file mode 100644 index 000000000..d12593639 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/EmitterTypeEnum.java @@ -0,0 +1,31 @@ +package run.mone.mimeter.dashboard.bo.common; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/6/30 + */ +public enum EmitterTypeEnum { + + FINISH("finish"), + + SLA_WARN("sla_warn"), + SLA_ERROR("sla_error"), + + TOTAL_STAT_ANALYSIS("total_stat_analysis") + ; + + private String value; + + EmitterTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/PageBase.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/PageBase.java new file mode 100644 index 000000000..29be272f0 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/PageBase.java @@ -0,0 +1,24 @@ +package run.mone.mimeter.dashboard.bo.common; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class PageBase implements Serializable { + /** + * 当前的页码 + */ + @HttpApiDocClassDefine(value = "page", required = true, description = "当前的页码", defaultValue = "1") + private int page; + + @HttpApiDocClassDefine(value = "pageSize", required = true, description = "每页条数", defaultValue = "10") + private int pageSize; + + /** + * 总记录数 + */ + @HttpApiDocClassDefine(value = "total", required = true, description = "总记录数", defaultValue = "100") + private long total = 0; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/PagedResp.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/PagedResp.java new file mode 100644 index 000000000..37ac1b0f1 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/PagedResp.java @@ -0,0 +1,22 @@ +package run.mone.mimeter.dashboard.bo.common; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/7/7 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class PagedResp { + + private long total; + + private T data; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/Result.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/Result.java new file mode 100644 index 000000000..c5af84eae --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/Result.java @@ -0,0 +1,75 @@ +package run.mone.mimeter.dashboard.bo.common; + + +import run.mone.mimeter.dashboard.exception.CommonError; + +import java.io.Serializable; + +/** + * http json 返回结果 + */ +public class Result implements Serializable { + + private int code; + private String message; + private T data; + + public Result() { + } + + public Result(int code, String message) { + this.code = code; + this.message = message; + } + + public Result(int code, String message, T data) { + this.code = code; + this.message = message; + this.data = data; + } + + public static Result success(T t) { + return new Result<>(0, "ok", t); + } + + public static Result fail(int code, String msg) { + return new Result(code, msg, null); + } + + public static Result fail(CommonError error) { + return new Result(error.code, error.message); + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } + + @Override + public String toString() { + return "Result{" + + "code=" + code + + ", message='" + message + '\'' + + ", data=" + data + + '}'; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/TestReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/TestReq.java new file mode 100644 index 000000000..be57d3ede --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/common/TestReq.java @@ -0,0 +1,10 @@ +package run.mone.mimeter.dashboard.bo.common; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class TestReq implements Serializable { + private String uid; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/DatasetDto.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/DatasetDto.java new file mode 100644 index 000000000..38b8db7f3 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/DatasetDto.java @@ -0,0 +1,76 @@ +package run.mone.mimeter.dashboard.bo.dataset; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +@Data +public class DatasetDto implements Serializable { + + @HttpApiDocClassDefine(value = "id", required = false, description = "数据源序号", defaultValue = "1") + private Integer id; + + @HttpApiDocClassDefine(value = "name", required = true, description = "数据源名称", defaultValue = "数据源示例名") + private String name; + + @HttpApiDocClassDefine(value = "note", required = false, description = "数据源描述", defaultValue = "数据源示理描述") + private String note; + + @HttpApiDocClassDefine(value = "type", required = true, description = "数据源分类", defaultValue = "1") + private Integer type; + + @HttpApiDocClassDefine(value = "defaultParamName", required = false, description = "默认参数名", defaultValue = "paramName") + private String defaultParamName; + + @HttpApiDocClassDefine(value = "ignoreFirstRow", required = false, description = "忽略上传文件首行", defaultValue = "0") + private Integer ignoreFirstRow; + + @HttpApiDocClassDefine(value = "fileName", required = false, description = "文件名", defaultValue = "tmp.csv") + private String fileName; + + @HttpApiDocClassDefine(value = "fileUrl", required = false, description = "文件下载链接", defaultValue = "http://") + private String fileUrl; + + @HttpApiDocClassDefine(value = "fileKsKey", required = false, description = "文件位于云上的key", defaultValue = "xx/xxx/xx") + private String fileKsKey; + + @HttpApiDocClassDefine(value = "fileRows", required = false, description = "文件行数", defaultValue = "10") + private Long fileRows; + + @HttpApiDocClassDefine(value = "fileSize", required = false, description = "文件大小", defaultValue = "100") + private Long fileSize; + + @HttpApiDocClassDefine(value = "previewFileRows", required = false, description = "预览文件", defaultValue = "") + private List previewFileRows; + + @HttpApiDocClassDefine(value = "header", required = true, description = "请求header", defaultValue = "{\"X-Real-IP\":\"127.0.0.1\"}") + private Map header; + + @HttpApiDocClassDefine(value = "interfaceUrl", required = true, description = "接口url", defaultValue = "http://") + private String interfaceUrl; + + @HttpApiDocClassDefine(value = "trafficRecordId", required = false, description = "流量录制", defaultValue = "100") + private Integer trafficRecordId; + + @HttpApiDocClassDefine(value = "bindScenes", required = false, description = "引用场景", defaultValue = "") + private Map bindScenes; + + @HttpApiDocClassDefine(value = "ctime", required = false, description = "创建时间", defaultValue = "0") + private Long ctime; + + @HttpApiDocClassDefine(value = "utime", required = false, description = "更新时间", defaultValue = "1") + private Long utime; + + @HttpApiDocClassDefine(value = "creator", required = false, description = "创建人", defaultValue = "创建人") + private String creator; + + @HttpApiDocClassDefine(value = "updater", required = false, description = "更新人", defaultValue = "更新人") + private String updater; + + @HttpApiDocClassDefine(value = "tenant",ignore = true, description = "租户", defaultValue = "") + private String tenant; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/DatasetLineNum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/DatasetLineNum.java new file mode 100644 index 000000000..e28cf223b --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/DatasetLineNum.java @@ -0,0 +1,16 @@ +package run.mone.mimeter.dashboard.bo.dataset; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class DatasetLineNum implements Serializable { + Integer datasetId; + String fileName; + String fileUrl; + String fileKsKey; + Long fileRaw; + String defaultParamName; + Boolean ignoreFirstLine; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/DatasetLinesReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/DatasetLinesReq.java new file mode 100644 index 000000000..3f08abc34 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/DatasetLinesReq.java @@ -0,0 +1,17 @@ +package run.mone.mimeter.dashboard.bo.dataset; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class DatasetLinesReq implements Serializable { + private Integer datasetId; + private String fileUrl; + private String fileKsKey; + private String defaultParamName; + //读对应文件的起始行数 + private Integer from; + //读对应文件的最后一行 + private Integer to; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/DatasetList.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/DatasetList.java new file mode 100644 index 000000000..e115e830b --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/DatasetList.java @@ -0,0 +1,36 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.bo.dataset; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; +import run.mone.mimeter.dashboard.bo.common.PageBase; + +import java.io.Serializable; +import java.util.List; + +@Data +public class DatasetList extends PageBase implements Serializable { + + + /** + * 返回的信息列表 + */ + @HttpApiDocClassDefine(value = "list", required = false, description = "数据源列表") + private List list; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/DatasetSceneRelationDto.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/DatasetSceneRelationDto.java new file mode 100644 index 000000000..b59fb1b9f --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/DatasetSceneRelationDto.java @@ -0,0 +1,35 @@ +package run.mone.mimeter.dashboard.bo.dataset; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; +import java.util.Map; + +@Data +public class DatasetSceneRelationDto implements Serializable { + + @HttpApiDocClassDefine(value = "id", required = false, description = "序号", defaultValue = "1") + private Integer id; + + @HttpApiDocClassDefine(value = "datasetId", required = true, description = "数据源序号", defaultValue = "1") + private Integer datasetId; + + @HttpApiDocClassDefine(value = "sceneId", required = true, description = "场景序号", defaultValue = "1") + private Integer sceneId; + + @HttpApiDocClassDefine(value = "ctime", required = false, description = "创建时间", defaultValue = "0") + private Long ctime; + + @HttpApiDocClassDefine(value = "utime", required = false, description = "更新时间", defaultValue = "1") + private Long utime; + + @HttpApiDocClassDefine(value = "creator", required = false, description = "创建人", defaultValue = "创建人") + private String creator; + + @HttpApiDocClassDefine(value = "updater", required = false, description = "更新人", defaultValue = "更新人") + private String updater; + + + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/DatasetTypeEnum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/DatasetTypeEnum.java new file mode 100644 index 000000000..30d5ab0e7 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/DatasetTypeEnum.java @@ -0,0 +1,33 @@ +package run.mone.mimeter.dashboard.bo.dataset; + +import java.util.Arrays; +import java.util.List; + +public enum DatasetTypeEnum { + + FileUpload(1, "FileUpload"), + TrafficRecord(2, "TrafficRecord"), + GlobalHeader(3, "GlobalHeader"), + DataOutput(4, "DataOutput"), + Interface(5, "Interface"); + + + + public int typeCode; + public String typeName; + + DatasetTypeEnum(int typeCode, String typeName) { + this.typeCode = typeCode; + this.typeName = typeName; + } + + public static List getDatasetTypes() { + return Arrays.asList( + FileUpload.typeCode, + TrafficRecord.typeCode, + GlobalHeader.typeCode, + DataOutput.typeCode, + Interface.typeCode + ); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/GetDatasetListReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/GetDatasetListReq.java new file mode 100644 index 000000000..06ce7aabe --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/GetDatasetListReq.java @@ -0,0 +1,44 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.bo.dataset; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class GetDatasetListReq implements Serializable { + + @HttpApiDocClassDefine(value = "datasetName", required = true, description = "数据源名称", defaultValue = "name") + private String datasetName; + + @HttpApiDocClassDefine(value = "creator", required = false, description = "创建人", defaultValue = "dingpei") + private String creator; + + @HttpApiDocClassDefine(value = "type", required = true, description = "数据源分类", defaultValue = "1") + private Integer type; + + @HttpApiDocClassDefine(value = "page", required = true, description = "当前的页码", defaultValue = "1") + private int page; + + @HttpApiDocClassDefine(value = "pageSize", required = true, description = "每页条数", defaultValue = "10") + private int pageSize; + + @HttpApiDocClassDefine(value = "tenant",ignore = true, description = "租户", defaultValue = "") + private String tenant; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/ParamData.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/ParamData.java new file mode 100644 index 000000000..2e2544923 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/ParamData.java @@ -0,0 +1,22 @@ +package run.mone.mimeter.dashboard.bo.dataset; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ParamData implements Serializable { + + @HttpApiDocClassDefine(value = "datasetId", required = true, description = "数据源id", defaultValue = "1") + private Integer datasetId; + + @HttpApiDocClassDefine(value = "paramName", required = true, description = "参数名", defaultValue = "key1") + private String paramName; + + @HttpApiDocClassDefine(value = "datasetName", required = true, description = "数据来源", defaultValue = "file.csv") + private String datasetName; + + @HttpApiDocClassDefine(value = "columnIndex", required = true, description = "索引列", defaultValue = "第1列") + private Integer columnIndex; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/PreviewFileRes.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/PreviewFileRes.java new file mode 100644 index 000000000..0a416e9a9 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/PreviewFileRes.java @@ -0,0 +1,25 @@ +package run.mone.mimeter.dashboard.bo.dataset; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.util.List; + +/** + * @author dingpei + * @date 2022-07-15 + */ +@Data +public class PreviewFileRes { + + @HttpApiDocClassDefine(value = "fileName", required = false, description = "文件名", defaultValue = "tmp.csv") + private String fileName; + + @HttpApiDocClassDefine(value = "fileRows", required = false, description = "文件行数", defaultValue = "10") + private Long fileRows; + + @HttpApiDocClassDefine(value = "previewFileRows", required = false, description = "文件预览", defaultValue = "") + private List previewFileRows; + + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/SceneFileDetailRes.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/SceneFileDetailRes.java new file mode 100644 index 000000000..ff8f9c5d7 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/SceneFileDetailRes.java @@ -0,0 +1,22 @@ +package run.mone.mimeter.dashboard.bo.dataset; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.util.List; + +/** + * @author dingpei + * @date 2022-07-15 + */ +@Data +public class SceneFileDetailRes { + + @HttpApiDocClassDefine(value = "datasetLists",required = true,description = "文件列表") + List datasetLists; + + @HttpApiDocClassDefine(value = "paramDataList",required = true,description = "参数列表") + List paramDataList; + + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/SceneParamData.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/SceneParamData.java new file mode 100644 index 000000000..2d6457cb3 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/SceneParamData.java @@ -0,0 +1,17 @@ +package run.mone.mimeter.dashboard.bo.dataset; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class SceneParamData implements Serializable { + + @HttpApiDocClassDefine(value = "paramDataType", required = true, description = "参数类型 0:全局 1:链路", defaultValue = "1") + Integer paramDataType; + + @HttpApiDocClassDefine(value = "paramDataList", required = true, description = "参数列表") + List paramDataList; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/UploadFileRes.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/UploadFileRes.java new file mode 100644 index 000000000..fc258dfd4 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/dataset/UploadFileRes.java @@ -0,0 +1,40 @@ +package run.mone.mimeter.dashboard.bo.dataset; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.util.List; + +/** + * @author dingpei + * @date 2022-07-15 + */ +@Data +public class UploadFileRes { + + @HttpApiDocClassDefine(value = "fileName", required = false, description = "文件名", defaultValue = "tmp.csv") + private String fileName; + + @HttpApiDocClassDefine(value = "fileUrl", required = false, description = "文件下载链接", defaultValue = "http://") + private String fileUrl; + + @HttpApiDocClassDefine(value = "fileKsKey", required = false, description = "文件位于云上的key", defaultValue = "xx/xxx/xx") + private String fileKsKey; + + @HttpApiDocClassDefine(value = "fileRows", required = false, description = "文件行数", defaultValue = "10") + private Long fileRows; + + @HttpApiDocClassDefine(value = "fileColumns", required = false, description = "文件列数", defaultValue = "3") + private int fileColumns; + + @HttpApiDocClassDefine(value = "fileSize", required = false, description = "文件大小", defaultValue = "100") + private Long fileSize; + + @HttpApiDocClassDefine(value = "firstRow", required = false, description = "首行", defaultValue = "") + private List firstRow; + + @HttpApiDocClassDefine(value = "previewFileRows", required = false, description = "文件预览", defaultValue = "") + private List previewFileRows; + + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/openapi/OpenSceneDTO.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/openapi/OpenSceneDTO.java new file mode 100644 index 000000000..4ac052731 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/openapi/OpenSceneDTO.java @@ -0,0 +1,31 @@ +package run.mone.mimeter.dashboard.bo.openapi; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; +import run.mone.mimeter.dashboard.bo.scene.SerialLinkDTO; + +import java.io.Serializable; +import java.util.List; + +@Data +public class OpenSceneDTO implements Serializable { + + @HttpApiDocClassDefine(value = "name", required = true, description = "场景名", defaultValue = "测试场景1") + private String name; + + @HttpApiDocClassDefine(value = "remark", description = "备注", defaultValue = "这是一个http链路场景") + private String remark; + + @HttpApiDocClassDefine(value = "sceneType", description = "场景类型 0:http 1:dubbo", defaultValue = "1") + private Integer sceneType; + + @HttpApiDocClassDefine(value = "serialLinkDTOs", description = "串联链路信息列表") + private List serialLinkDTOs; + + @HttpApiDocClassDefine(value = "benchMode", required = true, description = "压力模式 0 RPS (目前仅支持该模式)", defaultValue = "0") + private Integer benchMode; + + @HttpApiDocClassDefine(value = "incrementMode", required = true, description = "递增模式 0 手动(Rps下仅支持手动模式)", defaultValue = "0") + private Integer incrementMode; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/operationlog/GetOperationLogListReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/operationlog/GetOperationLogListReq.java new file mode 100644 index 000000000..79022f195 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/operationlog/GetOperationLogListReq.java @@ -0,0 +1,41 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.bo.operationlog; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class GetOperationLogListReq implements Serializable { + + @HttpApiDocClassDefine(value = "sceneId", required = false, description = "场景id", defaultValue = "1") + private int sceneId; + + @HttpApiDocClassDefine(value = "startTime", required = false, description = "开始时间", defaultValue = "13245432") + private long startTime; + + @HttpApiDocClassDefine(value = "endTime", required = false, description = "结束时间", defaultValue = "34223444") + private long endTime; + + @HttpApiDocClassDefine(value = "page", required = true, description = "当前的页码", defaultValue = "1") + private int page; + + @HttpApiDocClassDefine(value = "pageSize", required = true, description = "每页条数", defaultValue = "10") + private int pageSize; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/operationlog/OperationLogDto.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/operationlog/OperationLogDto.java new file mode 100644 index 000000000..f4832d066 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/operationlog/OperationLogDto.java @@ -0,0 +1,39 @@ +package run.mone.mimeter.dashboard.bo.operationlog; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class OperationLogDto implements Serializable { + + @HttpApiDocClassDefine(value = "id", required = false, description = "操作记录序号", defaultValue = "1") + private Long id; + + @HttpApiDocClassDefine(value = "reportId", required = false, description = "报告id", defaultValue = "报告id") + private String reportId; + + @HttpApiDocClassDefine(value = "sceneId", required = false, description = "场景id", defaultValue = "1") + private Integer sceneId; + + @HttpApiDocClassDefine(value = "type", required = false, description = "分类", defaultValue = "1") + private Integer type; + + @HttpApiDocClassDefine(value = "content", required = false, description = "操作内容", defaultValue = "内容") + private String content; + + @HttpApiDocClassDefine(value = "supportOperation", required = false, description = "操作", defaultValue = "") + private List supportOperation; + + @HttpApiDocClassDefine(value = "createTime", required = false, description = "创建时间", defaultValue = "0") + private Long createTime; + + @HttpApiDocClassDefine(value = "updateTime", required = false, description = "更新时间", defaultValue = "1") + private Long updateTime; + + @HttpApiDocClassDefine(value = "createBy", required = false, description = "创建人", defaultValue = "创建人") + private String createBy; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/operationlog/OperationLogList.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/operationlog/OperationLogList.java new file mode 100644 index 000000000..2113147bf --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/operationlog/OperationLogList.java @@ -0,0 +1,35 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.bo.operationlog; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; +import run.mone.mimeter.dashboard.bo.common.PageBase; + +import java.io.Serializable; +import java.util.List; + +@Data +public class OperationLogList extends PageBase implements Serializable { + + /** + * 返回的信息列表 + */ + @HttpApiDocClassDefine(value = "list", required = false, description = "操作记录列表") + private List list; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/operationlog/OperationLogTypeEnum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/operationlog/OperationLogTypeEnum.java new file mode 100644 index 000000000..d9f957e33 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/operationlog/OperationLogTypeEnum.java @@ -0,0 +1,20 @@ +package run.mone.mimeter.dashboard.bo.operationlog; + +public enum OperationLogTypeEnum { + + NEW_OPERATION(1, "NEW"), + UPDATE_OPERATION(2, "UPDATE"), + DELETE_OPERATION(3, "DELETE"), + START_BENCH(4, "START_BENCH"), + STOP_BENCH(5, "STOP_BENCH"), + DEBUG_OPERATION(5, "DEBUG"); + + public int typeCode; + public String typeName; + + OperationLogTypeEnum(int typeCode, String typeName) { + this.typeCode = typeCode; + this.typeName = typeName; + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/operationlog/OperationTypeEnum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/operationlog/OperationTypeEnum.java new file mode 100644 index 000000000..e33316d15 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/operationlog/OperationTypeEnum.java @@ -0,0 +1,19 @@ +package run.mone.mimeter.dashboard.bo.operationlog; + +public enum OperationTypeEnum { + + VIEW_SNAPSHOT("VIEW_SNAPSHOT", "查看快照"), + VIEW_REPORT("VIEW_REPORT", "查看报告"), + DEBUG_RECORD("DEBUG_RECORD", "调试记录"), + COPY_SNAPSHOT("COPY_SNAPSHOT", "复制快照"); + + public String typeName; + + public String typeCname; + + OperationTypeEnum(String typeName, String typeCname) { + this.typeName = typeName; + this.typeCname = typeCname; + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/operationlog/PerOperation.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/operationlog/PerOperation.java new file mode 100644 index 000000000..3b59d4a0a --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/operationlog/PerOperation.java @@ -0,0 +1,25 @@ +package run.mone.mimeter.dashboard.bo.operationlog; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class PerOperation implements Serializable { + + @HttpApiDocClassDefine(value = "operationName", required = false, description = "具体操作", defaultValue = "查看报告") + private String operationName; + + @HttpApiDocClassDefine(value = "operationType", required = false, description = "具体操作", defaultValue = "ViewReport") + private String operationType; + + @HttpApiDocClassDefine(value = "detailInfo", required = false, description = "操作对象", defaultValue = "dsgfds") + private String detailInfo; + + public PerOperation(String operationName, String operationType, String detailInfo) { + this.operationName = operationName; + this.operationType = operationType; + this.detailInfo = detailInfo; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/report/ErrRateBo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/report/ErrRateBo.java new file mode 100644 index 000000000..583e41e1d --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/report/ErrRateBo.java @@ -0,0 +1,10 @@ +package run.mone.mimeter.dashboard.bo.report; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ErrRateBo implements Serializable { + private String totalErrRate; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/report/ReportInfoBo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/report/ReportInfoBo.java new file mode 100644 index 000000000..b70616100 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/report/ReportInfoBo.java @@ -0,0 +1,81 @@ +package run.mone.mimeter.dashboard.bo.report; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/6/22 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class ReportInfoBo implements Serializable { + + private Long id; + + private Long sceneId; + + private String snapshotId; + + private String reportId; + + private String reportName; + + @HttpApiDocClassDefine(value = "duration", description = "压测时长(秒)") + private Integer duration; + + @HttpApiDocClassDefine(value = "concurrency", description = "并发数") + private Integer concurrency; + + private Integer concurrencyMax; + + @HttpApiDocClassDefine(value = "createBy", description = "创建人用户名") + private String createBy; + + private String tenant; + + private Date createTime; + + private Date updateTime; + + private Integer status; + + private String filePath; + + @HttpApiDocClassDefine(value = "agents", description = "agents ip列表") + private String agents; + + private String linkToDagId; + + @HttpApiDocClassDefine(value = "extra", description = "扩展信息json") + private String extra; + + private Long finishTime; + + private String slaEventList; + + private String totalStatAnalysis; + + private String successRate; + + public boolean checkCreate() { + return this.sceneId != null && this.sceneId > 0 && + StringUtils.isNotBlank(this.reportId) && + StringUtils.isNotBlank(this.createBy); + } + + public boolean checkUpdate() { + return StringUtils.isNotBlank(this.reportId); + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/report/ReqRespLogRecord.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/report/ReqRespLogRecord.java new file mode 100644 index 000000000..baa80eb99 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/report/ReqRespLogRecord.java @@ -0,0 +1,70 @@ +package run.mone.mimeter.dashboard.bo.report; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Builder; +import lombok.Data; +import org.apache.commons.lang3.StringUtils; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/8/15 + */ +@Data +@Builder +public class ReqRespLogRecord { + + private Long timestamp; + + private boolean failed; + + private Long taskId; + + @HttpApiDocClassDefine(value = "apiType", required = true, description = "api类型,http:1, dubbo:3") + private Integer apiType; + + @HttpApiDocClassDefine(value = "uri", required = true, description = "http url或dubbo服务名") + private String uri; + + @HttpApiDocClassDefine(value = "method", required = true, description = "http或dubbo方法") + private String method; + + private Integer rt; + + @HttpApiDocClassDefine(value = "respCode", description = "响应状态码") + private Long code; + + private Long sceneId; + + @HttpApiDocClassDefine(value = "serialId", description = "链路id") + private Long serialId; + + @HttpApiDocClassDefine(value = "reportId", description = "报告id") + private String reportId; + + @HttpApiDocClassDefine(value = "apiId", description = "api id") + private Long apiId; + + @HttpApiDocClassDefine(value = "traceId", description = "traceId") + private String traceId; + + @HttpApiDocClassDefine(value = "params", description = "请求body") + private String params; + + @HttpApiDocClassDefine(value = "result", description = "返回结果") + private String result; + + private String errorInfo; + + private String reqHeaders; + + private String respHeaders; + + public boolean validate() { + return this.taskId != null && this.taskId > 0 && + StringUtils.isNotBlank(this.uri) && StringUtils.isNotBlank(this.method) && + StringUtils.isNotBlank(this.method) && this.rt != null && this.rt > 0 && + this.code != null && this.sceneId != null && this.sceneId > 0 && + this.result != null && StringUtils.isNotBlank(this.reportId); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/report/RmReportReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/report/RmReportReq.java new file mode 100644 index 000000000..1ea9aa28e --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/report/RmReportReq.java @@ -0,0 +1,13 @@ +package run.mone.mimeter.dashboard.bo.report; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class RmReportReq implements Serializable { + @HttpApiDocClassDefine(value = "reportIds", required = true) + List reportIds; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/report/SearchApiLogReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/report/SearchApiLogReq.java new file mode 100644 index 000000000..16b23286e --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/report/SearchApiLogReq.java @@ -0,0 +1,67 @@ +package run.mone.mimeter.dashboard.bo.report; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/8/15 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class SearchApiLogReq { + + @HttpApiDocClassDefine(value = "sceneId") + private Long sceneId; + + @HttpApiDocClassDefine(value = "taskId", required = true) + private Long taskId; + + @HttpApiDocClassDefine(value = "serialId", description = "链路id") + private Long serialId; + + @HttpApiDocClassDefine(value = "reportId", description = "报告id") + private String reportId; + + @HttpApiDocClassDefine(value = "apiId", description = "api id") + private Long apiId; + + @HttpApiDocClassDefine(value = "apiUri", description = "http url或dubbo服务名") + private String apiUri; + + @HttpApiDocClassDefine(value = "apiMethod", description = "http或dubbo方法") + private String apiMethod; + + @HttpApiDocClassDefine(value = "rtMin", description = "最小rt") + private Long rtMin; + + @HttpApiDocClassDefine(value = "rtMax", description = "最大rt") + private Long rtMax; + + @HttpApiDocClassDefine(value = "failed", description = "是否失败") + private Boolean failed; + + @HttpApiDocClassDefine(value = "respCode", description = "响应状态码") + private Integer respCode; + + @HttpApiDocClassDefine(value = "startTs", description = "开始时间戳") + private Long startTs; + + @HttpApiDocClassDefine(value = "endTs", description = "结束时间戳") + private Long endTs; + + @HttpApiDocClassDefine(value = "traceId", description = "traceId") + private String traceId; + + @HttpApiDocClassDefine(value = "pageNo", required = true) + private Integer pageNo; + + @HttpApiDocClassDefine(value = "pageSize", required = true) + private Integer pageSize; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/ApiBenchInfo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/ApiBenchInfo.java new file mode 100644 index 000000000..b2c0d7360 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/ApiBenchInfo.java @@ -0,0 +1,38 @@ +package run.mone.mimeter.dashboard.bo.scene; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; +@Data +public class ApiBenchInfo implements Serializable,Comparable { + + @HttpApiDocClassDefine(value = "apiOrder",required = true,description = "接口顺序",defaultValue = "1") + private Integer apiOrder; + + @HttpApiDocClassDefine(value = "serialName",required = true,description = "链路名",defaultValue = "串联链路1") + private String serialName; + + @HttpApiDocClassDefine(value = "apiName",description = "接口名称",defaultValue = "压测百度") + private String apiName; + + @HttpApiDocClassDefine(value = "maxRps",description = "最大接口Rps",defaultValue = "2300") + private Integer maxRps; + + @HttpApiDocClassDefine(value = "originRps",description = "起始接口Rps",defaultValue = "10") + private Integer originRps; + + @HttpApiDocClassDefine(value = "linkOriRps",description = "链路起始rps",defaultValue = "10") + private Integer linkOriRps; + + @HttpApiDocClassDefine(value = "linkTps",description = "链路最大rps",defaultValue = "100") + private Integer linkTps; + + @HttpApiDocClassDefine(value = "linkBenchTime",description = "链路施压时间",defaultValue = "30") + private Integer linkBenchTime; + + @Override + public int compareTo(ApiBenchInfo apiBenchInfo) { + return this.apiOrder.compareTo(apiBenchInfo.apiOrder); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/BasicSceneDTO.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/BasicSceneDTO.java new file mode 100644 index 000000000..b12e3e3b7 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/BasicSceneDTO.java @@ -0,0 +1,43 @@ +package run.mone.mimeter.dashboard.bo.scene; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class BasicSceneDTO implements Serializable { + @HttpApiDocClassDefine(value = "id", required = true, description = "场景id", defaultValue = "1") + private Integer id; + + @HttpApiDocClassDefine(value = "name", required = true, description = "场景名", defaultValue = "测试场景1") + private String name; + + @HttpApiDocClassDefine(value = "remark", description = "备注", defaultValue = "这是一个http链路场景") + private String remark; + + @HttpApiDocClassDefine(value = "status", description = "场景状态 0 待启动 1 执行中", defaultValue = "1") + private Integer status; + + @HttpApiDocClassDefine(value = "benchTime", required = true, description = "施压时间(s)", defaultValue = "60") + private Integer benchTime; + + @HttpApiDocClassDefine(value = "sceneType", required = true, description = "场景类型 0:http 1:dubbo", defaultValue = "1") + private Integer sceneType; + + @HttpApiDocClassDefine(value = "curReportId", required = true, description = "当前报告id", defaultValue = "1jhlq3r1") + private String curReportId; + + @HttpApiDocClassDefine(value = "creator", required = true, description = "创建人", defaultValue = "dongzhenxing") + private String creator; + + @HttpApiDocClassDefine(value = "rpsRate", required = true, description = "rps比例", defaultValue = "10") + private Integer rpsRate; + + @HttpApiDocClassDefine(value = "uTime", required = true, description = "更新时间", defaultValue = "1124141241241") + private Long uTime; + + @HttpApiDocClassDefine(value = "cTime", required = true, description = "创建时间", defaultValue = "1124141241241") + private Long cTime; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/BenchCalendar.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/BenchCalendar.java new file mode 100644 index 000000000..e70553a13 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/BenchCalendar.java @@ -0,0 +1,11 @@ +package run.mone.mimeter.dashboard.bo.scene; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class BenchCalendar implements Serializable { + private List benchDateList; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/BenchDate.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/BenchDate.java new file mode 100644 index 000000000..9d5c9131f --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/BenchDate.java @@ -0,0 +1,16 @@ +package run.mone.mimeter.dashboard.bo.scene; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class BenchDate implements Serializable { + @HttpApiDocClassDefine(value = "benchCalendar", description = "该日期压测次数", defaultValue = "3") + private Integer dateBenchCount; + @HttpApiDocClassDefine(value = "benchCalendar", description = "压测日期", defaultValue = "2022-12-06") + private String benchDate; + @HttpApiDocClassDefine(value = "benchCalendar", ignore = true,description = "时间戳", defaultValue = "") + private Long timestamp; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/CreateSceneDTO.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/CreateSceneDTO.java new file mode 100644 index 000000000..9d1b09c94 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/CreateSceneDTO.java @@ -0,0 +1,10 @@ +package run.mone.mimeter.dashboard.bo.scene; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CreateSceneDTO extends SceneDTO implements Serializable { + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/DefaultSceneInfo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/DefaultSceneInfo.java new file mode 100644 index 000000000..7bc38dd15 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/DefaultSceneInfo.java @@ -0,0 +1,13 @@ +package run.mone.mimeter.dashboard.bo.scene; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class DefaultSceneInfo implements Serializable { + + String defaultSceneName; + String sceneType; + Object apiInfo; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/DubboApiInfoDTO.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/DubboApiInfoDTO.java new file mode 100644 index 000000000..d32439dde --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/DubboApiInfoDTO.java @@ -0,0 +1,22 @@ +package run.mone.mimeter.dashboard.bo.scene; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; +import run.mone.mimeter.dashboard.bo.sceneapi.SceneDubboApiInfoItemDetail; + +import java.io.Serializable; + +@Data +public class DubboApiInfoDTO extends SceneDubboApiInfoItemDetail implements Serializable,Comparable { + + @HttpApiDocClassDefine(value = "sourceType", required = true, description = "接口来源类型 1:mi-api 2:手动添加", defaultValue = "1") + private Integer sourceType; + + @HttpApiDocClassDefine(value = "requestTimeout", description = "dubbo接口即的请求超时时间 ms", defaultValue = "500") + private Integer requestTimeout; + + @Override + public int compareTo(DubboApiInfoDTO dubboApiInfoDTO) { + return getApiOrder().compareTo(dubboApiInfoDTO.getApiOrder()); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/EditSceneDTO.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/EditSceneDTO.java new file mode 100644 index 000000000..9c5dad560 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/EditSceneDTO.java @@ -0,0 +1,10 @@ +package run.mone.mimeter.dashboard.bo.scene; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class EditSceneDTO extends SceneDTO implements Serializable { + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/GetSceneListByIdsReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/GetSceneListByIdsReq.java new file mode 100644 index 000000000..db651284c --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/GetSceneListByIdsReq.java @@ -0,0 +1,33 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.bo.scene; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class GetSceneListByIdsReq implements Serializable { + + @HttpApiDocClassDefine(value = "sceneIdList",required = true,description = "场景id列表") + private List sceneIdList; + + @HttpApiDocClassDefine(value = "sceneType",required = false,description = "场景类型 0:http 1:dubbo ") + private Integer sceneType; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/GetSceneListReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/GetSceneListReq.java new file mode 100644 index 000000000..84373daf4 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/GetSceneListReq.java @@ -0,0 +1,44 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.bo.scene; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class GetSceneListReq implements Serializable { + + @HttpApiDocClassDefine(value = "page") + private int page; + + @HttpApiDocClassDefine(value = "pageSize") + private int pageSize; + + @HttpApiDocClassDefine(value = "keyword", required = false) + private String keyword; + + @HttpApiDocClassDefine(value = "sceneType", required = false, description = "场景类型 0:http 1:dubbo ") + private Integer sceneType; + + @HttpApiDocClassDefine(value = "status", description = "筛选场景状态 0:待运行、1:运行成功、4:运行中、5:已停止") + private Integer status; + + @HttpApiDocClassDefine(value = "tenant", ignore = true, required = false) + private String tenant; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/GlobalHeader.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/GlobalHeader.java new file mode 100644 index 000000000..bf25e15c7 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/GlobalHeader.java @@ -0,0 +1,11 @@ +package run.mone.mimeter.dashboard.bo.scene; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class GlobalHeader implements Serializable { + private String headerName; + private String headerValue; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/HttpApiInfoDTO.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/HttpApiInfoDTO.java new file mode 100644 index 000000000..8663c79da --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/HttpApiInfoDTO.java @@ -0,0 +1,42 @@ +package run.mone.mimeter.dashboard.bo.scene; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; +import run.mone.mimeter.dashboard.bo.sceneapi.ApiTrafficInfo; +import run.mone.mimeter.dashboard.bo.sceneapi.ApiX5Info; +import run.mone.mimeter.dashboard.bo.sceneapi.SceneHttpApiInfoItemDetail; + +import java.io.Serializable; + +@Data +public class HttpApiInfoDTO extends SceneHttpApiInfoItemDetail implements Serializable,Comparable{ + + @HttpApiDocClassDefine(value = "sourceType", required = true, description = "接口来源类型 1:mi-api 2:手动添加", defaultValue = "1") + private Integer sourceType; + + @HttpApiDocClassDefine(value = "requestTimeout", description = "接口即的请求超时时间 ms", defaultValue = "500") + private Integer requestTimeout; + + @HttpApiDocClassDefine(value = "needLogin",ignore = true, description = "该接口是否需要登录", defaultValue = "false") + private Boolean needLogin; + + @HttpApiDocClassDefine(value = "apiTspAuth", description = "单接口汽车部tsp验权信息,若配置将覆盖全局", defaultValue = "") + private TspAuthInfo apiTspAuth; + + @HttpApiDocClassDefine(value = "apiTrafficInfo", description = "该接口的流量录制配置", defaultValue = "") + private ApiTrafficInfo apiTrafficInfo; + + @HttpApiDocClassDefine(value = "apiX5Info", description = "该接口使用x5鉴权的信息", defaultValue = "") + private ApiX5Info apiX5Info; + + @HttpApiDocClassDefine(value = "tokenType", ignore = true,description = "该接口使用的token业务类别", defaultValue = "1") + private Integer tokenType; + + @HttpApiDocClassDefine(value = "contentType", description = "post请求数据格式类型", defaultValue = "application/json") + private String contentType; + + @Override + public int compareTo(HttpApiInfoDTO httpApiInfoDTO) { + return getApiOrder().compareTo(httpApiInfoDTO.getApiOrder()); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/SceneDTO.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/SceneDTO.java new file mode 100644 index 000000000..e492dd997 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/SceneDTO.java @@ -0,0 +1,122 @@ +package run.mone.mimeter.dashboard.bo.scene; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; +import run.mone.mimeter.dashboard.bo.agent.AgentDTO; +import run.mone.mimeter.dashboard.bo.sla.SlaDto; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +@Data +public class SceneDTO implements Serializable { + + @HttpApiDocClassDefine(value = "id", required = false, description = "场景id", defaultValue = "1") + private Integer id; + + @HttpApiDocClassDefine(value = "name", required = true, description = "场景名", defaultValue = "测试场景1") + private String name; + + @HttpApiDocClassDefine(value = "groupID", required = true, description = "所属分组id", defaultValue = "1") + private Integer groupID; + + @HttpApiDocClassDefine(value = "creator", description = "创建人", defaultValue = "dzx") + private String creator; + + @HttpApiDocClassDefine(value = "更新人", description = "更新人", defaultValue = "dzx") + private String updater; + + @HttpApiDocClassDefine(value = "uTime", required = true, description = "更新时间", defaultValue = "1124141241241") + private Long uTime; + + @HttpApiDocClassDefine(value = "cTime", required = true, description = "创建时间", defaultValue = "1124141241241") + private Long cTime; + + @HttpApiDocClassDefine(value = "benchCount", required = true, description = "压测次数", defaultValue = "12") + private Integer benchCount; + + @HttpApiDocClassDefine(value = "lastBenchTime", required = true, description = "最近压测时间", defaultValue = "1234234422") + private Long lastBenchTime; + + @HttpApiDocClassDefine(value = "apiNum", required = true, description = "有效接口数", defaultValue = "12") + private Integer apiNum; + + @HttpApiDocClassDefine(value = "remark", description = "备注", defaultValue = "这是一个http链路场景") + private String remark; + + @HttpApiDocClassDefine(value = "sceneType", description = "场景类型 0:http 1:dubbo", defaultValue = "1") + private Integer sceneType; + + @HttpApiDocClassDefine(value = "serialLinkDTOs", description = "串联链路信息列表") + private List serialLinkDTOs; + + @HttpApiDocClassDefine(value = "benchMode", required = true, description = "压力模式 0 RPS (目前仅支持该模式)", defaultValue = "0") + private Integer benchMode; + + @HttpApiDocClassDefine(value = "incrementMode", required = true, description = "rps模式下,0 固定rps、1 手动控制rps、2 百分比递增", defaultValue = "0") + private Integer incrementMode; + + @HttpApiDocClassDefine(value = "increasePercent", description = "rps百分比递增模式下,可选 5、10、20、25、50,默认10", defaultValue = "10") + private Integer increasePercent; + + @HttpApiDocClassDefine(value = "benchTime", required = true, description = "施压时间(s)", defaultValue = "60") + private Integer benchTime; + + @HttpApiDocClassDefine(value = "maxBenchQps", required = true, description = "最大施压qps(s)", defaultValue = "60") + private Integer maxBenchQps; + + @HttpApiDocClassDefine(value = "rpsRate", required = true, description = "施压比例,百分比", defaultValue = "60") + private Integer rpsRate; + + @HttpApiDocClassDefine(value = "apiBenchInfos", description = "场景各接口施压配置,最大、起始RPS,json格式", defaultValue = "") + private List apiBenchInfos; + + @HttpApiDocClassDefine(value = "slaBo", description = "SLA配置", defaultValue = "") + private SlaDto slaDto; + + @HttpApiDocClassDefine(value = "datasetIds", description = "数据集id列表", defaultValue = "") + private List datasetIds; + + @HttpApiDocClassDefine(value = "refDatasetIds", description = "引用的数据集id列表", defaultValue = "") + private Map refDatasetIds; + + @HttpApiDocClassDefine(value = "logRate", description = "日志采样率 百分比", defaultValue = "50") + private Integer logRate; + + @HttpApiDocClassDefine(value = "requestTimeout", description = "通用请求超时时间 ms", defaultValue = "500") + private Integer requestTimeout; + + @HttpApiDocClassDefine(value = "successCode", description = "请求成功状态码(默认200) ", defaultValue = "400,300") + private String successCode; + + @HttpApiDocClassDefine(value = "globalTspAuth", description = "全局汽车部tsp验权信息", defaultValue = "") + private TspAuthInfo globalTspAuth; + + @HttpApiDocClassDefine(value = "globalHeaderList", required = true, description = "全局header", defaultValue = "全局请求头") + private List globalHeaderList; + + @HttpApiDocClassDefine(value = "agentIdList", required = true, description = "绑定的压测机id列表", defaultValue = "") + private List agentIdList; + + @HttpApiDocClassDefine(value = "agentDTOList", required = true, description = "绑定的压测机信息列表", defaultValue = "") + private List agentDTOList; + + @HttpApiDocClassDefine(value = "sceneEnv", description = "场景环境 ", defaultValue = "500") + private Integer sceneEnv; + + @HttpApiDocClassDefine(value = "tenant",ignore = true, description = "租户", defaultValue = "") + private String tenant; + + @HttpApiDocClassDefine(value = "sceneSource",description = "场景来源", defaultValue = "0:控制台创建 1:openapi创建") + private Integer sceneSource; + + @HttpApiDocClassDefine(value = "useSla", description = "是否使用sla", defaultValue = "0:否,1:是") + private Integer useSla; + + @HttpApiDocClassDefine(value = "personsInCharge", description = "负责人列表", defaultValue = "") + private List personsInCharge; + + @HttpApiDocClassDefine(value = "benchCalendar", description = "压测日历", defaultValue = "") + private BenchCalendar benchCalendar; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/SceneList.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/SceneList.java new file mode 100644 index 000000000..d24d88ea5 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/SceneList.java @@ -0,0 +1,14 @@ +package run.mone.mimeter.dashboard.bo.scene; + +import lombok.Data; +import run.mone.mimeter.dashboard.bo.common.PageBase; + +import java.io.Serializable; +import java.util.List; + +@Data +public class SceneList extends PageBase implements Serializable { + + private List list; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/SceneSnapshotBo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/SceneSnapshotBo.java new file mode 100644 index 000000000..a3f78fcc8 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/SceneSnapshotBo.java @@ -0,0 +1,49 @@ +package run.mone.mimeter.dashboard.bo.scene; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Date; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/6/23 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class SceneSnapshotBo { + + private Long id; + + private Integer type; + + private Long sceneId; + + private String snapshotId; + + private Date createTime; + + private Date updateTime; + + private String createBy; + + private Integer version; + + @HttpApiDocClassDefine(value = "md5", description = "场景快照数据sha256") + private String md5; + + @HttpApiDocClassDefine(value = "scene", description = "场景快照json数据, SceneDTO") + private String scene; + + public boolean checkCreate() { + return this.sceneId != null && this.sceneId > 0 && StringUtils.isNotBlank(this.createBy) && + StringUtils.isNotBlank(this.scene); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/SceneTaskAppsBo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/SceneTaskAppsBo.java new file mode 100644 index 000000000..bbbccd968 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/SceneTaskAppsBo.java @@ -0,0 +1,33 @@ +package run.mone.mimeter.dashboard.bo.scene; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class SceneTaskAppsBo implements Serializable { + private String sceneTask; + private Long fromTime; + private Long toTime; + + private List serialLinks; + + @Data + public static class LinkTaskAppsBo implements Serializable { + private String serialLinkName; + private String serialLinkId; + private List apis; + } + + @Data + public static class ApiTaskAppsBo implements Serializable { + private String apiName; + private String apiId; + private List apps; + } + + + +} + diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/SerialLinkDTO.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/SerialLinkDTO.java new file mode 100644 index 000000000..4c5afd421 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/SerialLinkDTO.java @@ -0,0 +1,32 @@ +package run.mone.mimeter.dashboard.bo.scene; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class SerialLinkDTO implements Serializable { + + @HttpApiDocClassDefine(value = "httpApiInfoDTOList", description = "绑定的接口列表,http场景") + private List httpApiInfoDTOList; + + @HttpApiDocClassDefine(value = "dubboApiInfoDTOList", description = "绑定的接口列表,dubbo场景") + private List dubboApiInfoDTOList; + + @HttpApiDocClassDefine(value = "serialLinkID",required = false, description = "接口所属链路id,更新时使用,新增不需要", defaultValue = "12") + private Integer serialLinkID; + + @HttpApiDocClassDefine(value = "serialLinkName",required = true, description = "接口所属链路名", defaultValue = "串联链路1") + private String serialLinkName; + + @HttpApiDocClassDefine(value = "enable",required = true, description = "压测时是否启用该接口", defaultValue = "true") + private Boolean enable; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/TspAuthInfo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/TspAuthInfo.java new file mode 100644 index 000000000..aed95c9f4 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scene/TspAuthInfo.java @@ -0,0 +1,29 @@ +package run.mone.mimeter.dashboard.bo.scene; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class TspAuthInfo implements Serializable { + @HttpApiDocClassDefine(value = "enableAuth", description = "是否启用TSP验权", defaultValue = "false") + private boolean enableAuth; + @HttpApiDocClassDefine(value = "accessKey", description = "TSP验权的 accessKey", defaultValue = "xxxx") + private String accessKey; + @HttpApiDocClassDefine(value = "secretKey", description = "TSP验权的 secretKey", defaultValue = "xxxx") + private String secretKey; + + public TspAuthInfo(boolean enableAuth) { + this.enableAuth = enableAuth; + } + + public TspAuthInfo() { + } + + public TspAuthInfo(boolean enableAuth, String accessKey, String secretKey) { + this.enableAuth = enableAuth; + this.accessKey = accessKey; + this.secretKey = secretKey; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/ApiHeader.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/ApiHeader.java new file mode 100644 index 000000000..0cb8a96db --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/ApiHeader.java @@ -0,0 +1,16 @@ +package run.mone.mimeter.dashboard.bo.sceneapi; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApiHeader implements Serializable { + private String headerName; + private String headerValue; + + public ApiHeader(String headerName, String headerValue) { + this.headerName = headerName; + this.headerValue = headerValue; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/ApiTrafficInfo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/ApiTrafficInfo.java new file mode 100644 index 000000000..e3ef2d6b9 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/ApiTrafficInfo.java @@ -0,0 +1,34 @@ +package run.mone.mimeter.dashboard.bo.sceneapi; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +/** + * todo 目前尚未支持dubbo的流量录制后续支持后续另加 dubbo 相关 + */ +@Data +public class ApiTrafficInfo implements Serializable { + @HttpApiDocClassDefine(value = "enableTraffic", description = "是否使用录制的流量", defaultValue = "false") + private boolean enableTraffic; + + @HttpApiDocClassDefine(value = "url", description = "录制的网关url", defaultValue = "/mtop/test/api") + private String url; + + @HttpApiDocClassDefine(value = "fromTime", description = "录制参数的时间范围起点", defaultValue = "141242112") + private long fromTime; + + @HttpApiDocClassDefine(value = "toTime", description = "录制参数的的时间范围终点", defaultValue = "141242112") + private long toTime; + + @HttpApiDocClassDefine(value = "recordingConfigId", description = "录制配置id", defaultValue = "31") + private Integer recordingConfigId; + + public ApiTrafficInfo() { + } + + public ApiTrafficInfo(boolean enableTraffic) { + this.enableTraffic = enableTraffic; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/ApiX5Info.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/ApiX5Info.java new file mode 100644 index 000000000..2e8ce4abc --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/ApiX5Info.java @@ -0,0 +1,49 @@ +/* + * Copyright 2020 XiaoMi. + * + * Licensed 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 the following link. + * + * 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. + */ +package run.mone.mimeter.dashboard.bo.sceneapi; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +/** + * Created by dongzhenxing on 2023/3/6 10:43 AM + */ +@Data +public class ApiX5Info implements Serializable { + @HttpApiDocClassDefine(value = "enableX5", description = "是否使用x5协议", defaultValue = "false") + private boolean enableX5; + + @HttpApiDocClassDefine(value = "appID", description = "应用id", defaultValue = "121") + private String appId; + + @HttpApiDocClassDefine(value = "appKey", description = "应用密钥", defaultValue = "password") + private String appKey; + + @HttpApiDocClassDefine(value = "x5Method", description = "方法", defaultValue = "get") + private String x5Method; + + @HttpApiDocClassDefine(value = "x5Version", description = "x5的版本", defaultValue = "china") + private String x5Version; + + public ApiX5Info() { + } + + public ApiX5Info(boolean enableX5) { + this.enableX5 = enableX5; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/CheckPointInfoDTO.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/CheckPointInfoDTO.java new file mode 100644 index 000000000..a3be0b1ee --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/CheckPointInfoDTO.java @@ -0,0 +1,17 @@ +package run.mone.mimeter.dashboard.bo.sceneapi; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CheckPointInfoDTO implements Serializable { + private Integer id; + + @JsonProperty(value = "type") + private Integer checkType = 3; + private String checkObj; + private Integer checkCondition; + private String checkContent; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/FormParamValue.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/FormParamValue.java new file mode 100644 index 000000000..2ae550a7d --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/FormParamValue.java @@ -0,0 +1,16 @@ +package run.mone.mimeter.dashboard.bo.sceneapi; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class FormParamValue implements Serializable { + String paramKey; + Object paramValue; + + public FormParamValue(String paramKey, Object paramValue) { + this.paramKey = paramKey; + this.paramValue = paramValue; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/GetApiDetailReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/GetApiDetailReq.java new file mode 100644 index 000000000..98a9de52b --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/GetApiDetailReq.java @@ -0,0 +1,21 @@ +package run.mone.mimeter.dashboard.bo.sceneapi; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class GetApiDetailReq implements Serializable { + @HttpApiDocClassDefine(value = "projectID", required = true, description = "mi-api中的项目id", defaultValue = "432") + private Integer projectID; + + @HttpApiDocClassDefine(value = "apiID", required = true, description = "mi-api中的接口id", defaultValue = "666") + private Integer apiID; + + /** + * 1:http 3:dubbo 4:mione gateway + */ + @HttpApiDocClassDefine(value = "apiProtocol", required = true, description = "该接口的协议类型 1:http 3:dubbo 4:mione gateway", defaultValue = "1") + private Integer apiProtocol; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/GetDubboServiceReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/GetDubboServiceReq.java new file mode 100644 index 000000000..a4e42876c --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/GetDubboServiceReq.java @@ -0,0 +1,11 @@ +package run.mone.mimeter.dashboard.bo.sceneapi; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class GetDubboServiceReq implements Serializable { + String env; + String serviceName; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/OutputOriginEnum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/OutputOriginEnum.java new file mode 100644 index 000000000..10c93bc1d --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/OutputOriginEnum.java @@ -0,0 +1,12 @@ +package run.mone.mimeter.dashboard.bo.sceneapi; + +public enum OutputOriginEnum { + BODY_TXT(1), + BODY_JSON(2); + + public final int code; + + OutputOriginEnum(int code) { + this.code = code; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/SceneApiInfoItemBasic.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/SceneApiInfoItemBasic.java new file mode 100644 index 000000000..64bf79f23 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/SceneApiInfoItemBasic.java @@ -0,0 +1,42 @@ +package run.mone.mimeter.dashboard.bo.sceneapi; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class SceneApiInfoItemBasic implements Serializable { + @HttpApiDocClassDefine(value = "apiName", required = true, description = "接口名称", defaultValue = "测试接口") + private String apiName; + + @HttpApiDocClassDefine(value = "apiOrder", required = true, description = "该场景于该链路下的接口顺序", defaultValue = "1") + private Integer apiOrder; + + @HttpApiDocClassDefine(value = "projectID", ignore = true, required = true, description = "接口在mi-api中的项目id", defaultValue = "666") + private Integer projectID; + + @HttpApiDocClassDefine(value = "apiID", ignore = true, required = true, description = "接口在mi-api中的id", defaultValue = "1411") + private Integer apiID; + + @HttpApiDocClassDefine(value = "apiProtocol", required = true, description = "该接口的协议类型 1:http 3:dubbo 4:mione gateway", defaultValue = "1") + private Integer apiProtocol; + + @HttpApiDocClassDefine(value = "outputParamInfo", description = "出参定义", defaultValue = "") + private List outputParamInfos; + + @HttpApiDocClassDefine(value = "checkPointInfoList", description = "检查点信息列表", defaultValue = "") + private List checkPointInfoList; + + @HttpApiDocClassDefine(value = "filterCondition", description = "过滤条件列表", defaultValue = "") + private List filterCondition; + + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/SceneApiOutputParam.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/SceneApiOutputParam.java new file mode 100644 index 000000000..ec32f66f9 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/SceneApiOutputParam.java @@ -0,0 +1,21 @@ +package run.mone.mimeter.dashboard.bo.sceneapi; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class SceneApiOutputParam implements Serializable { + @HttpApiDocClassDefine(value = "paramName", required = true, description = "参数名称", defaultValue = "result") + private String paramName; + + @HttpApiDocClassDefine(value = "origin", required = true, description = "参数来源 1:Body:json 2:Body:txt", defaultValue = "1") + private Integer origin; + + @HttpApiDocClassDefine(value = "originParseExpr", required = true, description = "原解析表达式", defaultValue = "") + private String originParseExpr; + + @HttpApiDocClassDefine(value = "parseExpr", required = true, description = "解析表达式", defaultValue = "") + private String parseExpr; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/SceneDubboApiInfoItemBasic.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/SceneDubboApiInfoItemBasic.java new file mode 100644 index 000000000..0201c700a --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/SceneDubboApiInfoItemBasic.java @@ -0,0 +1,14 @@ +package run.mone.mimeter.dashboard.bo.sceneapi; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class SceneDubboApiInfoItemBasic extends SceneApiInfoItemBasic implements Serializable { + private String serviceName; + private String methodName; + private String group; + private String version; + private String path; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/SceneDubboApiInfoItemDetail.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/SceneDubboApiInfoItemDetail.java new file mode 100644 index 000000000..6e1c9669e --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/SceneDubboApiInfoItemDetail.java @@ -0,0 +1,26 @@ +package run.mone.mimeter.dashboard.bo.sceneapi; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * for get dubbo api detail resp + */ +@Data +public class SceneDubboApiInfoItemDetail extends SceneDubboApiInfoItemBasic implements Serializable { + @HttpApiDocClassDefine(value = "dubboEnv", required = true, description = "dubbo服务的nacos环境", defaultValue = "staging") + private String dubboEnv; + + @HttpApiDocClassDefine(value = "requestParamTypeList", required = true, description = "请求参数类型列表", defaultValue = "[]") + private List requestParamTypeList; + + @HttpApiDocClassDefine(value = "requestBody", required = true, description = "请求数据,json格式字符串", defaultValue = "[{}]") + private String requestBody; + + @HttpApiDocClassDefine(value = "attachments", description = "dubbo携带的attachements,等同于http的header", defaultValue = "{}") + private String attachments; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/SceneHttpApiInfoItemBasic.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/SceneHttpApiInfoItemBasic.java new file mode 100644 index 000000000..dfd0879fa --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/SceneHttpApiInfoItemBasic.java @@ -0,0 +1,15 @@ +package run.mone.mimeter.dashboard.bo.sceneapi; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class SceneHttpApiInfoItemBasic extends SceneApiInfoItemBasic implements Serializable { + @HttpApiDocClassDefine(value = "apiUrl", required = true, description = "接口的url", defaultValue = "/api/getUserInfo") + private String apiUrl; + + @HttpApiDocClassDefine(value = "apiRequestType", required = true, description = "http接口请求类型 0:post 1:get", defaultValue = "0") + private Integer apiRequestType; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/SceneHttpApiInfoItemDetail.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/SceneHttpApiInfoItemDetail.java new file mode 100644 index 000000000..8257f3646 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/SceneHttpApiInfoItemDetail.java @@ -0,0 +1,25 @@ +package run.mone.mimeter.dashboard.bo.sceneapi; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +/** + * for get http api detail resp + */ +@Data +public class SceneHttpApiInfoItemDetail extends SceneHttpApiInfoItemBasic implements Serializable { + @HttpApiDocClassDefine(value = "requestInfo", description = "请求数据,json格式字符串,含格式", defaultValue = "{}") + private String requestInfo; + + @HttpApiDocClassDefine(value = "apiRequestParamType", description = "请求数据格式", defaultValue = "0") + private Integer apiRequestParamType; + + @HttpApiDocClassDefine(value = "requestRaw", description = "请求数据,json raw格式", defaultValue = "{}") + private String requestInfoRaw; + + @HttpApiDocClassDefine(value = "headerInfo", required = true, description = "请求头,json格式字符串", defaultValue = "{}") + private String headerInfo; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/X5VersionEnum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/X5VersionEnum.java new file mode 100644 index 000000000..d995ed5f0 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sceneapi/X5VersionEnum.java @@ -0,0 +1,14 @@ +package run.mone.mimeter.dashboard.bo.sceneapi; + +public enum X5VersionEnum { + //中国区 + CHINA_VERSION("CHINA_VERSION"), + //信息部 + INFORMATION_VERISON("INFORMATION_VERISON"); + + public final String version; + + X5VersionEnum(String version) { + this.version = version; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scenegroup/GetSceneGroupListReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scenegroup/GetSceneGroupListReq.java new file mode 100644 index 000000000..2c4ca4b6d --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scenegroup/GetSceneGroupListReq.java @@ -0,0 +1,41 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.bo.scenegroup; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class GetSceneGroupListReq implements Serializable { + + @HttpApiDocClassDefine(value = "page") + private int page; + + @HttpApiDocClassDefine(value = "pageSize") + private int pageSize; + + @HttpApiDocClassDefine(value = "keyword",required = false) + private String keyword; + + @HttpApiDocClassDefine(value = "sceneType",required = false,description = "场景类型 0:http 1:dubbo ") + private Integer sceneType; + + @HttpApiDocClassDefine(value = "tenant", ignore = true, required = false) + private String tenant; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scenegroup/GroupSceneDTO.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scenegroup/GroupSceneDTO.java new file mode 100644 index 000000000..88dc09e9d --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scenegroup/GroupSceneDTO.java @@ -0,0 +1,22 @@ +package run.mone.mimeter.dashboard.bo.scenegroup; + +import lombok.Data; +import run.mone.mimeter.dashboard.bo.scene.BasicSceneDTO; + +import java.io.Serializable; +import java.util.List; + +@Data +public class GroupSceneDTO implements Serializable { + + private Integer sceneGroupID; + + private String groupName; + + private String groupDesc; + + private Long ctime; + + private List list; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scenegroup/SceneGroupDTO.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scenegroup/SceneGroupDTO.java new file mode 100644 index 000000000..9ae41254f --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scenegroup/SceneGroupDTO.java @@ -0,0 +1,18 @@ +package run.mone.mimeter.dashboard.bo.scenegroup; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class SceneGroupDTO implements Serializable { + private Integer id; + + private String groupName; + + private String groupDesc; + + private String creator; + + private String tenant; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scenegroup/SceneGroupList.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scenegroup/SceneGroupList.java new file mode 100644 index 000000000..4719f9caf --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/scenegroup/SceneGroupList.java @@ -0,0 +1,13 @@ +package run.mone.mimeter.dashboard.bo.scenegroup; + +import lombok.Data; +import run.mone.mimeter.dashboard.bo.common.PageBase; + +import java.io.Serializable; +import java.util.List; + +@Data +public class SceneGroupList extends PageBase implements Serializable { + + private List list; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/ActionEnum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/ActionEnum.java new file mode 100644 index 000000000..57cb7e024 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/ActionEnum.java @@ -0,0 +1,16 @@ +package run.mone.mimeter.dashboard.bo.sla; + +public enum ActionEnum { + + //报警级别 + WARNING("WARNING", "警告通知"), + ERROR("ERROR", "停止压测"); + + public String degreeName; + public String degreeCname; + + ActionEnum(String degreeName, String degreeCname) { + this.degreeName = degreeName; + this.degreeCname = degreeCname; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/AlarmDto.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/AlarmDto.java new file mode 100644 index 000000000..5c6586abd --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/AlarmDto.java @@ -0,0 +1,19 @@ +package run.mone.mimeter.dashboard.bo.sla; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class AlarmDto implements Serializable { + + @HttpApiDocClassDefine(value = "alarmType", required = false, description = "报警类别", defaultValue = "") + private String alarmType; + + @HttpApiDocClassDefine(value = "alarmMethods", required = false, description = "报警方式 0:飞书 1:短信", defaultValue = "") + private List alarmMethods; + + private List usernames; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/BenchEvent.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/BenchEvent.java new file mode 100644 index 000000000..e640a7fa4 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/BenchEvent.java @@ -0,0 +1,11 @@ +package run.mone.mimeter.dashboard.bo.sla; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class BenchEvent implements Serializable { + private String msg; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/DegreeEnum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/DegreeEnum.java new file mode 100644 index 000000000..e47240a86 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/DegreeEnum.java @@ -0,0 +1,20 @@ +package run.mone.mimeter.dashboard.bo.sla; + +public enum DegreeEnum { + + //敏感程度 + Sensitive(1, "敏感,连续一次"), + Tolerable(2, "可容忍,连续三次"), + NotSensitive(3, "不敏感,连续五次"); + + + public final int code; + + public String degreeName; + public final String degreeCname; + + DegreeEnum(int code, String degreeCname) { + this.code = code; + this.degreeCname = degreeCname; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/GetSlaListReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/GetSlaListReq.java new file mode 100644 index 000000000..20be6f741 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/GetSlaListReq.java @@ -0,0 +1,38 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.bo.sla; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class GetSlaListReq implements Serializable { + + @HttpApiDocClassDefine(value = "slaName", required = false, description = "sla名称", defaultValue = "sla名称") + private String slaName; + + @HttpApiDocClassDefine(value = "creator", required = false, description = "创建人", defaultValue = "1") + private String creator; + + @HttpApiDocClassDefine(value = "page", required = true, description = "当前的页码", defaultValue = "1") + private int page; + + @HttpApiDocClassDefine(value = "pageSize", required = true, description = "每页条数", defaultValue = "10") + private int pageSize; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/PerRuleItem.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/PerRuleItem.java new file mode 100644 index 000000000..b7cb4a134 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/PerRuleItem.java @@ -0,0 +1,37 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.bo.sla; + +import lombok.Data; +import run.mone.mimeter.dashboard.bo.common.CommonEnum; + +import java.io.Serializable; +import java.util.List; + +@Data +public class PerRuleItem implements Serializable { + + + /** + * 返回的信息列表 + */ + private List ruleList; + + private String ruleItemTypeName; + private String ruleItemTypeCname; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaBusinessGroupEnum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaBusinessGroupEnum.java new file mode 100644 index 000000000..01625bd63 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaBusinessGroupEnum.java @@ -0,0 +1,15 @@ +package run.mone.mimeter.dashboard.bo.sla; + +public enum SlaBusinessGroupEnum { + + InternetService("InternetService", "互联网服务"), + InternetGame("InternetGame", "互联网游戏"); + + public String businessGroupName; + public String businessGroupCname; + + SlaBusinessGroupEnum(String businessGroupName, String businessGroupCname) { + this.businessGroupName = businessGroupName; + this.businessGroupCname = businessGroupCname; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaDto.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaDto.java new file mode 100644 index 000000000..8bee56ee9 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaDto.java @@ -0,0 +1,42 @@ +package run.mone.mimeter.dashboard.bo.sla; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class SlaDto implements Serializable { + + @HttpApiDocClassDefine(value = "id", required = false, description = "sla序号", defaultValue = "1") + private Integer id; + + @HttpApiDocClassDefine(value = "name", required = true, description = "sla名称", defaultValue = "sla示例名") + private String name; + + @HttpApiDocClassDefine(value = "note", required = false, description = "sla描述", defaultValue = "sla示理描述") + private String note; + + @HttpApiDocClassDefine(value = "businessGroup", required = true, description = "业务分类", defaultValue = "1") + private String businessGroup; + + @HttpApiDocClassDefine(value = "ctime", required = false, description = "创建时间", defaultValue = "0") + private Long ctime; + + @HttpApiDocClassDefine(value = "utime", required = false, description = "更新时间", defaultValue = "1") + private Long utime; + + @HttpApiDocClassDefine(value = "creator", required = false, description = "创建人", defaultValue = "创建人") + private String creator; + + @HttpApiDocClassDefine(value = "updater", required = false, description = "更新人", defaultValue = "更新人") + private String updater; + + @HttpApiDocClassDefine(value = "slaRuleList", required = false, description = "sla规则列表", defaultValue = "") + private List slaRuleDtos; + + @HttpApiDocClassDefine(value = "alarmDto", required = false, description = "报警方式与接收人", defaultValue = "") + private List alarmDtos; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaEvent.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaEvent.java new file mode 100644 index 000000000..f86f216a1 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaEvent.java @@ -0,0 +1,23 @@ +package run.mone.mimeter.dashboard.bo.sla; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class SlaEvent extends BenchEvent implements Serializable { + //若业务指标触发则有以下几项 + private int triggerApiId; + private String apiName; + private String apiUrlOrServiceName; + + private String alarmLevel; + private int degree; + private String slaRuleName; + private String ruleItemType; + private String ruleItem; + private String condition; + private String triggerItem; + private Double value; + private Double ruleTargetValue; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaList.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaList.java new file mode 100644 index 000000000..17a527c74 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaList.java @@ -0,0 +1,35 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.bo.sla; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; +import run.mone.mimeter.dashboard.bo.common.PageBase; + +import java.io.Serializable; +import java.util.List; + +@Data +public class SlaList extends PageBase implements Serializable { + + /** + * 返回的信息列表 + */ + @HttpApiDocClassDefine(value = "list", required = false, description = "sla列表") + private List list; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaRuleDto.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaRuleDto.java new file mode 100644 index 000000000..703706ee6 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaRuleDto.java @@ -0,0 +1,52 @@ +package run.mone.mimeter.dashboard.bo.sla; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class SlaRuleDto implements Serializable { + + @HttpApiDocClassDefine(value = "id", required = false, description = "sla规则序号", defaultValue = "1") + private Integer id; + + @HttpApiDocClassDefine(value = "slaId", required = false, description = "sla序号", defaultValue = "1") + private Integer slaId; + + @HttpApiDocClassDefine(value = "name", required = true, description = "sla规则名称", defaultValue = "sla规则示例名") + private String name; + + @HttpApiDocClassDefine(value = "ruleItemType", required = true, description = "指标类型", defaultValue = "业务指标") + private String ruleItemType; + + @HttpApiDocClassDefine(value = "ruleItem", required = true, description = "指标名", defaultValue = "成功率") + private String ruleItem; + + @HttpApiDocClassDefine(value = "condition", required = true, description = "对比条件", defaultValue = "=") + private String condition; + + @HttpApiDocClassDefine(value = "value", required = true, description = "对比值", defaultValue = "100") + private Integer value; + + @HttpApiDocClassDefine(value = "degree", required = true, description = "敏感程度", defaultValue = "1") + private Integer degree; + + @HttpApiDocClassDefine(value = "action", required = true, description = "报警级别", defaultValue = "WARNING") + private String action; + + @HttpApiDocClassDefine(value = "ctime", required = false, description = "创建时间", defaultValue = "0") + private Long ctime; + + @HttpApiDocClassDefine(value = "utime", required = false, description = "更新时间", defaultValue = "0") + private Long utime; + + @HttpApiDocClassDefine(value = "creator", required = false, description = "创建人", defaultValue = "创建人") + private String creator; + + @HttpApiDocClassDefine(value = "updater", required = false, description = "更新人", defaultValue = "更新人") + private String updater; + + + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaRuleItemEnum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaRuleItemEnum.java new file mode 100644 index 000000000..df88e0664 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaRuleItemEnum.java @@ -0,0 +1,33 @@ +package run.mone.mimeter.dashboard.bo.sla; + +public enum SlaRuleItemEnum { + + //业务指标 + SuccessRate("SuccessRate", "成功率", "%"), + P99ResponseTime("P99ResponseTime", "P99_RT", "ms"), + + AvgResponseTime("AvgResponseTime", "Avg_RT", "ms"), + RequestPerSecond("RequestPerSecond", "RPS", "/s"), + + //监控指标 + CpuUtilization("CpuUtilization", "CPU利用率", "%"), + MemoryUtilization("MemoryUtilization", "内存利用率", "%"), + Load5Average("Load5Average", "load5平均值", ""), + Load5Max("Load5Max", "load5最大值", ""), + DropConnectionAverage("DropConnectionAverage", "丢弃连接数平均值", "个"), + DropConnectionMax("DropConnectionMax", "丢弃连接数最大值", "个"); + + + + public String ruleItemName; + + public String ruleItemCname; + + public String unit; + + SlaRuleItemEnum(String ruleItemName, String ruleItemCname, String unit) { + this.ruleItemName = ruleItemName; + this.ruleItemCname = ruleItemCname; + this.unit = unit; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaRuleItemTypeEnum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaRuleItemTypeEnum.java new file mode 100644 index 000000000..05b0ea9a1 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/SlaRuleItemTypeEnum.java @@ -0,0 +1,15 @@ +package run.mone.mimeter.dashboard.bo.sla; + +public enum SlaRuleItemTypeEnum { + + BusinessMetrics("BusinessMetrics", "业务指标"), + MonitorMetrics("MonitorMetrics", "监控指标"); + + public String ruleItemTypeName; + public String ruleItemTypeCname; + + SlaRuleItemTypeEnum(String ruleItemTypeName, String ruleItemTypeCname) { + this.ruleItemTypeName = ruleItemTypeName; + this.ruleItemTypeCname = ruleItemTypeCname; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/UserDTO.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/UserDTO.java new file mode 100644 index 000000000..395f0ddbf --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/sla/UserDTO.java @@ -0,0 +1,13 @@ +package run.mone.mimeter.dashboard.bo.sla; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class UserDTO implements Serializable { + private String user; + private String username; + private String email; + private String phoneNum; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/snapshot/SnapshotTypeEnum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/snapshot/SnapshotTypeEnum.java new file mode 100644 index 000000000..d4e17036c --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/snapshot/SnapshotTypeEnum.java @@ -0,0 +1,14 @@ +package run.mone.mimeter.dashboard.bo.snapshot; + +public enum SnapshotTypeEnum { + + SCENE_SNAPSHOT(1), + DEBUG_SNAPSHOT(2); + + public int typeCode; + + SnapshotTypeEnum(int typeCode) { + this.typeCode = typeCode; + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/statistics/ApiStatistics.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/statistics/ApiStatistics.java new file mode 100644 index 000000000..dcbc43312 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/statistics/ApiStatistics.java @@ -0,0 +1,101 @@ +package run.mone.mimeter.dashboard.bo.statistics; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ApiStatistics implements Serializable { + + private int apiId; + + private String apiName; + + /** + * 接口类型 0:http 1:dubbo + */ + private int apiType; + + private String uri; + + private String method; + + private String dubboServiceName; + + private String dubboMethodName; + + private String dubboGroup; + + private String dubboVersion; + + private int serialId; + + /** + * 该接口总请求次数 + */ + private int reqTotal; + + /** + * 业务事务处理总数 + */ + private int tansTotal; + + /** + * 该接口总请求成功次数 + */ + private int reqSucc; + + /** + * 该接口总请求失败次数 + */ + private int reqFail; + + /** + * 该接口请求成功率 + */ + private String succRate; + + /** + * 接口平均rt + */ + private int avgRt; + + /** + * 接口最大rt + */ + private int maxRt; + + + /** + * p99 rt + */ + private int p99Rt; + + + /** + * p95rt + */ + private int p95Rt; + + /** + * 接口平均tps + */ + private int avgTps; + + /** + * 接口最大tps + */ + private int maxTps; + + /** + * 接口最大rps + */ + private int maxRps; + + + /** + * 接口平均rps + */ + private int avgRps; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/statistics/ErrorTypeAnalysis.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/statistics/ErrorTypeAnalysis.java new file mode 100644 index 000000000..cfe106a5e --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/statistics/ErrorTypeAnalysis.java @@ -0,0 +1,49 @@ +package run.mone.mimeter.dashboard.bo.statistics; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Map; + +@Data +public class ErrorTypeAnalysis implements Serializable { + /** + * 0:错误码 or 1:检查点 + */ + private int errorType; + + /** + * http错误状态码 + */ + private int errorCode; + /** + * 该错误占比 + */ + private String errRate; + + /** + * 各接口该错误次数 + */ + private Map errInApis; + + /** + * 错误次数最多的api id + */ + private Integer mostErrApi; + + /** + * 错误次数最多的接口名 + */ + private String mostErrApiName; + + /** + * 检查点错误类型的 规则id + */ + private Integer checkPointId; + + /** + * 检查点错误类型的类型 + */ + private String checkPointDesc; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/statistics/TotalStatAnalysisEvent.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/statistics/TotalStatAnalysisEvent.java new file mode 100644 index 000000000..05c49fbfa --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/statistics/TotalStatAnalysisEvent.java @@ -0,0 +1,103 @@ +package run.mone.mimeter.dashboard.bo.statistics; + + +import lombok.Data; +import run.mone.mimeter.dashboard.bo.task.DagTaskRps; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +@Data +public class TotalStatAnalysisEvent implements Serializable { + + /** + * 全场景总请求次数 + */ + private int totalReq; + + /** + * 丢失连接数 + */ + private int lossConnNum; + + /** + * 全场景业务处理次数 + */ + private int totalTCount; + + /** + * 全场景成功次数 + */ + private int totalSuccReq; + + /** + * 全场景总错误请求次数 + */ + private int totalErrReq; + + /** + * 全场景成功率 + */ + private String totalSuccRate; + + /** + * 总错误占比 + */ + private String totalErrRate; + + /** + * 全场景平均rt + */ + private int avgRt; + + /** + * 全场景最大rt + */ + private int maxRt; + + /** + * 全场景平均tps + */ + private int avgTps; + + /** + * 全场景最大rps + */ + private int maxRps; + + /** + * 全场景平均rps + */ + private int avgRps; + + /** + * 全场景最大tps + */ + private int maxTps; + + /** + * 是否结束 + */ + private boolean finish; + + /** + * 全场景发压比例 + */ + private Integer rpsRate; + + /** + * 各错误类型统计分析 + */ + private List errorTypeAnalyses; + + /** + * 接口统计数据 + */ + private List apiStatisticsList; + + /** + * 链路id与dag任务id、rps映射 + */ + private Map linkToDagTaskRpsMap; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/BenchIncreaseModeEnum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/BenchIncreaseModeEnum.java new file mode 100644 index 000000000..25c1eeeeb --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/BenchIncreaseModeEnum.java @@ -0,0 +1,15 @@ +package run.mone.mimeter.dashboard.bo.task; + +public enum BenchIncreaseModeEnum { + + //Rps压力增加模式 0 固定() 1 手动 2 百分比递增 + STABLE(0), + MANUAL(1), + PERCENT_INCREASE(2); + + public final int code; + + BenchIncreaseModeEnum(int code) { + this.code = code; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/BenchModeEnum.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/BenchModeEnum.java new file mode 100644 index 000000000..c2705c262 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/BenchModeEnum.java @@ -0,0 +1,13 @@ +package run.mone.mimeter.dashboard.bo.task; + +public enum BenchModeEnum { + //压力模式 + RPS(0), + CONCURRENT(1); + + public final int code; + + BenchModeEnum(int code) { + this.code = code; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/DagTaskRps.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/DagTaskRps.java new file mode 100644 index 000000000..40bf24504 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/DagTaskRps.java @@ -0,0 +1,26 @@ +package run.mone.mimeter.dashboard.bo.task; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class DagTaskRps implements Serializable { + @HttpApiDocClassDefine(value = "linkId", required = true, description = "链路id", defaultValue = "120221") + Integer linkId; + @HttpApiDocClassDefine(value = "taskId", required = true, description = "该链路当前任务id", defaultValue = "12123") + Integer taskId; + + @HttpApiDocClassDefine(value = "rps", required = true, description = "该链路当前任务rps", defaultValue = "10000") + Integer rps; + + public DagTaskRps() { + } + + public DagTaskRps(Integer linkId, Integer taskId, Integer rps) { + this.linkId = linkId; + this.taskId = taskId; + this.rps = rps; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/DebugSceneApiInfoReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/DebugSceneApiInfoReq.java new file mode 100644 index 000000000..ea80de25e --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/DebugSceneApiInfoReq.java @@ -0,0 +1,75 @@ +package run.mone.mimeter.dashboard.bo.task; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; +import run.mone.mimeter.dashboard.bo.scene.TspAuthInfo; +import run.mone.mimeter.dashboard.bo.sceneapi.CheckPointInfoDTO; +import run.mone.mimeter.dashboard.bo.sceneapi.SceneApiOutputParam; + +import java.io.Serializable; +import java.util.List; + +/** + * @author dongzhenxing + * 用于单独调试的接口信息 + */ +@Data +public class DebugSceneApiInfoReq implements Serializable { + + @HttpApiDocClassDefine(value = "apiType", description = "接口类型 1:http 3:dubbo") + private Integer apiType; + + @HttpApiDocClassDefine(value = "apiUrl", description = "http接口 url",defaultValue = "http://www.baidu.com") + private String apiUrl; + + @HttpApiDocClassDefine(value = "requestMethod", description = "请求方式 0:get,1:post",defaultValue = "1") + private Integer requestMethod; + + @HttpApiDocClassDefine(value = "apiHeader", description = "http请求头",defaultValue = "json格式字符串") + private String apiHeader; + + @HttpApiDocClassDefine(value = "requestParamInfo",ignore = true, description = "http请求参数信息,带格式",defaultValue = "") + private String requestParamInfo; + + @HttpApiDocClassDefine(value = "requestBody", description = "http请求参数信息,raw",defaultValue = "") + private String requestBody; + + @HttpApiDocClassDefine(value = "requestTimeout", description = "请求超时时间",defaultValue = "3000") + private Integer requestTimeout = 1000; + + @HttpApiDocClassDefine(value = "contentType", description = "http接口参数格式类型",defaultValue = "application/json") + private String contentType; + + @HttpApiDocClassDefine(value = "api_tsp_auth", description = "单接口汽车部tsp验权信息,若配置将覆盖全局", defaultValue = "") + private TspAuthInfo apiTspAuth; + + @HttpApiDocClassDefine(value = "checkPointInfoList", description = "检查点信息列表", defaultValue = "") + private List checkPointInfoList; + + @HttpApiDocClassDefine(value = "outputParamInfo", description = "出参定义", defaultValue = "") + private List outputParamInfos; + + private String checkPointInfoListStr; + + private String outputParamInfosStr; + + @HttpApiDocClassDefine(value = "serviceName", description = "dubbo服务名",defaultValue = "test0930.api.HealthService") + private String serviceName; + + @HttpApiDocClassDefine(value = "methodName", description = "dubbo方法名",defaultValue = "ping") + private String methodName; + + @HttpApiDocClassDefine(value = "paramTypeList", description = "参数类型列表",defaultValue = "") + private String paramTypeList; + + @HttpApiDocClassDefine(value = "dubboGroup", description = "dubbo服务分组",defaultValue = "staging") + private String dubboGroup; + + @HttpApiDocClassDefine(value = "dubboVersion", description = "dubbo服务版本",defaultValue = "1.0") + private String dubboVersion; + + private String dubboParamJson; + + private String attachments; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/LinkRpsInfo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/LinkRpsInfo.java new file mode 100644 index 000000000..3b9daa5f1 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/LinkRpsInfo.java @@ -0,0 +1,15 @@ +package run.mone.mimeter.dashboard.bo.task; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class LinkRpsInfo implements Serializable { + Integer linkId; + Integer rps; + + public LinkRpsInfo(Integer linkId) { + this.linkId = linkId; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/QueryStatReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/QueryStatReq.java new file mode 100644 index 000000000..88d2fc6a6 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/QueryStatReq.java @@ -0,0 +1,26 @@ +package run.mone.mimeter.dashboard.bo.task; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/7/21 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class QueryStatReq { + + private Long taskId; + + private Long startTs; + + private Long endTs; + + private String query; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/SceneRpsRateReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/SceneRpsRateReq.java new file mode 100644 index 000000000..230c11ee7 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/SceneRpsRateReq.java @@ -0,0 +1,20 @@ +package run.mone.mimeter.dashboard.bo.task; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; +import java.util.Map; + +@Data +public class SceneRpsRateReq implements Serializable { + @HttpApiDocClassDefine(value = "sceneID", required = true, description = "场景id", defaultValue = "66312") + Integer sceneID; + @HttpApiDocClassDefine(value = "reportID", required = true, description = "报告id", defaultValue = "66124") + String reportID; + @HttpApiDocClassDefine(value = "rpsRate", required = true, description = "发压比例", defaultValue = "10") + Integer rpsRate; + + @HttpApiDocClassDefine(value = "linkToTaskMaps", required = true, description = "链路id与任务id映射", defaultValue = "") + Map linkToTaskMaps; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/TaskDTO.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/TaskDTO.java new file mode 100644 index 000000000..65cbdc77e --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/task/TaskDTO.java @@ -0,0 +1,48 @@ +package run.mone.mimeter.dashboard.bo.task; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class TaskDTO implements Serializable { + + /** + * 任务id列表 + */ + @HttpApiDocClassDefine(value = "ids", ignore = true, description = "该任务id列表", defaultValue = "") + private List ids; + + /** + * 场景定义id + */ + @HttpApiDocClassDefine(value = "sceneId", required = true, description = "任务所属的场景id", defaultValue = "12") + private Integer sceneId; + + /** + * 0:单接口调试 + * 1:场景调试 + * 2:场景压测 + */ + @HttpApiDocClassDefine(value = "submitTaskType", ignore = true) + private Integer submitTaskType; + + /** + * 每次压测任务绑定一个唯一报告id + */ + @HttpApiDocClassDefine(value = "reportId", ignore = true) + private String reportId; + + /** + * 用于调试的接口信息 + */ + @HttpApiDocClassDefine(value = "apiInfo", required = true, description = "具体的被调试接口信息,只有单接口调试时需要直接传") + private DebugSceneApiInfoReq apiInfo; + + private String opUser; + + private String tenant; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/traffic/record/GetGwApiInfoListReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/traffic/record/GetGwApiInfoListReq.java new file mode 100644 index 000000000..02d8dcadd --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/bo/traffic/record/GetGwApiInfoListReq.java @@ -0,0 +1,40 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.bo.traffic.record; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class GetGwApiInfoListReq implements Serializable { + + @HttpApiDocClassDefine(value = "name", required = false, description = "name", defaultValue = "名称") + private String name; + + @HttpApiDocClassDefine(value = "url", required = false, description = "url", defaultValue = "") + private String url; + + @HttpApiDocClassDefine(value = "page", required = true, description = "当前的页码", defaultValue = "1") + private int page; + + @HttpApiDocClassDefine(value = "pageSize", required = true, description = "每页条数", defaultValue = "10") + private int pageSize; + + private int env; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/exception/CommonError.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/exception/CommonError.java new file mode 100644 index 000000000..4ac12bf39 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/exception/CommonError.java @@ -0,0 +1,78 @@ +package run.mone.mimeter.dashboard.exception; + +/** + * 错误定义 + */ +public enum CommonError { + + Success(0, "success"), + UnknownError(1, "网络错误,请联系管理员"), + + UnknownUser(100000, "用户未登录"), + + // 参数问题 + InvalidParamError(100001, "无效的参数"), + InvalidIDParamError(100002, "无效的id参数"), + InvalidPageParamError(100003, "无效的列表请求参数"), + InvalidUsernameOrPasswdError(100004, "无效的用户名或密码"), + EmptyFileError(100005, "上传文件为空,请检查"), + TooLongParamError(100006, "参数过长"), + WrongFileTypeError(100007, "入参文件仅支持csv格式文件"), + OverMaxFileSizeError(100008, "上传文件过大"), + OverMaxFileRowsError(100009, "上传文件行数过大"), + FileFirstRowEmptyError(100010, "上传文件首行为空"), + UploadFileError(100011, "上传文件失败"), + DeleteFileBindingSceneError(100012, "有场景引用该文件,不能删除"), + MultiDeleteFileBindingSceneError(100013, "有选中文件被场景引用,不能删除"), + InvalidUserInfoError(100014, "无效的用户信息"), + + + SlaRuleAtLeastOneError(1001001, "请至少添加一条SLA规则"), + DeleteSlaBindingSceneError(1001002, "有场景引用该SLA,不能删除"), + + WrongGatewayEnvError(1002001, "网关环境错误"), + + + NewAccountError(200001, "创建账号失败"), + UnAuthorized(200002, "无权限执行此操作"), + BeanCopyError(200003, "执行属性拷贝失败"), + UpdateAccountError(200004, "更新账号失败"), + DelAccountError(200005, "删除账号失败"), + AccountNotFoundError(200006, "未找到给定账号信息"), + AccountExistError(200007, "用户名已经存在"), + JsonSerializeError(200008, "JSON序列化失败"), + JsonDeSerializeError(200008, "JSON反序列化失败"), + APIServerError(200009, "压测引擎任务请求失败"), + FileSaveError(200010, "文件保存失败"), + LoadFileError(200011, "读取文件失败"), + DubboDataTooLong(200012, "数据太大"), + LoadMiApiDataFail(200013, "加载mi-api接口数据失败"), + SceneAlreadyExist(200014, "该场景已存在"), + + UnableBenchAgent(200015, "不可用的压测机"), + + UnbindRefDataset(200016, "不允许解绑被引用的数据源"), + + AgentAlreadyApplied(200017, "本组已申请过该发压机"), + + AgentAlreadyGetTenant(200018, "该发压机已有租户"), + + InvalidAgentNumError(200019, "该模式至少绑定2台以上压测机"), + + SystemDeployingError(200020, "Mimeter 系统升级中,请稍后再试~"), + ; + + + + public int code; + public String message; + + public String getMessage() { + return message; + } + + CommonError(int code, String message) { + this.code = code; + this.message = message; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/exception/CommonException.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/exception/CommonException.java new file mode 100644 index 000000000..3ef2da8b5 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/exception/CommonException.java @@ -0,0 +1,35 @@ +package run.mone.mimeter.dashboard.exception; + +public class CommonException extends RuntimeException { + + private int code; + private String message; + + public CommonException(int code, String message) { + this.code = code; + this.message = message; + } + + + public CommonException(CommonError error) { + this.code = error.code; + this.message = error.message; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + @Override + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/service/BenchBroadcastService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/service/BenchBroadcastService.java new file mode 100644 index 000000000..1318c214e --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/service/BenchBroadcastService.java @@ -0,0 +1,33 @@ +package run.mone.mimeter.dashboard.service; + +import run.mone.mimeter.dashboard.bo.common.EmitterTypeEnum; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.report.ReportInfoBo; +import run.mone.mimeter.dashboard.bo.statistics.TotalStatAnalysisEvent; +import run.mone.mimeter.dashboard.bo.sla.SlaEvent; + + +/** + * @author dongzhenxing + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/7/21 + */ +public interface BenchBroadcastService { + + /** + * 压测结束事件通知 + */ + Result notifyEvent(EmitterTypeEnum emitEventType, String reportId, ReportInfoBo reportInfoBo); + + /** + * sla事件通知 + */ + Result notifyEvent(EmitterTypeEnum emitEventType, String reportId, SlaEvent slaEvent); + + /** + * 数据统计分析事件通知 + */ + Result notifyEvent(EmitterTypeEnum emitEventType, String reportId, TotalStatAnalysisEvent analysisEvent); + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/service/DatasetInfoSercice.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/service/DatasetInfoSercice.java new file mode 100644 index 000000000..627b6540c --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/service/DatasetInfoSercice.java @@ -0,0 +1,20 @@ +package run.mone.mimeter.dashboard.service; + +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.dataset.DatasetLineNum; +import run.mone.mimeter.dashboard.bo.dataset.DatasetLinesReq; + +import java.util.List; +import java.util.TreeMap; + +public interface DatasetInfoSercice { + + Result> getLineNumBySceneId(Integer sceneID); + + Result>> getDatasetMap(List linesReqs); + + Result syncTenant(); + + Result updateDatasetTenant(Integer datasetId,String tenant); + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/service/DubboHealthService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/service/DubboHealthService.java new file mode 100644 index 000000000..1a86fa0a4 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/service/DubboHealthService.java @@ -0,0 +1,12 @@ +package run.mone.mimeter.dashboard.service; + + +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.common.TestReq; + +public interface DubboHealthService { + + String health(TestReq testReq); + + Result getUid(); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/service/MonitorInfoService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/service/MonitorInfoService.java new file mode 100644 index 000000000..43ddacfc2 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/service/MonitorInfoService.java @@ -0,0 +1,7 @@ +package run.mone.mimeter.dashboard.service; + +import java.util.List; + +public interface MonitorInfoService { + List getAppListByReportID(Integer sceneId, String reportId); +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/service/SceneInfoService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/service/SceneInfoService.java new file mode 100644 index 000000000..ae465dc5a --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-api/src/main/java/run/mone/mimeter/dashboard/service/SceneInfoService.java @@ -0,0 +1,18 @@ +package run.mone.mimeter.dashboard.service; + +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.scene.SceneDTO; + +public interface SceneInfoService { + Result getSceneByID(Integer sceneID); + + void updateSceneStatus(Integer sceneId,Integer sceneStatus); + + Result updatemimeterTaskStatus(String report,Integer status); + + Result updateSceneTenant(Integer sceneId,String tenant); + + Result tmpUpdateLogRate(int sceneId,int logRate); + + Result processLossTask(); +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-common/pom.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-common/pom.xml new file mode 100644 index 000000000..1544fcf8f --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-common/pom.xml @@ -0,0 +1,32 @@ + + + + + mimeter-dashboard + run.mone + 1.0.0-SNAPSHOT + + 4.0.0 + + mimeter-dashboard-common + + + + + ch.qos.logback + logback-classic + 1.1.2 + + + + ch.qos.logback + logback-core + 1.1.2 + + + + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-common/src/main/java/run/mone/mimeter/dashboard/common/TemplateUtils.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-common/src/main/java/run/mone/mimeter/dashboard/common/TemplateUtils.java new file mode 100644 index 000000000..f81c01c4a --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-common/src/main/java/run/mone/mimeter/dashboard/common/TemplateUtils.java @@ -0,0 +1,20 @@ +package run.mone.mimeter.dashboard.common; + +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class TemplateUtils { + + public static String processTemplate(String template, Map params) { + Matcher m = Pattern.compile("\\$\\{\\w+\\}").matcher(template); + StringBuffer sb = new StringBuffer(); + while (m.find()) { + String param = m.group(); + String value = params.get(param.substring(2, param.length() - 1)); + m.appendReplacement(sb, value == null ? "" : value); + } + m.appendTail(sb); + return sb.toString(); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/Dockerfile b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/Dockerfile new file mode 100644 index 000000000..106b9ace9 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/Dockerfile @@ -0,0 +1,6 @@ +FROM miserver:0.2.31-jaeger +MAINTAINER youpin-biz-arch@xiaomi.com +RUN mkdir -p /home/work/mimeter-dashboard/ +RUN mkdir -p /home/work/log/mimeter-dashboard/ +COPY ./target/mimeter-dashboard-server-1.0.0-SNAPSHOT.jar /home/work/mimeter-dashboard/ +ENTRYPOINT ["java","-jar","-Xms1024M","-Xmx1024M","-XX:+UseG1GC","-XX:+PrintReferenceGC","-XX:+PrintGCDetails","-XX:+PrintGCDateStamps","-XX:+PrintHeapAtGC","-Xloggc:/home/work/log/mimeter-dashboard/gc.log","/home/work/mimeter-dashboard/mimeter-dashboard-server-1.0.0-SNAPSHOT.jar"] \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/pom.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/pom.xml new file mode 100644 index 000000000..82913ddbb --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/pom.xml @@ -0,0 +1,140 @@ + + + + mimeter-dashboard + run.mone + 1.0.0-SNAPSHOT + + 4.0.0 + + mimeter-dashboard-server + + + mimeter-dashboard-service + run.mone + 1.0.0-SNAPSHOT + + + org.apache.httpcomponents + httpclient + 4.5.5 + + + org.codehaus.janino + janino + 3.0.8 + + + + + + + src/main/resources + true + + + + + + org.springframework.boot + spring-boot-maven-plugin + 2.7.5 + + run.mone.mimeter.dashboard.bootstrap.MimeterDashboardBootstrap + + + + + repackage + + + + + + + org.mybatis.generator + mybatis-generator-maven-plugin + 1.3.7 + + src/main/resources/generatorConfig.xml + true + true + + + + + mysql + mysql-connector-java + 8.0.20 + + + com.itfsw + mybatis-generator-plugin + 1.3.8 + + + + + + + + + + + dev + + dev + + + + src/main/resources/config/dev.properties + + + + + + opensource + + opensource + + + + src/main/resources/config/opensource.properties + + + + + + staging + + staging + + + true + + + + src/main/resources/config/staging.properties + + + + + + production + + production + + + + src/main/resources/config/production.properties + + + + + + + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/bootstrap/MimeterDashboardBootstrap.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/bootstrap/MimeterDashboardBootstrap.java new file mode 100644 index 000000000..b2eb6a306 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/bootstrap/MimeterDashboardBootstrap.java @@ -0,0 +1,27 @@ +package run.mone.mimeter.dashboard.bootstrap; + +import org.apache.dubbo.config.spring.context.annotation.DubboComponentScan; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.context.annotation.ComponentScan; + +/** + * @author dongzhenxing + */ +@EnableAutoConfiguration +@ComponentScan(basePackages = {"run.mone.mimeter.dashboard", "com.xiaomi.youpin"}) +@DubboComponentScan(basePackages = "run.mone.mimeter.dashboard") +public class MimeterDashboardBootstrap { + private static final Logger logger = LoggerFactory.getLogger(MimeterDashboardBootstrap.class); + + public static void main(String... args) { + try { + SpringApplication.run(MimeterDashboardBootstrap.class, args); + } catch (Throwable throwable) { + logger.error(throwable.getMessage(), throwable); + System.exit(-1); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/common/ApiConsts.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/common/ApiConsts.java new file mode 100644 index 000000000..fae0aee57 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/common/ApiConsts.java @@ -0,0 +1,24 @@ +package run.mone.mimeter.dashboard.common; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/6/22 + */ +public class ApiConsts { + + public static final String API_PREFIX = "/api/bench"; + + public static final String GENERAL_LIST_ENDPOINT = "/list"; + public static final String GENERAL_DETAILS_ENDPOINT = "/details"; + + public static final String GENERAL_DELETE_ENDPOINT = "/delete"; + + public static final String REPORT_INFO_ROUTE = "/report/info"; + + public static final String SCENE_SNAPSHOT_ROUTE = "/scene/snapshot"; + + public static final String API_STAT_ROUTE = "/api/stat"; + + public static final String LOG_ROUTE = "/logs"; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/config/DataSourceConfig.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/config/DataSourceConfig.java new file mode 100644 index 000000000..9a937b1a1 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/config/DataSourceConfig.java @@ -0,0 +1,119 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.config; + +import com.alibaba.nacos.api.config.annotation.NacosValue; +import com.mchange.v2.c3p0.ComboPooledDataSource; +import lombok.extern.slf4j.Slf4j; +import org.apache.ibatis.session.SqlSessionFactory; +import org.mybatis.spring.SqlSessionFactoryBean; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.support.TransactionTemplate; + +import javax.naming.NamingException; +import javax.sql.DataSource; +import java.beans.PropertyVetoException; + +@Slf4j +@Configuration +@MapperScan(basePackages = DataSourceConfig.PACKAGE, sqlSessionFactoryRef = "masterSqlSessionFactory") +public class DataSourceConfig { + + static final String PACKAGE = "run.mone.mimeter.dashboard.mapper"; + static final String MAPPER_LOCATION = "classpath:mapper/*Mapper.xml"; + + @Value("${spring.datasource.driverClassName}") + private String driverClass; + + @Value("${spring.datasource.default.initialPoolSize}") + private Integer defaultInitialPoolSize; + + @Value("${spring.datasource.default.maxPoolSize}") + private Integer defaultMaxPoolSize; + + @Value("${spring.datasource.default.minialPoolSize}") + private Integer defaultMinPoolSize; + + @NacosValue(value = "${spring.datasource.username}", autoRefreshed = true) + private String dataSourceUserName; + + @NacosValue(value = "${spring.datasource.url}", autoRefreshed = true) + private String dataSourceUrl; + + @NacosValue(value = "${spring.datasource.password}", autoRefreshed = true) + private String dataSourcePasswd; + + @Bean(name = "masterDataSource") + @Primary + public DataSource masterDataSource() throws PropertyVetoException, NamingException { + log.info("DataSourceConfig {} {}", dataSourceUrl, dataSourceUserName); + + ComboPooledDataSource dataSource = new ComboPooledDataSource(); + dataSource.setDriverClass(driverClass); + dataSource.setJdbcUrl(dataSourceUrl); + dataSource.setUser(dataSourceUserName); + dataSource.setPassword(dataSourcePasswd); + + dataSource.setInitialPoolSize(defaultInitialPoolSize); + dataSource.setMaxPoolSize(defaultMaxPoolSize); + dataSource.setMinPoolSize(defaultMinPoolSize); + + setDatasouce(dataSource); + + return dataSource; + } + + private void setDatasouce(ComboPooledDataSource dataSource) { + dataSource.setTestConnectionOnCheckin(true); + dataSource.setTestConnectionOnCheckout(false); + dataSource.setPreferredTestQuery("select 1"); + dataSource.setIdleConnectionTestPeriod(180); + } + + @Bean(name = "masterTransactionManager") + @Primary + public DataSourceTransactionManager masterTransactionManager() throws PropertyVetoException, NamingException { + return new DataSourceTransactionManager(masterDataSource()); + } + + @Bean(name = "masterSqlSessionFactory") + @Primary + public SqlSessionFactory masterSqlSessionFactory(@Qualifier("masterDataSource") DataSource masterDataSource) + throws Exception { + final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); + sessionFactory.setDataSource(masterDataSource); + sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver() + .getResources(DataSourceConfig.MAPPER_LOCATION)); + sessionFactory.setTypeAliasesPackage("run.mone.mimeter.dashboard.pojo"); + return sessionFactory.getObject(); + } + + @Bean + public TransactionTemplate transactionTemplate(PlatformTransactionManager transactionManager) { + TransactionTemplate template = new TransactionTemplate(); + template.setTransactionManager(transactionManager); + return template; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/config/DubboConfiguration.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/config/DubboConfiguration.java new file mode 100644 index 000000000..c70b531bd --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/config/DubboConfiguration.java @@ -0,0 +1,79 @@ +package run.mone.mimeter.dashboard.config; + +import com.alibaba.nacos.api.config.annotation.NacosValue; +import org.apache.dubbo.config.ApplicationConfig; +import org.apache.dubbo.config.ProtocolConfig; +import org.apache.dubbo.config.RegistryConfig; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; + +@Configuration +public class DubboConfiguration { + + @Value("${spring.application.name}") + private String applicationName; + + @Value("${dubbo.protocol.port}") + private int port; + + @Value("${server.port}") + private String httpGateWayPort; + + @NacosValue("${dubbo.registry.address.st}") + private String stDubboRegistryAddress; + + @NacosValue("${dubbo.registry.address.ol}") + private String olDubboRegistryAddress; + + @Value("${is.online}") + private boolean isOnline; + + /** + * Dubbo应用配置 + */ + @Bean + public ApplicationConfig applicationConfig() { + ApplicationConfig applicationConfig = new ApplicationConfig(); + applicationConfig.setName(applicationName); + applicationConfig.setQosEnable(false); + return applicationConfig; + } + + + /** + * 配置st注册中心 + */ + @Bean + @Primary + public RegistryConfig stRegistry() { + RegistryConfig registryConfig = new RegistryConfig(); + registryConfig.setAddress(stDubboRegistryAddress); + registryConfig.setDefault(!isOnline); + return registryConfig; + } + + /** + * 配置ol注册中心 + */ + @Bean + public RegistryConfig olRegistry() { + + RegistryConfig registryConfig = new RegistryConfig(); + registryConfig.setAddress(olDubboRegistryAddress); + registryConfig.setDefault(isOnline); + return registryConfig; + } + + @Bean + public ProtocolConfig protocolConfig() { + ProtocolConfig protocolConfig = new ProtocolConfig(); + protocolConfig.setPort(port); + protocolConfig.setTransporter("netty4"); + protocolConfig.setThreadpool("fixed"); + protocolConfig.setThreads(800); + return protocolConfig; + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/config/FilterConfiguration.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/config/FilterConfiguration.java new file mode 100644 index 000000000..26e4fbc9b --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/config/FilterConfiguration.java @@ -0,0 +1,76 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.config; + +import com.alibaba.nacos.api.config.annotation.NacosValue; +import com.xiaomi.aegis.filter.AegisFilter; +import com.xiaomi.mone.tpc.login.filter.HttpReqUserFilter; +import com.xiaomi.mone.tpc.login.util.ConstUtil; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class FilterConfiguration { + + @NacosValue("${aegis.sdk.public.key:}") + private String aegisSdk; + + @Value("${server.cas.ignoreUrl}") + private String ignoreUrl; + + @Value("${is_local:false}") + private String isLocal; + + @Value("${cas.inner.auth}") + private String innerAuth; + + @NacosValue(value = "${token.parse.url:}", autoRefreshed = true) + private String tokenParseUrl; + + @NacosValue(value = "${server.cas.loginUrl:}", autoRefreshed = true) + private String loginUrl; + + @NacosValue(value = "${server.cas.logoutUrl:}", autoRefreshed = true) + private String logoutUrl; + + @NacosValue(value = "${server.cas.userInfoPath:}", autoRefreshed = true) + private String userInfoPath; + + @Bean + public FilterRegistrationBean filterCasBean() { + FilterRegistrationBean registrationBean = new FilterRegistrationBean(); + registrationBean.setFilter(new HttpReqUserFilter()); + registrationBean.addUrlPatterns("/*"); + registrationBean.addInitParameter(ConstUtil.innerAuth, innerAuth); + registrationBean.addInitParameter(ConstUtil.authTokenUrl, tokenParseUrl); + registrationBean.addInitParameter(ConstUtil.CAS_PUBLIC_KEY, aegisSdk); + if (isLocal.equals("true")) { + ignoreUrl = "/*"; + } + registrationBean.addInitParameter("IGNORE_URL", ignoreUrl); + registrationBean.addInitParameter("devMode", "false"); + registrationBean.addInitParameter(ConstUtil.USER_INFO_PATH, userInfoPath); + registrationBean.addInitParameter(ConstUtil.loginUrl, loginUrl); + registrationBean.addInitParameter(ConstUtil.logoutUrl, logoutUrl); + registrationBean.setOrder(0); + return registrationBean; + } + + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/config/InitService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/config/InitService.java new file mode 100644 index 000000000..d4d54f65f --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/config/InitService.java @@ -0,0 +1,53 @@ +package run.mone.mimeter.dashboard.config; + +import com.xiaomi.data.push.nacos.NacosNaming; +import org.apache.dubbo.common.utils.NetUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; + +@Service +public class InitService { + @Resource(name = "nacosNamingSt") + private NacosNaming nacosNamingSt; + + @Resource(name = "nacosNamingOl") + private NacosNaming nacosNamingOl; + + @Value("${server.port}") + private String httpPort; + + @Value("${dubbo.group}") + private String group; + + @PostConstruct + public void init() { + String host = System.getenv("host.ip") == null ? NetUtils.getLocalHost() : System.getenv("host.ip"); + final String port = httpPort; + + final String appName = "MiMeter"; + NacosNaming nacosNaming; + if (group.equals("online")){ + nacosNaming = nacosNamingOl; + }else { + nacosNaming = nacosNamingSt; + } + try { + nacosNaming.registerInstance(appName, host, Integer.valueOf(port), group); + + Runtime.getRuntime().addShutdownHook(new Thread(()->{ + try { + System.out.println("stop"); + nacosNaming.deregisterInstance(appName, host, Integer.valueOf(port), group); + } catch (Exception e) { + //ignore + } + })); + } catch (Exception ignored) { + } + } + + +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/config/NacosConfiguration.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/config/NacosConfiguration.java new file mode 100644 index 000000000..858ee5217 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/config/NacosConfiguration.java @@ -0,0 +1,72 @@ +package run.mone.mimeter.dashboard.config; + +import com.alibaba.nacos.api.annotation.NacosProperties; +import com.alibaba.nacos.api.config.annotation.NacosValue; +import com.alibaba.nacos.spring.context.annotation.config.EnableNacosConfig; +import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource; +import com.xiaomi.data.push.nacos.NacosNaming; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import run.mone.mimeter.dashboard.bo.NacosInfo; + +@Configuration +@EnableNacosConfig(globalProperties = @NacosProperties(serverAddr = "${nacos.config.addrs}")) +@NacosPropertySource(dataId = "${nacos.config.data.id}", autoRefreshed = true) +public class NacosConfiguration { + /** + * 中国区st nacos + */ + @NacosValue("${dubbo.registry.address.st}") + private String nacosAddressSt; + + @NacosValue(value = "${nacos.usernameSt}") + private String nacosUsernameCnSt; + + @NacosValue(value = "${nacos.passwordSt}") + private String nacosPasswordCnSt; + + /** + * 中国区线上 nacos + */ + @NacosValue("${dubbo.registry.address.ol}") + private String nacosAddressOl; + + @NacosValue(value = "${nacos.usernameOl}") + private String nacosUsernameCnOl; + + @NacosValue(value = "${nacos.passwordOl}") + private String nacosPasswordCnOl; + + @Bean + public NacosInfo nacosInfo(){ + return new NacosInfo(nacosUsernameCnSt,nacosPasswordCnSt,nacosUsernameCnOl,nacosPasswordCnOl); + } + + /** + * 中国区st nacos + * @return + */ + @Bean + @Primary + public NacosNaming nacosNamingSt() { + NacosNaming nacosNaming = new NacosNaming(); + String[] address = nacosAddressSt.split("//"); + nacosNaming.setServerAddr(address[1]); + nacosNaming.init(); + return nacosNaming; + } + + /** + * 中国区线上nacos + * @return + */ + @Bean + public NacosNaming nacosNamingOl() { + NacosNaming nacosNaming = new NacosNaming(); + String[] address = nacosAddressOl.split("//"); + nacosNaming.setServerAddr(address[1]); + nacosNaming.init(); + return nacosNaming; + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/AgentController.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/AgentController.java new file mode 100644 index 000000000..6d9785fc0 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/AgentController.java @@ -0,0 +1,283 @@ +package run.mone.mimeter.dashboard.controller; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDoc; +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import com.xiaomi.mone.http.docs.annotations.HttpApiModule; +import com.xiaomi.mone.http.docs.annotations.MiApiRequestMethod; +import com.xiaomi.mone.tpc.common.vo.OrgInfoVo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; +import run.mone.mimeter.dashboard.bo.agent.*; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.common.SessionAccount; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.service.AgentService; +import run.mone.mimeter.dashboard.service.impl.LoginService; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; +import java.util.Objects; + +@Slf4j +@RestController +@RequestMapping("/api/bench/agent") +@HttpApiModule(value = "AgentController", apiController = AgentController.class) +public class AgentController { + + @Autowired + private LoginService loginService; + + @Autowired + private AgentService agentService; + + @HttpApiDoc(value = "/api/bench/agent/getAgentList", apiName = "获取本组压测机列表详情", method = MiApiRequestMethod.POST, description = "获取压测机列表详情") + @RequestMapping(value = "/getAgentList", method = RequestMethod.POST) + public Result> getAgentList( + HttpServletRequest request,String tenant) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[AgentController.getAgentList] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + if (tenant == null || tenant.equals("")){ + tenant = account.getTenant(); + } + return agentService.getAgentListByTenant(tenant); + } + + @HttpApiDoc(value = "/api/bench/agent/getAllAgentList", apiName = "获取全部压测机列表详情", method = MiApiRequestMethod.POST, description = "获取全部压测机列表详情") + @RequestMapping(value = "/getAllAgentList", method = RequestMethod.POST) + public Result getAllAgentList( + HttpServletRequest request,GetAgentListReq req) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[AgentController.getAllAgentList] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + return agentService.getAllAgentList(req); + } + + @HttpApiDoc(value = "/api/bench/agent/getApplyList", apiName = "获取申请记录列表", method = MiApiRequestMethod.POST, description = "获取申请记录列表") + @RequestMapping(value = "/getApplyList", method = RequestMethod.POST) + public Result getApplyList( + HttpServletRequest request, GetApplyListReq req) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[AgentController.getApplyList] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + return agentService.getApplyList(req); + } + + @HttpApiDoc(value = "/api/bench/agent/getOrgList", apiName = "获取部门组织列表", method = MiApiRequestMethod.POST, description = "获取部门组织列表") + @RequestMapping(value = "/getOrgList", method = RequestMethod.POST) + public Result> getOrgList( + HttpServletRequest request, String orgName) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[AgentController.getOrgList] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + return agentService.getOrgList(orgName); + } + + @HttpApiDoc(value = "/api/bench/agent/getAllAvailableAgentList", apiName = "获取全部可选压测机列表详情", method = MiApiRequestMethod.POST, description = "获取全部可选压测机列表详情") + @RequestMapping(value = "/getAllAvailableAgentList", method = RequestMethod.POST) + public Result> getAllAvailableAgentList( + HttpServletRequest request) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[AgentController.获取全部可选压测机列表详情] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + return agentService.getAllAvailableAgentList(); + } + + @HttpApiDoc(value = "/api/bench/agent/applyAgent", apiName = "批量申请压测机", method = MiApiRequestMethod.POST, description = "申请压测机") + @RequestMapping(value = "/applyAgent", method = RequestMethod.POST) + public Result applyAgent( + HttpServletRequest request, + @RequestBody AgentApplyReq req) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[AgentController.applyAgent] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + req.setApplier(account.getUsername()); + return agentService.applyAgent(req); + } + + @HttpApiDoc(value = "/api/bench/agent/approveApply", apiName = "通过压测机申请", method = MiApiRequestMethod.POST, description = "通过压测机申请") + @RequestMapping(value = "/approveApply", method = RequestMethod.POST) + public Result approveApply( + HttpServletRequest request, + @HttpApiDocClassDefine(value = "applyID", required = true, description = "申请记录id", defaultValue = "66") + Integer applyID) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[AgentController.approveApply] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + return agentService.approveApply(applyID); + } + + @HttpApiDoc(value = "/api/bench/agent/refuseApply", apiName = "拒绝压测机申请", method = MiApiRequestMethod.POST, description = "拒绝压测机申请") + @RequestMapping(value = "/refuseApply", method = RequestMethod.POST) + public Result refuseApply( + HttpServletRequest request, + @HttpApiDocClassDefine(value = "applyID", required = true, description = "申请记录id", defaultValue = "66") + Integer applyID) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[AgentController.refuseApply] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + return agentService.refuseApply(applyID); + } + + @HttpApiDoc(value = "/api/bench/agent/tenantForAgent", apiName = "给压测机打租户", method = MiApiRequestMethod.POST, description = "给压测机打租户") + @RequestMapping(value = "/tenantForAgent", method = RequestMethod.POST) + public Result tenantForAgent( + HttpServletRequest request, + TenantForAgentReq req) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[AgentController.tenantForAgent] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + return agentService.tenantForAgent(req); + } + + @HttpApiDoc(value = "/api/bench/agent/applyAgentDomain", apiName = "批量绑定压测机域名", method = MiApiRequestMethod.POST, description = "批量绑定压测机域名") + @RequestMapping(value = "/applyAgentDomain", method = RequestMethod.POST) + public Result applyAgentDomain( + HttpServletRequest request, + @RequestBody List req) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[AgentController.applyAgentDomain] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + req.forEach(domainApplyReq -> domainApplyReq.setApplier(account.getUsername())); + return agentService.applyAgentDomain(req); + } + + @HttpApiDoc(value = "/api/bench/agent/applyAgentDomainByRate", apiName = "根据比例批量绑定压测机域名", method = MiApiRequestMethod.POST, description = "根据比例批量绑定压测机域名") + @RequestMapping(value = "/applyAgentDomainByRate", method = RequestMethod.POST) + public Result applyAgentDomainByRate( + HttpServletRequest request, + @RequestBody DomainApplyByRateReq req) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[AgentController.applyAgentDomainByRate] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + req.setApplier(account.getUsername()); + return agentService.applyAgentDomainByRate(req); + } + + @HttpApiDoc(value = "/api/bench/agent/getDomainApplyList", apiName = "获取域名绑定申请记录列表", method = MiApiRequestMethod.POST, description = "获取域名绑定申请记录列表") + @RequestMapping(value = "/getDomainApplyList", method = RequestMethod.POST) + public Result getDomainApplyList( + HttpServletRequest request, @RequestBody GetApplyListReq req) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[AgentController.getDomainApplyList] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + return agentService.getDomainApplyList(req); + } + + @HttpApiDoc(value = "/api/bench/agent/approveDomainApply", apiName = "通过域名绑定申请", method = MiApiRequestMethod.POST, description = "通过压测机申请") + @RequestMapping(value = "/approveDomainApply", method = RequestMethod.POST) + public Result approveDomainApply( + HttpServletRequest request, + @HttpApiDocClassDefine(value = "applyID", required = true, description = "申请记录id", defaultValue = "66") + Integer applyID) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[AgentController.approveDomainApply] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + return agentService.approveDomainApply(applyID); + } + + @HttpApiDoc(value = "/api/bench/agent/refuseDomainApply", apiName = "拒绝域名绑定申请", method = MiApiRequestMethod.POST, description = "拒绝压测机申请") + @RequestMapping(value = "/refuseDomainApply", method = RequestMethod.POST) + public Result refuseDomainApply( + HttpServletRequest request, + @HttpApiDocClassDefine(value = "applyID", required = true, description = "申请记录id", defaultValue = "66") + Integer applyID) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[AgentController.refuseDomainApply] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + return agentService.refuseDomainApply(applyID); + } + + @HttpApiDoc(value = "/api/bench/agent/hostForAgent", apiName = "直接给一台压测机绑定域名", method = MiApiRequestMethod.POST, description = "直接给一台压测机绑定域名") + @RequestMapping(value = "/hostForAgent", method = RequestMethod.POST) + public Result hostForAgent( + HttpServletRequest request, + @RequestBody HostForAgentReq req) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[AgentController.hostForAgent] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + return agentService.hostForAgent(req); + } + + @HttpApiDoc(value = "/api/bench/agent/delHostForAgents", apiName = "批量删除压测机某个域名绑定", method = MiApiRequestMethod.POST, description = "批量删除压测机某个域名绑定") + @RequestMapping(value = "/delHostForAgents", method = RequestMethod.POST) + public Result delHostForAgents( + HttpServletRequest request, + @RequestBody DelHostForAgentsReq req) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[AgentController.delHostForAgents] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + return agentService.delHostForAgents(req); + } + + @HttpApiDoc(value = "/api/bench/agent/getAgentHostsFile", apiName = "获取某台机器hosts文件内容", method = MiApiRequestMethod.POST, description = "获取某台机器hosts文件内容") + @RequestMapping(value = "/getAgentHostsFile", method = RequestMethod.POST) + public Result getAgentHostsFile( + HttpServletRequest request, + @RequestBody LoadHostsFileReq req) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[AgentController.getDomainApplyList] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + if (req.getAgentIp().isEmpty()){ + return Result.success(""); + } + return agentService.getAgentHostsFile(req); + } + + @HttpApiDoc(value = "/api/bench/agent/syncDomainConf", apiName = "同步发压机域名绑定配置", method = MiApiRequestMethod.POST, description = "同步发压机域名绑定配置") + @RequestMapping(value = "/syncDomainConf", method = RequestMethod.POST) + public Result syncDomainConf( + HttpServletRequest request) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[AgentController.syncDomainConf] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + return agentService.syncDomainConf(); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/BenchMonitorController.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/BenchMonitorController.java new file mode 100644 index 000000000..e59102760 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/BenchMonitorController.java @@ -0,0 +1,80 @@ +package run.mone.mimeter.dashboard.controller; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDoc; +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import com.xiaomi.mone.http.docs.annotations.HttpApiModule; +import com.xiaomi.mone.http.docs.annotations.MiApiRequestMethod; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import run.mone.mimeter.dashboard.bo.scene.SceneTaskAppsBo; +import run.mone.mimeter.dashboard.bo.agent.AgentMonitorBo; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.common.SessionAccount; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.service.BenchMonitorService; +import run.mone.mimeter.dashboard.service.impl.LoginService; + +import javax.servlet.http.HttpServletRequest; +import java.util.Objects; + +@Slf4j +@RestController +@RequestMapping(value = "/api/bench/monitor") +@HttpApiModule(value = "BenchMonitorController", apiController = BenchMonitorController.class) +public class BenchMonitorController { + + @Autowired + private LoginService loginService; + + @Autowired + private BenchMonitorService monitorService; + + /** + * 获取某次场景压测关联的应用列表 + * + * @param request + * @return + */ + @HttpApiDoc(value = "/api/bench/monitor/getAppListByReportID", apiName = "获取某次场景压测关联的应用列表", method = MiApiRequestMethod.POST, description = "获取某次场景压测关联的应用列表") + @RequestMapping(value = "/getAppListByReportID", method = RequestMethod.POST) + public Result getAppListByReportID( + HttpServletRequest request, + @HttpApiDocClassDefine(value = "sceneID",required = true,description = "场景id",defaultValue = "111") + Integer sceneID, + @HttpApiDocClassDefine(value = "reportID",required = true,description = "报告id",defaultValue = "dsas134") + String reportID, + @HttpApiDocClassDefine(value = "realTime",required = true,description = "是否实时",defaultValue = "dsas134") + Boolean realTime + ) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TaskController.getAppListByTaskFlag] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + return monitorService.getAppListByReportID(sceneID,reportID,realTime); + } + + /** + * 获取报告下的压测机数据 + * + * @param request + * @return + */ + @HttpApiDoc(value = "/api/bench/monitor/getAgentInfosByReport", apiName = "获取报告下的压测机数据", method = MiApiRequestMethod.POST, description = "获取报告下的压测机数据") + @RequestMapping(value = "/getAgentInfosByReport", method = RequestMethod.POST) + public Result getAgentInfosByReport( + HttpServletRequest request, + @HttpApiDocClassDefine(value = "reportID",required = true,description = "报告id",defaultValue = "dsas134") + String reportID, + @HttpApiDocClassDefine(value = "realTime",required = true,description = "是否实时",defaultValue = "dsas134") + Boolean realTime + ) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TaskController.getAgentInfoByReport] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + return monitorService.getAgentInfosByReport(reportID,realTime); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/DatasetController.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/DatasetController.java new file mode 100644 index 000000000..0fb457452 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/DatasetController.java @@ -0,0 +1,260 @@ +package run.mone.mimeter.dashboard.controller; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDoc; +import com.xiaomi.mone.http.docs.annotations.HttpApiModule; +import com.xiaomi.mone.http.docs.annotations.MiApiRequestMethod; +import lombok.extern.slf4j.Slf4j; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.dataset.*; +import run.mone.mimeter.dashboard.common.SessionAccount; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.exception.CommonException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import run.mone.mimeter.dashboard.service.DatasetService; +import run.mone.mimeter.dashboard.service.impl.LoginService; +import run.mone.mimeter.dashboard.service.impl.UploadService; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; +import java.util.Objects; + +import static run.mone.mimeter.dashboard.exception.CommonError.InvalidParamError; + +@Slf4j +@RestController +@RequestMapping("/api/bench/dataset") +@HttpApiModule(value = "DatasetController", apiController = DatasetController.class) +public class DatasetController { + + @Autowired + private LoginService loginService; + + @Autowired + private UploadService uploadService; + + @Autowired + private DatasetService datasetService; + + + @HttpApiDoc(apiName = "数据源新增", value = "/api/bench/dataset/new", method = MiApiRequestMethod.POST, description = "数据源新增") + @RequestMapping(value = "/new", method = RequestMethod.POST) + public Result newDataset(HttpServletRequest request, + @RequestBody DatasetDto param) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[DatasetController.newDataset] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + param.setCreator(account.getUsername()); + param.setUpdater(account.getUsername()); + param.setTenant(account.getTenant()); + log.info("[DatasetController.newDataset] param: {}", param); + return datasetService.newDataset(param); + } + + @HttpApiDoc(apiName = "数据源批量新增", value = "/api/bench/dataset/multiNew", method = MiApiRequestMethod.POST, description = "数据源批量新增") + @RequestMapping(value = "/multiNew", method = RequestMethod.POST) + public Result> multiNewDataset(HttpServletRequest request, + @RequestBody List param) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[DatasetController.multiNewDataset] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + param.forEach(it -> { + it.setCreator(account.getUsername()); + it.setUpdater(account.getUsername()); + it.setTenant(account.getTenant()); + }); + + log.info("[DatasetController.multiNewDataset] param: {}", param); + return datasetService.multiNewDataset(param); + } + + @HttpApiDoc(apiName = "数据源更新", value = "/api/bench/dataset/update", method = MiApiRequestMethod.POST, description = "数据源更新") + @RequestMapping(value = "/update", method = RequestMethod.POST) + public Result updateDataset(HttpServletRequest request, + @RequestBody DatasetDto param) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[DatasetController.updateDataset] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + param.setUpdater(account.getUsername()); + param.setTenant(account.getTenant()); + + log.info("[DatasetController.updateDataset] param: {}", param); + return datasetService.updateDataset(param); + } + + @HttpApiDoc(apiName = "数据源批量更新", value = "/api/bench/dataset/multiUpdate", method = MiApiRequestMethod.POST, description = "数据源批量更新") + @RequestMapping(value = "/multiUpdate", method = RequestMethod.POST) + public Result multiUpdateDataset(HttpServletRequest request, + @RequestBody List param) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[DatasetController.multiUpdateDataset] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + param.forEach(it -> { + it.setUpdater(account.getUsername()); + it.setTenant(account.getTenant()); + }); + + log.info("[DatasetController.multiUpdateDataset] param: {}", param); + return datasetService.multiUpdateDataset(param); + } + + @HttpApiDoc(apiName = "数据源列表", value = "/api/bench/dataset/list", method = MiApiRequestMethod.POST, description = "数据源列表") + @RequestMapping(value = "/list", method = RequestMethod.POST) + public Result getDatasetList(HttpServletRequest request, + @RequestBody GetDatasetListReq param) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[DatasetController.getDatasetList] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + log.info("[DatasetController.getDatasetList] param: {}", param); + if (param == null) { + return Result.fail(InvalidParamError); + } + param.setTenant(account.getTenant()); + return datasetService.getDatasetList(param); + } + + @HttpApiDoc(apiName = "根据数据源ids获取参数列表", value = "/api/bench/dataset/getParamDataByIds", method = MiApiRequestMethod.POST, description = "根据数据源ids获取参数列表") + @RequestMapping(value = "/getParamDataByIds", method = RequestMethod.POST) + public Result> getParamDataByIds(HttpServletRequest request, + @RequestBody List ids) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[DatasetController.getParamDataByIds] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + log.info("[DatasetController.getParamDataByIds] param: {}", ids); + if (ids == null) { + return Result.fail(InvalidParamError); + } + return datasetService.getParamDataByIds(ids); + } + + @HttpApiDoc(apiName = "数据源删除", value = "/api/bench/dataset/del", method = MiApiRequestMethod.DELETE, description = "数据源删除") + @RequestMapping(value = "/del", method = RequestMethod.DELETE) + public Result delDataset(HttpServletRequest request, + @RequestParam("id") int id) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[DatasetController.delDataset] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + log.info("[DatasetController.delDataset] param: {}", id); + return datasetService.delDataset(id); + } + + @HttpApiDoc(apiName = "数据源批量删除", value = "/api/bench/dataset/multiDel", method = MiApiRequestMethod.POST, description = "数据源批量删除") + @RequestMapping(value = "/multiDel", method = RequestMethod.POST) + public Result multiDelDataset(HttpServletRequest request, + @RequestBody List ids) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[DatasetController.multiDelDataset] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + log.info("[DatasetController.multiDelDataset] param: {}", ids); + return datasetService.multiDelDataset(ids); + } + + @HttpApiDoc(apiName = "获取数据源详情", value = "/api/bench/dataset/detail", method = MiApiRequestMethod.GET, description = "获取数据源详情") + @RequestMapping(value = "/detail", method = RequestMethod.GET) + public Result detail(HttpServletRequest request, + @RequestParam("id") int id) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[DatasetController.detail] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + log.info("[DatasetController.detail] param: {}", id); + return datasetService.getDatasetById(id); + } + + @HttpApiDoc(apiName = "上传文件数据源", value = "/api/bench/dataset/upload", method = MiApiRequestMethod.POST, description = "上传文件数据源") + @RequestMapping(value="/upload", method = RequestMethod.POST) + public Result upload(HttpServletRequest request, + @RequestParam("file") MultipartFile file) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[DatasetController.upload] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + if (file.isEmpty()) { + throw new CommonException(CommonError.EmptyFileError); + } + return uploadService.save(file); + } + + @HttpApiDoc(apiName = "预览文件", value = "/api/bench/dataset/file/preview", method = MiApiRequestMethod.POST, description = "预览文件") + @RequestMapping(value="/file/preview", method = RequestMethod.POST) + public Result filePreview(HttpServletRequest request, + @RequestParam("id") int id) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[DatasetController.filePreview] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + log.info("[DatasetController.filePreview] id: {}", id); + return datasetService.filePreview(id); + } + + @HttpApiDoc(apiName = "添加使用场景", value = "/api/bench/dataset/bindScene", method = MiApiRequestMethod.POST, description = "添加使用场景") + @RequestMapping(value="/bindScene", method = RequestMethod.POST) + public Result bindScene(HttpServletRequest request, + @RequestBody DatasetSceneRelationDto datasetSceneRelationDto) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[DatasetController.bindScene] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + log.info("[DatasetController.bindScene] param: {}", datasetSceneRelationDto); + return datasetService.bindScene(datasetSceneRelationDto.getDatasetId(), datasetSceneRelationDto.getSceneId()); + } + + @HttpApiDoc(apiName = "解绑场景", value = "/api/bench/dataset/unbindScene", method = MiApiRequestMethod.POST, description = "解绑场景") + @RequestMapping(value="/unbindScene", method = RequestMethod.POST) + public Result unbindScene(HttpServletRequest request, + @RequestBody DatasetSceneRelationDto datasetSceneRelationDto) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[DatasetController.unbindScene] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + log.info("[DatasetController.unbindScene] param: {}", datasetSceneRelationDto); + return datasetService.unbindScene(datasetSceneRelationDto.getDatasetId(), datasetSceneRelationDto.getSceneId()); + } + + @HttpApiDoc(apiName = "场景编辑--文件数据源详情", value = "/api/bench/dataset/sceneFileDetail", method = MiApiRequestMethod.POST, description = "场景编辑--文件数据源详情") + @RequestMapping(value="/sceneFileDetail", method = RequestMethod.POST) + public Result sceneFileDetail(HttpServletRequest request, + @RequestParam("sceneId") int sceneId) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[DatasetController.sceneFileDetail] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + log.info("[DatasetController.sceneFileDetail] id: {}", sceneId); + return datasetService.sceneFileDetail(sceneId); + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/EsLogController.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/EsLogController.java new file mode 100644 index 000000000..0b235d0fd --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/EsLogController.java @@ -0,0 +1,48 @@ +package run.mone.mimeter.dashboard.controller; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDoc; +import com.xiaomi.mone.http.docs.annotations.HttpApiModule; +import com.xiaomi.mone.http.docs.annotations.MiApiRequestMethod; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import run.mone.mimeter.dashboard.bo.common.PagedResp; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.report.*; +import run.mone.mimeter.dashboard.common.SessionAccount; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.service.EsLogService; +import run.mone.mimeter.dashboard.service.impl.LoginService; +import run.mone.mimeter.dashboard.common.ApiConsts; + +import javax.servlet.http.HttpServletRequest; +import java.util.*; + +@Slf4j +@RestController +@RequestMapping(ApiConsts.API_PREFIX + ApiConsts.API_STAT_ROUTE) +@HttpApiModule(value = "ApiStatController", apiController = EsLogController.class) +public class EsLogController { + + @Autowired + private LoginService loginService; + + @Autowired + private EsLogService esLogService; + + @HttpApiDoc(value = ApiConsts.API_PREFIX + ApiConsts.API_STAT_ROUTE + ApiConsts.LOG_ROUTE + ApiConsts.GENERAL_LIST_ENDPOINT, apiName = "搜索压测api采样日志", + method = MiApiRequestMethod.POST, description = "搜索压测api采样日志") + @PostMapping(ApiConsts.LOG_ROUTE + ApiConsts.GENERAL_LIST_ENDPOINT) + public Result>> searchApiLogs(HttpServletRequest request, + @RequestBody SearchApiLogReq searchApiLogReq) { + SessionAccount account = this.loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + String logPrefix = "[ApiStatController]"; + log.warn(logPrefix + "searchApiLogs current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + return esLogService.searchApiLogs(searchApiLogReq); + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/OpenApiController.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/OpenApiController.java new file mode 100644 index 000000000..85cd4c25e --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/OpenApiController.java @@ -0,0 +1,35 @@ +package run.mone.mimeter.dashboard.controller; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDoc; +import com.xiaomi.mone.http.docs.annotations.HttpApiModule; +import com.xiaomi.mone.http.docs.annotations.MiApiRequestMethod; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.scene.CreateSceneDTO; +import run.mone.mimeter.dashboard.bo.scene.SceneDTO; +import run.mone.mimeter.dashboard.common.SceneSource; +import run.mone.mimeter.dashboard.service.SceneService; + +@Slf4j +@RestController +@RequestMapping("/api/bench/agent/openapi") +@HttpApiModule(value = "OpenApiController", apiController = OpenApiController.class) +public class OpenApiController { + + @Autowired + private SceneService sceneService; + + @HttpApiDoc(value = "/api/bench/agent/openapi/createScene", apiName = "批量绑定压测机域名", method = MiApiRequestMethod.POST, description = "创建场景的openapi") + @RequestMapping(value = "/createScene", method = RequestMethod.POST) + public Result createScene( + @RequestBody CreateSceneDTO createSceneReq) { + createSceneReq.setSceneSource(SceneSource.OPEN_API.code); + createSceneReq.setTenant("open_api"); + return sceneService.newScene(createSceneReq, "open_api"); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/OperationLogController.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/OperationLogController.java new file mode 100644 index 000000000..bb61d98c5 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/OperationLogController.java @@ -0,0 +1,53 @@ +package run.mone.mimeter.dashboard.controller; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDoc; +import com.xiaomi.mone.http.docs.annotations.HttpApiModule; +import com.xiaomi.mone.http.docs.annotations.MiApiRequestMethod; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.operationlog.GetOperationLogListReq; +import run.mone.mimeter.dashboard.bo.operationlog.OperationLogList; +import run.mone.mimeter.dashboard.common.SessionAccount; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.service.OperationLogService; +import run.mone.mimeter.dashboard.service.impl.LoginService; + +import javax.servlet.http.HttpServletRequest; +import java.util.Objects; + +import static run.mone.mimeter.dashboard.exception.CommonError.InvalidParamError; + +@Slf4j +@RestController +@RequestMapping("/api/bench/operationlog") +@HttpApiModule(value = "OperationLogController", apiController = OperationLogController.class) +public class OperationLogController { + + @Autowired + private LoginService loginService; + + @Autowired + private OperationLogService operationLogService; + + + @HttpApiDoc(apiName = "操作记录列表", value = "/api/bench/operationlog/list", method = MiApiRequestMethod.POST, description = "操作记录列表") + @RequestMapping(value = "/list", method = RequestMethod.POST) + public Result getOperationLogList(HttpServletRequest request, + @RequestBody GetOperationLogListReq param) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[OperationLogController.getOperationLogList] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + log.info("[OperationLogController.getOperationLogList] param: {}", param); + if (param == null) { + return Result.fail(InvalidParamError); + } + return operationLogService.getOperationLogList(param); + } + + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/ReportInfoController.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/ReportInfoController.java new file mode 100644 index 000000000..c9aebadf0 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/ReportInfoController.java @@ -0,0 +1,120 @@ +package run.mone.mimeter.dashboard.controller; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDoc; +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import com.xiaomi.mone.http.docs.annotations.HttpApiModule; +import com.xiaomi.mone.http.docs.annotations.MiApiRequestMethod; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import run.mone.mimeter.dashboard.bo.common.PagedResp; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.report.ReportInfoBo; +import run.mone.mimeter.dashboard.bo.report.RmReportReq; +import run.mone.mimeter.dashboard.common.SessionAccount; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.service.ReportInfoService; +import run.mone.mimeter.dashboard.service.SceneService; +import run.mone.mimeter.dashboard.service.SceneSnapshotService; +import run.mone.mimeter.dashboard.service.impl.LoginService; +import run.mone.mimeter.dashboard.common.ApiConsts; + +import javax.servlet.http.HttpServletRequest; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +import static run.mone.mimeter.dashboard.bo.common.Constants.DEFAULT_API_TIMEOUT; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/6/22 + */ +@Slf4j +@RestController +@RequestMapping(ApiConsts.API_PREFIX + ApiConsts.REPORT_INFO_ROUTE) +@HttpApiModule(value = "ReportInfoController", apiController = ReportInfoController.class) +public class ReportInfoController { + + @Autowired + private LoginService loginService; + + @Autowired + private ReportInfoService reportInfoService; + + @Autowired + private SceneService sceneService; + + @Autowired + private SceneSnapshotService sceneSnapshotService; + + private final String logPrefix = "[ReportInfoController]"; + + @HttpApiDoc(value = ApiConsts.API_PREFIX + ApiConsts.REPORT_INFO_ROUTE + ApiConsts.GENERAL_LIST_ENDPOINT, apiName = "获取压测报告列表", + method = MiApiRequestMethod.GET, description = "获取压测报告列表") + @GetMapping(ApiConsts.GENERAL_LIST_ENDPOINT) + public Result>> listReports(HttpServletRequest request, + @HttpApiDocClassDefine("keyword") + @RequestParam(required = false) String keyword, + @HttpApiDocClassDefine("pageNo") + @RequestParam(required = false) Integer pageNo, + @HttpApiDocClassDefine("pageSize") + @RequestParam(required = false) Integer pageSize) + throws ExecutionException, InterruptedException, TimeoutException { + SessionAccount account = this.loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn(this.logPrefix + "newScene current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + CompletableFuture>> cf1 = CompletableFuture.supplyAsync( + () -> this.reportInfoService.listReports(account.getTenant(), keyword, pageNo, pageSize) + ); + CompletableFuture> cf2 = CompletableFuture.supplyAsync( + () -> this.reportInfoService.countReports(account.getTenant(), keyword, pageNo, pageSize) + ); + CompletableFuture.allOf(cf1, cf2).get(DEFAULT_API_TIMEOUT, TimeUnit.MILLISECONDS); + List reportList = cf1.get().getData(); + PagedResp> resp = new PagedResp<>(); + + resp.setTotal(cf2.get().getData()); + resp.setData(reportList); + return Result.success(resp); + } + + @HttpApiDoc(value = ApiConsts.API_PREFIX + ApiConsts.REPORT_INFO_ROUTE + ApiConsts.GENERAL_DETAILS_ENDPOINT, apiName = "获取压测报告详情", + method = MiApiRequestMethod.GET, description = "获取压测报告详情") + @GetMapping(ApiConsts.GENERAL_DETAILS_ENDPOINT) + public Result reportDetails(HttpServletRequest request, + @HttpApiDocClassDefine(value = "sceneId") + @RequestParam(required = false) Long sceneId, + @HttpApiDocClassDefine(value = "reportId", required = true) + @RequestParam String reportId) { + SessionAccount account = this.loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn(this.logPrefix + "reportDetails current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + ReportInfoBo report = this.reportInfoService.getReportDetails(sceneId, reportId).getData(); + ReportInfoBo obj = new ReportInfoBo(); + BeanUtils.copyProperties(report, obj); + return Result.success(obj); + } + + @HttpApiDoc(value = ApiConsts.API_PREFIX + ApiConsts.REPORT_INFO_ROUTE + ApiConsts.GENERAL_DELETE_ENDPOINT, apiName = "删除压测报告", + method = MiApiRequestMethod.DELETE, description = "删除压测报告") + @RequestMapping(value = "/delete", method = RequestMethod.POST) + public Result removeReports(HttpServletRequest request, + @RequestBody RmReportReq rmReportReq) { + SessionAccount account = this.loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn(this.logPrefix + "removeReports current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + return this.reportInfoService.removeReports(rmReportReq.getReportIds()); + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/SceneApiController.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/SceneApiController.java new file mode 100644 index 000000000..c9b498258 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/SceneApiController.java @@ -0,0 +1,123 @@ +package run.mone.mimeter.dashboard.controller; + +import com.alibaba.nacos.api.exception.NacosException; +import com.xiaomi.mone.http.docs.annotations.HttpApiDoc; +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import com.xiaomi.mone.http.docs.annotations.HttpApiModule; +import com.xiaomi.mone.http.docs.annotations.MiApiRequestMethod; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import run.mone.mimeter.dashboard.bo.DubboService; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.scene.DefaultSceneInfo; +import run.mone.mimeter.dashboard.bo.sceneapi.GetApiDetailReq; +import run.mone.mimeter.dashboard.bo.sceneapi.GetDubboServiceReq; +import run.mone.mimeter.dashboard.common.SessionAccount; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.service.SceneApiService; +import run.mone.mimeter.dashboard.service.impl.LoginService; + +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.util.List; +import java.util.Objects; + +@Slf4j +@RestController +@RequestMapping("/api/bench/sceneApi") +@HttpApiModule(value = "SceneApiController", apiController = SceneApiController.class) +public class SceneApiController { + + @Autowired + private LoginService loginService; + + @Autowired + private SceneApiService sceneApiService; + + @HttpApiDoc(value = "/api/bench/sceneApi/searchApiFromMiApi", apiName = "模糊搜索mi-api中的接口", method = MiApiRequestMethod.POST, description = "根据keyword模糊搜索mi-api中的接口") + @RequestMapping(value = "/searchApiFromMiApi", method = RequestMethod.POST) + public Result searchApiFromMiApi( + HttpServletRequest request, + @HttpApiDocClassDefine(value = "keyword", required = true, description = "关键字", defaultValue = "getUser") + String keyword, + @HttpApiDocClassDefine(value = "apiProtocol", required = true, description = "接口协议类型 1:http 3:dubbo", defaultValue = "3") + Integer apiProtocol + ) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SceneApiController.searchApiFromMiApi] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + if (Objects.isNull(keyword)) { + keyword = ""; + } + return sceneApiService.searchApiFromMiApi(keyword, apiProtocol); + } + + @HttpApiDoc(value = "/api/bench/sceneApi/getSceneBasicInfoFromApiID", apiName = "通过mi-api接口id获取场景基本默认数据", method = MiApiRequestMethod.POST, description = "通过mi-api接口id获取场景基本默认数据") + @RequestMapping(value = "/getSceneBasicInfoFromApiID", method = RequestMethod.POST) + public Result getSceneBasicInfoFromApiID( + HttpServletRequest request, + GetApiDetailReq getApiDetailReq) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SceneApiController.getSceneBasicInfoFromApiID] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + return sceneApiService.getSceneBasicInfoFromApiID(getApiDetailReq); + } + + @HttpApiDoc(value = "/api/bench/sceneApi/getApiDetailFromMiApi", apiName = "获取mi-api中的接口详情", method = MiApiRequestMethod.POST, description = "根据id获取mi-api中的接口详情") + @RequestMapping(value = "/getApiDetailFromMiApi", method = RequestMethod.POST) + public Result getApiDetailFromMiApi( + HttpServletRequest request, + GetApiDetailReq getApiDetailReq + ) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SceneApiController.getApiDetailFromMiApi] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + return sceneApiService.getApiDetailFromMiApi(getApiDetailReq); + } + + /** + * 根据服务名大致搜索nacos上的服务列表可搜dubbo服务 + * + * @return + * @throws IOException + */ + @HttpApiDoc(value = "/api/bench/sceneApi/loadDubboApiServices", apiName = "搜索dubbo接口", method = MiApiRequestMethod.POST, description = "根据服务名大致搜索nacos上的服务列表可搜dubbo服务") + @ResponseBody + @RequestMapping(value = "/loadDubboApiServices", method = RequestMethod.POST) + public Result> loadDubboApiServices(GetDubboServiceReq req) throws IOException { + return sceneApiService.loadDubboApiServices(req.getServiceName(), req.getEnv()); + } + + /** + * 根据服务名获取方法列表 + * + * @return + * @throws IOException + */ + @HttpApiDoc(value = "/api/bench/sceneApi/getServiceMethod", apiName = "根据服务名获取方法列表", method = MiApiRequestMethod.POST, description = "根据服务名获取方法列表") + @ResponseBody + @RequestMapping(value = "/getServiceMethod", method = RequestMethod.POST) + public Result> getServiceMethod(GetDubboServiceReq req) throws IOException, NacosException { + return sceneApiService.getServiceMethod(req.getServiceName(), req.getEnv()); + } + + @HttpApiDoc(value = "/api/bench/sceneApi/getUrlById", apiName = "根据apiId获取url", + method = MiApiRequestMethod.POST, description = "根据apiId获取url") + @RequestMapping(value = "/getUrlById", method = RequestMethod.POST) + public Result getUrlById(HttpServletRequest request, Integer apiId) { + SessionAccount account = this.loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("getUrlById current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + return sceneApiService.getApiUrlById(apiId); + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/SceneController.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/SceneController.java new file mode 100644 index 000000000..c71199207 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/SceneController.java @@ -0,0 +1,180 @@ +package run.mone.mimeter.dashboard.controller; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDoc; +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import com.xiaomi.mone.http.docs.annotations.HttpApiModule; +import com.xiaomi.mone.http.docs.annotations.MiApiRequestMethod; +import lombok.extern.slf4j.Slf4j; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.dataset.SceneParamData; +import run.mone.mimeter.dashboard.bo.scene.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import run.mone.mimeter.dashboard.bo.scenegroup.GetSceneGroupListReq; +import run.mone.mimeter.dashboard.bo.scenegroup.SceneGroupList; +import run.mone.mimeter.dashboard.common.SceneSource; +import run.mone.mimeter.dashboard.common.SessionAccount; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.service.SceneService; +import run.mone.mimeter.dashboard.service.impl.LoginService; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; +import java.util.Objects; + +@Slf4j +@RestController +@RequestMapping("/api/bench/scene") +@HttpApiModule(value = "SceneController", apiController = SceneController.class) +public class SceneController { + + @Autowired + private LoginService loginService; + + @Autowired + private SceneService sceneService; + + @HttpApiDoc(value = "/api/bench/scene/newScene", apiName = "新增压测场景", method = MiApiRequestMethod.POST, description = "新增压测场景") + @RequestMapping(value = "/newScene", method = RequestMethod.POST) + public Result newScene( + HttpServletRequest request, + @RequestBody CreateSceneDTO createSceneReq) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SceneController.newScene] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + createSceneReq.setSceneSource(SceneSource.CONSOLE.code); + createSceneReq.setTenant(account.getTenant()); + try { + return sceneService.newScene(createSceneReq, account.getUsername()); + } catch (Exception e) { + return Result.fail(CommonError.InvalidParamError); + } + } + + @HttpApiDoc(value = "/api/bench/scene/deleteScene", apiName = "删除压测场景", method = MiApiRequestMethod.POST, description = "根据ID删除压测场景") + @RequestMapping(value = "/deleteScene", method = RequestMethod.POST) + public Result deleteScene( + HttpServletRequest request, + @HttpApiDocClassDefine(value = "sceneID", required = true, description = "场景ID", defaultValue = "66") + Integer sceneID) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SceneController.newScene] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + //todo 租户权限校验 + + try { + return sceneService.delScene(sceneID, account.getUsername()); + } catch (Exception e) { + log.warn("[SceneController.newScene] error :{}",e.getMessage()); + return Result.fail(CommonError.InvalidParamError); + } + } + + @HttpApiDoc(value = "/api/bench/scene/editScene", apiName = "编辑压测场景", method = MiApiRequestMethod.POST, description = "编辑压测场景") + @RequestMapping(value = "/editScene", method = RequestMethod.POST) + public Result editScene( + HttpServletRequest request, + @RequestBody EditSceneDTO editSceneReq) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SceneController.editScene] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + editSceneReq.setTenant(account.getTenant()); + editSceneReq.setSceneSource(SceneSource.CONSOLE.code); + try { + return sceneService.editScene(editSceneReq, account.getUsername()); + } catch (Exception e) { + log.warn("[SceneController.editScene] error :{}",e.getMessage()); + return Result.fail(CommonError.InvalidParamError); + } + } + + @HttpApiDoc(value = "/api/bench/scene/getSceneByID", apiName = "获取压测场景详情", method = MiApiRequestMethod.GET, description = "根据ID获取压测场景") + @RequestMapping(value = "/getSceneByID", method = RequestMethod.GET) + public Result getSceneByID( + HttpServletRequest request, + @HttpApiDocClassDefine(value = "sceneID", required = true, description = "场景ID", defaultValue = "66") + Integer sceneID) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SceneController.newScene] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + try { + return sceneService.getSceneByID(sceneID,false); + } catch (Exception e) { + log.warn("[SceneController.getSceneByID] error :{}",e); + return Result.fail(CommonError.InvalidParamError); + } + } + + @HttpApiDoc(value = "/api/bench/scene/getSceneList", apiName = "获取压测场景列表", method = MiApiRequestMethod.POST, description = "获取压测场景列表") + @RequestMapping(value = "/getSceneList", method = RequestMethod.POST) + public Result getSceneList(GetSceneListReq req,HttpServletRequest request) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SceneController.getSceneList] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + req.setTenant(account.getTenant()); + return sceneService.getSceneList(req); + } + + @HttpApiDoc(value = "/api/bench/scene/getSceneListByIds", apiName = "根据id列表获取压测场景列表", method = MiApiRequestMethod.POST, description = "根据id列表获取压测场景列表") + @RequestMapping(value = "/getSceneListByIds", method = RequestMethod.POST) + public Result> getSceneListByIds(@RequestBody GetSceneListByIdsReq req,HttpServletRequest request) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SceneController.getSceneListByIds] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + return sceneService.getSceneListByIds(req); + } + + @HttpApiDoc(value = "/api/bench/scene/getSceneListByGroup", apiName = "获取压测场景分组列表", method = MiApiRequestMethod.POST, description = "获取压测场景分组列表") + @RequestMapping(value = "/getSceneListByGroup", method = RequestMethod.POST) + public Result getSceneListByGroup(GetSceneGroupListReq req, HttpServletRequest request) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SceneController.getSceneListByGroup] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + req.setTenant(account.getTenant()); + return sceneService.getSceneListByGroup(req); + } + + @HttpApiDoc(value = "/api/bench/scene/searchSceneByKeyword", apiName = "按关键字搜索场景", method = MiApiRequestMethod.POST, description = "按关键字搜索场景") + @RequestMapping(value = "/searchSceneByKeyword", method = RequestMethod.POST) + public Result searchSceneByKeyword(GetSceneListReq req,HttpServletRequest request) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SceneController.newScene] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + req.setTenant(account.getTenant()); + try { + return sceneService.getSceneListByKeyword(req); + } catch (Exception e) { + log.warn("[SceneController.searchSceneByKeyword] error :{}",e.getMessage()); + return Result.fail(CommonError.InvalidParamError); } + } + + @HttpApiDoc(value = "/api/bench/scene/getSceneParamData", apiName = "获取压测场景参数数据", method = MiApiRequestMethod.GET, description = "获取压测场景参数数据,目前支持全局参数") + @RequestMapping(value = "/getSceneParamData", method = RequestMethod.POST) + public Result getSceneDataset( + @HttpApiDocClassDefine(value = "场景id",required = true,description = "所属场景id",defaultValue = "66") + Integer sceneId, HttpServletRequest request) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SceneController.getSceneParamData] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + return sceneService.getSceneParamData(sceneId); + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/SceneGroupController.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/SceneGroupController.java new file mode 100644 index 000000000..a4ece8621 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/SceneGroupController.java @@ -0,0 +1,75 @@ +package run.mone.mimeter.dashboard.controller; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDoc; +import com.xiaomi.mone.http.docs.annotations.HttpApiModule; +import com.xiaomi.mone.http.docs.annotations.MiApiRequestMethod; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.scenegroup.SceneGroupDTO; +import run.mone.mimeter.dashboard.common.SessionAccount; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.service.SceneGroupService; +import run.mone.mimeter.dashboard.service.impl.LoginService; + +import javax.servlet.http.HttpServletRequest; +import java.util.Objects; + +@Slf4j +@RestController +@RequestMapping("/api/bench/scene") +@HttpApiModule(value = "SceneGroupController", apiController = SceneGroupController.class) +public class SceneGroupController { + + @Autowired + private LoginService loginService; + + @Autowired + private SceneGroupService sceneGroupService; + + @HttpApiDoc(value = "/api/bench/scene/newSceneGroup", apiName = "新增场景分组", method = MiApiRequestMethod.POST, description = "新增场景分组") + @RequestMapping(value = "/newSceneGroup", method = RequestMethod.POST) + public Result newSceneGroup( + HttpServletRequest request, + @RequestBody SceneGroupDTO sceneGroupReq) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SceneController.newSceneGroup] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + sceneGroupReq.setTenant(account.getTenant()); + return sceneGroupService.newSceneGroup(sceneGroupReq, account.getUsername()); + } + + @HttpApiDoc(value = "/api/bench/scene/deleteSceneGroup", apiName = "删除压测场景分组", method = MiApiRequestMethod.POST, description = "根据ID删除压测场景") + @RequestMapping(value = "/deleteSceneGroup", method = RequestMethod.POST) + public Result deleteSceneGroup( + HttpServletRequest request ,@RequestBody SceneGroupDTO sceneGroupReq){ + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SceneController.deleteSceneGroup] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + return sceneGroupService.delSceneGroup(sceneGroupReq, account.getUsername()); + } + + @HttpApiDoc(value = "/api/bench/scene/editSceneGroup", apiName = "编辑压测场景分组信息", method = MiApiRequestMethod.POST, description = "编辑压测场景") + @RequestMapping(value = "/editSceneGroup", method = RequestMethod.POST) + public Result editSceneGroup( + HttpServletRequest request, + @RequestBody SceneGroupDTO sceneGroupReq) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SceneController.editSceneGroup] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + return sceneGroupService.editSceneGroup(sceneGroupReq, account.getUsername()); + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/SceneSnapshotController.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/SceneSnapshotController.java new file mode 100644 index 000000000..e667ab7ef --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/SceneSnapshotController.java @@ -0,0 +1,71 @@ +package run.mone.mimeter.dashboard.controller; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDoc; +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import com.xiaomi.mone.http.docs.annotations.HttpApiModule; +import com.xiaomi.mone.http.docs.annotations.MiApiRequestMethod; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.scene.SceneSnapshotBo; +import run.mone.mimeter.dashboard.common.SessionAccount; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.service.SceneService; +import run.mone.mimeter.dashboard.service.SceneSnapshotService; +import run.mone.mimeter.dashboard.service.impl.LoginService; +import run.mone.mimeter.dashboard.common.ApiConsts; + +import javax.servlet.http.HttpServletRequest; +import java.util.Objects; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/6/23 + */ +@Slf4j +@RestController +@RequestMapping(ApiConsts.API_PREFIX + ApiConsts.SCENE_SNAPSHOT_ROUTE) +@HttpApiModule(value = "SceneSnapshotController", apiController = SceneSnapshotController.class) +public class SceneSnapshotController { + + @Autowired + private LoginService loginService; + + @Autowired + private SceneSnapshotService sceneSnapshotService; + + @Autowired + private SceneService sceneService; + + private final String logPrefix = "[SceneSnapshotController]"; + + @HttpApiDoc(value = ApiConsts.API_PREFIX + ApiConsts.SCENE_SNAPSHOT_ROUTE + ApiConsts.GENERAL_DETAILS_ENDPOINT, apiName = "获取压测场景快照", + method = MiApiRequestMethod.GET, description = "获取压测场景快照") + @GetMapping(ApiConsts.GENERAL_DETAILS_ENDPOINT) + public Result snapshotDetails(HttpServletRequest request, + @HttpApiDocClassDefine(value = "snapshotId", required = true) + @RequestParam String snapshotId) { + SessionAccount account = this.loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn(this.logPrefix + "snapshotDetails current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + return this.sceneSnapshotService.getSceneSnapshotById(snapshotId); + } + + @GetMapping("/scene") + public Result getByScene(HttpServletRequest request, + @RequestParam Long sceneId) { + SessionAccount account = this.loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn(this.logPrefix + "getByScene current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + return this.sceneSnapshotService.getSceneSnapshotByScene(sceneId); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/SlaController.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/SlaController.java new file mode 100644 index 000000000..d1e2c4c03 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/SlaController.java @@ -0,0 +1,208 @@ +package run.mone.mimeter.dashboard.controller; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDoc; +import com.xiaomi.mone.http.docs.annotations.HttpApiModule; +import com.xiaomi.mone.http.docs.annotations.MiApiRequestMethod; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import run.mone.mimeter.dashboard.bo.common.CommonEnum; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.sla.GetSlaListReq; +import run.mone.mimeter.dashboard.bo.sla.PerRuleItem; +import run.mone.mimeter.dashboard.bo.sla.SlaDto; +import run.mone.mimeter.dashboard.bo.sla.SlaList; +import run.mone.mimeter.dashboard.common.SessionAccount; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.service.SlaService; +import run.mone.mimeter.dashboard.service.impl.LoginService; + +import javax.servlet.http.HttpServletRequest; +import java.util.*; + +import static run.mone.mimeter.dashboard.bo.sla.DegreeEnum.*; +import static run.mone.mimeter.dashboard.bo.sla.SlaBusinessGroupEnum.InternetGame; +import static run.mone.mimeter.dashboard.bo.sla.SlaBusinessGroupEnum.InternetService; +import static run.mone.mimeter.dashboard.bo.sla.SlaRuleItemEnum.*; +import static run.mone.mimeter.dashboard.bo.sla.SlaRuleItemTypeEnum.BusinessMetrics; +import static run.mone.mimeter.dashboard.bo.sla.SlaRuleItemTypeEnum.MonitorMetrics; +import static run.mone.mimeter.dashboard.exception.CommonError.InvalidParamError; + + +@Slf4j +@RestController +@RequestMapping("/api/bench/sla") +@HttpApiModule(value = "SlaController", apiController = SlaController.class) +public class SlaController { + + @Autowired + private LoginService loginService; + + @Autowired + private SlaService slaService; + + + @HttpApiDoc(apiName = "sla新增", value = "/api/bench/sla/new", method = MiApiRequestMethod.POST, description = "sla新增") + @RequestMapping(value = "/new", method = RequestMethod.POST) + public Result newSla(HttpServletRequest request, + @RequestBody SlaDto param) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SlaController.newSla] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + param.setCreator(account.getUsername()); + param.setUpdater(account.getUsername()); + + log.info("[SlaController.newSla] param: {}", param); + return slaService.newSla(param); + } + + @HttpApiDoc(apiName = "sla更新", value = "/api/bench/sla/update", method = MiApiRequestMethod.POST, description = "sla更新") + @RequestMapping(value = "/update", method = RequestMethod.POST) + public Result updateSla(HttpServletRequest request, + @RequestBody SlaDto param) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SlaController.updateSla] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + param.setUpdater(account.getUsername()); + + log.info("[SlaController.updateSla] param: {}", param); + return slaService.updateSla(param); + } + + @HttpApiDoc(apiName = "sla列表", value = "/api/bench/sla/list", method = MiApiRequestMethod.POST, description = "sla列表") + @RequestMapping(value = "/list", method = RequestMethod.POST) + public Result getSlaList(HttpServletRequest request, + @RequestBody GetSlaListReq param) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SlaController.getSlaList] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + log.info("[SlaController.getSlaList] param: {}", param); + if (param == null) { + return Result.fail(InvalidParamError); + } + return slaService.getSlaList(param); + } + + @HttpApiDoc(apiName = "sla删除", value = "/api/bench/sla/del", method = MiApiRequestMethod.DELETE, description = "sla删除") + @RequestMapping(value = "/del", method = RequestMethod.DELETE) + public Result delSla(HttpServletRequest request, + @RequestParam("id") int id) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SlaController.delSla] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + log.info("[SlaController.delSla] param: {}", id); + return slaService.delSla(id); + } + + @HttpApiDoc(apiName = "sla批量删除", value = "/api/bench/sla/multiDel", method = MiApiRequestMethod.POST, description = "sla批量删除") + @RequestMapping(value = "/multiDel", method = RequestMethod.POST) + public Result multiDelSla(HttpServletRequest request, + @RequestBody List ids) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SlaController.multiDelSla] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + log.info("[SlaController.multiDelSla] param: {}", ids); + return slaService.multiDelSla(ids); + } + + @HttpApiDoc(apiName = "获取sla详情", value = "/api/bench/sla/detail", method = MiApiRequestMethod.GET, description = "获取sla详情") + @RequestMapping(value = "/detail", method = RequestMethod.GET) + public Result detail(HttpServletRequest request, + @RequestParam("id") int id) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SlaController.detail] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + log.info("[SlaController.detail] param: {}", id); + return slaService.getSlaById(id); + } + + @HttpApiDoc(apiName = "sla业务分类枚举", value = "/api/bench/sla/businessgroup/list", method = MiApiRequestMethod.GET, description = "sla业务分类枚举") + @RequestMapping(value = "/businessgroup/list", method = RequestMethod.GET) + public Result> businessGroupList(HttpServletRequest request) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SlaController.businessGroupList] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + List list = Arrays.asList( + new CommonEnum(InternetService.businessGroupCname, InternetService.businessGroupName), + new CommonEnum(InternetGame.businessGroupCname, InternetGame.businessGroupName) + ); + return Result.success(list); + } + + @HttpApiDoc(apiName = "sla指标敏感程度枚举", value = "/api/bench/sla/degree/list", method = MiApiRequestMethod.GET, description = "sla指标敏感程度枚举") + @RequestMapping(value = "/degree/list", method = RequestMethod.GET) + public Result> degreeList(HttpServletRequest request) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SlaController.degreeList] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + List list = Arrays.asList( + new CommonEnum(Sensitive.code, Sensitive.degreeCname), + new CommonEnum(Tolerable.code, Tolerable.degreeCname), + new CommonEnum(NotSensitive.code, NotSensitive.degreeCname) + ); + return Result.success(list); + } + + @HttpApiDoc(apiName = "sla指标枚举", value = "/api/bench/sla/ruleItem/list", method = MiApiRequestMethod.GET, description = "sla指标枚举") + @RequestMapping(value = "/ruleItem/list", method = RequestMethod.GET) + public Result> ruleItemList(HttpServletRequest request) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SlaController.ruleItemList] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + List ruleItemList = new ArrayList<>(); + + PerRuleItem businessMetrics = new PerRuleItem(); + businessMetrics.setRuleItemTypeCname(BusinessMetrics.ruleItemTypeCname); + businessMetrics.setRuleItemTypeName(BusinessMetrics.ruleItemTypeName); + List businessMetricsList = Arrays.asList( + new CommonEnum(SuccessRate.ruleItemCname, SuccessRate.ruleItemName, SuccessRate.unit), + new CommonEnum(P99ResponseTime.ruleItemCname, P99ResponseTime.ruleItemName, P99ResponseTime.unit), + new CommonEnum(AvgResponseTime.ruleItemCname, AvgResponseTime.ruleItemName, AvgResponseTime.unit), + new CommonEnum(RequestPerSecond.ruleItemCname, RequestPerSecond.ruleItemName, RequestPerSecond.unit) + ); + businessMetrics.setRuleList(businessMetricsList); + ruleItemList.add(businessMetrics); + + PerRuleItem monitorMetrics = new PerRuleItem(); + monitorMetrics.setRuleItemTypeCname(MonitorMetrics.ruleItemTypeCname); + monitorMetrics.setRuleItemTypeName(MonitorMetrics.ruleItemTypeName); + List monitorMetricsList = Arrays.asList( + new CommonEnum(CpuUtilization.ruleItemCname, CpuUtilization.ruleItemName, CpuUtilization.unit), + new CommonEnum(MemoryUtilization.ruleItemCname, MemoryUtilization.ruleItemName, MemoryUtilization.unit), + new CommonEnum(Load5Average.ruleItemCname, Load5Average.ruleItemName, Load5Average.unit), + new CommonEnum(Load5Max.ruleItemCname, Load5Max.ruleItemName, Load5Max.unit), + new CommonEnum(DropConnectionAverage.ruleItemCname, DropConnectionAverage.ruleItemName, DropConnectionAverage.unit), + new CommonEnum(DropConnectionMax.ruleItemCname, DropConnectionMax.ruleItemName, DropConnectionMax.unit) + ); + monitorMetrics.setRuleList(monitorMetricsList); + ruleItemList.add(monitorMetrics); + + return Result.success(ruleItemList); + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/TaskController.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/TaskController.java new file mode 100644 index 000000000..66ed6a9a1 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/TaskController.java @@ -0,0 +1,219 @@ +package run.mone.mimeter.dashboard.controller; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDoc; +import com.xiaomi.mone.http.docs.annotations.HttpApiDocClassDefine; +import com.xiaomi.mone.http.docs.annotations.HttpApiModule; +import com.xiaomi.mone.http.docs.annotations.MiApiRequestMethod; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; +import run.mone.mimeter.dashboard.bo.ChangeQpsReq; +import run.mone.mimeter.dashboard.bo.DubboSceneDebugResult; +import run.mone.mimeter.dashboard.bo.HttpSceneDebugResult; +import run.mone.mimeter.dashboard.bo.SubmitTaskRes; +import run.mone.mimeter.dashboard.bo.common.Constants; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.task.DebugSceneApiInfoReq; +import run.mone.mimeter.dashboard.bo.task.SceneRpsRateReq; +import run.mone.mimeter.dashboard.bo.task.TaskDTO; +import run.mone.mimeter.dashboard.common.SessionAccount; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.service.TaskService; +import run.mone.mimeter.dashboard.service.impl.LoginService; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Objects; +import java.util.TreeMap; + +@Slf4j +@RestController +@RequestMapping(value = "/api/bench/task") +@HttpApiModule(value = "TaskController", apiController = TaskController.class) +public class TaskController { + + @Autowired + private LoginService loginService; + + @Autowired + private TaskService taskService; + + /** + * 单接口测试任务 + * + */ + @HttpApiDoc(value = "/api/bench/task/submitSingleApiDebugTask", apiName = "提交执行单接口测试任务", method = MiApiRequestMethod.POST, description = "提交接口测试执行任务") + @RequestMapping(value = "/submitSingleApiDebugTask", method = RequestMethod.POST) + public Result submitSingleApiDebugTask( + HttpServletRequest request, + @RequestBody DebugSceneApiInfoReq apiInfoReq + ) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TaskController.submitSingleApiDebugTask] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + TaskDTO taskDTO = new TaskDTO(); + taskDTO.setSubmitTaskType(Constants.SINGLE_API_DEBUG); + taskDTO.setApiInfo(apiInfoReq); + taskDTO.setTenant(account.getTenant()); + return taskService.submitTask(taskDTO, account.getUsername()); + } + + /** + * 执行场景调试任务 + * + * @param request + * @param + * @return + */ + @HttpApiDoc(value = "/api/bench/task/submitSceneDebugTask", apiName = "执行场景调试任务", method = MiApiRequestMethod.POST, description = "执行场景调试任务") + @RequestMapping(value = "/submitSceneDebugTask", method = RequestMethod.POST) + public Result submitSceneDebugTask( + HttpServletRequest request, + @HttpApiDocClassDefine(value = "sceneID", description = "场景id", required = true, defaultValue = "234") + Integer sceneID + ) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TaskController.submitSceneDebugTask] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + TaskDTO taskDTO = new TaskDTO(); + taskDTO.setSceneId(sceneID); + taskDTO.setSubmitTaskType(Constants.SCENE_DEBUG); + taskDTO.setTenant(account.getTenant()); + + return taskService.submitTask(taskDTO, account.getUsername()); + } + + /** + * 执行场景压测任务 + * + * @param request + * @param + * @return + */ + @HttpApiDoc(value = "/api/bench/task/submitSceneBenchTask", apiName = "执行场景压测任务", method = MiApiRequestMethod.POST, description = "执行场景压测任务") + @RequestMapping(value = "/submitSceneBenchTask", method = RequestMethod.POST) + public Result submitSceneBenchTask( + HttpServletRequest request, + @HttpApiDocClassDefine(value = "sceneID", description = "场景id", required = true, defaultValue = "234") + Integer sceneID) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TaskController.submitSceneBenchTask] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + TaskDTO taskDTO = new TaskDTO(); + taskDTO.setSceneId(sceneID); + taskDTO.setSubmitTaskType(Constants.SCENE_BENCH); + taskDTO.setTenant(account.getTenant()); + + return taskService.submitTask(taskDTO, account.getUsername()); + } + + @HttpApiDoc(value = "/api/bench/task/stopTask", apiName = "停止任务", method = MiApiRequestMethod.POST, description = "停止任务") + @RequestMapping(value = "/stopTask", method = RequestMethod.POST) + public Result stopTask( + HttpServletRequest request, + @HttpApiDocClassDefine(value = "type", required = true, description = "基于哪个id停止任务 0:报告id 1:场景", defaultValue = "1") + Integer type, + @HttpApiDocClassDefine(value = "sceneID", required = true, description = "场景ID", defaultValue = "66") + Integer sceneID, + @HttpApiDocClassDefine(value = "reportID", required = true, description = "报告ID", defaultValue = "66") + String reportID + ) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TaskController.stopTask] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + TaskDTO taskDTO = new TaskDTO(); + taskDTO.setReportId(reportID); + taskDTO.setSceneId(sceneID); + taskDTO.setTenant(account.getTenant()); + + return taskService.stopTask(type,taskDTO, account.getUsername()); + } + + @HttpApiDoc(value = "/api/bench/task/manualUpdateRps", apiName = "手动调节链路rps", method = MiApiRequestMethod.POST, description = "手动调节链路rps") + @RequestMapping(value = "/manualUpdateRps", method = RequestMethod.POST) + public Result manualUpdateRps( + HttpServletRequest request, + @RequestBody ChangeQpsReq req + ) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TaskController.stopTask] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + return taskService.manualUpdateRps(req); + } + + @HttpApiDoc(value = "/api/bench/task/manualUpdateSceneRpsRate", apiName = "实时手动调节整个场景发压比例", method = MiApiRequestMethod.POST, description = "手动调节链路rps") + @RequestMapping(value = "/manualUpdateSceneRpsRate", method = RequestMethod.POST) + public Result manualUpdateSceneRpsRate( + HttpServletRequest request, + @RequestBody SceneRpsRateReq req){ + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TaskController.manualUpdateSceneRpsRate] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + return taskService.manualUpdateSceneRpsRate(req); + } + + @HttpApiDoc(value = "/api/bench/task/getHttpSceneDebugResultByTaskId", apiName = "获取场景调试结果数据", method = MiApiRequestMethod.POST, description = "获取场景调试结果数据") + @RequestMapping(value = "/getHttpSceneDebugResultByTaskId", method = RequestMethod.POST) + public Result>> getSceneDebugResultByTaskId( + HttpServletRequest request, + @HttpApiDocClassDefine(value = "reportID", required = true, description = "该任务id", defaultValue = "66") + String reportID) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TaskController.getSceneDebugResultByTaskId] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + return taskService.getHttpSceneDebugResultByTaskId(reportID, account.getUsername()); + } + + @HttpApiDoc(value = "/api/bench/task/getDubboSceneDebugResultByTaskId", apiName = "获取场景调试结果数据", method = MiApiRequestMethod.POST, description = "获取场景调试结果数据") + @RequestMapping(value = "/getDubboSceneDebugResultByTaskId", method = RequestMethod.POST) + public Result>> getDubboSceneDebugResultByTaskId( + HttpServletRequest request, + @HttpApiDocClassDefine(value = "reportID", required = true, description = "该任务id", defaultValue = "66") + String reportID) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TaskController.getDubboSceneDebugResultByTaskId] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser); + } + + return taskService.getDubboSceneDebugResultByTaskId(reportID, account.getUsername()); + } + + @HttpApiDoc(value = "/api/bench/task/stream", apiName = "连接实时压测", method = MiApiRequestMethod.GET, description = "连接实时压测") + @RequestMapping(value = "/stream", method = RequestMethod.GET, produces = {MediaType.TEXT_EVENT_STREAM_VALUE}) + public SseEmitter stream(HttpServletRequest request, + HttpServletResponse response, + @HttpApiDocClassDefine(value = "reportId", required = true) + @RequestParam String reportId) throws IllegalAccessException { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TaskController.stream] current user not have valid account info in session"); + throw new IllegalAccessException("用户未登录"); + } + response.addHeader("X-Accel-Buffering", "no"); + response.addHeader("Cache-Control","false"); + return this.taskService.stream(reportId, account.getUsername()); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/TrafficController.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/TrafficController.java new file mode 100644 index 000000000..2341b0bad --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/TrafficController.java @@ -0,0 +1,74 @@ +package run.mone.mimeter.dashboard.controller; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDoc; +import com.xiaomi.mone.http.docs.annotations.HttpApiModule; +import com.xiaomi.mone.http.docs.annotations.MiApiRequestMethod; +import com.xiaomi.youpin.tesla.traffic.recording.api.bo.Result; +import com.xiaomi.youpin.tesla.traffic.recording.api.bo.traffic.GetTrafficReq; +import com.xiaomi.youpin.tesla.traffic.recording.api.bo.traffic.TrafficList; +import com.xiaomi.youpin.tesla.traffic.recording.api.service.TrafficDubboService; +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; +import run.mone.mimeter.dashboard.common.SessionAccount; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.service.impl.LoginService; + +import javax.servlet.http.HttpServletRequest; +import java.util.Objects; + + +@Slf4j +@RestController +@RequestMapping("/api/bench/traffic") +@HttpApiModule(value = "TrafficController", apiController = TrafficController.class) +public class TrafficController { + + @Autowired + private LoginService loginService; + + @DubboReference(group = "${ref.traffic.service.group}", interfaceClass = TrafficDubboService.class, check = false,timeout = 3000) + private TrafficDubboService trafficDubboService; + + @HttpApiDoc(apiName = "流量列表", value = "/api/bench/traffic/list", method = MiApiRequestMethod.POST, description = "流量列表") + @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST}) + public Result getTrafficList(HttpServletRequest request, + @RequestBody GetTrafficReq param) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TrafficController.getTrafficList] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser.code, CommonError.UnknownUser.message); + } + + log.info("[TrafficController.getTrafficList] param: {}", param); + try { + return trafficDubboService.getTrafficList(param); + } catch (Exception e) { + return Result.fail(e.getMessage()); + } + } + + @HttpApiDoc(apiName = "流量删除", value = "/api/bench/traffic/del", method = MiApiRequestMethod.POST, description = "流量删除") + @RequestMapping(value = "/del", method = {RequestMethod.GET, RequestMethod.POST}) + public Result delTraffic(HttpServletRequest request, + @RequestBody GetTrafficReq param) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TrafficController.delTraffic] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser.code, CommonError.UnknownUser.message); + } + + log.info("[TrafficController.delTraffic] param: {}", param); + try { + return trafficDubboService.delTraffic(param); + } catch (Exception e) { + return Result.fail(e.getMessage()); + } + } + + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/TrafficRecordController.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/TrafficRecordController.java new file mode 100644 index 000000000..4e8a9e5ac --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/TrafficRecordController.java @@ -0,0 +1,237 @@ +package run.mone.mimeter.dashboard.controller; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDoc; +import com.xiaomi.mone.http.docs.annotations.HttpApiModule; +import com.xiaomi.mone.http.docs.annotations.MiApiRequestMethod; +import com.xiaomi.youpin.gateway.manager.bo.openApi.GatewayApiInfoList; +import com.xiaomi.youpin.gateway.manager.bo.openApi.GetGatewayApiInfoListReq; +import com.xiaomi.youpin.tesla.traffic.recording.api.bo.CommonEnum; +import com.xiaomi.youpin.tesla.traffic.recording.api.bo.Result; +import com.xiaomi.youpin.tesla.traffic.recording.api.bo.recording.GetRecordingConfigListReq; +import com.xiaomi.youpin.tesla.traffic.recording.api.bo.recording.RecordingConfig; +import com.xiaomi.youpin.tesla.traffic.recording.api.bo.recording.RecordingConfigList; +import com.xiaomi.youpin.tesla.traffic.recording.api.bo.recording.RecordingConfigReq; +import com.xiaomi.youpin.tesla.traffic.recording.api.service.RecordingDubboService; +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; +import run.mone.mimeter.dashboard.bo.traffic.record.GetGwApiInfoListReq; +import run.mone.mimeter.dashboard.common.SessionAccount; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.service.impl.GatewayService; +import run.mone.mimeter.dashboard.service.impl.LoginService; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; +import java.util.Objects; + + +@Slf4j +@RestController +@RequestMapping("/api/bench/trafficRecord") +@HttpApiModule(value = "TrafficRecordController", apiController = TrafficRecordController.class) +public class TrafficRecordController { + + @Autowired + private LoginService loginService; + + @Value("${server.env}") + private String env; + + @DubboReference(group = "${ref.traffic.service.group}", interfaceClass = RecordingDubboService.class, check = false,timeout = 3000) + private RecordingDubboService recordingDubboService; + + @Autowired + private GatewayService gatewayService; + + @HttpApiDoc(apiName = "网关流量录制---配置列表", value = "/api/bench/trafficRecord/gateway/config/list", method = MiApiRequestMethod.POST, description = "网关流量录制---配置列表") + @RequestMapping(value = "/gateway/config/list", method = {RequestMethod.GET, RequestMethod.POST}) + public Result getGatewayRecordingConfigList(HttpServletRequest request, + @RequestBody GetRecordingConfigListReq param) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TrafficRecordController.getGatewayRecordingConfigList] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser.code, CommonError.UnknownUser.message); + } + + log.info("[TrafficRecordController.getGatewayRecordingConfigList] param: {}", param); + try { + return recordingDubboService.getRecordingConfigList(param); + } catch (Exception e) { + return Result.fail(e.getMessage()); + } + } + + @HttpApiDoc(apiName = "网关流量录制---新增配置", value = "/api/bench/trafficRecord/gateway/config/new", method = MiApiRequestMethod.POST, description = "网关流量录制---新增配置") + @RequestMapping(value = "/gateway/config/new", method = {RequestMethod.POST}) + public Result newGatewayRecordingConfig(HttpServletRequest request, + @RequestBody RecordingConfig param) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TrafficRecordController.newGatewayRecordingConfig] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser.code, CommonError.UnknownUser.message); + } + param.setCreator(account.getUsername()); + param.setUpdater(account.getUsername()); + + log.info("[TrafficRecordController.newGatewayRecordingConfig] param: {}", param); + try { + return recordingDubboService.newRecordingConfig(param); + } catch (Exception e) { + return Result.fail(e.getMessage()); + } + } + + @HttpApiDoc(apiName = "网关流量录制---更新配置", value = "/api/bench/trafficRecord/gateway/config/update", method = MiApiRequestMethod.POST, description = "网关流量录制---更新配置") + @RequestMapping(value = "/gateway/config/update", method = {RequestMethod.POST}) + public Result updateGatewayRecordingConfig(HttpServletRequest request, + @RequestBody RecordingConfig param) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TrafficRecordController.updateGatewayRecordingConfig] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser.code, CommonError.UnknownUser.message); + } + param.setUpdater(account.getUsername()); + + log.info("[TrafficRecordController.updateGatewayRecordingConfig] param: {}", param); + try { + return recordingDubboService.updateRecordingConfig(param); + } catch (Exception e) { + return Result.fail(e.getMessage()); + } + } + + @HttpApiDoc(apiName = "网关流量录制---删除配置", value = "/api/bench/trafficRecord/gateway/config/delete", method = MiApiRequestMethod.POST, description = "网关流量录制---删除配置") + @RequestMapping(value = "/gateway/config/delete", method = {RequestMethod.POST}) + public Result deleteGatewayRecordingConfig(HttpServletRequest request, + @RequestBody RecordingConfigReq param) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TrafficRecordController.deleteGatewayRecordingConfig] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser.code, CommonError.UnknownUser.message); + } + param.setUser(account.getUsername()); + + log.info("[TrafficRecordController.deleteGatewayRecordingConfig] param: {}", param); + try { + return recordingDubboService.deleteRecordingConfig(param); + } catch (Exception e) { + return Result.fail(e.getMessage()); + } + } + + @HttpApiDoc(apiName = "网关流量录制---配置详情", value = "/api/bench/trafficRecord/gateway/config/detail", method = MiApiRequestMethod.POST, description = "网关流量录制---配置详情") + @RequestMapping(value = "/gateway/config/detail", method = {RequestMethod.POST}) + public Result gatewayRecordingConfigDetail(HttpServletRequest request, + @RequestBody RecordingConfigReq param) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TrafficRecordController.gatewayRecordingConfigDetail] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser.code, CommonError.UnknownUser.message); + } + + log.info("[TrafficRecordController.gatewayRecordingConfigDetail] param: {}", param); + try { + return recordingDubboService.recordingConfigDetail(param); + } catch (Exception e) { + return Result.fail(e.getMessage()); + } + } + + @HttpApiDoc(apiName = "网关流量录制---开始录制", value = "/api/bench/trafficRecord/gateway/config/start", method = MiApiRequestMethod.POST, description = "网关流量录制---开始录制") + @RequestMapping(value = "/gateway/config/start", method = {RequestMethod.POST}) + public Result startGatewayRecording(HttpServletRequest request, + @RequestBody RecordingConfigReq param) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TrafficRecordController.startGatewayRecording] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser.code, CommonError.UnknownUser.message); + } + + param.setUser(account.getUsername()); + log.info("[TrafficRecordController.startGatewayRecording] param: {}", param); + try { + return recordingDubboService.startRecording(param); + } catch (Exception e) { + return Result.fail(e.getMessage()); + } + } + + @HttpApiDoc(apiName = "网关流量录制---停止录制", value = "/api/bench/trafficRecord/gateway/config/stop", method = MiApiRequestMethod.POST, description = "网关流量录制---停止录制") + @RequestMapping(value = "/gateway/config/stop", method = {RequestMethod.POST}) + public Result stopGatewayRecording(HttpServletRequest request, + @RequestBody RecordingConfigReq param) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TrafficRecordController.stopGatewayRecording] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser.code, CommonError.UnknownUser.message); + } + + param.setUser(account.getUsername()); + log.info("[TrafficRecordController.stopGatewayRecording] param: {}", param); + try { + return recordingDubboService.stopRecording(param); + } catch (Exception e) { + return Result.fail(e.getMessage()); + } + } + + @HttpApiDoc(apiName = "网关流量录制---获取网关环境枚举", value = "/api/bench/trafficRecord/gateway/envTypes", method = MiApiRequestMethod.GET, description = "网关流量录制---获取网关环境枚举") + @RequestMapping(value = "/gateway/envTypes", method = {RequestMethod.GET}) + public Result> getGatewayEnvTypes(HttpServletRequest request) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TrafficRecordController.getGatewayEnvTypes] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser.code, CommonError.UnknownUser.message); + } + + try { + return recordingDubboService.getGatewayEnvTypes(env); + } catch (Exception e) { + return Result.fail(e.getMessage()); + } + } + + @HttpApiDoc(apiName = "网关流量录制---网关接口列表", value = "/api/bench/trafficRecord/gateway/apiInfoList", method = MiApiRequestMethod.POST, description = "网关流量录制---网关接口列表") + @RequestMapping(value = "/gateway/apiInfoList", method = {RequestMethod.POST}) + public run.mone.mimeter.dashboard.bo.common.Result getGatewayApiInfoList(HttpServletRequest request, + @RequestBody GetGwApiInfoListReq req) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[SlaController.newSla] current user not have valid account info in session"); + return run.mone.mimeter.dashboard.bo.common.Result.fail(CommonError.UnknownUser.code, CommonError.UnknownUser.message); + } + + try { + GetGatewayApiInfoListReq req1 = new GetGatewayApiInfoListReq(); + BeanUtils.copyProperties(req, req1); + return gatewayService.getGatewayApiInfoList(req1, account.getName(), req.getEnv()); + } catch (Exception e) { + return run.mone.mimeter.dashboard.bo.common.Result.fail(-1, e.getMessage()); + } + } + + + @HttpApiDoc(apiName = "流量录制---获取录制策略枚举", value = "/api/bench/trafficRecord/recordingStrategys", method = MiApiRequestMethod.GET, description = "流量录制---获取录制策略枚举") + @RequestMapping(value = "/recordingStrategys", method = {RequestMethod.GET}) + public Result> getRecordingStrategys(HttpServletRequest request) { + SessionAccount account = loginService.getAccountFromSession(request); + if (Objects.isNull(account)) { + log.warn("[TrafficRecordController.getRecordingStrategys] current user not have valid account info in session"); + return Result.fail(CommonError.UnknownUser.code, CommonError.UnknownUser.message); + } + + try { + return recordingDubboService.getRecordingStrategys(); + } catch (Exception e) { + return Result.fail(e.getMessage()); + } + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/UserController.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/UserController.java new file mode 100644 index 000000000..2b6ea6468 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/java/run/mone/mimeter/dashboard/controller/UserController.java @@ -0,0 +1,56 @@ +package run.mone.mimeter.dashboard.controller; + +import com.xiaomi.mone.http.docs.annotations.HttpApiDoc; +import com.xiaomi.mone.http.docs.annotations.HttpApiModule; +import com.xiaomi.mone.http.docs.annotations.MiApiRequestMethod; +import com.xiaomi.mone.tpc.login.util.UserUtil; +import com.xiaomi.mone.tpc.login.vo.AuthUserVo; +import com.xiaomi.youpin.gateway.manager.bo.user.UserInfoVo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import run.mone.mimeter.dashboard.bo.UserInfo; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.service.impl.UserV1Service; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +@Slf4j +@RestController +@RequestMapping("/api/bench/user") +@HttpApiModule(value = "UserController", apiController = UserController.class) +public class UserController { + + @Autowired + UserV1Service userService; + + @ResponseBody + @RequestMapping("/getUserInfo") + @HttpApiDoc(value = "/api/bench/user/getUserInfo", apiName = "获取用户信息", method = MiApiRequestMethod.POST, description = "获取用户信息") + public Result userInfo(HttpServletRequest request) { + try { + return Result.success(userService.getUserInfo()); + } catch (Exception e) { + log.error("UserController.userInfo", e); + return Result.fail(CommonError.UnknownError); + } + } + + @RequestMapping(value = "/getAllPartnerList", method = RequestMethod.GET) + @HttpApiDoc(value = "/api/bench/user/getAllPartnerList", apiName = "获取用户列表", method = MiApiRequestMethod.POST, description = "获取用户列表") + public Result> getAllPartnerList(@RequestParam("username") String username, + HttpServletRequest request, + HttpServletResponse response) throws IOException { + if (username.length() < 3) { + return Result.fail(-1, "请输入三个以上字母搜索"); + } + AuthUserVo userVo = UserUtil.getUser(); + List accounts = userService.qryUserList(username, null, userVo); + return Result.success(accounts); + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/application.properties b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/application.properties new file mode 100644 index 000000000..abae2b873 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/application.properties @@ -0,0 +1,55 @@ +#server +spring.application.name=mimeter-dashboard +server.type=${server.type} +server.port=${server.port} +server.env=${server.env} +server.debug=true +server.connection-timeout=1000 +is_local=${is_local} +is.online=@is.online@ + +server.cas.ignoreUrl=${server.cas.ignoreUrl} +cas.inner.auth=${cas.inner.auth} + +banner.charset=UTF-8 +server.tomcat.uri-encoding=UTF-8 +spring.http.encoding.charset=UTF-8 +spring.http.encoding.enabled=true +spring.http.encoding.force=true +spring.messages.encoding=UTF-8 +spring.servlet.multipart.max-file-size=512MB + +spring.datasource.driverClassName=com.mysql.jdbc.Driver +spring.datasource.default.initialPoolSize=10 +spring.datasource.default.maxPoolSize=20 +spring.datasource.default.minialPoolSize=10 + +dubbo.group=${dubbo.group} +dubbo.version=${dubbo.version} +dubbo.protocol.id=${dubbo.protocol.id} +dubbo.protocol.name=${dubbo.protocol.name} +dubbo.protocol.port=${dubbo.protocol.port} +nacos.config.addrs=${nacos.config.addrs} +nacos.config.data.id=${nacos.config.data.id} + +ref.miapi.service.group=${ref.miapi.service.group} +ref.miapi.service.version=${ref.miapi.service.version} +ref.traffic.service.group=${ref.traffic.service.group} +ref.gateway.service.group.staging=${ref.gateway.service.group.staging} +ref.gateway.service.group.intranet=${ref.gateway.service.group.intranet} +ref.gateway.service.group.online=${ref.gateway.service.group.online} +ref.hera.service.group=${ref.hera.service.group} +ref.k8s.service.group=${ref.k8s.service.group} +mimeter.monitor.dubbo.group=${mimeter.monitor.dubbo.group} +ref.tpc.service.group=${ref.tpc.service.group} + +es.address=${es.address} +es.user=${es.user} +es.pwd=${es.pwd} +es.index.apilog=${es.index.apilog} +es.type.apilog=${es.type.apilog} + +upload.save.base=${upload.save.base} +log.path=${log.path} + +app.nacos=${app.nacos} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/config/dev.properties b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/config/dev.properties new file mode 100644 index 000000000..ee7ca2b83 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/config/dev.properties @@ -0,0 +1,47 @@ +#server +spring.application.name=mimeter-dashboard +server.type=staging +server.env=staging +server.port=8081 +server.debug=true +server.connection-timeout=1000 + +is_local=true +is.online=false + +server.cas.ignoreUrl=/* +server.cas.loginUrl= +server.cas.logoutUrl= +token.parse.url= +cas.inner.auth=true + +dubbo.group=staging +dubbo.version=1.0 +dubbo.protocol.id=dubbo +dubbo.protocol.name=dubbo +dubbo.protocol.port=-1 +dubbo.registry.address=nacos://127.0.0.1:80 +nacos.config.addrs=127.0.0.1:80 +nacos.config.data.id=mibench_dashboard_config + +ref.miapi.service.group=staging +ref.miapi.service.version=1.0 +ref.traffic.service.group=staging +ref.gateway.service.group.staging= +ref.gateway.service.group.intranet=intranet +ref.gateway.service.group.online= +ref.hera.service.group=staging +ref.k8s.service.group=test +mimeter.monitor.dubbo.group= +ref.tpc.service.group=staging + +es.address=127.0.0.1:80 +es.user=test +es.pwd=test +es.index.apilog=zgq_common_staging_yace +es.type.apilog=_doc + + +log.path=/tmp/ +upload.save.base=/mimeter/dataset/ +bench.api_manager_url=http://127.0.0.1:8080 diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/config/opensource.properties b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/config/opensource.properties new file mode 100644 index 000000000..4097ed590 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/config/opensource.properties @@ -0,0 +1,41 @@ +#server +spring.application.name=mimeter-dashboard +server.type=staging +server.env=staging +server.port=8081 +server.debug=true +server.connection-timeout=1000 + +is_local=false +is.online=false + +server.cas.ignoreUrl=/OpenApi/* +cas.inner.auth=false + +dubbo.group=staging +dubbo.version=1.0 +dubbo.protocol.id=dubbo +dubbo.protocol.name=dubbo +dubbo.protocol.port=-1 +nacos.config.addrs=nacos:80 +nacos.config.data.id=mimeter_dashboard_open + +ref.miapi.service.group=staging +ref.miapi.service.version=1.0 +ref.traffic.service.group=staging +ref.gateway.service.group.staging=staging +ref.gateway.service.group.intranet=intranet +ref.gateway.service.group.online= +ref.hera.service.group=staging +ref.k8s.service.group=test +mimeter.monitor.dubbo.group= +ref.tpc.service.group=staging-open + +es.address=elasticsearch:9200 +es.user= +es.pwd= +es.index.apilog=zgq_common_staging_yace +es.type.apilog=_doc + +log.path=/home/work/log +upload.save.base=/mimeter/dataset/ diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/dubbo.properties b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/dubbo.properties new file mode 100644 index 000000000..a4be96c97 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/dubbo.properties @@ -0,0 +1 @@ +dubbo.trace.log.path=/home/work/log/dubbo/mimeter-dashboard_ diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/generatorConfig.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/generatorConfig.xml new file mode 100644 index 000000000..b2da93c93 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/generatorConfig.xml @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/logback.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/logback.xml new file mode 100644 index 000000000..6e9b47828 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/logback.xml @@ -0,0 +1,59 @@ + + + + + + + + + ${log.path}/mimeter-dashboard/server.log + + %d|%-5level|%X{trace_id}|%thread|%logger{40}|%msg%n + + + ${log.path}/mimeter-dashboard/server.log.%d{yyyy-MM-dd-HH} + ${MAX_HISTORY} + + + + + 0 + 60000 + + + + + + ${log.path}/mimeter-dashboard/error.log + + %d|%-5level|%X{trace_id}|%thread|%logger{40}|%msg%n + + + ${log.path}/mimeter-dashboard/error.log.%d{yyyy-MM-dd-HH} + ${MAX_HISTORY} + + + ERROR + ACCEPT + DENY + + + + + + %d|%-5level|%X{trace_id}|%thread|%logger{40}|%msg%n + + + + + + + + + + + + + + + diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/AgentApplyInfoMapper.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/AgentApplyInfoMapper.xml new file mode 100644 index 000000000..36c61a1a0 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/AgentApplyInfoMapper.xml @@ -0,0 +1,305 @@ + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, apply_user, apply_org_id, apply_org_name, agent_ip, agent_hostname, apply_status, + ctime + + + + + delete from agent_apply_info + where id = #{id,jdbcType=INTEGER} + + + delete from agent_apply_info + + + + + + + SELECT LAST_INSERT_ID() + + insert into agent_apply_info (apply_user, apply_org_id, apply_org_name, + agent_ip, agent_hostname, apply_status, + ctime) + values (#{applyUser,jdbcType=VARCHAR}, #{applyOrgId,jdbcType=VARCHAR}, #{applyOrgName,jdbcType=VARCHAR}, + #{agentIp,jdbcType=VARCHAR}, #{agentHostname,jdbcType=VARCHAR}, #{applyStatus,jdbcType=INTEGER}, + #{ctime,jdbcType=BIGINT}) + + + + SELECT LAST_INSERT_ID() + + insert into agent_apply_info + + + apply_user, + + + apply_org_id, + + + apply_org_name, + + + agent_ip, + + + agent_hostname, + + + apply_status, + + + ctime, + + + + + #{applyUser,jdbcType=VARCHAR}, + + + #{applyOrgId,jdbcType=VARCHAR}, + + + #{applyOrgName,jdbcType=VARCHAR}, + + + #{agentIp,jdbcType=VARCHAR}, + + + #{agentHostname,jdbcType=VARCHAR}, + + + #{applyStatus,jdbcType=INTEGER}, + + + #{ctime,jdbcType=BIGINT}, + + + + + + update agent_apply_info + + + id = #{record.id,jdbcType=INTEGER}, + + + apply_user = #{record.applyUser,jdbcType=VARCHAR}, + + + apply_org_id = #{record.applyOrgId,jdbcType=VARCHAR}, + + + apply_org_name = #{record.applyOrgName,jdbcType=VARCHAR}, + + + agent_ip = #{record.agentIp,jdbcType=VARCHAR}, + + + agent_hostname = #{record.agentHostname,jdbcType=VARCHAR}, + + + apply_status = #{record.applyStatus,jdbcType=INTEGER}, + + + ctime = #{record.ctime,jdbcType=BIGINT}, + + + + + + + + update agent_apply_info + set id = #{record.id,jdbcType=INTEGER}, + apply_user = #{record.applyUser,jdbcType=VARCHAR}, + apply_org_id = #{record.applyOrgId,jdbcType=VARCHAR}, + apply_org_name = #{record.applyOrgName,jdbcType=VARCHAR}, + agent_ip = #{record.agentIp,jdbcType=VARCHAR}, + agent_hostname = #{record.agentHostname,jdbcType=VARCHAR}, + apply_status = #{record.applyStatus,jdbcType=INTEGER}, + ctime = #{record.ctime,jdbcType=BIGINT} + + + + + + update agent_apply_info + + + apply_user = #{applyUser,jdbcType=VARCHAR}, + + + apply_org_id = #{applyOrgId,jdbcType=VARCHAR}, + + + apply_org_name = #{applyOrgName,jdbcType=VARCHAR}, + + + agent_ip = #{agentIp,jdbcType=VARCHAR}, + + + agent_hostname = #{agentHostname,jdbcType=VARCHAR}, + + + apply_status = #{applyStatus,jdbcType=INTEGER}, + + + ctime = #{ctime,jdbcType=BIGINT}, + + + where id = #{id,jdbcType=INTEGER} + + + update agent_apply_info + set apply_user = #{applyUser,jdbcType=VARCHAR}, + apply_org_id = #{applyOrgId,jdbcType=VARCHAR}, + apply_org_name = #{applyOrgName,jdbcType=VARCHAR}, + agent_ip = #{agentIp,jdbcType=VARCHAR}, + agent_hostname = #{agentHostname,jdbcType=VARCHAR}, + apply_status = #{applyStatus,jdbcType=INTEGER}, + ctime = #{ctime,jdbcType=BIGINT} + where id = #{id,jdbcType=INTEGER} + + + insert into agent_apply_info + (apply_user, apply_org_id, apply_org_name, agent_ip, agent_hostname, apply_status, + ctime) + values + + (#{item.applyUser,jdbcType=VARCHAR}, #{item.applyOrgId,jdbcType=VARCHAR}, #{item.applyOrgName,jdbcType=VARCHAR}, + #{item.agentIp,jdbcType=VARCHAR}, #{item.agentHostname,jdbcType=VARCHAR}, #{item.applyStatus,jdbcType=INTEGER}, + #{item.ctime,jdbcType=BIGINT}) + + + + insert into agent_apply_info ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.applyUser,jdbcType=VARCHAR} + + + #{item.applyOrgId,jdbcType=VARCHAR} + + + #{item.applyOrgName,jdbcType=VARCHAR} + + + #{item.agentIp,jdbcType=VARCHAR} + + + #{item.agentHostname,jdbcType=VARCHAR} + + + #{item.applyStatus,jdbcType=INTEGER} + + + #{item.ctime,jdbcType=BIGINT} + + + ) + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/AgentInfoMapper.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/AgentInfoMapper.xml new file mode 100644 index 000000000..816a56a56 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/AgentInfoMapper.xml @@ -0,0 +1,538 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, server_name, ip, port, cpu, mem, use_cpu, use_mem, hostname, client_desc, ctime, + utime, enable, node_ip, tenant, tenant_cn + + + domain_conf + + + + + + delete from agent_info + where id = #{id,jdbcType=INTEGER} + + + delete from agent_info + + + + + + + SELECT LAST_INSERT_ID() + + insert into agent_info (server_name, ip, port, + cpu, mem, use_cpu, use_mem, + hostname, client_desc, ctime, + utime, enable, node_ip, tenant, + tenant_cn, domain_conf) + values (#{serverName,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR}, #{port,jdbcType=INTEGER}, + #{cpu,jdbcType=INTEGER}, #{mem,jdbcType=BIGINT}, #{useCpu,jdbcType=INTEGER}, #{useMem,jdbcType=BIGINT}, + #{hostname,jdbcType=VARCHAR}, #{clientDesc,jdbcType=VARCHAR}, #{ctime,jdbcType=BIGINT}, + #{utime,jdbcType=BIGINT}, #{enable,jdbcType=BIT}, #{nodeIp,jdbcType=VARCHAR}, #{tenant,jdbcType=VARCHAR}, + #{tenantCn,jdbcType=VARCHAR}, #{domainConf,jdbcType=LONGVARCHAR}) + + + + SELECT LAST_INSERT_ID() + + insert into agent_info + + + server_name, + + + ip, + + + port, + + + cpu, + + + mem, + + + use_cpu, + + + use_mem, + + + hostname, + + + client_desc, + + + ctime, + + + utime, + + + enable, + + + node_ip, + + + tenant, + + + tenant_cn, + + + domain_conf, + + + + + #{serverName,jdbcType=VARCHAR}, + + + #{ip,jdbcType=VARCHAR}, + + + #{port,jdbcType=INTEGER}, + + + #{cpu,jdbcType=INTEGER}, + + + #{mem,jdbcType=BIGINT}, + + + #{useCpu,jdbcType=INTEGER}, + + + #{useMem,jdbcType=BIGINT}, + + + #{hostname,jdbcType=VARCHAR}, + + + #{clientDesc,jdbcType=VARCHAR}, + + + #{ctime,jdbcType=BIGINT}, + + + #{utime,jdbcType=BIGINT}, + + + #{enable,jdbcType=BIT}, + + + #{nodeIp,jdbcType=VARCHAR}, + + + #{tenant,jdbcType=VARCHAR}, + + + #{tenantCn,jdbcType=VARCHAR}, + + + #{domainConf,jdbcType=LONGVARCHAR}, + + + + + + update agent_info + + + id = #{record.id,jdbcType=INTEGER}, + + + server_name = #{record.serverName,jdbcType=VARCHAR}, + + + ip = #{record.ip,jdbcType=VARCHAR}, + + + port = #{record.port,jdbcType=INTEGER}, + + + cpu = #{record.cpu,jdbcType=INTEGER}, + + + mem = #{record.mem,jdbcType=BIGINT}, + + + use_cpu = #{record.useCpu,jdbcType=INTEGER}, + + + use_mem = #{record.useMem,jdbcType=BIGINT}, + + + hostname = #{record.hostname,jdbcType=VARCHAR}, + + + client_desc = #{record.clientDesc,jdbcType=VARCHAR}, + + + ctime = #{record.ctime,jdbcType=BIGINT}, + + + utime = #{record.utime,jdbcType=BIGINT}, + + + enable = #{record.enable,jdbcType=BIT}, + + + node_ip = #{record.nodeIp,jdbcType=VARCHAR}, + + + tenant = #{record.tenant,jdbcType=VARCHAR}, + + + tenant_cn = #{record.tenantCn,jdbcType=VARCHAR}, + + + domain_conf = #{record.domainConf,jdbcType=LONGVARCHAR}, + + + + + + + + update agent_info + set id = #{record.id,jdbcType=INTEGER}, + server_name = #{record.serverName,jdbcType=VARCHAR}, + ip = #{record.ip,jdbcType=VARCHAR}, + port = #{record.port,jdbcType=INTEGER}, + cpu = #{record.cpu,jdbcType=INTEGER}, + mem = #{record.mem,jdbcType=BIGINT}, + use_cpu = #{record.useCpu,jdbcType=INTEGER}, + use_mem = #{record.useMem,jdbcType=BIGINT}, + hostname = #{record.hostname,jdbcType=VARCHAR}, + client_desc = #{record.clientDesc,jdbcType=VARCHAR}, + ctime = #{record.ctime,jdbcType=BIGINT}, + utime = #{record.utime,jdbcType=BIGINT}, + enable = #{record.enable,jdbcType=BIT}, + node_ip = #{record.nodeIp,jdbcType=VARCHAR}, + tenant = #{record.tenant,jdbcType=VARCHAR}, + tenant_cn = #{record.tenantCn,jdbcType=VARCHAR}, + domain_conf = #{record.domainConf,jdbcType=LONGVARCHAR} + + + + + + update agent_info + set id = #{record.id,jdbcType=INTEGER}, + server_name = #{record.serverName,jdbcType=VARCHAR}, + ip = #{record.ip,jdbcType=VARCHAR}, + port = #{record.port,jdbcType=INTEGER}, + cpu = #{record.cpu,jdbcType=INTEGER}, + mem = #{record.mem,jdbcType=BIGINT}, + use_cpu = #{record.useCpu,jdbcType=INTEGER}, + use_mem = #{record.useMem,jdbcType=BIGINT}, + hostname = #{record.hostname,jdbcType=VARCHAR}, + client_desc = #{record.clientDesc,jdbcType=VARCHAR}, + ctime = #{record.ctime,jdbcType=BIGINT}, + utime = #{record.utime,jdbcType=BIGINT}, + enable = #{record.enable,jdbcType=BIT}, + node_ip = #{record.nodeIp,jdbcType=VARCHAR}, + tenant = #{record.tenant,jdbcType=VARCHAR}, + tenant_cn = #{record.tenantCn,jdbcType=VARCHAR} + + + + + + update agent_info + + + server_name = #{serverName,jdbcType=VARCHAR}, + + + ip = #{ip,jdbcType=VARCHAR}, + + + port = #{port,jdbcType=INTEGER}, + + + cpu = #{cpu,jdbcType=INTEGER}, + + + mem = #{mem,jdbcType=BIGINT}, + + + use_cpu = #{useCpu,jdbcType=INTEGER}, + + + use_mem = #{useMem,jdbcType=BIGINT}, + + + hostname = #{hostname,jdbcType=VARCHAR}, + + + client_desc = #{clientDesc,jdbcType=VARCHAR}, + + + ctime = #{ctime,jdbcType=BIGINT}, + + + utime = #{utime,jdbcType=BIGINT}, + + + enable = #{enable,jdbcType=BIT}, + + + node_ip = #{nodeIp,jdbcType=VARCHAR}, + + + tenant = #{tenant,jdbcType=VARCHAR}, + + + tenant_cn = #{tenantCn,jdbcType=VARCHAR}, + + + domain_conf = #{domainConf,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update agent_info + set server_name = #{serverName,jdbcType=VARCHAR}, + ip = #{ip,jdbcType=VARCHAR}, + port = #{port,jdbcType=INTEGER}, + cpu = #{cpu,jdbcType=INTEGER}, + mem = #{mem,jdbcType=BIGINT}, + use_cpu = #{useCpu,jdbcType=INTEGER}, + use_mem = #{useMem,jdbcType=BIGINT}, + hostname = #{hostname,jdbcType=VARCHAR}, + client_desc = #{clientDesc,jdbcType=VARCHAR}, + ctime = #{ctime,jdbcType=BIGINT}, + utime = #{utime,jdbcType=BIGINT}, + enable = #{enable,jdbcType=BIT}, + node_ip = #{nodeIp,jdbcType=VARCHAR}, + tenant = #{tenant,jdbcType=VARCHAR}, + tenant_cn = #{tenantCn,jdbcType=VARCHAR}, + domain_conf = #{domainConf,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=INTEGER} + + + update agent_info + set server_name = #{serverName,jdbcType=VARCHAR}, + ip = #{ip,jdbcType=VARCHAR}, + port = #{port,jdbcType=INTEGER}, + cpu = #{cpu,jdbcType=INTEGER}, + mem = #{mem,jdbcType=BIGINT}, + use_cpu = #{useCpu,jdbcType=INTEGER}, + use_mem = #{useMem,jdbcType=BIGINT}, + hostname = #{hostname,jdbcType=VARCHAR}, + client_desc = #{clientDesc,jdbcType=VARCHAR}, + ctime = #{ctime,jdbcType=BIGINT}, + utime = #{utime,jdbcType=BIGINT}, + enable = #{enable,jdbcType=BIT}, + node_ip = #{nodeIp,jdbcType=VARCHAR}, + tenant = #{tenant,jdbcType=VARCHAR}, + tenant_cn = #{tenantCn,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + + insert into agent_info + (server_name, ip, port, cpu, mem, use_cpu, use_mem, hostname, client_desc, ctime, + utime, enable, node_ip, tenant, tenant_cn, domain_conf) + values + + (#{item.serverName,jdbcType=VARCHAR}, #{item.ip,jdbcType=VARCHAR}, #{item.port,jdbcType=INTEGER}, + #{item.cpu,jdbcType=INTEGER}, #{item.mem,jdbcType=BIGINT}, #{item.useCpu,jdbcType=INTEGER}, + #{item.useMem,jdbcType=BIGINT}, #{item.hostname,jdbcType=VARCHAR}, #{item.clientDesc,jdbcType=VARCHAR}, + #{item.ctime,jdbcType=BIGINT}, #{item.utime,jdbcType=BIGINT}, #{item.enable,jdbcType=BIT}, + #{item.nodeIp,jdbcType=VARCHAR}, #{item.tenant,jdbcType=VARCHAR}, #{item.tenantCn,jdbcType=VARCHAR}, + #{item.domainConf,jdbcType=LONGVARCHAR}) + + + + insert into agent_info ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.serverName,jdbcType=VARCHAR} + + + #{item.ip,jdbcType=VARCHAR} + + + #{item.port,jdbcType=INTEGER} + + + #{item.cpu,jdbcType=INTEGER} + + + #{item.mem,jdbcType=BIGINT} + + + #{item.useCpu,jdbcType=INTEGER} + + + #{item.useMem,jdbcType=BIGINT} + + + #{item.hostname,jdbcType=VARCHAR} + + + #{item.clientDesc,jdbcType=VARCHAR} + + + #{item.ctime,jdbcType=BIGINT} + + + #{item.utime,jdbcType=BIGINT} + + + #{item.enable,jdbcType=BIT} + + + #{item.nodeIp,jdbcType=VARCHAR} + + + #{item.tenant,jdbcType=VARCHAR} + + + #{item.tenantCn,jdbcType=VARCHAR} + + + #{item.domainConf,jdbcType=LONGVARCHAR} + + + ) + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/CheckPointInfoMapper.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/CheckPointInfoMapper.xml new file mode 100644 index 000000000..6a787b293 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/CheckPointInfoMapper.xml @@ -0,0 +1,286 @@ + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, check_type, check_obj, check_condition + + + check_content + + + + + + delete from checkpoint_info + where id = #{id,jdbcType=INTEGER} + + + delete from checkpoint_info + + + + + + + SELECT LAST_INSERT_ID() + + insert into checkpoint_info (check_type, check_obj, check_condition, + check_content) + values (#{checkType,jdbcType=INTEGER}, #{checkObj,jdbcType=VARCHAR}, #{checkCondition,jdbcType=INTEGER}, + #{checkContent,jdbcType=LONGVARCHAR}) + + + + SELECT LAST_INSERT_ID() + + insert into checkpoint_info + + + check_type, + + + check_obj, + + + check_condition, + + + check_content, + + + + + #{checkType,jdbcType=INTEGER}, + + + #{checkObj,jdbcType=VARCHAR}, + + + #{checkCondition,jdbcType=INTEGER}, + + + #{checkContent,jdbcType=LONGVARCHAR}, + + + + + + update checkpoint_info + + + id = #{record.id,jdbcType=INTEGER}, + + + check_type = #{record.checkType,jdbcType=INTEGER}, + + + check_obj = #{record.checkObj,jdbcType=VARCHAR}, + + + check_condition = #{record.checkCondition,jdbcType=INTEGER}, + + + check_content = #{record.checkContent,jdbcType=LONGVARCHAR}, + + + + + + + + update checkpoint_info + set id = #{record.id,jdbcType=INTEGER}, + check_type = #{record.checkType,jdbcType=INTEGER}, + check_obj = #{record.checkObj,jdbcType=VARCHAR}, + check_condition = #{record.checkCondition,jdbcType=INTEGER}, + check_content = #{record.checkContent,jdbcType=LONGVARCHAR} + + + + + + update checkpoint_info + set id = #{record.id,jdbcType=INTEGER}, + check_type = #{record.checkType,jdbcType=INTEGER}, + check_obj = #{record.checkObj,jdbcType=VARCHAR}, + check_condition = #{record.checkCondition,jdbcType=INTEGER} + + + + + + update checkpoint_info + + + check_type = #{checkType,jdbcType=INTEGER}, + + + check_obj = #{checkObj,jdbcType=VARCHAR}, + + + check_condition = #{checkCondition,jdbcType=INTEGER}, + + + check_content = #{checkContent,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update checkpoint_info + set check_type = #{checkType,jdbcType=INTEGER}, + check_obj = #{checkObj,jdbcType=VARCHAR}, + check_condition = #{checkCondition,jdbcType=INTEGER}, + check_content = #{checkContent,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=INTEGER} + + + update checkpoint_info + set check_type = #{checkType,jdbcType=INTEGER}, + check_obj = #{checkObj,jdbcType=VARCHAR}, + check_condition = #{checkCondition,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + + insert into checkpoint_info + (check_type, check_obj, check_condition, check_content) + values + + (#{item.checkType,jdbcType=INTEGER}, #{item.checkObj,jdbcType=VARCHAR}, #{item.checkCondition,jdbcType=INTEGER}, + #{item.checkContent,jdbcType=LONGVARCHAR}) + + + + insert into checkpoint_info ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.checkType,jdbcType=INTEGER} + + + #{item.checkObj,jdbcType=VARCHAR} + + + #{item.checkCondition,jdbcType=INTEGER} + + + #{item.checkContent,jdbcType=LONGVARCHAR} + + + ) + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/DatasetMapper.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/DatasetMapper.xml new file mode 100644 index 000000000..539236646 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/DatasetMapper.xml @@ -0,0 +1,604 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, name, note, type, default_param_name, ignore_first_row, file_name, file_url, + file_ks_key, file_rows, file_size, interface_url, traffic_record_id, ctime, utime, + creator, updater, tenant + + + preview_file_rows, header + + + + + + delete from dataset + where id = #{id,jdbcType=INTEGER} + + + delete from dataset + + + + + + + SELECT LAST_INSERT_ID() + + insert into dataset (name, note, type, + default_param_name, ignore_first_row, file_name, + file_url, file_ks_key, file_rows, + file_size, interface_url, traffic_record_id, + ctime, utime, creator, + updater, tenant, preview_file_rows, + header) + values (#{name,jdbcType=VARCHAR}, #{note,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, + #{defaultParamName,jdbcType=VARCHAR}, #{ignoreFirstRow,jdbcType=INTEGER}, #{fileName,jdbcType=VARCHAR}, + #{fileUrl,jdbcType=VARCHAR}, #{fileKsKey,jdbcType=VARCHAR}, #{fileRows,jdbcType=BIGINT}, + #{fileSize,jdbcType=BIGINT}, #{interfaceUrl,jdbcType=VARCHAR}, #{trafficRecordId,jdbcType=INTEGER}, + #{ctime,jdbcType=BIGINT}, #{utime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, + #{updater,jdbcType=VARCHAR}, #{tenant,jdbcType=VARCHAR}, #{previewFileRows,jdbcType=LONGVARCHAR}, + #{header,jdbcType=LONGVARCHAR}) + + + + SELECT LAST_INSERT_ID() + + insert into dataset + + + name, + + + note, + + + type, + + + default_param_name, + + + ignore_first_row, + + + file_name, + + + file_url, + + + file_ks_key, + + + file_rows, + + + file_size, + + + interface_url, + + + traffic_record_id, + + + ctime, + + + utime, + + + creator, + + + updater, + + + tenant, + + + preview_file_rows, + + + header, + + + + + #{name,jdbcType=VARCHAR}, + + + #{note,jdbcType=VARCHAR}, + + + #{type,jdbcType=INTEGER}, + + + #{defaultParamName,jdbcType=VARCHAR}, + + + #{ignoreFirstRow,jdbcType=INTEGER}, + + + #{fileName,jdbcType=VARCHAR}, + + + #{fileUrl,jdbcType=VARCHAR}, + + + #{fileKsKey,jdbcType=VARCHAR}, + + + #{fileRows,jdbcType=BIGINT}, + + + #{fileSize,jdbcType=BIGINT}, + + + #{interfaceUrl,jdbcType=VARCHAR}, + + + #{trafficRecordId,jdbcType=INTEGER}, + + + #{ctime,jdbcType=BIGINT}, + + + #{utime,jdbcType=BIGINT}, + + + #{creator,jdbcType=VARCHAR}, + + + #{updater,jdbcType=VARCHAR}, + + + #{tenant,jdbcType=VARCHAR}, + + + #{previewFileRows,jdbcType=LONGVARCHAR}, + + + #{header,jdbcType=LONGVARCHAR}, + + + + + + update dataset + + + id = #{record.id,jdbcType=INTEGER}, + + + name = #{record.name,jdbcType=VARCHAR}, + + + note = #{record.note,jdbcType=VARCHAR}, + + + type = #{record.type,jdbcType=INTEGER}, + + + default_param_name = #{record.defaultParamName,jdbcType=VARCHAR}, + + + ignore_first_row = #{record.ignoreFirstRow,jdbcType=INTEGER}, + + + file_name = #{record.fileName,jdbcType=VARCHAR}, + + + file_url = #{record.fileUrl,jdbcType=VARCHAR}, + + + file_ks_key = #{record.fileKsKey,jdbcType=VARCHAR}, + + + file_rows = #{record.fileRows,jdbcType=BIGINT}, + + + file_size = #{record.fileSize,jdbcType=BIGINT}, + + + interface_url = #{record.interfaceUrl,jdbcType=VARCHAR}, + + + traffic_record_id = #{record.trafficRecordId,jdbcType=INTEGER}, + + + ctime = #{record.ctime,jdbcType=BIGINT}, + + + utime = #{record.utime,jdbcType=BIGINT}, + + + creator = #{record.creator,jdbcType=VARCHAR}, + + + updater = #{record.updater,jdbcType=VARCHAR}, + + + tenant = #{record.tenant,jdbcType=VARCHAR}, + + + preview_file_rows = #{record.previewFileRows,jdbcType=LONGVARCHAR}, + + + header = #{record.header,jdbcType=LONGVARCHAR}, + + + + + + + + update dataset + set id = #{record.id,jdbcType=INTEGER}, + name = #{record.name,jdbcType=VARCHAR}, + note = #{record.note,jdbcType=VARCHAR}, + type = #{record.type,jdbcType=INTEGER}, + default_param_name = #{record.defaultParamName,jdbcType=VARCHAR}, + ignore_first_row = #{record.ignoreFirstRow,jdbcType=INTEGER}, + file_name = #{record.fileName,jdbcType=VARCHAR}, + file_url = #{record.fileUrl,jdbcType=VARCHAR}, + file_ks_key = #{record.fileKsKey,jdbcType=VARCHAR}, + file_rows = #{record.fileRows,jdbcType=BIGINT}, + file_size = #{record.fileSize,jdbcType=BIGINT}, + interface_url = #{record.interfaceUrl,jdbcType=VARCHAR}, + traffic_record_id = #{record.trafficRecordId,jdbcType=INTEGER}, + ctime = #{record.ctime,jdbcType=BIGINT}, + utime = #{record.utime,jdbcType=BIGINT}, + creator = #{record.creator,jdbcType=VARCHAR}, + updater = #{record.updater,jdbcType=VARCHAR}, + tenant = #{record.tenant,jdbcType=VARCHAR}, + preview_file_rows = #{record.previewFileRows,jdbcType=LONGVARCHAR}, + header = #{record.header,jdbcType=LONGVARCHAR} + + + + + + update dataset + set id = #{record.id,jdbcType=INTEGER}, + name = #{record.name,jdbcType=VARCHAR}, + note = #{record.note,jdbcType=VARCHAR}, + type = #{record.type,jdbcType=INTEGER}, + default_param_name = #{record.defaultParamName,jdbcType=VARCHAR}, + ignore_first_row = #{record.ignoreFirstRow,jdbcType=INTEGER}, + file_name = #{record.fileName,jdbcType=VARCHAR}, + file_url = #{record.fileUrl,jdbcType=VARCHAR}, + file_ks_key = #{record.fileKsKey,jdbcType=VARCHAR}, + file_rows = #{record.fileRows,jdbcType=BIGINT}, + file_size = #{record.fileSize,jdbcType=BIGINT}, + interface_url = #{record.interfaceUrl,jdbcType=VARCHAR}, + traffic_record_id = #{record.trafficRecordId,jdbcType=INTEGER}, + ctime = #{record.ctime,jdbcType=BIGINT}, + utime = #{record.utime,jdbcType=BIGINT}, + creator = #{record.creator,jdbcType=VARCHAR}, + updater = #{record.updater,jdbcType=VARCHAR}, + tenant = #{record.tenant,jdbcType=VARCHAR} + + + + + + update dataset + + + name = #{name,jdbcType=VARCHAR}, + + + note = #{note,jdbcType=VARCHAR}, + + + type = #{type,jdbcType=INTEGER}, + + + default_param_name = #{defaultParamName,jdbcType=VARCHAR}, + + + ignore_first_row = #{ignoreFirstRow,jdbcType=INTEGER}, + + + file_name = #{fileName,jdbcType=VARCHAR}, + + + file_url = #{fileUrl,jdbcType=VARCHAR}, + + + file_ks_key = #{fileKsKey,jdbcType=VARCHAR}, + + + file_rows = #{fileRows,jdbcType=BIGINT}, + + + file_size = #{fileSize,jdbcType=BIGINT}, + + + interface_url = #{interfaceUrl,jdbcType=VARCHAR}, + + + traffic_record_id = #{trafficRecordId,jdbcType=INTEGER}, + + + ctime = #{ctime,jdbcType=BIGINT}, + + + utime = #{utime,jdbcType=BIGINT}, + + + creator = #{creator,jdbcType=VARCHAR}, + + + updater = #{updater,jdbcType=VARCHAR}, + + + tenant = #{tenant,jdbcType=VARCHAR}, + + + preview_file_rows = #{previewFileRows,jdbcType=LONGVARCHAR}, + + + header = #{header,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update dataset + set name = #{name,jdbcType=VARCHAR}, + note = #{note,jdbcType=VARCHAR}, + type = #{type,jdbcType=INTEGER}, + default_param_name = #{defaultParamName,jdbcType=VARCHAR}, + ignore_first_row = #{ignoreFirstRow,jdbcType=INTEGER}, + file_name = #{fileName,jdbcType=VARCHAR}, + file_url = #{fileUrl,jdbcType=VARCHAR}, + file_ks_key = #{fileKsKey,jdbcType=VARCHAR}, + file_rows = #{fileRows,jdbcType=BIGINT}, + file_size = #{fileSize,jdbcType=BIGINT}, + interface_url = #{interfaceUrl,jdbcType=VARCHAR}, + traffic_record_id = #{trafficRecordId,jdbcType=INTEGER}, + ctime = #{ctime,jdbcType=BIGINT}, + utime = #{utime,jdbcType=BIGINT}, + creator = #{creator,jdbcType=VARCHAR}, + updater = #{updater,jdbcType=VARCHAR}, + tenant = #{tenant,jdbcType=VARCHAR}, + preview_file_rows = #{previewFileRows,jdbcType=LONGVARCHAR}, + header = #{header,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=INTEGER} + + + update dataset + set name = #{name,jdbcType=VARCHAR}, + note = #{note,jdbcType=VARCHAR}, + type = #{type,jdbcType=INTEGER}, + default_param_name = #{defaultParamName,jdbcType=VARCHAR}, + ignore_first_row = #{ignoreFirstRow,jdbcType=INTEGER}, + file_name = #{fileName,jdbcType=VARCHAR}, + file_url = #{fileUrl,jdbcType=VARCHAR}, + file_ks_key = #{fileKsKey,jdbcType=VARCHAR}, + file_rows = #{fileRows,jdbcType=BIGINT}, + file_size = #{fileSize,jdbcType=BIGINT}, + interface_url = #{interfaceUrl,jdbcType=VARCHAR}, + traffic_record_id = #{trafficRecordId,jdbcType=INTEGER}, + ctime = #{ctime,jdbcType=BIGINT}, + utime = #{utime,jdbcType=BIGINT}, + creator = #{creator,jdbcType=VARCHAR}, + updater = #{updater,jdbcType=VARCHAR}, + tenant = #{tenant,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + + insert into dataset + (name, note, type, default_param_name, ignore_first_row, file_name, file_url, file_ks_key, + file_rows, file_size, interface_url, traffic_record_id, ctime, utime, creator, + updater, tenant, preview_file_rows, header) + values + + (#{item.name,jdbcType=VARCHAR}, #{item.note,jdbcType=VARCHAR}, #{item.type,jdbcType=INTEGER}, + #{item.defaultParamName,jdbcType=VARCHAR}, #{item.ignoreFirstRow,jdbcType=INTEGER}, + #{item.fileName,jdbcType=VARCHAR}, #{item.fileUrl,jdbcType=VARCHAR}, #{item.fileKsKey,jdbcType=VARCHAR}, + #{item.fileRows,jdbcType=BIGINT}, #{item.fileSize,jdbcType=BIGINT}, #{item.interfaceUrl,jdbcType=VARCHAR}, + #{item.trafficRecordId,jdbcType=INTEGER}, #{item.ctime,jdbcType=BIGINT}, #{item.utime,jdbcType=BIGINT}, + #{item.creator,jdbcType=VARCHAR}, #{item.updater,jdbcType=VARCHAR}, #{item.tenant,jdbcType=VARCHAR}, + #{item.previewFileRows,jdbcType=LONGVARCHAR}, #{item.header,jdbcType=LONGVARCHAR} + ) + + + + insert into dataset ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.name,jdbcType=VARCHAR} + + + #{item.note,jdbcType=VARCHAR} + + + #{item.type,jdbcType=INTEGER} + + + #{item.defaultParamName,jdbcType=VARCHAR} + + + #{item.ignoreFirstRow,jdbcType=INTEGER} + + + #{item.fileName,jdbcType=VARCHAR} + + + #{item.fileUrl,jdbcType=VARCHAR} + + + #{item.fileKsKey,jdbcType=VARCHAR} + + + #{item.fileRows,jdbcType=BIGINT} + + + #{item.fileSize,jdbcType=BIGINT} + + + #{item.interfaceUrl,jdbcType=VARCHAR} + + + #{item.trafficRecordId,jdbcType=INTEGER} + + + #{item.ctime,jdbcType=BIGINT} + + + #{item.utime,jdbcType=BIGINT} + + + #{item.creator,jdbcType=VARCHAR} + + + #{item.updater,jdbcType=VARCHAR} + + + #{item.tenant,jdbcType=VARCHAR} + + + #{item.previewFileRows,jdbcType=LONGVARCHAR} + + + #{item.header,jdbcType=LONGVARCHAR} + + + ) + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/DatasetSceneRelationMapper.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/DatasetSceneRelationMapper.xml new file mode 100644 index 000000000..b2712c7b4 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/DatasetSceneRelationMapper.xml @@ -0,0 +1,303 @@ + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, dataset_id, scene_id, ctime, utime, creator, updater, enable + + + + + delete from dataset_scene_relation + where id = #{id,jdbcType=INTEGER} + + + delete from dataset_scene_relation + + + + + + + SELECT LAST_INSERT_ID() + + insert into dataset_scene_relation (dataset_id, scene_id, ctime, + utime, creator, updater, + enable) + values (#{datasetId,jdbcType=INTEGER}, #{sceneId,jdbcType=INTEGER}, #{ctime,jdbcType=BIGINT}, + #{utime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, #{updater,jdbcType=VARCHAR}, + #{enable,jdbcType=BIT}) + + + + SELECT LAST_INSERT_ID() + + insert into dataset_scene_relation + + + dataset_id, + + + scene_id, + + + ctime, + + + utime, + + + creator, + + + updater, + + + enable, + + + + + #{datasetId,jdbcType=INTEGER}, + + + #{sceneId,jdbcType=INTEGER}, + + + #{ctime,jdbcType=BIGINT}, + + + #{utime,jdbcType=BIGINT}, + + + #{creator,jdbcType=VARCHAR}, + + + #{updater,jdbcType=VARCHAR}, + + + #{enable,jdbcType=BIT}, + + + + + + update dataset_scene_relation + + + id = #{record.id,jdbcType=INTEGER}, + + + dataset_id = #{record.datasetId,jdbcType=INTEGER}, + + + scene_id = #{record.sceneId,jdbcType=INTEGER}, + + + ctime = #{record.ctime,jdbcType=BIGINT}, + + + utime = #{record.utime,jdbcType=BIGINT}, + + + creator = #{record.creator,jdbcType=VARCHAR}, + + + updater = #{record.updater,jdbcType=VARCHAR}, + + + enable = #{record.enable,jdbcType=BIT}, + + + + + + + + update dataset_scene_relation + set id = #{record.id,jdbcType=INTEGER}, + dataset_id = #{record.datasetId,jdbcType=INTEGER}, + scene_id = #{record.sceneId,jdbcType=INTEGER}, + ctime = #{record.ctime,jdbcType=BIGINT}, + utime = #{record.utime,jdbcType=BIGINT}, + creator = #{record.creator,jdbcType=VARCHAR}, + updater = #{record.updater,jdbcType=VARCHAR}, + enable = #{record.enable,jdbcType=BIT} + + + + + + update dataset_scene_relation + + + dataset_id = #{datasetId,jdbcType=INTEGER}, + + + scene_id = #{sceneId,jdbcType=INTEGER}, + + + ctime = #{ctime,jdbcType=BIGINT}, + + + utime = #{utime,jdbcType=BIGINT}, + + + creator = #{creator,jdbcType=VARCHAR}, + + + updater = #{updater,jdbcType=VARCHAR}, + + + enable = #{enable,jdbcType=BIT}, + + + where id = #{id,jdbcType=INTEGER} + + + update dataset_scene_relation + set dataset_id = #{datasetId,jdbcType=INTEGER}, + scene_id = #{sceneId,jdbcType=INTEGER}, + ctime = #{ctime,jdbcType=BIGINT}, + utime = #{utime,jdbcType=BIGINT}, + creator = #{creator,jdbcType=VARCHAR}, + updater = #{updater,jdbcType=VARCHAR}, + enable = #{enable,jdbcType=BIT} + where id = #{id,jdbcType=INTEGER} + + + insert into dataset_scene_relation + (dataset_id, scene_id, ctime, utime, creator, updater, enable) + values + + (#{item.datasetId,jdbcType=INTEGER}, #{item.sceneId,jdbcType=INTEGER}, #{item.ctime,jdbcType=BIGINT}, + #{item.utime,jdbcType=BIGINT}, #{item.creator,jdbcType=VARCHAR}, #{item.updater,jdbcType=VARCHAR}, + #{item.enable,jdbcType=BIT}) + + + + insert into dataset_scene_relation ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.datasetId,jdbcType=INTEGER} + + + #{item.sceneId,jdbcType=INTEGER} + + + #{item.ctime,jdbcType=BIGINT} + + + #{item.utime,jdbcType=BIGINT} + + + #{item.creator,jdbcType=VARCHAR} + + + #{item.updater,jdbcType=VARCHAR} + + + #{item.enable,jdbcType=BIT} + + + ) + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/DomainApplyInfoMapper.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/DomainApplyInfoMapper.xml new file mode 100644 index 000000000..fe483ed74 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/DomainApplyInfoMapper.xml @@ -0,0 +1,329 @@ + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, apply_user, domain, ip, apply_status, ctime + + + agent_ip_list + + + + + + delete from domain_apply_info + where id = #{id,jdbcType=INTEGER} + + + delete from domain_apply_info + + + + + + + SELECT LAST_INSERT_ID() + + insert into domain_apply_info (apply_user, domain, ip, + apply_status, ctime, agent_ip_list + ) + values (#{applyUser,jdbcType=VARCHAR}, #{domain,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR}, + #{applyStatus,jdbcType=INTEGER}, #{ctime,jdbcType=BIGINT}, #{agentIpList,jdbcType=LONGVARCHAR} + ) + + + + SELECT LAST_INSERT_ID() + + insert into domain_apply_info + + + apply_user, + + + domain, + + + ip, + + + apply_status, + + + ctime, + + + agent_ip_list, + + + + + #{applyUser,jdbcType=VARCHAR}, + + + #{domain,jdbcType=VARCHAR}, + + + #{ip,jdbcType=VARCHAR}, + + + #{applyStatus,jdbcType=INTEGER}, + + + #{ctime,jdbcType=BIGINT}, + + + #{agentIpList,jdbcType=LONGVARCHAR}, + + + + + + update domain_apply_info + + + id = #{record.id,jdbcType=INTEGER}, + + + apply_user = #{record.applyUser,jdbcType=VARCHAR}, + + + domain = #{record.domain,jdbcType=VARCHAR}, + + + ip = #{record.ip,jdbcType=VARCHAR}, + + + apply_status = #{record.applyStatus,jdbcType=INTEGER}, + + + ctime = #{record.ctime,jdbcType=BIGINT}, + + + agent_ip_list = #{record.agentIpList,jdbcType=LONGVARCHAR}, + + + + + + + + update domain_apply_info + set id = #{record.id,jdbcType=INTEGER}, + apply_user = #{record.applyUser,jdbcType=VARCHAR}, + domain = #{record.domain,jdbcType=VARCHAR}, + ip = #{record.ip,jdbcType=VARCHAR}, + apply_status = #{record.applyStatus,jdbcType=INTEGER}, + ctime = #{record.ctime,jdbcType=BIGINT}, + agent_ip_list = #{record.agentIpList,jdbcType=LONGVARCHAR} + + + + + + update domain_apply_info + set id = #{record.id,jdbcType=INTEGER}, + apply_user = #{record.applyUser,jdbcType=VARCHAR}, + domain = #{record.domain,jdbcType=VARCHAR}, + ip = #{record.ip,jdbcType=VARCHAR}, + apply_status = #{record.applyStatus,jdbcType=INTEGER}, + ctime = #{record.ctime,jdbcType=BIGINT} + + + + + + update domain_apply_info + + + apply_user = #{applyUser,jdbcType=VARCHAR}, + + + domain = #{domain,jdbcType=VARCHAR}, + + + ip = #{ip,jdbcType=VARCHAR}, + + + apply_status = #{applyStatus,jdbcType=INTEGER}, + + + ctime = #{ctime,jdbcType=BIGINT}, + + + agent_ip_list = #{agentIpList,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update domain_apply_info + set apply_user = #{applyUser,jdbcType=VARCHAR}, + domain = #{domain,jdbcType=VARCHAR}, + ip = #{ip,jdbcType=VARCHAR}, + apply_status = #{applyStatus,jdbcType=INTEGER}, + ctime = #{ctime,jdbcType=BIGINT}, + agent_ip_list = #{agentIpList,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=INTEGER} + + + update domain_apply_info + set apply_user = #{applyUser,jdbcType=VARCHAR}, + domain = #{domain,jdbcType=VARCHAR}, + ip = #{ip,jdbcType=VARCHAR}, + apply_status = #{applyStatus,jdbcType=INTEGER}, + ctime = #{ctime,jdbcType=BIGINT} + where id = #{id,jdbcType=INTEGER} + + + insert into domain_apply_info + (apply_user, domain, ip, apply_status, ctime, agent_ip_list) + values + + (#{item.applyUser,jdbcType=VARCHAR}, #{item.domain,jdbcType=VARCHAR}, #{item.ip,jdbcType=VARCHAR}, + #{item.applyStatus,jdbcType=INTEGER}, #{item.ctime,jdbcType=BIGINT}, #{item.agentIpList,jdbcType=LONGVARCHAR} + ) + + + + insert into domain_apply_info ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.applyUser,jdbcType=VARCHAR} + + + #{item.domain,jdbcType=VARCHAR} + + + #{item.ip,jdbcType=VARCHAR} + + + #{item.applyStatus,jdbcType=INTEGER} + + + #{item.ctime,jdbcType=BIGINT} + + + #{item.agentIpList,jdbcType=LONGVARCHAR} + + + ) + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/MibenchTaskMapper.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/MibenchTaskMapper.xml new file mode 100644 index 000000000..bdde7090b --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/MibenchTaskMapper.xml @@ -0,0 +1,894 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, qps, origin_qps, max_qps, scene_id, serial_link_id, scene_api_id, time, agent_num, + finish_agent_num, ctime, utime, state, version, success_num, failure_num, task_type, + parent_task_id, report_id, req_param_type, ok, connect_task_num, debug_rt, debug_size, + bench_mode, increase_mode, increase_percent + + + debug_result, debug_result_header, request_params, debug_trigger_cp, debug_trigger_filter_condition, + debug_req_headers, debug_url + + + + + + delete from mibench_task + where id = #{id,jdbcType=INTEGER} + + + delete from mibench_task + + + + + + + SELECT LAST_INSERT_ID() + + insert into mibench_task (qps, origin_qps, max_qps, + scene_id, serial_link_id, scene_api_id, + time, agent_num, finish_agent_num, + ctime, utime, state, + version, success_num, failure_num, + task_type, parent_task_id, report_id, + req_param_type, ok, connect_task_num, + debug_rt, debug_size, bench_mode, + increase_mode, increase_percent, debug_result, + debug_result_header, request_params, + debug_trigger_cp, debug_trigger_filter_condition, + debug_req_headers, debug_url) + values (#{qps,jdbcType=INTEGER}, #{originQps,jdbcType=INTEGER}, #{maxQps,jdbcType=INTEGER}, + #{sceneId,jdbcType=INTEGER}, #{serialLinkId,jdbcType=INTEGER}, #{sceneApiId,jdbcType=INTEGER}, + #{time,jdbcType=INTEGER}, #{agentNum,jdbcType=INTEGER}, #{finishAgentNum,jdbcType=INTEGER}, + #{ctime,jdbcType=BIGINT}, #{utime,jdbcType=BIGINT}, #{state,jdbcType=INTEGER}, + #{version,jdbcType=INTEGER}, #{successNum,jdbcType=BIGINT}, #{failureNum,jdbcType=BIGINT}, + #{taskType,jdbcType=INTEGER}, #{parentTaskId,jdbcType=INTEGER}, #{reportId,jdbcType=VARCHAR}, + #{reqParamType,jdbcType=INTEGER}, #{ok,jdbcType=BIT}, #{connectTaskNum,jdbcType=INTEGER}, + #{debugRt,jdbcType=INTEGER}, #{debugSize,jdbcType=INTEGER}, #{benchMode,jdbcType=INTEGER}, + #{increaseMode,jdbcType=INTEGER}, #{increasePercent,jdbcType=INTEGER}, #{debugResult,jdbcType=LONGVARCHAR}, + #{debugResultHeader,jdbcType=LONGVARCHAR}, #{requestParams,jdbcType=LONGVARCHAR}, + #{debugTriggerCp,jdbcType=LONGVARCHAR}, #{debugTriggerFilterCondition,jdbcType=LONGVARCHAR}, + #{debugReqHeaders,jdbcType=LONGVARCHAR}, #{debugUrl,jdbcType=LONGVARCHAR}) + + + + SELECT LAST_INSERT_ID() + + insert into mibench_task + + + qps, + + + origin_qps, + + + max_qps, + + + scene_id, + + + serial_link_id, + + + scene_api_id, + + + time, + + + agent_num, + + + finish_agent_num, + + + ctime, + + + utime, + + + state, + + + version, + + + success_num, + + + failure_num, + + + task_type, + + + parent_task_id, + + + report_id, + + + req_param_type, + + + ok, + + + connect_task_num, + + + debug_rt, + + + debug_size, + + + bench_mode, + + + increase_mode, + + + increase_percent, + + + debug_result, + + + debug_result_header, + + + request_params, + + + debug_trigger_cp, + + + debug_trigger_filter_condition, + + + debug_req_headers, + + + debug_url, + + + + + #{qps,jdbcType=INTEGER}, + + + #{originQps,jdbcType=INTEGER}, + + + #{maxQps,jdbcType=INTEGER}, + + + #{sceneId,jdbcType=INTEGER}, + + + #{serialLinkId,jdbcType=INTEGER}, + + + #{sceneApiId,jdbcType=INTEGER}, + + + #{time,jdbcType=INTEGER}, + + + #{agentNum,jdbcType=INTEGER}, + + + #{finishAgentNum,jdbcType=INTEGER}, + + + #{ctime,jdbcType=BIGINT}, + + + #{utime,jdbcType=BIGINT}, + + + #{state,jdbcType=INTEGER}, + + + #{version,jdbcType=INTEGER}, + + + #{successNum,jdbcType=BIGINT}, + + + #{failureNum,jdbcType=BIGINT}, + + + #{taskType,jdbcType=INTEGER}, + + + #{parentTaskId,jdbcType=INTEGER}, + + + #{reportId,jdbcType=VARCHAR}, + + + #{reqParamType,jdbcType=INTEGER}, + + + #{ok,jdbcType=BIT}, + + + #{connectTaskNum,jdbcType=INTEGER}, + + + #{debugRt,jdbcType=INTEGER}, + + + #{debugSize,jdbcType=INTEGER}, + + + #{benchMode,jdbcType=INTEGER}, + + + #{increaseMode,jdbcType=INTEGER}, + + + #{increasePercent,jdbcType=INTEGER}, + + + #{debugResult,jdbcType=LONGVARCHAR}, + + + #{debugResultHeader,jdbcType=LONGVARCHAR}, + + + #{requestParams,jdbcType=LONGVARCHAR}, + + + #{debugTriggerCp,jdbcType=LONGVARCHAR}, + + + #{debugTriggerFilterCondition,jdbcType=LONGVARCHAR}, + + + #{debugReqHeaders,jdbcType=LONGVARCHAR}, + + + #{debugUrl,jdbcType=LONGVARCHAR}, + + + + + + update mibench_task + + + id = #{record.id,jdbcType=INTEGER}, + + + qps = #{record.qps,jdbcType=INTEGER}, + + + origin_qps = #{record.originQps,jdbcType=INTEGER}, + + + max_qps = #{record.maxQps,jdbcType=INTEGER}, + + + scene_id = #{record.sceneId,jdbcType=INTEGER}, + + + serial_link_id = #{record.serialLinkId,jdbcType=INTEGER}, + + + scene_api_id = #{record.sceneApiId,jdbcType=INTEGER}, + + + time = #{record.time,jdbcType=INTEGER}, + + + agent_num = #{record.agentNum,jdbcType=INTEGER}, + + + finish_agent_num = #{record.finishAgentNum,jdbcType=INTEGER}, + + + ctime = #{record.ctime,jdbcType=BIGINT}, + + + utime = #{record.utime,jdbcType=BIGINT}, + + + state = #{record.state,jdbcType=INTEGER}, + + + version = #{record.version,jdbcType=INTEGER}, + + + success_num = #{record.successNum,jdbcType=BIGINT}, + + + failure_num = #{record.failureNum,jdbcType=BIGINT}, + + + task_type = #{record.taskType,jdbcType=INTEGER}, + + + parent_task_id = #{record.parentTaskId,jdbcType=INTEGER}, + + + report_id = #{record.reportId,jdbcType=VARCHAR}, + + + req_param_type = #{record.reqParamType,jdbcType=INTEGER}, + + + ok = #{record.ok,jdbcType=BIT}, + + + connect_task_num = #{record.connectTaskNum,jdbcType=INTEGER}, + + + debug_rt = #{record.debugRt,jdbcType=INTEGER}, + + + debug_size = #{record.debugSize,jdbcType=INTEGER}, + + + bench_mode = #{record.benchMode,jdbcType=INTEGER}, + + + increase_mode = #{record.increaseMode,jdbcType=INTEGER}, + + + increase_percent = #{record.increasePercent,jdbcType=INTEGER}, + + + debug_result = #{record.debugResult,jdbcType=LONGVARCHAR}, + + + debug_result_header = #{record.debugResultHeader,jdbcType=LONGVARCHAR}, + + + request_params = #{record.requestParams,jdbcType=LONGVARCHAR}, + + + debug_trigger_cp = #{record.debugTriggerCp,jdbcType=LONGVARCHAR}, + + + debug_trigger_filter_condition = #{record.debugTriggerFilterCondition,jdbcType=LONGVARCHAR}, + + + debug_req_headers = #{record.debugReqHeaders,jdbcType=LONGVARCHAR}, + + + debug_url = #{record.debugUrl,jdbcType=LONGVARCHAR}, + + + + + + + + update mibench_task + set id = #{record.id,jdbcType=INTEGER}, + qps = #{record.qps,jdbcType=INTEGER}, + origin_qps = #{record.originQps,jdbcType=INTEGER}, + max_qps = #{record.maxQps,jdbcType=INTEGER}, + scene_id = #{record.sceneId,jdbcType=INTEGER}, + serial_link_id = #{record.serialLinkId,jdbcType=INTEGER}, + scene_api_id = #{record.sceneApiId,jdbcType=INTEGER}, + time = #{record.time,jdbcType=INTEGER}, + agent_num = #{record.agentNum,jdbcType=INTEGER}, + finish_agent_num = #{record.finishAgentNum,jdbcType=INTEGER}, + ctime = #{record.ctime,jdbcType=BIGINT}, + utime = #{record.utime,jdbcType=BIGINT}, + state = #{record.state,jdbcType=INTEGER}, + version = #{record.version,jdbcType=INTEGER}, + success_num = #{record.successNum,jdbcType=BIGINT}, + failure_num = #{record.failureNum,jdbcType=BIGINT}, + task_type = #{record.taskType,jdbcType=INTEGER}, + parent_task_id = #{record.parentTaskId,jdbcType=INTEGER}, + report_id = #{record.reportId,jdbcType=VARCHAR}, + req_param_type = #{record.reqParamType,jdbcType=INTEGER}, + ok = #{record.ok,jdbcType=BIT}, + connect_task_num = #{record.connectTaskNum,jdbcType=INTEGER}, + debug_rt = #{record.debugRt,jdbcType=INTEGER}, + debug_size = #{record.debugSize,jdbcType=INTEGER}, + bench_mode = #{record.benchMode,jdbcType=INTEGER}, + increase_mode = #{record.increaseMode,jdbcType=INTEGER}, + increase_percent = #{record.increasePercent,jdbcType=INTEGER}, + debug_result = #{record.debugResult,jdbcType=LONGVARCHAR}, + debug_result_header = #{record.debugResultHeader,jdbcType=LONGVARCHAR}, + request_params = #{record.requestParams,jdbcType=LONGVARCHAR}, + debug_trigger_cp = #{record.debugTriggerCp,jdbcType=LONGVARCHAR}, + debug_trigger_filter_condition = #{record.debugTriggerFilterCondition,jdbcType=LONGVARCHAR}, + debug_req_headers = #{record.debugReqHeaders,jdbcType=LONGVARCHAR}, + debug_url = #{record.debugUrl,jdbcType=LONGVARCHAR} + + + + + + update mibench_task + set id = #{record.id,jdbcType=INTEGER}, + qps = #{record.qps,jdbcType=INTEGER}, + origin_qps = #{record.originQps,jdbcType=INTEGER}, + max_qps = #{record.maxQps,jdbcType=INTEGER}, + scene_id = #{record.sceneId,jdbcType=INTEGER}, + serial_link_id = #{record.serialLinkId,jdbcType=INTEGER}, + scene_api_id = #{record.sceneApiId,jdbcType=INTEGER}, + time = #{record.time,jdbcType=INTEGER}, + agent_num = #{record.agentNum,jdbcType=INTEGER}, + finish_agent_num = #{record.finishAgentNum,jdbcType=INTEGER}, + ctime = #{record.ctime,jdbcType=BIGINT}, + utime = #{record.utime,jdbcType=BIGINT}, + state = #{record.state,jdbcType=INTEGER}, + version = #{record.version,jdbcType=INTEGER}, + success_num = #{record.successNum,jdbcType=BIGINT}, + failure_num = #{record.failureNum,jdbcType=BIGINT}, + task_type = #{record.taskType,jdbcType=INTEGER}, + parent_task_id = #{record.parentTaskId,jdbcType=INTEGER}, + report_id = #{record.reportId,jdbcType=VARCHAR}, + req_param_type = #{record.reqParamType,jdbcType=INTEGER}, + ok = #{record.ok,jdbcType=BIT}, + connect_task_num = #{record.connectTaskNum,jdbcType=INTEGER}, + debug_rt = #{record.debugRt,jdbcType=INTEGER}, + debug_size = #{record.debugSize,jdbcType=INTEGER}, + bench_mode = #{record.benchMode,jdbcType=INTEGER}, + increase_mode = #{record.increaseMode,jdbcType=INTEGER}, + increase_percent = #{record.increasePercent,jdbcType=INTEGER} + + + + + + update mibench_task + + + qps = #{qps,jdbcType=INTEGER}, + + + origin_qps = #{originQps,jdbcType=INTEGER}, + + + max_qps = #{maxQps,jdbcType=INTEGER}, + + + scene_id = #{sceneId,jdbcType=INTEGER}, + + + serial_link_id = #{serialLinkId,jdbcType=INTEGER}, + + + scene_api_id = #{sceneApiId,jdbcType=INTEGER}, + + + time = #{time,jdbcType=INTEGER}, + + + agent_num = #{agentNum,jdbcType=INTEGER}, + + + finish_agent_num = #{finishAgentNum,jdbcType=INTEGER}, + + + ctime = #{ctime,jdbcType=BIGINT}, + + + utime = #{utime,jdbcType=BIGINT}, + + + state = #{state,jdbcType=INTEGER}, + + + version = #{version,jdbcType=INTEGER}, + + + success_num = #{successNum,jdbcType=BIGINT}, + + + failure_num = #{failureNum,jdbcType=BIGINT}, + + + task_type = #{taskType,jdbcType=INTEGER}, + + + parent_task_id = #{parentTaskId,jdbcType=INTEGER}, + + + report_id = #{reportId,jdbcType=VARCHAR}, + + + req_param_type = #{reqParamType,jdbcType=INTEGER}, + + + ok = #{ok,jdbcType=BIT}, + + + connect_task_num = #{connectTaskNum,jdbcType=INTEGER}, + + + debug_rt = #{debugRt,jdbcType=INTEGER}, + + + debug_size = #{debugSize,jdbcType=INTEGER}, + + + bench_mode = #{benchMode,jdbcType=INTEGER}, + + + increase_mode = #{increaseMode,jdbcType=INTEGER}, + + + increase_percent = #{increasePercent,jdbcType=INTEGER}, + + + debug_result = #{debugResult,jdbcType=LONGVARCHAR}, + + + debug_result_header = #{debugResultHeader,jdbcType=LONGVARCHAR}, + + + request_params = #{requestParams,jdbcType=LONGVARCHAR}, + + + debug_trigger_cp = #{debugTriggerCp,jdbcType=LONGVARCHAR}, + + + debug_trigger_filter_condition = #{debugTriggerFilterCondition,jdbcType=LONGVARCHAR}, + + + debug_req_headers = #{debugReqHeaders,jdbcType=LONGVARCHAR}, + + + debug_url = #{debugUrl,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update mibench_task + set qps = #{qps,jdbcType=INTEGER}, + origin_qps = #{originQps,jdbcType=INTEGER}, + max_qps = #{maxQps,jdbcType=INTEGER}, + scene_id = #{sceneId,jdbcType=INTEGER}, + serial_link_id = #{serialLinkId,jdbcType=INTEGER}, + scene_api_id = #{sceneApiId,jdbcType=INTEGER}, + time = #{time,jdbcType=INTEGER}, + agent_num = #{agentNum,jdbcType=INTEGER}, + finish_agent_num = #{finishAgentNum,jdbcType=INTEGER}, + ctime = #{ctime,jdbcType=BIGINT}, + utime = #{utime,jdbcType=BIGINT}, + state = #{state,jdbcType=INTEGER}, + version = #{version,jdbcType=INTEGER}, + success_num = #{successNum,jdbcType=BIGINT}, + failure_num = #{failureNum,jdbcType=BIGINT}, + task_type = #{taskType,jdbcType=INTEGER}, + parent_task_id = #{parentTaskId,jdbcType=INTEGER}, + report_id = #{reportId,jdbcType=VARCHAR}, + req_param_type = #{reqParamType,jdbcType=INTEGER}, + ok = #{ok,jdbcType=BIT}, + connect_task_num = #{connectTaskNum,jdbcType=INTEGER}, + debug_rt = #{debugRt,jdbcType=INTEGER}, + debug_size = #{debugSize,jdbcType=INTEGER}, + bench_mode = #{benchMode,jdbcType=INTEGER}, + increase_mode = #{increaseMode,jdbcType=INTEGER}, + increase_percent = #{increasePercent,jdbcType=INTEGER}, + debug_result = #{debugResult,jdbcType=LONGVARCHAR}, + debug_result_header = #{debugResultHeader,jdbcType=LONGVARCHAR}, + request_params = #{requestParams,jdbcType=LONGVARCHAR}, + debug_trigger_cp = #{debugTriggerCp,jdbcType=LONGVARCHAR}, + debug_trigger_filter_condition = #{debugTriggerFilterCondition,jdbcType=LONGVARCHAR}, + debug_req_headers = #{debugReqHeaders,jdbcType=LONGVARCHAR}, + debug_url = #{debugUrl,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=INTEGER} + + + update mibench_task + set qps = #{qps,jdbcType=INTEGER}, + origin_qps = #{originQps,jdbcType=INTEGER}, + max_qps = #{maxQps,jdbcType=INTEGER}, + scene_id = #{sceneId,jdbcType=INTEGER}, + serial_link_id = #{serialLinkId,jdbcType=INTEGER}, + scene_api_id = #{sceneApiId,jdbcType=INTEGER}, + time = #{time,jdbcType=INTEGER}, + agent_num = #{agentNum,jdbcType=INTEGER}, + finish_agent_num = #{finishAgentNum,jdbcType=INTEGER}, + ctime = #{ctime,jdbcType=BIGINT}, + utime = #{utime,jdbcType=BIGINT}, + state = #{state,jdbcType=INTEGER}, + version = #{version,jdbcType=INTEGER}, + success_num = #{successNum,jdbcType=BIGINT}, + failure_num = #{failureNum,jdbcType=BIGINT}, + task_type = #{taskType,jdbcType=INTEGER}, + parent_task_id = #{parentTaskId,jdbcType=INTEGER}, + report_id = #{reportId,jdbcType=VARCHAR}, + req_param_type = #{reqParamType,jdbcType=INTEGER}, + ok = #{ok,jdbcType=BIT}, + connect_task_num = #{connectTaskNum,jdbcType=INTEGER}, + debug_rt = #{debugRt,jdbcType=INTEGER}, + debug_size = #{debugSize,jdbcType=INTEGER}, + bench_mode = #{benchMode,jdbcType=INTEGER}, + increase_mode = #{increaseMode,jdbcType=INTEGER}, + increase_percent = #{increasePercent,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + + insert into mibench_task + (qps, origin_qps, max_qps, scene_id, serial_link_id, scene_api_id, time, agent_num, + finish_agent_num, ctime, utime, state, version, success_num, failure_num, task_type, + parent_task_id, report_id, req_param_type, ok, connect_task_num, debug_rt, debug_size, + bench_mode, increase_mode, increase_percent, debug_result, debug_result_header, + request_params, debug_trigger_cp, debug_trigger_filter_condition, debug_req_headers, + debug_url) + values + + (#{item.qps,jdbcType=INTEGER}, #{item.originQps,jdbcType=INTEGER}, #{item.maxQps,jdbcType=INTEGER}, + #{item.sceneId,jdbcType=INTEGER}, #{item.serialLinkId,jdbcType=INTEGER}, #{item.sceneApiId,jdbcType=INTEGER}, + #{item.time,jdbcType=INTEGER}, #{item.agentNum,jdbcType=INTEGER}, #{item.finishAgentNum,jdbcType=INTEGER}, + #{item.ctime,jdbcType=BIGINT}, #{item.utime,jdbcType=BIGINT}, #{item.state,jdbcType=INTEGER}, + #{item.version,jdbcType=INTEGER}, #{item.successNum,jdbcType=BIGINT}, #{item.failureNum,jdbcType=BIGINT}, + #{item.taskType,jdbcType=INTEGER}, #{item.parentTaskId,jdbcType=INTEGER}, #{item.reportId,jdbcType=VARCHAR}, + #{item.reqParamType,jdbcType=INTEGER}, #{item.ok,jdbcType=BIT}, #{item.connectTaskNum,jdbcType=INTEGER}, + #{item.debugRt,jdbcType=INTEGER}, #{item.debugSize,jdbcType=INTEGER}, #{item.benchMode,jdbcType=INTEGER}, + #{item.increaseMode,jdbcType=INTEGER}, #{item.increasePercent,jdbcType=INTEGER}, + #{item.debugResult,jdbcType=LONGVARCHAR}, #{item.debugResultHeader,jdbcType=LONGVARCHAR}, + #{item.requestParams,jdbcType=LONGVARCHAR}, #{item.debugTriggerCp,jdbcType=LONGVARCHAR}, + #{item.debugTriggerFilterCondition,jdbcType=LONGVARCHAR}, #{item.debugReqHeaders,jdbcType=LONGVARCHAR}, + #{item.debugUrl,jdbcType=LONGVARCHAR}) + + + + insert into mibench_task ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.qps,jdbcType=INTEGER} + + + #{item.originQps,jdbcType=INTEGER} + + + #{item.maxQps,jdbcType=INTEGER} + + + #{item.sceneId,jdbcType=INTEGER} + + + #{item.serialLinkId,jdbcType=INTEGER} + + + #{item.sceneApiId,jdbcType=INTEGER} + + + #{item.time,jdbcType=INTEGER} + + + #{item.agentNum,jdbcType=INTEGER} + + + #{item.finishAgentNum,jdbcType=INTEGER} + + + #{item.ctime,jdbcType=BIGINT} + + + #{item.utime,jdbcType=BIGINT} + + + #{item.state,jdbcType=INTEGER} + + + #{item.version,jdbcType=INTEGER} + + + #{item.successNum,jdbcType=BIGINT} + + + #{item.failureNum,jdbcType=BIGINT} + + + #{item.taskType,jdbcType=INTEGER} + + + #{item.parentTaskId,jdbcType=INTEGER} + + + #{item.reportId,jdbcType=VARCHAR} + + + #{item.reqParamType,jdbcType=INTEGER} + + + #{item.ok,jdbcType=BIT} + + + #{item.connectTaskNum,jdbcType=INTEGER} + + + #{item.debugRt,jdbcType=INTEGER} + + + #{item.debugSize,jdbcType=INTEGER} + + + #{item.benchMode,jdbcType=INTEGER} + + + #{item.increaseMode,jdbcType=INTEGER} + + + #{item.increasePercent,jdbcType=INTEGER} + + + #{item.debugResult,jdbcType=LONGVARCHAR} + + + #{item.debugResultHeader,jdbcType=LONGVARCHAR} + + + #{item.requestParams,jdbcType=LONGVARCHAR} + + + #{item.debugTriggerCp,jdbcType=LONGVARCHAR} + + + #{item.debugTriggerFilterCondition,jdbcType=LONGVARCHAR} + + + #{item.debugReqHeaders,jdbcType=LONGVARCHAR} + + + #{item.debugUrl,jdbcType=LONGVARCHAR} + + + ) + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/OperationLogMapper.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/OperationLogMapper.xml new file mode 100644 index 000000000..e2656d23d --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/OperationLogMapper.xml @@ -0,0 +1,369 @@ + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, report_id, scene_id, type, create_by, create_time, update_time + + + content, support_operation + + + + + + delete from operation_log + where id = #{id,jdbcType=BIGINT} + + + delete from operation_log + + + + + + + SELECT LAST_INSERT_ID() + + insert into operation_log (report_id, scene_id, type, + create_by, create_time, update_time, + content, support_operation) + values (#{reportId,jdbcType=VARCHAR}, #{sceneId,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, + #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, + #{content,jdbcType=LONGVARCHAR}, #{supportOperation,jdbcType=LONGVARCHAR}) + + + + SELECT LAST_INSERT_ID() + + insert into operation_log + + + report_id, + + + scene_id, + + + type, + + + create_by, + + + create_time, + + + update_time, + + + content, + + + support_operation, + + + + + #{reportId,jdbcType=VARCHAR}, + + + #{sceneId,jdbcType=INTEGER}, + + + #{type,jdbcType=INTEGER}, + + + #{createBy,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=BIGINT}, + + + #{updateTime,jdbcType=BIGINT}, + + + #{content,jdbcType=LONGVARCHAR}, + + + #{supportOperation,jdbcType=LONGVARCHAR}, + + + + + + update operation_log + + + id = #{record.id,jdbcType=BIGINT}, + + + report_id = #{record.reportId,jdbcType=VARCHAR}, + + + scene_id = #{record.sceneId,jdbcType=INTEGER}, + + + type = #{record.type,jdbcType=INTEGER}, + + + create_by = #{record.createBy,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=BIGINT}, + + + update_time = #{record.updateTime,jdbcType=BIGINT}, + + + content = #{record.content,jdbcType=LONGVARCHAR}, + + + support_operation = #{record.supportOperation,jdbcType=LONGVARCHAR}, + + + + + + + + update operation_log + set id = #{record.id,jdbcType=BIGINT}, + report_id = #{record.reportId,jdbcType=VARCHAR}, + scene_id = #{record.sceneId,jdbcType=INTEGER}, + type = #{record.type,jdbcType=INTEGER}, + create_by = #{record.createBy,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + content = #{record.content,jdbcType=LONGVARCHAR}, + support_operation = #{record.supportOperation,jdbcType=LONGVARCHAR} + + + + + + update operation_log + set id = #{record.id,jdbcType=BIGINT}, + report_id = #{record.reportId,jdbcType=VARCHAR}, + scene_id = #{record.sceneId,jdbcType=INTEGER}, + type = #{record.type,jdbcType=INTEGER}, + create_by = #{record.createBy,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT} + + + + + + update operation_log + + + report_id = #{reportId,jdbcType=VARCHAR}, + + + scene_id = #{sceneId,jdbcType=INTEGER}, + + + type = #{type,jdbcType=INTEGER}, + + + create_by = #{createBy,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=BIGINT}, + + + update_time = #{updateTime,jdbcType=BIGINT}, + + + content = #{content,jdbcType=LONGVARCHAR}, + + + support_operation = #{supportOperation,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + update operation_log + set report_id = #{reportId,jdbcType=VARCHAR}, + scene_id = #{sceneId,jdbcType=INTEGER}, + type = #{type,jdbcType=INTEGER}, + create_by = #{createBy,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT}, + content = #{content,jdbcType=LONGVARCHAR}, + support_operation = #{supportOperation,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=BIGINT} + + + update operation_log + set report_id = #{reportId,jdbcType=VARCHAR}, + scene_id = #{sceneId,jdbcType=INTEGER}, + type = #{type,jdbcType=INTEGER}, + create_by = #{createBy,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT} + where id = #{id,jdbcType=BIGINT} + + + insert into operation_log + (report_id, scene_id, type, create_by, create_time, update_time, content, support_operation + ) + values + + (#{item.reportId,jdbcType=VARCHAR}, #{item.sceneId,jdbcType=INTEGER}, #{item.type,jdbcType=INTEGER}, + #{item.createBy,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT}, #{item.updateTime,jdbcType=BIGINT}, + #{item.content,jdbcType=LONGVARCHAR}, #{item.supportOperation,jdbcType=LONGVARCHAR} + ) + + + + insert into operation_log ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.reportId,jdbcType=VARCHAR} + + + #{item.sceneId,jdbcType=INTEGER} + + + #{item.type,jdbcType=INTEGER} + + + #{item.createBy,jdbcType=VARCHAR} + + + #{item.createTime,jdbcType=BIGINT} + + + #{item.updateTime,jdbcType=BIGINT} + + + #{item.content,jdbcType=LONGVARCHAR} + + + #{item.supportOperation,jdbcType=LONGVARCHAR} + + + ) + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/ReportInfoMapper.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/ReportInfoMapper.xml new file mode 100644 index 000000000..120728ad6 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/ReportInfoMapper.xml @@ -0,0 +1,635 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, scene_id, snapshot_id, report_id, report_name, duration, concurrency, concurrency_max, + create_by, create_time, update_time, status, task_id, file_path, finish_time, tenant + + + agents, extra, sla_event_list, total_stat_analysis_event_list, link_to_dag_id + + + + + + delete from report_info + where id = #{id,jdbcType=BIGINT} + + + delete from report_info + + + + + + + SELECT LAST_INSERT_ID() + + insert into report_info (scene_id, snapshot_id, report_id, + report_name, duration, concurrency, + concurrency_max, create_by, create_time, + update_time, status, task_id, + file_path, finish_time, tenant, + agents, extra, sla_event_list, + total_stat_analysis_event_list, link_to_dag_id + ) + values (#{sceneId,jdbcType=BIGINT}, #{snapshotId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, + #{reportName,jdbcType=VARCHAR}, #{duration,jdbcType=INTEGER}, #{concurrency,jdbcType=INTEGER}, + #{concurrencyMax,jdbcType=INTEGER}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, + #{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, #{taskId,jdbcType=BIGINT}, + #{filePath,jdbcType=VARCHAR}, #{finishTime,jdbcType=BIGINT}, #{tenant,jdbcType=VARCHAR}, + #{agents,jdbcType=LONGVARCHAR}, #{extra,jdbcType=LONGVARCHAR}, #{slaEventList,jdbcType=LONGVARCHAR}, + #{totalStatAnalysisEventList,jdbcType=LONGVARCHAR}, #{linkToDagId,jdbcType=LONGVARCHAR} + ) + + + + SELECT LAST_INSERT_ID() + + insert into report_info + + + scene_id, + + + snapshot_id, + + + report_id, + + + report_name, + + + duration, + + + concurrency, + + + concurrency_max, + + + create_by, + + + create_time, + + + update_time, + + + status, + + + task_id, + + + file_path, + + + finish_time, + + + tenant, + + + agents, + + + extra, + + + sla_event_list, + + + total_stat_analysis_event_list, + + + link_to_dag_id, + + + + + #{sceneId,jdbcType=BIGINT}, + + + #{snapshotId,jdbcType=VARCHAR}, + + + #{reportId,jdbcType=VARCHAR}, + + + #{reportName,jdbcType=VARCHAR}, + + + #{duration,jdbcType=INTEGER}, + + + #{concurrency,jdbcType=INTEGER}, + + + #{concurrencyMax,jdbcType=INTEGER}, + + + #{createBy,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{status,jdbcType=INTEGER}, + + + #{taskId,jdbcType=BIGINT}, + + + #{filePath,jdbcType=VARCHAR}, + + + #{finishTime,jdbcType=BIGINT}, + + + #{tenant,jdbcType=VARCHAR}, + + + #{agents,jdbcType=LONGVARCHAR}, + + + #{extra,jdbcType=LONGVARCHAR}, + + + #{slaEventList,jdbcType=LONGVARCHAR}, + + + #{totalStatAnalysisEventList,jdbcType=LONGVARCHAR}, + + + #{linkToDagId,jdbcType=LONGVARCHAR}, + + + + + + update report_info + + + id = #{record.id,jdbcType=BIGINT}, + + + scene_id = #{record.sceneId,jdbcType=BIGINT}, + + + snapshot_id = #{record.snapshotId,jdbcType=VARCHAR}, + + + report_id = #{record.reportId,jdbcType=VARCHAR}, + + + report_name = #{record.reportName,jdbcType=VARCHAR}, + + + duration = #{record.duration,jdbcType=INTEGER}, + + + concurrency = #{record.concurrency,jdbcType=INTEGER}, + + + concurrency_max = #{record.concurrencyMax,jdbcType=INTEGER}, + + + create_by = #{record.createBy,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + + + status = #{record.status,jdbcType=INTEGER}, + + + task_id = #{record.taskId,jdbcType=BIGINT}, + + + file_path = #{record.filePath,jdbcType=VARCHAR}, + + + finish_time = #{record.finishTime,jdbcType=BIGINT}, + + + tenant = #{record.tenant,jdbcType=VARCHAR}, + + + agents = #{record.agents,jdbcType=LONGVARCHAR}, + + + extra = #{record.extra,jdbcType=LONGVARCHAR}, + + + sla_event_list = #{record.slaEventList,jdbcType=LONGVARCHAR}, + + + total_stat_analysis_event_list = #{record.totalStatAnalysisEventList,jdbcType=LONGVARCHAR}, + + + link_to_dag_id = #{record.linkToDagId,jdbcType=LONGVARCHAR}, + + + + + + + + update report_info + set id = #{record.id,jdbcType=BIGINT}, + scene_id = #{record.sceneId,jdbcType=BIGINT}, + snapshot_id = #{record.snapshotId,jdbcType=VARCHAR}, + report_id = #{record.reportId,jdbcType=VARCHAR}, + report_name = #{record.reportName,jdbcType=VARCHAR}, + duration = #{record.duration,jdbcType=INTEGER}, + concurrency = #{record.concurrency,jdbcType=INTEGER}, + concurrency_max = #{record.concurrencyMax,jdbcType=INTEGER}, + create_by = #{record.createBy,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + status = #{record.status,jdbcType=INTEGER}, + task_id = #{record.taskId,jdbcType=BIGINT}, + file_path = #{record.filePath,jdbcType=VARCHAR}, + finish_time = #{record.finishTime,jdbcType=BIGINT}, + tenant = #{record.tenant,jdbcType=VARCHAR}, + agents = #{record.agents,jdbcType=LONGVARCHAR}, + extra = #{record.extra,jdbcType=LONGVARCHAR}, + sla_event_list = #{record.slaEventList,jdbcType=LONGVARCHAR}, + total_stat_analysis_event_list = #{record.totalStatAnalysisEventList,jdbcType=LONGVARCHAR}, + link_to_dag_id = #{record.linkToDagId,jdbcType=LONGVARCHAR} + + + + + + update report_info + set id = #{record.id,jdbcType=BIGINT}, + scene_id = #{record.sceneId,jdbcType=BIGINT}, + snapshot_id = #{record.snapshotId,jdbcType=VARCHAR}, + report_id = #{record.reportId,jdbcType=VARCHAR}, + report_name = #{record.reportName,jdbcType=VARCHAR}, + duration = #{record.duration,jdbcType=INTEGER}, + concurrency = #{record.concurrency,jdbcType=INTEGER}, + concurrency_max = #{record.concurrencyMax,jdbcType=INTEGER}, + create_by = #{record.createBy,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + status = #{record.status,jdbcType=INTEGER}, + task_id = #{record.taskId,jdbcType=BIGINT}, + file_path = #{record.filePath,jdbcType=VARCHAR}, + finish_time = #{record.finishTime,jdbcType=BIGINT}, + tenant = #{record.tenant,jdbcType=VARCHAR} + + + + + + update report_info + + + scene_id = #{sceneId,jdbcType=BIGINT}, + + + snapshot_id = #{snapshotId,jdbcType=VARCHAR}, + + + report_id = #{reportId,jdbcType=VARCHAR}, + + + report_name = #{reportName,jdbcType=VARCHAR}, + + + duration = #{duration,jdbcType=INTEGER}, + + + concurrency = #{concurrency,jdbcType=INTEGER}, + + + concurrency_max = #{concurrencyMax,jdbcType=INTEGER}, + + + create_by = #{createBy,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + status = #{status,jdbcType=INTEGER}, + + + task_id = #{taskId,jdbcType=BIGINT}, + + + file_path = #{filePath,jdbcType=VARCHAR}, + + + finish_time = #{finishTime,jdbcType=BIGINT}, + + + tenant = #{tenant,jdbcType=VARCHAR}, + + + agents = #{agents,jdbcType=LONGVARCHAR}, + + + extra = #{extra,jdbcType=LONGVARCHAR}, + + + sla_event_list = #{slaEventList,jdbcType=LONGVARCHAR}, + + + total_stat_analysis_event_list = #{totalStatAnalysisEventList,jdbcType=LONGVARCHAR}, + + + link_to_dag_id = #{linkToDagId,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + update report_info + set scene_id = #{sceneId,jdbcType=BIGINT}, + snapshot_id = #{snapshotId,jdbcType=VARCHAR}, + report_id = #{reportId,jdbcType=VARCHAR}, + report_name = #{reportName,jdbcType=VARCHAR}, + duration = #{duration,jdbcType=INTEGER}, + concurrency = #{concurrency,jdbcType=INTEGER}, + concurrency_max = #{concurrencyMax,jdbcType=INTEGER}, + create_by = #{createBy,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + status = #{status,jdbcType=INTEGER}, + task_id = #{taskId,jdbcType=BIGINT}, + file_path = #{filePath,jdbcType=VARCHAR}, + finish_time = #{finishTime,jdbcType=BIGINT}, + tenant = #{tenant,jdbcType=VARCHAR}, + agents = #{agents,jdbcType=LONGVARCHAR}, + extra = #{extra,jdbcType=LONGVARCHAR}, + sla_event_list = #{slaEventList,jdbcType=LONGVARCHAR}, + total_stat_analysis_event_list = #{totalStatAnalysisEventList,jdbcType=LONGVARCHAR}, + link_to_dag_id = #{linkToDagId,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=BIGINT} + + + update report_info + set scene_id = #{sceneId,jdbcType=BIGINT}, + snapshot_id = #{snapshotId,jdbcType=VARCHAR}, + report_id = #{reportId,jdbcType=VARCHAR}, + report_name = #{reportName,jdbcType=VARCHAR}, + duration = #{duration,jdbcType=INTEGER}, + concurrency = #{concurrency,jdbcType=INTEGER}, + concurrency_max = #{concurrencyMax,jdbcType=INTEGER}, + create_by = #{createBy,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + status = #{status,jdbcType=INTEGER}, + task_id = #{taskId,jdbcType=BIGINT}, + file_path = #{filePath,jdbcType=VARCHAR}, + finish_time = #{finishTime,jdbcType=BIGINT}, + tenant = #{tenant,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} + + + insert into report_info + (scene_id, snapshot_id, report_id, report_name, duration, concurrency, concurrency_max, + create_by, create_time, update_time, status, task_id, file_path, finish_time, tenant, + agents, extra, sla_event_list, total_stat_analysis_event_list, link_to_dag_id) + values + + (#{item.sceneId,jdbcType=BIGINT}, #{item.snapshotId,jdbcType=VARCHAR}, #{item.reportId,jdbcType=VARCHAR}, + #{item.reportName,jdbcType=VARCHAR}, #{item.duration,jdbcType=INTEGER}, #{item.concurrency,jdbcType=INTEGER}, + #{item.concurrencyMax,jdbcType=INTEGER}, #{item.createBy,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}, + #{item.updateTime,jdbcType=TIMESTAMP}, #{item.status,jdbcType=INTEGER}, #{item.taskId,jdbcType=BIGINT}, + #{item.filePath,jdbcType=VARCHAR}, #{item.finishTime,jdbcType=BIGINT}, #{item.tenant,jdbcType=VARCHAR}, + #{item.agents,jdbcType=LONGVARCHAR}, #{item.extra,jdbcType=LONGVARCHAR}, #{item.slaEventList,jdbcType=LONGVARCHAR}, + #{item.totalStatAnalysisEventList,jdbcType=LONGVARCHAR}, #{item.linkToDagId,jdbcType=LONGVARCHAR} + ) + + + + insert into report_info ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.sceneId,jdbcType=BIGINT} + + + #{item.snapshotId,jdbcType=VARCHAR} + + + #{item.reportId,jdbcType=VARCHAR} + + + #{item.reportName,jdbcType=VARCHAR} + + + #{item.duration,jdbcType=INTEGER} + + + #{item.concurrency,jdbcType=INTEGER} + + + #{item.concurrencyMax,jdbcType=INTEGER} + + + #{item.createBy,jdbcType=VARCHAR} + + + #{item.createTime,jdbcType=TIMESTAMP} + + + #{item.updateTime,jdbcType=TIMESTAMP} + + + #{item.status,jdbcType=INTEGER} + + + #{item.taskId,jdbcType=BIGINT} + + + #{item.filePath,jdbcType=VARCHAR} + + + #{item.finishTime,jdbcType=BIGINT} + + + #{item.tenant,jdbcType=VARCHAR} + + + #{item.agents,jdbcType=LONGVARCHAR} + + + #{item.extra,jdbcType=LONGVARCHAR} + + + #{item.slaEventList,jdbcType=LONGVARCHAR} + + + #{item.totalStatAnalysisEventList,jdbcType=LONGVARCHAR} + + + #{item.linkToDagId,jdbcType=LONGVARCHAR} + + + ) + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SceneApiInfoMapper.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SceneApiInfoMapper.xml new file mode 100644 index 000000000..10c660044 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SceneApiInfoMapper.xml @@ -0,0 +1,779 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, scene_id, api_order, api_name, source_type, api_type, request_method, request_timeout, + need_login, token_type, content_type, nacos_type, service_name, method_name, param_type_list, + dubbo_group, dubbo_version, serial_link_id + + + api_url, api_header, request_param_info, output_param_info, request_body, dubbo_param_json, + check_point, filter_condition, api_tsp_auth, api_traffic_info, api_x5_info + + + + + + delete from scene_api_info + where id = #{id,jdbcType=INTEGER} + + + delete from scene_api_info + + + + + + + SELECT LAST_INSERT_ID() + + insert into scene_api_info (scene_id, api_order, api_name, + source_type, api_type, request_method, + request_timeout, need_login, token_type, + content_type, nacos_type, service_name, + method_name, param_type_list, dubbo_group, + dubbo_version, serial_link_id, api_url, + api_header, request_param_info, output_param_info, + request_body, dubbo_param_json, check_point, + filter_condition, api_tsp_auth, api_traffic_info, + api_x5_info) + values (#{sceneId,jdbcType=INTEGER}, #{apiOrder,jdbcType=INTEGER}, #{apiName,jdbcType=VARCHAR}, + #{sourceType,jdbcType=INTEGER}, #{apiType,jdbcType=INTEGER}, #{requestMethod,jdbcType=INTEGER}, + #{requestTimeout,jdbcType=INTEGER}, #{needLogin,jdbcType=BIT}, #{tokenType,jdbcType=INTEGER}, + #{contentType,jdbcType=VARCHAR}, #{nacosType,jdbcType=INTEGER}, #{serviceName,jdbcType=VARCHAR}, + #{methodName,jdbcType=VARCHAR}, #{paramTypeList,jdbcType=VARCHAR}, #{dubboGroup,jdbcType=VARCHAR}, + #{dubboVersion,jdbcType=VARCHAR}, #{serialLinkId,jdbcType=INTEGER}, #{apiUrl,jdbcType=LONGVARCHAR}, + #{apiHeader,jdbcType=LONGVARCHAR}, #{requestParamInfo,jdbcType=LONGVARCHAR}, #{outputParamInfo,jdbcType=LONGVARCHAR}, + #{requestBody,jdbcType=LONGVARCHAR}, #{dubboParamJson,jdbcType=LONGVARCHAR}, #{checkPoint,jdbcType=LONGVARCHAR}, + #{filterCondition,jdbcType=LONGVARCHAR}, #{apiTspAuth,jdbcType=LONGVARCHAR}, #{apiTrafficInfo,jdbcType=LONGVARCHAR}, + #{apiX5Info,jdbcType=LONGVARCHAR}) + + + + SELECT LAST_INSERT_ID() + + insert into scene_api_info + + + scene_id, + + + api_order, + + + api_name, + + + source_type, + + + api_type, + + + request_method, + + + request_timeout, + + + need_login, + + + token_type, + + + content_type, + + + nacos_type, + + + service_name, + + + method_name, + + + param_type_list, + + + dubbo_group, + + + dubbo_version, + + + serial_link_id, + + + api_url, + + + api_header, + + + request_param_info, + + + output_param_info, + + + request_body, + + + dubbo_param_json, + + + check_point, + + + filter_condition, + + + api_tsp_auth, + + + api_traffic_info, + + + api_x5_info, + + + + + #{sceneId,jdbcType=INTEGER}, + + + #{apiOrder,jdbcType=INTEGER}, + + + #{apiName,jdbcType=VARCHAR}, + + + #{sourceType,jdbcType=INTEGER}, + + + #{apiType,jdbcType=INTEGER}, + + + #{requestMethod,jdbcType=INTEGER}, + + + #{requestTimeout,jdbcType=INTEGER}, + + + #{needLogin,jdbcType=BIT}, + + + #{tokenType,jdbcType=INTEGER}, + + + #{contentType,jdbcType=VARCHAR}, + + + #{nacosType,jdbcType=INTEGER}, + + + #{serviceName,jdbcType=VARCHAR}, + + + #{methodName,jdbcType=VARCHAR}, + + + #{paramTypeList,jdbcType=VARCHAR}, + + + #{dubboGroup,jdbcType=VARCHAR}, + + + #{dubboVersion,jdbcType=VARCHAR}, + + + #{serialLinkId,jdbcType=INTEGER}, + + + #{apiUrl,jdbcType=LONGVARCHAR}, + + + #{apiHeader,jdbcType=LONGVARCHAR}, + + + #{requestParamInfo,jdbcType=LONGVARCHAR}, + + + #{outputParamInfo,jdbcType=LONGVARCHAR}, + + + #{requestBody,jdbcType=LONGVARCHAR}, + + + #{dubboParamJson,jdbcType=LONGVARCHAR}, + + + #{checkPoint,jdbcType=LONGVARCHAR}, + + + #{filterCondition,jdbcType=LONGVARCHAR}, + + + #{apiTspAuth,jdbcType=LONGVARCHAR}, + + + #{apiTrafficInfo,jdbcType=LONGVARCHAR}, + + + #{apiX5Info,jdbcType=LONGVARCHAR}, + + + + + + update scene_api_info + + + id = #{record.id,jdbcType=INTEGER}, + + + scene_id = #{record.sceneId,jdbcType=INTEGER}, + + + api_order = #{record.apiOrder,jdbcType=INTEGER}, + + + api_name = #{record.apiName,jdbcType=VARCHAR}, + + + source_type = #{record.sourceType,jdbcType=INTEGER}, + + + api_type = #{record.apiType,jdbcType=INTEGER}, + + + request_method = #{record.requestMethod,jdbcType=INTEGER}, + + + request_timeout = #{record.requestTimeout,jdbcType=INTEGER}, + + + need_login = #{record.needLogin,jdbcType=BIT}, + + + token_type = #{record.tokenType,jdbcType=INTEGER}, + + + content_type = #{record.contentType,jdbcType=VARCHAR}, + + + nacos_type = #{record.nacosType,jdbcType=INTEGER}, + + + service_name = #{record.serviceName,jdbcType=VARCHAR}, + + + method_name = #{record.methodName,jdbcType=VARCHAR}, + + + param_type_list = #{record.paramTypeList,jdbcType=VARCHAR}, + + + dubbo_group = #{record.dubboGroup,jdbcType=VARCHAR}, + + + dubbo_version = #{record.dubboVersion,jdbcType=VARCHAR}, + + + serial_link_id = #{record.serialLinkId,jdbcType=INTEGER}, + + + api_url = #{record.apiUrl,jdbcType=LONGVARCHAR}, + + + api_header = #{record.apiHeader,jdbcType=LONGVARCHAR}, + + + request_param_info = #{record.requestParamInfo,jdbcType=LONGVARCHAR}, + + + output_param_info = #{record.outputParamInfo,jdbcType=LONGVARCHAR}, + + + request_body = #{record.requestBody,jdbcType=LONGVARCHAR}, + + + dubbo_param_json = #{record.dubboParamJson,jdbcType=LONGVARCHAR}, + + + check_point = #{record.checkPoint,jdbcType=LONGVARCHAR}, + + + filter_condition = #{record.filterCondition,jdbcType=LONGVARCHAR}, + + + api_tsp_auth = #{record.apiTspAuth,jdbcType=LONGVARCHAR}, + + + api_traffic_info = #{record.apiTrafficInfo,jdbcType=LONGVARCHAR}, + + + api_x5_info = #{record.apiX5Info,jdbcType=LONGVARCHAR}, + + + + + + + + update scene_api_info + set id = #{record.id,jdbcType=INTEGER}, + scene_id = #{record.sceneId,jdbcType=INTEGER}, + api_order = #{record.apiOrder,jdbcType=INTEGER}, + api_name = #{record.apiName,jdbcType=VARCHAR}, + source_type = #{record.sourceType,jdbcType=INTEGER}, + api_type = #{record.apiType,jdbcType=INTEGER}, + request_method = #{record.requestMethod,jdbcType=INTEGER}, + request_timeout = #{record.requestTimeout,jdbcType=INTEGER}, + need_login = #{record.needLogin,jdbcType=BIT}, + token_type = #{record.tokenType,jdbcType=INTEGER}, + content_type = #{record.contentType,jdbcType=VARCHAR}, + nacos_type = #{record.nacosType,jdbcType=INTEGER}, + service_name = #{record.serviceName,jdbcType=VARCHAR}, + method_name = #{record.methodName,jdbcType=VARCHAR}, + param_type_list = #{record.paramTypeList,jdbcType=VARCHAR}, + dubbo_group = #{record.dubboGroup,jdbcType=VARCHAR}, + dubbo_version = #{record.dubboVersion,jdbcType=VARCHAR}, + serial_link_id = #{record.serialLinkId,jdbcType=INTEGER}, + api_url = #{record.apiUrl,jdbcType=LONGVARCHAR}, + api_header = #{record.apiHeader,jdbcType=LONGVARCHAR}, + request_param_info = #{record.requestParamInfo,jdbcType=LONGVARCHAR}, + output_param_info = #{record.outputParamInfo,jdbcType=LONGVARCHAR}, + request_body = #{record.requestBody,jdbcType=LONGVARCHAR}, + dubbo_param_json = #{record.dubboParamJson,jdbcType=LONGVARCHAR}, + check_point = #{record.checkPoint,jdbcType=LONGVARCHAR}, + filter_condition = #{record.filterCondition,jdbcType=LONGVARCHAR}, + api_tsp_auth = #{record.apiTspAuth,jdbcType=LONGVARCHAR}, + api_traffic_info = #{record.apiTrafficInfo,jdbcType=LONGVARCHAR}, + api_x5_info = #{record.apiX5Info,jdbcType=LONGVARCHAR} + + + + + + update scene_api_info + set id = #{record.id,jdbcType=INTEGER}, + scene_id = #{record.sceneId,jdbcType=INTEGER}, + api_order = #{record.apiOrder,jdbcType=INTEGER}, + api_name = #{record.apiName,jdbcType=VARCHAR}, + source_type = #{record.sourceType,jdbcType=INTEGER}, + api_type = #{record.apiType,jdbcType=INTEGER}, + request_method = #{record.requestMethod,jdbcType=INTEGER}, + request_timeout = #{record.requestTimeout,jdbcType=INTEGER}, + need_login = #{record.needLogin,jdbcType=BIT}, + token_type = #{record.tokenType,jdbcType=INTEGER}, + content_type = #{record.contentType,jdbcType=VARCHAR}, + nacos_type = #{record.nacosType,jdbcType=INTEGER}, + service_name = #{record.serviceName,jdbcType=VARCHAR}, + method_name = #{record.methodName,jdbcType=VARCHAR}, + param_type_list = #{record.paramTypeList,jdbcType=VARCHAR}, + dubbo_group = #{record.dubboGroup,jdbcType=VARCHAR}, + dubbo_version = #{record.dubboVersion,jdbcType=VARCHAR}, + serial_link_id = #{record.serialLinkId,jdbcType=INTEGER} + + + + + + update scene_api_info + + + scene_id = #{sceneId,jdbcType=INTEGER}, + + + api_order = #{apiOrder,jdbcType=INTEGER}, + + + api_name = #{apiName,jdbcType=VARCHAR}, + + + source_type = #{sourceType,jdbcType=INTEGER}, + + + api_type = #{apiType,jdbcType=INTEGER}, + + + request_method = #{requestMethod,jdbcType=INTEGER}, + + + request_timeout = #{requestTimeout,jdbcType=INTEGER}, + + + need_login = #{needLogin,jdbcType=BIT}, + + + token_type = #{tokenType,jdbcType=INTEGER}, + + + content_type = #{contentType,jdbcType=VARCHAR}, + + + nacos_type = #{nacosType,jdbcType=INTEGER}, + + + service_name = #{serviceName,jdbcType=VARCHAR}, + + + method_name = #{methodName,jdbcType=VARCHAR}, + + + param_type_list = #{paramTypeList,jdbcType=VARCHAR}, + + + dubbo_group = #{dubboGroup,jdbcType=VARCHAR}, + + + dubbo_version = #{dubboVersion,jdbcType=VARCHAR}, + + + serial_link_id = #{serialLinkId,jdbcType=INTEGER}, + + + api_url = #{apiUrl,jdbcType=LONGVARCHAR}, + + + api_header = #{apiHeader,jdbcType=LONGVARCHAR}, + + + request_param_info = #{requestParamInfo,jdbcType=LONGVARCHAR}, + + + output_param_info = #{outputParamInfo,jdbcType=LONGVARCHAR}, + + + request_body = #{requestBody,jdbcType=LONGVARCHAR}, + + + dubbo_param_json = #{dubboParamJson,jdbcType=LONGVARCHAR}, + + + check_point = #{checkPoint,jdbcType=LONGVARCHAR}, + + + filter_condition = #{filterCondition,jdbcType=LONGVARCHAR}, + + + api_tsp_auth = #{apiTspAuth,jdbcType=LONGVARCHAR}, + + + api_traffic_info = #{apiTrafficInfo,jdbcType=LONGVARCHAR}, + + + api_x5_info = #{apiX5Info,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update scene_api_info + set scene_id = #{sceneId,jdbcType=INTEGER}, + api_order = #{apiOrder,jdbcType=INTEGER}, + api_name = #{apiName,jdbcType=VARCHAR}, + source_type = #{sourceType,jdbcType=INTEGER}, + api_type = #{apiType,jdbcType=INTEGER}, + request_method = #{requestMethod,jdbcType=INTEGER}, + request_timeout = #{requestTimeout,jdbcType=INTEGER}, + need_login = #{needLogin,jdbcType=BIT}, + token_type = #{tokenType,jdbcType=INTEGER}, + content_type = #{contentType,jdbcType=VARCHAR}, + nacos_type = #{nacosType,jdbcType=INTEGER}, + service_name = #{serviceName,jdbcType=VARCHAR}, + method_name = #{methodName,jdbcType=VARCHAR}, + param_type_list = #{paramTypeList,jdbcType=VARCHAR}, + dubbo_group = #{dubboGroup,jdbcType=VARCHAR}, + dubbo_version = #{dubboVersion,jdbcType=VARCHAR}, + serial_link_id = #{serialLinkId,jdbcType=INTEGER}, + api_url = #{apiUrl,jdbcType=LONGVARCHAR}, + api_header = #{apiHeader,jdbcType=LONGVARCHAR}, + request_param_info = #{requestParamInfo,jdbcType=LONGVARCHAR}, + output_param_info = #{outputParamInfo,jdbcType=LONGVARCHAR}, + request_body = #{requestBody,jdbcType=LONGVARCHAR}, + dubbo_param_json = #{dubboParamJson,jdbcType=LONGVARCHAR}, + check_point = #{checkPoint,jdbcType=LONGVARCHAR}, + filter_condition = #{filterCondition,jdbcType=LONGVARCHAR}, + api_tsp_auth = #{apiTspAuth,jdbcType=LONGVARCHAR}, + api_traffic_info = #{apiTrafficInfo,jdbcType=LONGVARCHAR}, + api_x5_info = #{apiX5Info,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=INTEGER} + + + update scene_api_info + set scene_id = #{sceneId,jdbcType=INTEGER}, + api_order = #{apiOrder,jdbcType=INTEGER}, + api_name = #{apiName,jdbcType=VARCHAR}, + source_type = #{sourceType,jdbcType=INTEGER}, + api_type = #{apiType,jdbcType=INTEGER}, + request_method = #{requestMethod,jdbcType=INTEGER}, + request_timeout = #{requestTimeout,jdbcType=INTEGER}, + need_login = #{needLogin,jdbcType=BIT}, + token_type = #{tokenType,jdbcType=INTEGER}, + content_type = #{contentType,jdbcType=VARCHAR}, + nacos_type = #{nacosType,jdbcType=INTEGER}, + service_name = #{serviceName,jdbcType=VARCHAR}, + method_name = #{methodName,jdbcType=VARCHAR}, + param_type_list = #{paramTypeList,jdbcType=VARCHAR}, + dubbo_group = #{dubboGroup,jdbcType=VARCHAR}, + dubbo_version = #{dubboVersion,jdbcType=VARCHAR}, + serial_link_id = #{serialLinkId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + + insert into scene_api_info + (scene_id, api_order, api_name, source_type, api_type, request_method, request_timeout, + need_login, token_type, content_type, nacos_type, service_name, method_name, param_type_list, + dubbo_group, dubbo_version, serial_link_id, api_url, api_header, request_param_info, + output_param_info, request_body, dubbo_param_json, check_point, filter_condition, + api_tsp_auth, api_traffic_info, api_x5_info) + values + + (#{item.sceneId,jdbcType=INTEGER}, #{item.apiOrder,jdbcType=INTEGER}, #{item.apiName,jdbcType=VARCHAR}, + #{item.sourceType,jdbcType=INTEGER}, #{item.apiType,jdbcType=INTEGER}, #{item.requestMethod,jdbcType=INTEGER}, + #{item.requestTimeout,jdbcType=INTEGER}, #{item.needLogin,jdbcType=BIT}, #{item.tokenType,jdbcType=INTEGER}, + #{item.contentType,jdbcType=VARCHAR}, #{item.nacosType,jdbcType=INTEGER}, #{item.serviceName,jdbcType=VARCHAR}, + #{item.methodName,jdbcType=VARCHAR}, #{item.paramTypeList,jdbcType=VARCHAR}, #{item.dubboGroup,jdbcType=VARCHAR}, + #{item.dubboVersion,jdbcType=VARCHAR}, #{item.serialLinkId,jdbcType=INTEGER}, #{item.apiUrl,jdbcType=LONGVARCHAR}, + #{item.apiHeader,jdbcType=LONGVARCHAR}, #{item.requestParamInfo,jdbcType=LONGVARCHAR}, + #{item.outputParamInfo,jdbcType=LONGVARCHAR}, #{item.requestBody,jdbcType=LONGVARCHAR}, + #{item.dubboParamJson,jdbcType=LONGVARCHAR}, #{item.checkPoint,jdbcType=LONGVARCHAR}, + #{item.filterCondition,jdbcType=LONGVARCHAR}, #{item.apiTspAuth,jdbcType=LONGVARCHAR}, + #{item.apiTrafficInfo,jdbcType=LONGVARCHAR}, #{item.apiX5Info,jdbcType=LONGVARCHAR} + ) + + + + insert into scene_api_info ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.sceneId,jdbcType=INTEGER} + + + #{item.apiOrder,jdbcType=INTEGER} + + + #{item.apiName,jdbcType=VARCHAR} + + + #{item.sourceType,jdbcType=INTEGER} + + + #{item.apiType,jdbcType=INTEGER} + + + #{item.requestMethod,jdbcType=INTEGER} + + + #{item.requestTimeout,jdbcType=INTEGER} + + + #{item.needLogin,jdbcType=BIT} + + + #{item.tokenType,jdbcType=INTEGER} + + + #{item.contentType,jdbcType=VARCHAR} + + + #{item.nacosType,jdbcType=INTEGER} + + + #{item.serviceName,jdbcType=VARCHAR} + + + #{item.methodName,jdbcType=VARCHAR} + + + #{item.paramTypeList,jdbcType=VARCHAR} + + + #{item.dubboGroup,jdbcType=VARCHAR} + + + #{item.dubboVersion,jdbcType=VARCHAR} + + + #{item.serialLinkId,jdbcType=INTEGER} + + + #{item.apiUrl,jdbcType=LONGVARCHAR} + + + #{item.apiHeader,jdbcType=LONGVARCHAR} + + + #{item.requestParamInfo,jdbcType=LONGVARCHAR} + + + #{item.outputParamInfo,jdbcType=LONGVARCHAR} + + + #{item.requestBody,jdbcType=LONGVARCHAR} + + + #{item.dubboParamJson,jdbcType=LONGVARCHAR} + + + #{item.checkPoint,jdbcType=LONGVARCHAR} + + + #{item.filterCondition,jdbcType=LONGVARCHAR} + + + #{item.apiTspAuth,jdbcType=LONGVARCHAR} + + + #{item.apiTrafficInfo,jdbcType=LONGVARCHAR} + + + #{item.apiX5Info,jdbcType=LONGVARCHAR} + + + ) + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SceneGroupMapper.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SceneGroupMapper.xml new file mode 100644 index 000000000..58c38c59c --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SceneGroupMapper.xml @@ -0,0 +1,264 @@ + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, group_name, group_desc, creator, ctime, tenant + + + + + delete from scene_group + where id = #{id,jdbcType=INTEGER} + + + delete from scene_group + + + + + + + SELECT LAST_INSERT_ID() + + insert into scene_group (group_name, group_desc, creator, + ctime, tenant) + values (#{groupName,jdbcType=VARCHAR}, #{groupDesc,jdbcType=VARCHAR}, #{creator,jdbcType=VARCHAR}, + #{ctime,jdbcType=BIGINT}, #{tenant,jdbcType=VARCHAR}) + + + + SELECT LAST_INSERT_ID() + + insert into scene_group + + + group_name, + + + group_desc, + + + creator, + + + ctime, + + + tenant, + + + + + #{groupName,jdbcType=VARCHAR}, + + + #{groupDesc,jdbcType=VARCHAR}, + + + #{creator,jdbcType=VARCHAR}, + + + #{ctime,jdbcType=BIGINT}, + + + #{tenant,jdbcType=VARCHAR}, + + + + + + update scene_group + + + id = #{record.id,jdbcType=INTEGER}, + + + group_name = #{record.groupName,jdbcType=VARCHAR}, + + + group_desc = #{record.groupDesc,jdbcType=VARCHAR}, + + + creator = #{record.creator,jdbcType=VARCHAR}, + + + ctime = #{record.ctime,jdbcType=BIGINT}, + + + tenant = #{record.tenant,jdbcType=VARCHAR}, + + + + + + + + update scene_group + set id = #{record.id,jdbcType=INTEGER}, + group_name = #{record.groupName,jdbcType=VARCHAR}, + group_desc = #{record.groupDesc,jdbcType=VARCHAR}, + creator = #{record.creator,jdbcType=VARCHAR}, + ctime = #{record.ctime,jdbcType=BIGINT}, + tenant = #{record.tenant,jdbcType=VARCHAR} + + + + + + update scene_group + + + group_name = #{groupName,jdbcType=VARCHAR}, + + + group_desc = #{groupDesc,jdbcType=VARCHAR}, + + + creator = #{creator,jdbcType=VARCHAR}, + + + ctime = #{ctime,jdbcType=BIGINT}, + + + tenant = #{tenant,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update scene_group + set group_name = #{groupName,jdbcType=VARCHAR}, + group_desc = #{groupDesc,jdbcType=VARCHAR}, + creator = #{creator,jdbcType=VARCHAR}, + ctime = #{ctime,jdbcType=BIGINT}, + tenant = #{tenant,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + + insert into scene_group + (group_name, group_desc, creator, ctime, tenant) + values + + (#{item.groupName,jdbcType=VARCHAR}, #{item.groupDesc,jdbcType=VARCHAR}, #{item.creator,jdbcType=VARCHAR}, + #{item.ctime,jdbcType=BIGINT}, #{item.tenant,jdbcType=VARCHAR}) + + + + insert into scene_group ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.groupName,jdbcType=VARCHAR} + + + #{item.groupDesc,jdbcType=VARCHAR} + + + #{item.creator,jdbcType=VARCHAR} + + + #{item.ctime,jdbcType=BIGINT} + + + #{item.tenant,jdbcType=VARCHAR} + + + ) + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SceneInfoMapper.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SceneInfoMapper.xml new file mode 100644 index 000000000..3bb45792b --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SceneInfoMapper.xml @@ -0,0 +1,891 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, name, scene_status, creator, updator, apiNum, remark, scene_type, bench_mode, + Increment_mode, increase_percent, bench_time, max_bench_qps, rps_rate, log_rate, + request_timeout, success_code, ctime, utime, scene_group_id, cur_report_id, scene_env, + tenant, bench_count, scene_source, last_bench_time + + + api_bench_infos, sla, global_header, agent_list, ref_dataset_ids, person_in_charge, + bench_calendar, global_tsp_auth + + + + + + delete from scene_info + where id = #{id,jdbcType=INTEGER} + + + delete from scene_info + + + + + + + SELECT LAST_INSERT_ID() + + insert into scene_info (name, scene_status, creator, + updator, apiNum, remark, + scene_type, bench_mode, Increment_mode, + increase_percent, bench_time, max_bench_qps, + rps_rate, log_rate, request_timeout, + success_code, ctime, utime, + scene_group_id, cur_report_id, scene_env, + tenant, bench_count, scene_source, + last_bench_time, api_bench_infos, sla, + global_header, agent_list, ref_dataset_ids, + person_in_charge, bench_calendar, + global_tsp_auth) + values (#{name,jdbcType=VARCHAR}, #{sceneStatus,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR}, + #{updator,jdbcType=VARCHAR}, #{apinum,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, + #{sceneType,jdbcType=INTEGER}, #{benchMode,jdbcType=INTEGER}, #{incrementMode,jdbcType=INTEGER}, + #{increasePercent,jdbcType=INTEGER}, #{benchTime,jdbcType=INTEGER}, #{maxBenchQps,jdbcType=INTEGER}, + #{rpsRate,jdbcType=INTEGER}, #{logRate,jdbcType=INTEGER}, #{requestTimeout,jdbcType=INTEGER}, + #{successCode,jdbcType=VARCHAR}, #{ctime,jdbcType=BIGINT}, #{utime,jdbcType=BIGINT}, + #{sceneGroupId,jdbcType=INTEGER}, #{curReportId,jdbcType=VARCHAR}, #{sceneEnv,jdbcType=INTEGER}, + #{tenant,jdbcType=VARCHAR}, #{benchCount,jdbcType=INTEGER}, #{sceneSource,jdbcType=INTEGER}, + #{lastBenchTime,jdbcType=BIGINT}, #{apiBenchInfos,jdbcType=LONGVARCHAR}, #{sla,jdbcType=LONGVARCHAR}, + #{globalHeader,jdbcType=LONGVARCHAR}, #{agentList,jdbcType=LONGVARCHAR}, #{refDatasetIds,jdbcType=LONGVARCHAR}, + #{personInCharge,jdbcType=LONGVARCHAR}, #{benchCalendar,jdbcType=LONGVARCHAR}, + #{globalTspAuth,jdbcType=LONGVARCHAR}) + + + + SELECT LAST_INSERT_ID() + + insert into scene_info + + + name, + + + scene_status, + + + creator, + + + updator, + + + apiNum, + + + remark, + + + scene_type, + + + bench_mode, + + + Increment_mode, + + + increase_percent, + + + bench_time, + + + max_bench_qps, + + + rps_rate, + + + log_rate, + + + request_timeout, + + + success_code, + + + ctime, + + + utime, + + + scene_group_id, + + + cur_report_id, + + + scene_env, + + + tenant, + + + bench_count, + + + scene_source, + + + last_bench_time, + + + api_bench_infos, + + + sla, + + + global_header, + + + agent_list, + + + ref_dataset_ids, + + + person_in_charge, + + + bench_calendar, + + + global_tsp_auth, + + + + + #{name,jdbcType=VARCHAR}, + + + #{sceneStatus,jdbcType=INTEGER}, + + + #{creator,jdbcType=VARCHAR}, + + + #{updator,jdbcType=VARCHAR}, + + + #{apinum,jdbcType=INTEGER}, + + + #{remark,jdbcType=VARCHAR}, + + + #{sceneType,jdbcType=INTEGER}, + + + #{benchMode,jdbcType=INTEGER}, + + + #{incrementMode,jdbcType=INTEGER}, + + + #{increasePercent,jdbcType=INTEGER}, + + + #{benchTime,jdbcType=INTEGER}, + + + #{maxBenchQps,jdbcType=INTEGER}, + + + #{rpsRate,jdbcType=INTEGER}, + + + #{logRate,jdbcType=INTEGER}, + + + #{requestTimeout,jdbcType=INTEGER}, + + + #{successCode,jdbcType=VARCHAR}, + + + #{ctime,jdbcType=BIGINT}, + + + #{utime,jdbcType=BIGINT}, + + + #{sceneGroupId,jdbcType=INTEGER}, + + + #{curReportId,jdbcType=VARCHAR}, + + + #{sceneEnv,jdbcType=INTEGER}, + + + #{tenant,jdbcType=VARCHAR}, + + + #{benchCount,jdbcType=INTEGER}, + + + #{sceneSource,jdbcType=INTEGER}, + + + #{lastBenchTime,jdbcType=BIGINT}, + + + #{apiBenchInfos,jdbcType=LONGVARCHAR}, + + + #{sla,jdbcType=LONGVARCHAR}, + + + #{globalHeader,jdbcType=LONGVARCHAR}, + + + #{agentList,jdbcType=LONGVARCHAR}, + + + #{refDatasetIds,jdbcType=LONGVARCHAR}, + + + #{personInCharge,jdbcType=LONGVARCHAR}, + + + #{benchCalendar,jdbcType=LONGVARCHAR}, + + + #{globalTspAuth,jdbcType=LONGVARCHAR}, + + + + + + update scene_info + + + id = #{record.id,jdbcType=INTEGER}, + + + name = #{record.name,jdbcType=VARCHAR}, + + + scene_status = #{record.sceneStatus,jdbcType=INTEGER}, + + + creator = #{record.creator,jdbcType=VARCHAR}, + + + updator = #{record.updator,jdbcType=VARCHAR}, + + + apiNum = #{record.apinum,jdbcType=INTEGER}, + + + remark = #{record.remark,jdbcType=VARCHAR}, + + + scene_type = #{record.sceneType,jdbcType=INTEGER}, + + + bench_mode = #{record.benchMode,jdbcType=INTEGER}, + + + Increment_mode = #{record.incrementMode,jdbcType=INTEGER}, + + + increase_percent = #{record.increasePercent,jdbcType=INTEGER}, + + + bench_time = #{record.benchTime,jdbcType=INTEGER}, + + + max_bench_qps = #{record.maxBenchQps,jdbcType=INTEGER}, + + + rps_rate = #{record.rpsRate,jdbcType=INTEGER}, + + + log_rate = #{record.logRate,jdbcType=INTEGER}, + + + request_timeout = #{record.requestTimeout,jdbcType=INTEGER}, + + + success_code = #{record.successCode,jdbcType=VARCHAR}, + + + ctime = #{record.ctime,jdbcType=BIGINT}, + + + utime = #{record.utime,jdbcType=BIGINT}, + + + scene_group_id = #{record.sceneGroupId,jdbcType=INTEGER}, + + + cur_report_id = #{record.curReportId,jdbcType=VARCHAR}, + + + scene_env = #{record.sceneEnv,jdbcType=INTEGER}, + + + tenant = #{record.tenant,jdbcType=VARCHAR}, + + + bench_count = #{record.benchCount,jdbcType=INTEGER}, + + + scene_source = #{record.sceneSource,jdbcType=INTEGER}, + + + last_bench_time = #{record.lastBenchTime,jdbcType=BIGINT}, + + + api_bench_infos = #{record.apiBenchInfos,jdbcType=LONGVARCHAR}, + + + sla = #{record.sla,jdbcType=LONGVARCHAR}, + + + global_header = #{record.globalHeader,jdbcType=LONGVARCHAR}, + + + agent_list = #{record.agentList,jdbcType=LONGVARCHAR}, + + + ref_dataset_ids = #{record.refDatasetIds,jdbcType=LONGVARCHAR}, + + + person_in_charge = #{record.personInCharge,jdbcType=LONGVARCHAR}, + + + bench_calendar = #{record.benchCalendar,jdbcType=LONGVARCHAR}, + + + global_tsp_auth = #{record.globalTspAuth,jdbcType=LONGVARCHAR}, + + + + + + + + update scene_info + set id = #{record.id,jdbcType=INTEGER}, + name = #{record.name,jdbcType=VARCHAR}, + scene_status = #{record.sceneStatus,jdbcType=INTEGER}, + creator = #{record.creator,jdbcType=VARCHAR}, + updator = #{record.updator,jdbcType=VARCHAR}, + apiNum = #{record.apinum,jdbcType=INTEGER}, + remark = #{record.remark,jdbcType=VARCHAR}, + scene_type = #{record.sceneType,jdbcType=INTEGER}, + bench_mode = #{record.benchMode,jdbcType=INTEGER}, + Increment_mode = #{record.incrementMode,jdbcType=INTEGER}, + increase_percent = #{record.increasePercent,jdbcType=INTEGER}, + bench_time = #{record.benchTime,jdbcType=INTEGER}, + max_bench_qps = #{record.maxBenchQps,jdbcType=INTEGER}, + rps_rate = #{record.rpsRate,jdbcType=INTEGER}, + log_rate = #{record.logRate,jdbcType=INTEGER}, + request_timeout = #{record.requestTimeout,jdbcType=INTEGER}, + success_code = #{record.successCode,jdbcType=VARCHAR}, + ctime = #{record.ctime,jdbcType=BIGINT}, + utime = #{record.utime,jdbcType=BIGINT}, + scene_group_id = #{record.sceneGroupId,jdbcType=INTEGER}, + cur_report_id = #{record.curReportId,jdbcType=VARCHAR}, + scene_env = #{record.sceneEnv,jdbcType=INTEGER}, + tenant = #{record.tenant,jdbcType=VARCHAR}, + bench_count = #{record.benchCount,jdbcType=INTEGER}, + scene_source = #{record.sceneSource,jdbcType=INTEGER}, + last_bench_time = #{record.lastBenchTime,jdbcType=BIGINT}, + api_bench_infos = #{record.apiBenchInfos,jdbcType=LONGVARCHAR}, + sla = #{record.sla,jdbcType=LONGVARCHAR}, + global_header = #{record.globalHeader,jdbcType=LONGVARCHAR}, + agent_list = #{record.agentList,jdbcType=LONGVARCHAR}, + ref_dataset_ids = #{record.refDatasetIds,jdbcType=LONGVARCHAR}, + person_in_charge = #{record.personInCharge,jdbcType=LONGVARCHAR}, + bench_calendar = #{record.benchCalendar,jdbcType=LONGVARCHAR}, + global_tsp_auth = #{record.globalTspAuth,jdbcType=LONGVARCHAR} + + + + + + update scene_info + set id = #{record.id,jdbcType=INTEGER}, + name = #{record.name,jdbcType=VARCHAR}, + scene_status = #{record.sceneStatus,jdbcType=INTEGER}, + creator = #{record.creator,jdbcType=VARCHAR}, + updator = #{record.updator,jdbcType=VARCHAR}, + apiNum = #{record.apinum,jdbcType=INTEGER}, + remark = #{record.remark,jdbcType=VARCHAR}, + scene_type = #{record.sceneType,jdbcType=INTEGER}, + bench_mode = #{record.benchMode,jdbcType=INTEGER}, + Increment_mode = #{record.incrementMode,jdbcType=INTEGER}, + increase_percent = #{record.increasePercent,jdbcType=INTEGER}, + bench_time = #{record.benchTime,jdbcType=INTEGER}, + max_bench_qps = #{record.maxBenchQps,jdbcType=INTEGER}, + rps_rate = #{record.rpsRate,jdbcType=INTEGER}, + log_rate = #{record.logRate,jdbcType=INTEGER}, + request_timeout = #{record.requestTimeout,jdbcType=INTEGER}, + success_code = #{record.successCode,jdbcType=VARCHAR}, + ctime = #{record.ctime,jdbcType=BIGINT}, + utime = #{record.utime,jdbcType=BIGINT}, + scene_group_id = #{record.sceneGroupId,jdbcType=INTEGER}, + cur_report_id = #{record.curReportId,jdbcType=VARCHAR}, + scene_env = #{record.sceneEnv,jdbcType=INTEGER}, + tenant = #{record.tenant,jdbcType=VARCHAR}, + bench_count = #{record.benchCount,jdbcType=INTEGER}, + scene_source = #{record.sceneSource,jdbcType=INTEGER}, + last_bench_time = #{record.lastBenchTime,jdbcType=BIGINT} + + + + + + update scene_info + + + name = #{name,jdbcType=VARCHAR}, + + + scene_status = #{sceneStatus,jdbcType=INTEGER}, + + + creator = #{creator,jdbcType=VARCHAR}, + + + updator = #{updator,jdbcType=VARCHAR}, + + + apiNum = #{apinum,jdbcType=INTEGER}, + + + remark = #{remark,jdbcType=VARCHAR}, + + + scene_type = #{sceneType,jdbcType=INTEGER}, + + + bench_mode = #{benchMode,jdbcType=INTEGER}, + + + Increment_mode = #{incrementMode,jdbcType=INTEGER}, + + + increase_percent = #{increasePercent,jdbcType=INTEGER}, + + + bench_time = #{benchTime,jdbcType=INTEGER}, + + + max_bench_qps = #{maxBenchQps,jdbcType=INTEGER}, + + + rps_rate = #{rpsRate,jdbcType=INTEGER}, + + + log_rate = #{logRate,jdbcType=INTEGER}, + + + request_timeout = #{requestTimeout,jdbcType=INTEGER}, + + + success_code = #{successCode,jdbcType=VARCHAR}, + + + ctime = #{ctime,jdbcType=BIGINT}, + + + utime = #{utime,jdbcType=BIGINT}, + + + scene_group_id = #{sceneGroupId,jdbcType=INTEGER}, + + + cur_report_id = #{curReportId,jdbcType=VARCHAR}, + + + scene_env = #{sceneEnv,jdbcType=INTEGER}, + + + tenant = #{tenant,jdbcType=VARCHAR}, + + + bench_count = #{benchCount,jdbcType=INTEGER}, + + + scene_source = #{sceneSource,jdbcType=INTEGER}, + + + last_bench_time = #{lastBenchTime,jdbcType=BIGINT}, + + + api_bench_infos = #{apiBenchInfos,jdbcType=LONGVARCHAR}, + + + sla = #{sla,jdbcType=LONGVARCHAR}, + + + global_header = #{globalHeader,jdbcType=LONGVARCHAR}, + + + agent_list = #{agentList,jdbcType=LONGVARCHAR}, + + + ref_dataset_ids = #{refDatasetIds,jdbcType=LONGVARCHAR}, + + + person_in_charge = #{personInCharge,jdbcType=LONGVARCHAR}, + + + bench_calendar = #{benchCalendar,jdbcType=LONGVARCHAR}, + + + global_tsp_auth = #{globalTspAuth,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update scene_info + set name = #{name,jdbcType=VARCHAR}, + scene_status = #{sceneStatus,jdbcType=INTEGER}, + creator = #{creator,jdbcType=VARCHAR}, + updator = #{updator,jdbcType=VARCHAR}, + apiNum = #{apinum,jdbcType=INTEGER}, + remark = #{remark,jdbcType=VARCHAR}, + scene_type = #{sceneType,jdbcType=INTEGER}, + bench_mode = #{benchMode,jdbcType=INTEGER}, + Increment_mode = #{incrementMode,jdbcType=INTEGER}, + increase_percent = #{increasePercent,jdbcType=INTEGER}, + bench_time = #{benchTime,jdbcType=INTEGER}, + max_bench_qps = #{maxBenchQps,jdbcType=INTEGER}, + rps_rate = #{rpsRate,jdbcType=INTEGER}, + log_rate = #{logRate,jdbcType=INTEGER}, + request_timeout = #{requestTimeout,jdbcType=INTEGER}, + success_code = #{successCode,jdbcType=VARCHAR}, + ctime = #{ctime,jdbcType=BIGINT}, + utime = #{utime,jdbcType=BIGINT}, + scene_group_id = #{sceneGroupId,jdbcType=INTEGER}, + cur_report_id = #{curReportId,jdbcType=VARCHAR}, + scene_env = #{sceneEnv,jdbcType=INTEGER}, + tenant = #{tenant,jdbcType=VARCHAR}, + bench_count = #{benchCount,jdbcType=INTEGER}, + scene_source = #{sceneSource,jdbcType=INTEGER}, + last_bench_time = #{lastBenchTime,jdbcType=BIGINT}, + api_bench_infos = #{apiBenchInfos,jdbcType=LONGVARCHAR}, + sla = #{sla,jdbcType=LONGVARCHAR}, + global_header = #{globalHeader,jdbcType=LONGVARCHAR}, + agent_list = #{agentList,jdbcType=LONGVARCHAR}, + ref_dataset_ids = #{refDatasetIds,jdbcType=LONGVARCHAR}, + person_in_charge = #{personInCharge,jdbcType=LONGVARCHAR}, + bench_calendar = #{benchCalendar,jdbcType=LONGVARCHAR}, + global_tsp_auth = #{globalTspAuth,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=INTEGER} + + + update scene_info + set name = #{name,jdbcType=VARCHAR}, + scene_status = #{sceneStatus,jdbcType=INTEGER}, + creator = #{creator,jdbcType=VARCHAR}, + updator = #{updator,jdbcType=VARCHAR}, + apiNum = #{apinum,jdbcType=INTEGER}, + remark = #{remark,jdbcType=VARCHAR}, + scene_type = #{sceneType,jdbcType=INTEGER}, + bench_mode = #{benchMode,jdbcType=INTEGER}, + Increment_mode = #{incrementMode,jdbcType=INTEGER}, + increase_percent = #{increasePercent,jdbcType=INTEGER}, + bench_time = #{benchTime,jdbcType=INTEGER}, + max_bench_qps = #{maxBenchQps,jdbcType=INTEGER}, + rps_rate = #{rpsRate,jdbcType=INTEGER}, + log_rate = #{logRate,jdbcType=INTEGER}, + request_timeout = #{requestTimeout,jdbcType=INTEGER}, + success_code = #{successCode,jdbcType=VARCHAR}, + ctime = #{ctime,jdbcType=BIGINT}, + utime = #{utime,jdbcType=BIGINT}, + scene_group_id = #{sceneGroupId,jdbcType=INTEGER}, + cur_report_id = #{curReportId,jdbcType=VARCHAR}, + scene_env = #{sceneEnv,jdbcType=INTEGER}, + tenant = #{tenant,jdbcType=VARCHAR}, + bench_count = #{benchCount,jdbcType=INTEGER}, + scene_source = #{sceneSource,jdbcType=INTEGER}, + last_bench_time = #{lastBenchTime,jdbcType=BIGINT} + where id = #{id,jdbcType=INTEGER} + + + insert into scene_info + (name, scene_status, creator, updator, apiNum, remark, scene_type, bench_mode, Increment_mode, + increase_percent, bench_time, max_bench_qps, rps_rate, log_rate, request_timeout, + success_code, ctime, utime, scene_group_id, cur_report_id, scene_env, tenant, bench_count, + scene_source, last_bench_time, api_bench_infos, sla, global_header, agent_list, + ref_dataset_ids, person_in_charge, bench_calendar, global_tsp_auth) + values + + (#{item.name,jdbcType=VARCHAR}, #{item.sceneStatus,jdbcType=INTEGER}, #{item.creator,jdbcType=VARCHAR}, + #{item.updator,jdbcType=VARCHAR}, #{item.apinum,jdbcType=INTEGER}, #{item.remark,jdbcType=VARCHAR}, + #{item.sceneType,jdbcType=INTEGER}, #{item.benchMode,jdbcType=INTEGER}, #{item.incrementMode,jdbcType=INTEGER}, + #{item.increasePercent,jdbcType=INTEGER}, #{item.benchTime,jdbcType=INTEGER}, #{item.maxBenchQps,jdbcType=INTEGER}, + #{item.rpsRate,jdbcType=INTEGER}, #{item.logRate,jdbcType=INTEGER}, #{item.requestTimeout,jdbcType=INTEGER}, + #{item.successCode,jdbcType=VARCHAR}, #{item.ctime,jdbcType=BIGINT}, #{item.utime,jdbcType=BIGINT}, + #{item.sceneGroupId,jdbcType=INTEGER}, #{item.curReportId,jdbcType=VARCHAR}, #{item.sceneEnv,jdbcType=INTEGER}, + #{item.tenant,jdbcType=VARCHAR}, #{item.benchCount,jdbcType=INTEGER}, #{item.sceneSource,jdbcType=INTEGER}, + #{item.lastBenchTime,jdbcType=BIGINT}, #{item.apiBenchInfos,jdbcType=LONGVARCHAR}, + #{item.sla,jdbcType=LONGVARCHAR}, #{item.globalHeader,jdbcType=LONGVARCHAR}, #{item.agentList,jdbcType=LONGVARCHAR}, + #{item.refDatasetIds,jdbcType=LONGVARCHAR}, #{item.personInCharge,jdbcType=LONGVARCHAR}, + #{item.benchCalendar,jdbcType=LONGVARCHAR}, #{item.globalTspAuth,jdbcType=LONGVARCHAR} + ) + + + + insert into scene_info ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.name,jdbcType=VARCHAR} + + + #{item.sceneStatus,jdbcType=INTEGER} + + + #{item.creator,jdbcType=VARCHAR} + + + #{item.updator,jdbcType=VARCHAR} + + + #{item.apinum,jdbcType=INTEGER} + + + #{item.remark,jdbcType=VARCHAR} + + + #{item.sceneType,jdbcType=INTEGER} + + + #{item.benchMode,jdbcType=INTEGER} + + + #{item.incrementMode,jdbcType=INTEGER} + + + #{item.increasePercent,jdbcType=INTEGER} + + + #{item.benchTime,jdbcType=INTEGER} + + + #{item.maxBenchQps,jdbcType=INTEGER} + + + #{item.rpsRate,jdbcType=INTEGER} + + + #{item.logRate,jdbcType=INTEGER} + + + #{item.requestTimeout,jdbcType=INTEGER} + + + #{item.successCode,jdbcType=VARCHAR} + + + #{item.ctime,jdbcType=BIGINT} + + + #{item.utime,jdbcType=BIGINT} + + + #{item.sceneGroupId,jdbcType=INTEGER} + + + #{item.curReportId,jdbcType=VARCHAR} + + + #{item.sceneEnv,jdbcType=INTEGER} + + + #{item.tenant,jdbcType=VARCHAR} + + + #{item.benchCount,jdbcType=INTEGER} + + + #{item.sceneSource,jdbcType=INTEGER} + + + #{item.lastBenchTime,jdbcType=BIGINT} + + + #{item.apiBenchInfos,jdbcType=LONGVARCHAR} + + + #{item.sla,jdbcType=LONGVARCHAR} + + + #{item.globalHeader,jdbcType=LONGVARCHAR} + + + #{item.agentList,jdbcType=LONGVARCHAR} + + + #{item.refDatasetIds,jdbcType=LONGVARCHAR} + + + #{item.personInCharge,jdbcType=LONGVARCHAR} + + + #{item.benchCalendar,jdbcType=LONGVARCHAR} + + + #{item.globalTspAuth,jdbcType=LONGVARCHAR} + + + ) + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SceneSnapshotMapper.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SceneSnapshotMapper.xml new file mode 100644 index 000000000..ab2357986 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SceneSnapshotMapper.xml @@ -0,0 +1,393 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, scene_id, snapshot_id, create_time, update_time, create_by, version, md5, type + + + scene + + + + + + delete from scene_snapshot + where id = #{id,jdbcType=BIGINT} + + + delete from scene_snapshot + + + + + + + SELECT LAST_INSERT_ID() + + insert into scene_snapshot (scene_id, snapshot_id, create_time, + update_time, create_by, version, + md5, type, scene + ) + values (#{sceneId,jdbcType=BIGINT}, #{snapshotId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, + #{updateTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=VARCHAR}, #{version,jdbcType=INTEGER}, + #{md5,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{scene,jdbcType=LONGVARCHAR} + ) + + + + SELECT LAST_INSERT_ID() + + insert into scene_snapshot + + + scene_id, + + + snapshot_id, + + + create_time, + + + update_time, + + + create_by, + + + version, + + + md5, + + + type, + + + scene, + + + + + #{sceneId,jdbcType=BIGINT}, + + + #{snapshotId,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{createBy,jdbcType=VARCHAR}, + + + #{version,jdbcType=INTEGER}, + + + #{md5,jdbcType=VARCHAR}, + + + #{type,jdbcType=INTEGER}, + + + #{scene,jdbcType=LONGVARCHAR}, + + + + + + update scene_snapshot + + + id = #{record.id,jdbcType=BIGINT}, + + + scene_id = #{record.sceneId,jdbcType=BIGINT}, + + + snapshot_id = #{record.snapshotId,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + + + create_by = #{record.createBy,jdbcType=VARCHAR}, + + + version = #{record.version,jdbcType=INTEGER}, + + + md5 = #{record.md5,jdbcType=VARCHAR}, + + + type = #{record.type,jdbcType=INTEGER}, + + + scene = #{record.scene,jdbcType=LONGVARCHAR}, + + + + + + + + update scene_snapshot + set id = #{record.id,jdbcType=BIGINT}, + scene_id = #{record.sceneId,jdbcType=BIGINT}, + snapshot_id = #{record.snapshotId,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + create_by = #{record.createBy,jdbcType=VARCHAR}, + version = #{record.version,jdbcType=INTEGER}, + md5 = #{record.md5,jdbcType=VARCHAR}, + type = #{record.type,jdbcType=INTEGER}, + scene = #{record.scene,jdbcType=LONGVARCHAR} + + + + + + update scene_snapshot + set id = #{record.id,jdbcType=BIGINT}, + scene_id = #{record.sceneId,jdbcType=BIGINT}, + snapshot_id = #{record.snapshotId,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + create_by = #{record.createBy,jdbcType=VARCHAR}, + version = #{record.version,jdbcType=INTEGER}, + md5 = #{record.md5,jdbcType=VARCHAR}, + type = #{record.type,jdbcType=INTEGER} + + + + + + update scene_snapshot + + + scene_id = #{sceneId,jdbcType=BIGINT}, + + + snapshot_id = #{snapshotId,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + create_by = #{createBy,jdbcType=VARCHAR}, + + + version = #{version,jdbcType=INTEGER}, + + + md5 = #{md5,jdbcType=VARCHAR}, + + + type = #{type,jdbcType=INTEGER}, + + + scene = #{scene,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + update scene_snapshot + set scene_id = #{sceneId,jdbcType=BIGINT}, + snapshot_id = #{snapshotId,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + create_by = #{createBy,jdbcType=VARCHAR}, + version = #{version,jdbcType=INTEGER}, + md5 = #{md5,jdbcType=VARCHAR}, + type = #{type,jdbcType=INTEGER}, + scene = #{scene,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=BIGINT} + + + update scene_snapshot + set scene_id = #{sceneId,jdbcType=BIGINT}, + snapshot_id = #{snapshotId,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + create_by = #{createBy,jdbcType=VARCHAR}, + version = #{version,jdbcType=INTEGER}, + md5 = #{md5,jdbcType=VARCHAR}, + type = #{type,jdbcType=INTEGER} + where id = #{id,jdbcType=BIGINT} + + + insert into scene_snapshot + (scene_id, snapshot_id, create_time, update_time, create_by, version, md5, type, + scene) + values + + (#{item.sceneId,jdbcType=BIGINT}, #{item.snapshotId,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}, + #{item.updateTime,jdbcType=TIMESTAMP}, #{item.createBy,jdbcType=VARCHAR}, #{item.version,jdbcType=INTEGER}, + #{item.md5,jdbcType=VARCHAR}, #{item.type,jdbcType=INTEGER}, #{item.scene,jdbcType=LONGVARCHAR} + ) + + + + insert into scene_snapshot ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.sceneId,jdbcType=BIGINT} + + + #{item.snapshotId,jdbcType=VARCHAR} + + + #{item.createTime,jdbcType=TIMESTAMP} + + + #{item.updateTime,jdbcType=TIMESTAMP} + + + #{item.createBy,jdbcType=VARCHAR} + + + #{item.version,jdbcType=INTEGER} + + + #{item.md5,jdbcType=VARCHAR} + + + #{item.type,jdbcType=INTEGER} + + + #{item.scene,jdbcType=LONGVARCHAR} + + + ) + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SerialLinkMapper.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SerialLinkMapper.xml new file mode 100644 index 000000000..999f8167e --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SerialLinkMapper.xml @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, name, scene_id, enable + + + + + delete from serial_link + where id = #{id,jdbcType=INTEGER} + + + delete from serial_link + + + + + + + SELECT LAST_INSERT_ID() + + insert into serial_link (name, scene_id, enable + ) + values (#{name,jdbcType=VARCHAR}, #{sceneId,jdbcType=INTEGER}, #{enable,jdbcType=BIT} + ) + + + + SELECT LAST_INSERT_ID() + + insert into serial_link + + + name, + + + scene_id, + + + enable, + + + + + #{name,jdbcType=VARCHAR}, + + + #{sceneId,jdbcType=INTEGER}, + + + #{enable,jdbcType=BIT}, + + + + + + update serial_link + + + id = #{record.id,jdbcType=INTEGER}, + + + name = #{record.name,jdbcType=VARCHAR}, + + + scene_id = #{record.sceneId,jdbcType=INTEGER}, + + + enable = #{record.enable,jdbcType=BIT}, + + + + + + + + update serial_link + set id = #{record.id,jdbcType=INTEGER}, + name = #{record.name,jdbcType=VARCHAR}, + scene_id = #{record.sceneId,jdbcType=INTEGER}, + enable = #{record.enable,jdbcType=BIT} + + + + + + update serial_link + + + name = #{name,jdbcType=VARCHAR}, + + + scene_id = #{sceneId,jdbcType=INTEGER}, + + + enable = #{enable,jdbcType=BIT}, + + + where id = #{id,jdbcType=INTEGER} + + + update serial_link + set name = #{name,jdbcType=VARCHAR}, + scene_id = #{sceneId,jdbcType=INTEGER}, + enable = #{enable,jdbcType=BIT} + where id = #{id,jdbcType=INTEGER} + + + insert into serial_link + (name, scene_id, enable) + values + + (#{item.name,jdbcType=VARCHAR}, #{item.sceneId,jdbcType=INTEGER}, #{item.enable,jdbcType=BIT} + ) + + + + insert into serial_link ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.name,jdbcType=VARCHAR} + + + #{item.sceneId,jdbcType=INTEGER} + + + #{item.enable,jdbcType=BIT} + + + ) + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SlaMapper.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SlaMapper.xml new file mode 100644 index 000000000..31de2d7ee --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SlaMapper.xml @@ -0,0 +1,303 @@ + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, name, note, business_group, ctime, utime, creator, updater + + + + + delete from sla + where id = #{id,jdbcType=INTEGER} + + + delete from sla + + + + + + + SELECT LAST_INSERT_ID() + + insert into sla (name, note, business_group, + ctime, utime, creator, + updater) + values (#{name,jdbcType=VARCHAR}, #{note,jdbcType=VARCHAR}, #{businessGroup,jdbcType=VARCHAR}, + #{ctime,jdbcType=BIGINT}, #{utime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, + #{updater,jdbcType=VARCHAR}) + + + + SELECT LAST_INSERT_ID() + + insert into sla + + + name, + + + note, + + + business_group, + + + ctime, + + + utime, + + + creator, + + + updater, + + + + + #{name,jdbcType=VARCHAR}, + + + #{note,jdbcType=VARCHAR}, + + + #{businessGroup,jdbcType=VARCHAR}, + + + #{ctime,jdbcType=BIGINT}, + + + #{utime,jdbcType=BIGINT}, + + + #{creator,jdbcType=VARCHAR}, + + + #{updater,jdbcType=VARCHAR}, + + + + + + update sla + + + id = #{record.id,jdbcType=INTEGER}, + + + name = #{record.name,jdbcType=VARCHAR}, + + + note = #{record.note,jdbcType=VARCHAR}, + + + business_group = #{record.businessGroup,jdbcType=VARCHAR}, + + + ctime = #{record.ctime,jdbcType=BIGINT}, + + + utime = #{record.utime,jdbcType=BIGINT}, + + + creator = #{record.creator,jdbcType=VARCHAR}, + + + updater = #{record.updater,jdbcType=VARCHAR}, + + + + + + + + update sla + set id = #{record.id,jdbcType=INTEGER}, + name = #{record.name,jdbcType=VARCHAR}, + note = #{record.note,jdbcType=VARCHAR}, + business_group = #{record.businessGroup,jdbcType=VARCHAR}, + ctime = #{record.ctime,jdbcType=BIGINT}, + utime = #{record.utime,jdbcType=BIGINT}, + creator = #{record.creator,jdbcType=VARCHAR}, + updater = #{record.updater,jdbcType=VARCHAR} + + + + + + update sla + + + name = #{name,jdbcType=VARCHAR}, + + + note = #{note,jdbcType=VARCHAR}, + + + business_group = #{businessGroup,jdbcType=VARCHAR}, + + + ctime = #{ctime,jdbcType=BIGINT}, + + + utime = #{utime,jdbcType=BIGINT}, + + + creator = #{creator,jdbcType=VARCHAR}, + + + updater = #{updater,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update sla + set name = #{name,jdbcType=VARCHAR}, + note = #{note,jdbcType=VARCHAR}, + business_group = #{businessGroup,jdbcType=VARCHAR}, + ctime = #{ctime,jdbcType=BIGINT}, + utime = #{utime,jdbcType=BIGINT}, + creator = #{creator,jdbcType=VARCHAR}, + updater = #{updater,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + + insert into sla + (name, note, business_group, ctime, utime, creator, updater) + values + + (#{item.name,jdbcType=VARCHAR}, #{item.note,jdbcType=VARCHAR}, #{item.businessGroup,jdbcType=VARCHAR}, + #{item.ctime,jdbcType=BIGINT}, #{item.utime,jdbcType=BIGINT}, #{item.creator,jdbcType=VARCHAR}, + #{item.updater,jdbcType=VARCHAR}) + + + + insert into sla ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.name,jdbcType=VARCHAR} + + + #{item.note,jdbcType=VARCHAR} + + + #{item.businessGroup,jdbcType=VARCHAR} + + + #{item.ctime,jdbcType=BIGINT} + + + #{item.utime,jdbcType=BIGINT} + + + #{item.creator,jdbcType=VARCHAR} + + + #{item.updater,jdbcType=VARCHAR} + + + ) + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SlaRuleMapper.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SlaRuleMapper.xml new file mode 100644 index 000000000..f573f80f8 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/mapper/SlaRuleMapper.xml @@ -0,0 +1,401 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, sla_id, name, rule_item_type, rule_item, compare_condition, compare_value, degree, + action_level, ctime, utime, creator, updater + + + + + delete from sla_rule + where id = #{id,jdbcType=INTEGER} + + + delete from sla_rule + + + + + + + SELECT LAST_INSERT_ID() + + insert into sla_rule (sla_id, name, rule_item_type, + rule_item, compare_condition, compare_value, + degree, action_level, ctime, + utime, creator, updater + ) + values (#{slaId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{ruleItemType,jdbcType=VARCHAR}, + #{ruleItem,jdbcType=VARCHAR}, #{compareCondition,jdbcType=VARCHAR}, #{compareValue,jdbcType=INTEGER}, + #{degree,jdbcType=INTEGER}, #{actionLevel,jdbcType=VARCHAR}, #{ctime,jdbcType=BIGINT}, + #{utime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, #{updater,jdbcType=VARCHAR} + ) + + + + SELECT LAST_INSERT_ID() + + insert into sla_rule + + + sla_id, + + + name, + + + rule_item_type, + + + rule_item, + + + compare_condition, + + + compare_value, + + + degree, + + + action_level, + + + ctime, + + + utime, + + + creator, + + + updater, + + + + + #{slaId,jdbcType=INTEGER}, + + + #{name,jdbcType=VARCHAR}, + + + #{ruleItemType,jdbcType=VARCHAR}, + + + #{ruleItem,jdbcType=VARCHAR}, + + + #{compareCondition,jdbcType=VARCHAR}, + + + #{compareValue,jdbcType=INTEGER}, + + + #{degree,jdbcType=INTEGER}, + + + #{actionLevel,jdbcType=VARCHAR}, + + + #{ctime,jdbcType=BIGINT}, + + + #{utime,jdbcType=BIGINT}, + + + #{creator,jdbcType=VARCHAR}, + + + #{updater,jdbcType=VARCHAR}, + + + + + + update sla_rule + + + id = #{record.id,jdbcType=INTEGER}, + + + sla_id = #{record.slaId,jdbcType=INTEGER}, + + + name = #{record.name,jdbcType=VARCHAR}, + + + rule_item_type = #{record.ruleItemType,jdbcType=VARCHAR}, + + + rule_item = #{record.ruleItem,jdbcType=VARCHAR}, + + + compare_condition = #{record.compareCondition,jdbcType=VARCHAR}, + + + compare_value = #{record.compareValue,jdbcType=INTEGER}, + + + degree = #{record.degree,jdbcType=INTEGER}, + + + action_level = #{record.actionLevel,jdbcType=VARCHAR}, + + + ctime = #{record.ctime,jdbcType=BIGINT}, + + + utime = #{record.utime,jdbcType=BIGINT}, + + + creator = #{record.creator,jdbcType=VARCHAR}, + + + updater = #{record.updater,jdbcType=VARCHAR}, + + + + + + + + update sla_rule + set id = #{record.id,jdbcType=INTEGER}, + sla_id = #{record.slaId,jdbcType=INTEGER}, + name = #{record.name,jdbcType=VARCHAR}, + rule_item_type = #{record.ruleItemType,jdbcType=VARCHAR}, + rule_item = #{record.ruleItem,jdbcType=VARCHAR}, + compare_condition = #{record.compareCondition,jdbcType=VARCHAR}, + compare_value = #{record.compareValue,jdbcType=INTEGER}, + degree = #{record.degree,jdbcType=INTEGER}, + action_level = #{record.actionLevel,jdbcType=VARCHAR}, + ctime = #{record.ctime,jdbcType=BIGINT}, + utime = #{record.utime,jdbcType=BIGINT}, + creator = #{record.creator,jdbcType=VARCHAR}, + updater = #{record.updater,jdbcType=VARCHAR} + + + + + + update sla_rule + + + sla_id = #{slaId,jdbcType=INTEGER}, + + + name = #{name,jdbcType=VARCHAR}, + + + rule_item_type = #{ruleItemType,jdbcType=VARCHAR}, + + + rule_item = #{ruleItem,jdbcType=VARCHAR}, + + + compare_condition = #{compareCondition,jdbcType=VARCHAR}, + + + compare_value = #{compareValue,jdbcType=INTEGER}, + + + degree = #{degree,jdbcType=INTEGER}, + + + action_level = #{actionLevel,jdbcType=VARCHAR}, + + + ctime = #{ctime,jdbcType=BIGINT}, + + + utime = #{utime,jdbcType=BIGINT}, + + + creator = #{creator,jdbcType=VARCHAR}, + + + updater = #{updater,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update sla_rule + set sla_id = #{slaId,jdbcType=INTEGER}, + name = #{name,jdbcType=VARCHAR}, + rule_item_type = #{ruleItemType,jdbcType=VARCHAR}, + rule_item = #{ruleItem,jdbcType=VARCHAR}, + compare_condition = #{compareCondition,jdbcType=VARCHAR}, + compare_value = #{compareValue,jdbcType=INTEGER}, + degree = #{degree,jdbcType=INTEGER}, + action_level = #{actionLevel,jdbcType=VARCHAR}, + ctime = #{ctime,jdbcType=BIGINT}, + utime = #{utime,jdbcType=BIGINT}, + creator = #{creator,jdbcType=VARCHAR}, + updater = #{updater,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + + insert into sla_rule + (sla_id, name, rule_item_type, rule_item, compare_condition, compare_value, degree, + action_level, ctime, utime, creator, updater) + values + + (#{item.slaId,jdbcType=INTEGER}, #{item.name,jdbcType=VARCHAR}, #{item.ruleItemType,jdbcType=VARCHAR}, + #{item.ruleItem,jdbcType=VARCHAR}, #{item.compareCondition,jdbcType=VARCHAR}, #{item.compareValue,jdbcType=INTEGER}, + #{item.degree,jdbcType=INTEGER}, #{item.actionLevel,jdbcType=VARCHAR}, #{item.ctime,jdbcType=BIGINT}, + #{item.utime,jdbcType=BIGINT}, #{item.creator,jdbcType=VARCHAR}, #{item.updater,jdbcType=VARCHAR} + ) + + + + insert into sla_rule ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.slaId,jdbcType=INTEGER} + + + #{item.name,jdbcType=VARCHAR} + + + #{item.ruleItemType,jdbcType=VARCHAR} + + + #{item.ruleItem,jdbcType=VARCHAR} + + + #{item.compareCondition,jdbcType=VARCHAR} + + + #{item.compareValue,jdbcType=INTEGER} + + + #{item.degree,jdbcType=INTEGER} + + + #{item.actionLevel,jdbcType=VARCHAR} + + + #{item.ctime,jdbcType=BIGINT} + + + #{item.utime,jdbcType=BIGINT} + + + #{item.creator,jdbcType=VARCHAR} + + + #{item.updater,jdbcType=VARCHAR} + + + ) + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/sql/init.sql b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/sql/init.sql new file mode 100644 index 000000000..922b1480b --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/main/resources/sql/init.sql @@ -0,0 +1,325 @@ +-- table: 数据源 -- +CREATE TABLE `agent_apply_info` +( + `id` int(32) NOT NULL AUTO_INCREMENT COMMENT '唯一id', + `apply_user` varchar(255) NOT NULL DEFAULT '' COMMENT '申请人', + `apply_org_id` varchar(255) NOT NULL DEFAULT '' COMMENT '申请人组织id', + `apply_org_name` varchar(255) NOT NULL DEFAULT '' COMMENT '申请人组织中文名', + `agent_ip` varchar(255) NOT NULL DEFAULT '' COMMENT '申请的发压机ip', + `agent_hostname` varchar(255) NOT NULL DEFAULT '' COMMENT '申请的发压机的hostname', + `apply_status` int(11) NOT NULL DEFAULT '0' COMMENT '申请状态 0:待审核 1:审核完成', + `ctime` bigint(64) NOT NULL DEFAULT '0' COMMENT '创建时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=30001 COMMENT='压测机申请记录表'; + +CREATE TABLE `agent_info` +( + `id` int(32) NOT NULL AUTO_INCREMENT COMMENT '压测机id', + `server_name` varchar(255) DEFAULT NULL COMMENT '服务名', + `ip` varchar(255) NOT NULL COMMENT '压测机ip', + `port` int(32) DEFAULT NULL COMMENT '压测机端口', + `cpu` int(32) DEFAULT NULL COMMENT '压测机总cpu', + `mem` bigint(64) DEFAULT NULL COMMENT '压测机总内存', + `use_cpu` int(32) DEFAULT NULL COMMENT '已使用的cpu数', + `use_mem` bigint(20) DEFAULT NULL COMMENT '已使用的内存数', + `hostname` varchar(255) DEFAULT NULL COMMENT '主机名', + `client_desc` varchar(255) DEFAULT NULL COMMENT '描述', + `ctime` bigint(64) DEFAULT NULL COMMENT '创建时间', + `utime` bigint(64) DEFAULT NULL COMMENT '更新时间', + `enable` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否可用', + `node_ip` varchar(255) DEFAULT NULL COMMENT '压测机所属宿主机ip', + `tenant` varchar(255) DEFAULT NULL COMMENT '租户信息', + `tenant_cn` varchar(255) NOT NULL DEFAULT '' COMMENT '租户,中文名', + `domain_conf` json DEFAULT NULL COMMENT '域名绑定', + PRIMARY KEY (`id`), + UNIQUE KEY `agent_ip_uindex` (`ip`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=60001; + +CREATE TABLE `checkpoint_info` +( + `id` int(32) NOT NULL AUTO_INCREMENT, + `check_type` int(11) DEFAULT NULL COMMENT '检查点类型', + `check_obj` varchar(255) DEFAULT NULL COMMENT '检查对象', + `check_condition` int(11) DEFAULT NULL COMMENT '检查条件', + `check_content` text DEFAULT NULL COMMENT '检查内容', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=60001; + +CREATE TABLE `dataset` +( + `id` int(32) NOT NULL AUTO_INCREMENT, + `name` varchar(128) DEFAULT NULL, + `note` varchar(128) DEFAULT NULL, + `type` int(32) DEFAULT NULL, + `default_param_name` varchar(128) DEFAULT NULL, + `ignore_first_row` int(32) DEFAULT '0', + `file_name` varchar(128) DEFAULT NULL, + `file_url` varchar(1024) DEFAULT NULL, + `file_ks_key` varchar(256) DEFAULT NULL, + `file_rows` bigint(64) DEFAULT NULL, + `file_size` bigint(64) DEFAULT NULL, + `preview_file_rows` json DEFAULT NULL, + `header` json DEFAULT NULL, + `interface_url` varchar(256) DEFAULT NULL, + `traffic_record_id` int(32) DEFAULT NULL, + `ctime` bigint(64) DEFAULT NULL, + `utime` bigint(64) DEFAULT NULL, + `creator` varchar(128) DEFAULT NULL, + `updater` varchar(128) DEFAULT NULL, + `tenant` varchar(255) DEFAULT NULL COMMENT '租户信息', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=60003; + +CREATE TABLE `dataset_scene_relation` +( + `id` int(32) NOT NULL AUTO_INCREMENT, + `dataset_id` int(32) DEFAULT NULL, + `scene_id` int(32) NOT NULL DEFAULT '0', + `ctime` bigint(64) DEFAULT NULL, + `utime` bigint(64) DEFAULT NULL, + `creator` varchar(128) DEFAULT NULL, + `updater` varchar(128) DEFAULT NULL, + `enable` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否真正引用', + PRIMARY KEY (`id`), + UNIQUE KEY `dataset_id` (`dataset_id`,`scene_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=60001; + +CREATE TABLE `domain_apply_info` +( + `id` int(32) NOT NULL AUTO_INCREMENT COMMENT '主键', + `apply_user` varchar(255) NOT NULL DEFAULT '' COMMENT '申请人', + `domain` varchar(255) NOT NULL DEFAULT '' COMMENT '要绑定的域名', + `ip` varchar(255) NOT NULL DEFAULT '' COMMENT '要绑定的ip', + `agent_ip_list` json DEFAULT NULL COMMENT '绑定的机器ip列表', + `apply_status` int(11) NOT NULL DEFAULT '0' COMMENT '申请状态 0:待审核 1:审核完成', + `ctime` bigint(64) NOT NULL DEFAULT '0' COMMENT '创建时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=30001; + +CREATE TABLE `mibench_task` +( + `id` int(32) NOT NULL AUTO_INCREMENT, + `qps` int(32) DEFAULT NULL, + `origin_qps` int(32) DEFAULT NULL COMMENT '起始qps', + `max_qps` int(11) DEFAULT NULL COMMENT '最大qps', + `scene_id` int(32) DEFAULT NULL, + `serial_link_id` int(32) DEFAULT NULL COMMENT '所属链路id', + `scene_api_id` int(32) DEFAULT NULL COMMENT '该任务属于哪个接口', + `time` int(32) DEFAULT NULL, + `agent_num` int(32) DEFAULT NULL, + `finish_agent_num` int(32) DEFAULT NULL, + `ctime` bigint(64) DEFAULT NULL, + `utime` bigint(64) DEFAULT NULL, + `state` int(32) DEFAULT NULL, + `version` int(32) DEFAULT NULL, + `success_num` bigint(64) DEFAULT NULL, + `failure_num` bigint(64) DEFAULT NULL, + `task_type` int(32) DEFAULT NULL COMMENT '任务类型:1 http 2 dubbo 3 dag', + `parent_task_id` int(32) DEFAULT NULL COMMENT '所属父任务id', + `debug_result` longtext DEFAULT NULL COMMENT '调试的结果', + `debug_result_header` json DEFAULT NULL, + `report_id` varchar(255) DEFAULT NULL COMMENT '标记为同一次压测任务', + `request_params` json DEFAULT NULL COMMENT '请求参数', + `req_param_type` int(11) DEFAULT NULL COMMENT '请求参数所属类型', + `ok` tinyint(1) DEFAULT NULL COMMENT '是否成功', + `connect_task_num` int(11) DEFAULT NULL COMMENT '同一次压测下的总任务数', + `debug_trigger_cp` json DEFAULT NULL COMMENT '触发的cp', + `debug_trigger_filter_condition` json DEFAULT NULL COMMENT '触发的过滤条件', + `debug_req_headers` json DEFAULT NULL, + `debug_url` text DEFAULT NULL COMMENT '实际使用的url', + `debug_rt` int(32) NOT NULL DEFAULT '0' COMMENT '调试的rt', + `debug_size` int(32) NOT NULL DEFAULT '0' COMMENT '调试返回结果的大小', + `bench_mode` int(11) NOT NULL DEFAULT '0' COMMENT '压力模式 0 rps、1并发', + `increase_mode` int(11) NOT NULL DEFAULT '0' COMMENT 'Rps压力增加模式 0 固定() 1 手动 2 百分比递增', + `increase_percent` int(11) NOT NULL DEFAULT '0' COMMENT '递增百分比', + PRIMARY KEY (`id`), + KEY `idx_parent_task_id` (`parent_task_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=152326; + +CREATE TABLE `operation_log` +( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', + `report_id` varchar(255) DEFAULT '' COMMENT '报告id', + `scene_id` int(32) NOT NULL COMMENT '所属场景id', + `type` int(4) unsigned DEFAULT '0' COMMENT '操作类型', + `content` text DEFAULT NULL COMMENT '操作内容', + `support_operation` json DEFAULT NULL, + `create_by` varchar(64) NOT NULL DEFAULT '' COMMENT '操作人用户名', + `create_time` bigint(64) NOT NULL COMMENT '创建时间', + `update_time` bigint(64) NOT NULL COMMENT '更新时间', + PRIMARY KEY (`id`), + KEY `operation_log_scene_id_index` (`scene_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=60003 COMMENT='压测操作记录'; + +CREATE TABLE `report_info` +( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', + `scene_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '场景id', + `snapshot_id` varchar(128) NOT NULL DEFAULT '' COMMENT '场景快照id', + `report_id` varchar(128) NOT NULL DEFAULT '' COMMENT '报告id', + `report_name` varchar(255) NOT NULL DEFAULT '' COMMENT '报告名', + `duration` int(10) unsigned DEFAULT '0' COMMENT '压测时长', + `concurrency` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '默认并发数', + `concurrency_max` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大并发数', + `create_by` varchar(64) NOT NULL DEFAULT '' COMMENT '操作人用户名', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `status` int(11) unsigned NOT NULL DEFAULT '0', + `task_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '执行任务id', + `file_path` varchar(255) NOT NULL DEFAULT '' COMMENT '报告路径', + `finish_time` bigint(64) DEFAULT NULL COMMENT '压测结束时间', + `agents` text DEFAULT NULL COMMENT 'agent ip列表', + `extra` text DEFAULT NULL COMMENT '扩展信息', + `sla_event_list` json DEFAULT NULL COMMENT '事件列表', + `total_stat_analysis_event_list` json DEFAULT NULL COMMENT '错误分析事件记录', + `tenant` varchar(255) DEFAULT NULL COMMENT '租户信息', + `link_to_dag_id` json DEFAULT NULL COMMENT '链路id与dag任务id的映射', + PRIMARY KEY (`id`), + UNIQUE KEY `report_info_report_id_uindex` (`report_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=90001 COMMENT='压测报告信息'; + +CREATE TABLE `scene_api_info` +( + `id` int(32) NOT NULL AUTO_INCREMENT COMMENT '场景接口id', + `scene_id` int(32) NOT NULL COMMENT '该接口所属场景id', + `api_order` int(11) NOT NULL COMMENT '接口在该场景下的顺序', + `api_name` varchar(255) NOT NULL DEFAULT '' COMMENT '接口名', + `source_type` int(11) NOT NULL COMMENT '接口来源 1:mi-api导入 2 手动输入', + `api_type` int(11) NOT NULL COMMENT '接口类型 0:http 1:dubbo', + `api_url` text DEFAULT NULL COMMENT '接口请求url', + `request_method` int(11) NOT NULL DEFAULT '0' COMMENT '请求方式 0:get,1:post', + `request_timeout` int(11) NOT NULL DEFAULT '0' COMMENT '请求超时时间 ms', + `need_login` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否需要登录 0:否 1:是', + `token_type` int(11) DEFAULT '0' COMMENT '使用的token部门 0 有品(tokens) 1 米粉app ', + `api_header` json DEFAULT NULL COMMENT '接口请求头', + `content_type` varchar(255) DEFAULT NULL COMMENT 'post接口的请求数据格式 x-www-form-urlencoded raw(多种)', + `request_param_info` json DEFAULT NULL COMMENT 'http请求参数,带结构', + `output_param_info` json DEFAULT NULL COMMENT '接口出参定义', + `request_body` json DEFAULT NULL COMMENT 'post 请求体', + `nacos_type` int(11) DEFAULT NULL COMMENT 'dubbo接口使用的nacos地址', + `service_name` varchar(255) DEFAULT '' COMMENT 'dubbo服务名', + `method_name` varchar(255) DEFAULT '' COMMENT 'dubbo接口方法名', + `param_type_list` varchar(255) DEFAULT '' COMMENT 'dubbo参数类型列表', + `dubbo_param_json` json DEFAULT NULL COMMENT 'dubbo请求参数', + `dubbo_group` varchar(255) DEFAULT '' COMMENT 'dubbo接口分组', + `dubbo_version` varchar(255) DEFAULT '' COMMENT 'dubbo接口版本', + `serial_link_id` int(32) NOT NULL COMMENT '所属串联链路id', + `check_point` json DEFAULT NULL COMMENT '接口检查点配置', + `filter_condition` json DEFAULT NULL COMMENT '接口的过滤条件', + `api_tsp_auth` json DEFAULT NULL COMMENT '接口级别tsp验权', + `api_traffic_info` json DEFAULT NULL COMMENT '接口的流量录制配置', + `api_x5_info` json DEFAULT NULL COMMENT 'x5鉴权信息', + PRIMARY KEY (`id`), + KEY `idx_scene_link` (`scene_id`,`serial_link_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=90001; + +CREATE TABLE `scene_group` +( + `id` int(32) NOT NULL AUTO_INCREMENT COMMENT '分组id', + `group_name` varchar(255) NOT NULL COMMENT '分组名', + `group_desc` varchar(255) DEFAULT NULL COMMENT '分组描述', + `creator` varchar(255) DEFAULT NULL COMMENT '创建人', + `ctime` bigint(64) NOT NULL COMMENT '创建时间', + `tenant` varchar(255) DEFAULT NULL COMMENT '租户信息', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=60002; + +CREATE TABLE `scene_info` +( + `id` int(32) NOT NULL AUTO_INCREMENT COMMENT 'id', + `name` varchar(255) NOT NULL DEFAULT '' COMMENT '场景名', + `scene_status` int(11) NOT NULL COMMENT '场景状态 0 待启动 1 执行中', + `creator` varchar(255) NOT NULL DEFAULT '' COMMENT '创建人', + `updator` varchar(255) NOT NULL DEFAULT '' COMMENT '更新人', + `apiNum` int(11) NOT NULL COMMENT '有效api数', + `remark` varchar(255) DEFAULT '' COMMENT '备注', + `scene_type` int(11) NOT NULL COMMENT '场景类型 0:http 1:dubbo', + `bench_mode` int(11) NOT NULL DEFAULT '0' COMMENT '压力模式 0 RPS (目前仅支持该模式)', + `Increment_mode` int(11) NOT NULL DEFAULT '0' COMMENT '递增模式 0 手动(Rps下仅支持手动模式)', + `increase_percent` int(11) NOT NULL DEFAULT '0' COMMENT '递增模式下的递增百分比', + `bench_time` int(11) NOT NULL DEFAULT '3' COMMENT '压测时间(秒)', + `max_bench_qps` int(11) DEFAULT NULL COMMENT '场景最大施压qps', + `rps_rate` int(11) NOT NULL DEFAULT '100' COMMENT '发压比例', + `api_bench_infos` json DEFAULT NULL COMMENT '场景各接口施压配置,最大、起始RPS,json格式', + `log_rate` int(11) DEFAULT '0' COMMENT '日志采样率 百分比', + `sla` json DEFAULT NULL COMMENT '场景对应的sla 信息', + `request_timeout` int(11) NOT NULL DEFAULT '0' COMMENT '通用请求超时时间 ms', + `success_code` varchar(255) DEFAULT NULL COMMENT '请求成功状态码(默认200 )"301,302"', + `ctime` bigint(64) NOT NULL COMMENT '创建时间', + `utime` bigint(64) NOT NULL COMMENT '更新时间', + `scene_group_id` int(32) NOT NULL DEFAULT '0' COMMENT '所属分组id', + `global_header` json DEFAULT NULL COMMENT '全局header', + `cur_report_id` varchar(255) DEFAULT NULL COMMENT '当前运行时对应的报告id', + `agent_list` json DEFAULT NULL COMMENT '场景绑定的压测机id列表', + `scene_env` int(11) NOT NULL DEFAULT '0' COMMENT '场景环境', + `ref_dataset_ids` text DEFAULT NULL COMMENT '真正引用的数据集id', + `tenant` varchar(255) DEFAULT NULL COMMENT '租户信息\n', + `bench_count` int(11) NOT NULL DEFAULT '0' COMMENT '压测次数', + `scene_source` int(11) NOT NULL DEFAULT '0' COMMENT '场景来源 0:控制台创建 1:openapi创建', + `person_in_charge` json DEFAULT NULL COMMENT '场景负责人', + `last_bench_time` bigint(64) NOT NULL DEFAULT '0' COMMENT '上次压测时间', + `bench_calendar` json DEFAULT NULL COMMENT '压测日历', + `global_tsp_auth` json DEFAULT NULL COMMENT '全局tsp验证信息', + PRIMARY KEY (`id`), + KEY `uk_name` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=90001; + +CREATE TABLE `scene_snapshot` +( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', + `scene_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '场景id', + `snapshot_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'snapshot id', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(64) DEFAULT '' COMMENT '创建人用户名', + `version` int(10) unsigned DEFAULT '0' COMMENT '场景配置版本', + `md5` varchar(64) NOT NULL DEFAULT '', + `scene` longtext DEFAULT NULL COMMENT '场景配置', + `type` int(32) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `scene_snapshot_id_uindex` (`snapshot_id`), + KEY `scene_snapshot_scene_index` (`scene_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=90001 COMMENT='压测配置快照'; + +CREATE TABLE `serial_link` +( + `id` int(32) NOT NULL AUTO_INCREMENT COMMENT '串联链路id', + `name` varchar(255) NOT NULL COMMENT '串联链路名', + `scene_id` int(32) NOT NULL COMMENT '所属场景id', + `enable` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否启用', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=90001; + +CREATE TABLE `sla` +( + `id` int(32) NOT NULL AUTO_INCREMENT, + `name` varchar(128) DEFAULT NULL, + `note` varchar(128) DEFAULT NULL, + `business_group` varchar(128) DEFAULT NULL, + `ctime` bigint(64) DEFAULT NULL, + `utime` bigint(64) DEFAULT NULL, + `creator` varchar(128) DEFAULT NULL, + `updater` varchar(128) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `k_creator` (`creator`), + KEY `k_ctime` (`ctime`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=90003; + +CREATE TABLE `sla_rule` +( + `id` int(32) NOT NULL AUTO_INCREMENT, + `sla_id` int(32) NOT NULL, + `name` varchar(128) DEFAULT NULL COMMENT '规则名称', + `rule_item_type` varchar(128) DEFAULT NULL COMMENT '指标类型', + `rule_item` varchar(128) DEFAULT NULL COMMENT '指标名', + `compare_condition` varchar(128) NOT NULL DEFAULT '' COMMENT '对比条件', + `compare_value` int(32) DEFAULT NULL, + `degree` int(32) DEFAULT NULL, + `action_level` varchar(128) DEFAULT NULL, + `ctime` bigint(64) DEFAULT NULL, + `utime` bigint(64) DEFAULT NULL, + `creator` varchar(128) DEFAULT NULL, + `updater` varchar(128) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `k_sla_id` (`sla_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=90003; \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/test/java/run/mone/mimeter/dashboard/service/common/UtilityTest.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/test/java/run/mone/mimeter/dashboard/service/common/UtilityTest.java new file mode 100644 index 000000000..338a90a10 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-server/src/test/java/run/mone/mimeter/dashboard/service/common/UtilityTest.java @@ -0,0 +1,50 @@ +package run.mone.mimeter.dashboard.service.common; + +import org.junit.Ignore; +import org.junit.Test; +import run.mone.mimeter.dashboard.common.util.FileUtils; +import run.mone.mimeter.dashboard.common.util.Utility; + +import java.util.List; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/6/22 + */ +@Ignore +public class UtilityTest { + + @Test + public void testGenId() { + System.out.println(Utility.generateId(23439L)); + } + + @Test + public void rehashSalt() { + System.out.println(Utility.rehashSalt(-23439L, 2)); + } + + @Test + public void saltVersionedId() { + System.out.println(Utility.saltVersionedId(99439345L, 999)); + } + + @Test + public void generateSha256() { + System.out.println(Utility.generateSha256("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")); + } + + @Test + public void castTest() { + Object val = 1; + System.out.println(((Integer)val).longValue()); + } + + @Test + public void csvTest() { + String str = "a,\"a,b\",c"; + List lists = FileUtils.parseCsv(str); + System.out.println(1); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/pom.xml b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/pom.xml new file mode 100644 index 000000000..846fdf03c --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/pom.xml @@ -0,0 +1,301 @@ + + + + mimeter-dashboard + run.mone + 1.0.0-SNAPSHOT + + 4.0.0 + + mimeter-dashboard-service + + + + + org.springframework.boot + spring-boot-starter-web + 2.2.2.RELEASE + + + + org.springframework.boot + spring-boot-starter-test + 2.2.2.RELEASE + + + + org.springframework + spring-beans + 5.2.0.RELEASE + + + + org.springframework + spring-core + 5.2.0.RELEASE + + + + org.springframework + spring-context + 5.2.0.RELEASE + + + + org.springframework + spring-test + 5.2.0.RELEASE + + + + com.xiaomi.mone + http-docs-core + 2.7.12-mone-v5-SNAPSHOT + + + + com.xiaomi.faas + hera-api-dubboapi + 1.0.3 + + + + com.xiaomi.youpin + tesla-k8s-proxy-api + 1.0.0-SNAPSHOT + + + + com.xiaomi.mone + mimonitor-api + 1.0-SNAPSHOT + + + + com.xiaomi.youpin + coloregg + 1.4-SNAPSHOT + + + + com.xiaomi.youpin + aop + 1.4-SNAPSHOT + + + + com.xiaomi.youpin + common + 1.7-SNAPSHOT + + + + org.springframework + spring-jdbc + 5.2.0.RELEASE + + + + mimeter-dashboard-api + run.mone + 1.0.0-SNAPSHOT + + + + mimeter-dashboard-common + run.mone + 1.0.0-SNAPSHOT + + + + org.apache.dubbo + dubbo + 2.7.12-mone-v14-SNAPSHOT + + + + + com.xiaomi.youpin + feishu + 1.4-SNAPSHOT + + + org.mybatis.generator + mybatis-generator-core + 1.3.5 + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.1.0 + + + com.mchange + c3p0 + 0.9.5.2 + + + + mysql + mysql-connector-java + 5.1.40 + + + + com.xiaomi.mone + mi-tpc-api + 1.0.0-SNAPSHOT + + + com.alibaba.nacos + nacos-spring-context + 0.3.6-mone-SNAPSHOT + + + spring-context + org.springframework + + + com.alibaba + fastjson + + + spring-context-support + com.alibaba.spring + + + + + + com.alibaba.nacos + nacos-client + 1.2.1-mone-v5-SNAPSHOT + + + commons-io + commons-io + + + + + + com.xiaomi.mone + dubbo-docs-core + 2.7.12-mone-v5-SNAPSHOT + + + dubbo + org.apache.dubbo + + + + + + com.xiaomi.youpin + nacos + 1.4-SNAPSHOT + + + + com.xiaomi.infosec + aegis-java-sdk + 2.3.2 + + + + com.xiaomi.miapi + mi-api-api + 1.0.0-SNAPSHOT + + + com.xiaomi.mone + dubbo-docs-core + + + + + + com.xiaomi.youpin + ks3 + 1.4-SNAPSHOT + compile + + + + org.apache.httpcomponents + httpmime + 4.5.5 + + + + com.xiaomi.youpin + 1.0.0-SNAPSHOT + tesla-traffic-recording-api + + + + com.xiaomi.youpin + 0.0.1-SNAPSHOT + gateway-api + + + + org.elasticsearch.client + elasticsearch-rest-high-level-client + 7.6.2 + + + + org.elasticsearch + elasticsearch + 7.6.2 + + + + run.mone + es + 1.4-SNAPSHOT + + + + com.opencsv + opencsv + 4.4 + + + + com.xiaomi.infra + rocketmq-client-java + 1.0.1-RELEASE + + + + com.xiaomi.youpin + rmq-swimlane-aspect + 1.0.0-SNAPSHOT + + + + run.mone + umami + 1.4-SNAPSHOT + + + org.slf4j + slf4j-log4j12 + + + + + + mi-tpclogin-sdk + run.mone + 1.0.0-SNAPSHOT + + + + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/ChangeQpsReq.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/ChangeQpsReq.java new file mode 100644 index 000000000..b1eb23f49 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/ChangeQpsReq.java @@ -0,0 +1,22 @@ +package run.mone.mimeter.dashboard.bo; + +import lombok.Data; +import run.mone.mimeter.dashboard.bo.task.DagTaskRps; + +import java.io.Serializable; +import java.util.List; + +@Data +public class ChangeQpsReq implements Serializable { + + Integer rpsRate; + + List dagTaskRpsList; + + public ChangeQpsReq() { + } + + public ChangeQpsReq(List dagTaskRpsList) { + this.dagTaskRpsList = dagTaskRpsList; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/DubboSceneDebugResult.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/DubboSceneDebugResult.java new file mode 100644 index 000000000..f303515f6 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/DubboSceneDebugResult.java @@ -0,0 +1,51 @@ +package run.mone.mimeter.dashboard.bo; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class DubboSceneDebugResult implements Serializable { + + private boolean parentTask; + + private Integer id; + + private Integer sceneId; + + private String apiName; + + private String serviceName; + + private String methodName; + + private String group; + + private String version; + + private Integer apiOrder; + + private Integer requestTimeout; + + private String paramsTypeList; + + private String requestBody; + + private String triggerCpInfo; + + private String debugTriggerFilterCondition; + + private String debugResult; + + private Integer taskStatus; + + private String realParam; + + private boolean ok; + + private long rt; + + //bytes + private long size; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/DubboService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/DubboService.java new file mode 100644 index 000000000..7f5a0f8fb --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/DubboService.java @@ -0,0 +1,9 @@ +package run.mone.mimeter.dashboard.bo; + +import lombok.Data; + +@Data +public class DubboService { + private String name; + private Integer healthyInstanceCount; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/DubboServiceList.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/DubboServiceList.java new file mode 100644 index 000000000..dba839f15 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/DubboServiceList.java @@ -0,0 +1,10 @@ +package run.mone.mimeter.dashboard.bo; + +import lombok.Data; + +import java.util.List; + +@Data +public class DubboServiceList { + private List serviceList; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/HttpSceneDebugResult.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/HttpSceneDebugResult.java new file mode 100644 index 000000000..be1fda4ec --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/HttpSceneDebugResult.java @@ -0,0 +1,57 @@ +package run.mone.mimeter.dashboard.bo; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class HttpSceneDebugResult implements Serializable { + + private boolean parentTask; + + private Integer id; + + private Integer sceneId; + + private String apiName; + + private String apiUrl; + + private Integer apiOrder; + + private Integer requestMethod; + + private Integer requestTimeout; + + private String contentType; + + private String apiHeader; + + private Integer reqParamType; + + private String requestParamInfo; + + private String outputParamInfo; + + private String requestBody; + + private String respHeader; + + private String triggerCpInfo; + + private String debugTriggerFilterCondition; + + private String debugResult; + + private Integer taskStatus; + + private String realParam; + + private boolean ok; + + private long rt; + + //bytes + private long size; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/MetricsValue.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/MetricsValue.java new file mode 100644 index 000000000..811f52071 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/MetricsValue.java @@ -0,0 +1,22 @@ +package run.mone.mimeter.dashboard.bo; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/7/19 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class MetricsValue { + + private Long ts; + + private Double value; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/NacosInfo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/NacosInfo.java new file mode 100644 index 000000000..ae4cb936c --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/NacosInfo.java @@ -0,0 +1,20 @@ +package run.mone.mimeter.dashboard.bo; + +import lombok.Data; + +@Data +public class NacosInfo { + private String usernameSt; + private String passwordSt; + + private String usernameOl; + private String passwordOl; + + + public NacosInfo(String usernameSt, String passwordSt, String usernameOl, String passwordOl) { + this.usernameSt = usernameSt; + this.passwordSt = passwordSt; + this.usernameOl = usernameOl; + this.passwordOl = passwordOl; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/NacosLoginInfo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/NacosLoginInfo.java new file mode 100644 index 000000000..3831ef3ce --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/NacosLoginInfo.java @@ -0,0 +1,8 @@ +package run.mone.mimeter.dashboard.bo; + +import lombok.Data; + +@Data +public class NacosLoginInfo { + private String accessToken; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/ReportEmitterData.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/ReportEmitterData.java new file mode 100644 index 000000000..553d578a2 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/ReportEmitterData.java @@ -0,0 +1,40 @@ +package run.mone.mimeter.dashboard.bo; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/6/30 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class ReportEmitterData { + + /** + * EmitterTypeEnum + */ + private String type; + + /** + * create time + */ + private Long ts; + + /** + * json data point + */ + private String data; + + /** + * used for machine node or api + */ + private String node; + + private String extra; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/SceneNameDTO.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/SceneNameDTO.java new file mode 100644 index 000000000..9508833e0 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/SceneNameDTO.java @@ -0,0 +1,10 @@ +package run.mone.mimeter.dashboard.bo; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class SceneNameDTO implements Serializable { + String name; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/SubmitTaskRes.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/SubmitTaskRes.java new file mode 100644 index 000000000..482553fd1 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/SubmitTaskRes.java @@ -0,0 +1,27 @@ +package run.mone.mimeter.dashboard.bo; + +import lombok.Data; +import run.mone.mimeter.dashboard.bo.task.DagTaskRps; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +@Data +public class SubmitTaskRes implements Serializable { + private String reportId; + private TaskResult taskResult; + + /** + * 链路id与生成的dag 任务id映射 + */ + private Map linkTaskIdMap; + private List agentIpList; + + public SubmitTaskRes(String reportId, TaskResult taskResult, Map linkTaskIdMap, List agentIpList) { + this.reportId = reportId; + this.taskResult = taskResult; + this.linkTaskIdMap = linkTaskIdMap; + this.agentIpList = agentIpList; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/TaskResult.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/TaskResult.java new file mode 100644 index 000000000..0045dba5f --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/TaskResult.java @@ -0,0 +1,33 @@ +package run.mone.mimeter.dashboard.bo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Map; + +@Data +public class TaskResult implements Serializable { + /** + * 任务id + */ + private int id; + + private int code; + + private String result; + + private boolean ok; + + /** + * 返回的header + */ + private Map respHeaders; + + private String triggerCpInfo; + + private long rt; + + //bytes + private long size; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/UserInfo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/UserInfo.java new file mode 100644 index 000000000..dcb457ad1 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/bo/UserInfo.java @@ -0,0 +1,19 @@ +package run.mone.mimeter.dashboard.bo; + +import lombok.Data; + +@Data +public class UserInfo { + private String fullAccount;// + private String username;//用户账号 + private String name;//名称 + private String displayName;//展示名称 + private String departmentName;//部门 + private String firstDepartment;//一级部门(用于区分用户空间) + private String secondDepartment;//二级部门(用于区分用户空间) + private String email;//邮箱 + private String miID;//米id + private String avatar;//头像图片 + private boolean admin; + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/CheckResult.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/CheckResult.java new file mode 100644 index 000000000..abbad7719 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/CheckResult.java @@ -0,0 +1,54 @@ +package run.mone.mimeter.dashboard.common; + +/** + * 用于封装检查结果 + */ +public class CheckResult { + private boolean valid; + + private int code; + + private String msg; + + + public CheckResult(boolean valid, int code, String msg) { + this.valid = valid; + this.code = code; + this.msg = msg; + } + + + public boolean isValid() { + return valid; + } + + public void setValid(boolean valid) { + this.valid = valid; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + + @Override + public String toString() { + return "CheckResult{" + + "valid=" + valid + + ", code=" + code + + ", msg='" + msg + '\'' + + '}'; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/DubboParamItem.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/DubboParamItem.java new file mode 100644 index 000000000..e9c6f7d3c --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/DubboParamItem.java @@ -0,0 +1,18 @@ +package run.mone.mimeter.dashboard.common; + +import lombok.Data; + +import java.lang.reflect.Type; +import java.util.List; + +@Data +public class DubboParamItem { + private Class itemClass; + private Type itemType; + + private String itemName; + private String itemClassStr; + private String defaultValue; + private String exampleValue; + private List itemValue; +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/HttpDao.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/HttpDao.java new file mode 100644 index 000000000..d89fbcad3 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/HttpDao.java @@ -0,0 +1,265 @@ +package run.mone.mimeter.dashboard.common; + +import com.google.gson.Gson; +import run.mone.mimeter.dashboard.common.util.Util; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.exception.CommonException; +import org.apache.http.HttpEntity; +import org.apache.http.HttpStatus; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.entity.mime.HttpMultipartMode; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Repository; + +import javax.annotation.PostConstruct; +import java.io.File; +import java.io.IOException; +import java.util.Map; + +@Repository +public class HttpDao { + + private static final Logger LOGGER = LoggerFactory.getLogger(HttpDao.class); + + private static final Gson gson = Util.getGson(); + + private RequestConfig requestConfig; + + @PostConstruct + public void init() { + requestConfig = RequestConfig.custom() + .setSocketTimeout(20000) + .setConnectTimeout(15000) + .setConnectionRequestTimeout(20000) + .build(); + } + + public HttpResult get(String url, Map params) { + Gson gson = new Gson(); + + CloseableHttpClient httpClient = HttpClients.createDefault(); + CloseableHttpResponse response = null; + HttpEntity entity = null; + String responseContent = null; + + + HttpResult result = null; + + try { + URIBuilder uriBuilder = new URIBuilder(url); + for(Map.Entry entry : params.entrySet()) { + uriBuilder.setParameter(entry.getKey(), entry.getValue()); + } + + HttpGet request = new HttpGet(uriBuilder.build().toASCIIString()); + request.setHeader("Content-Type", "application/json"); + request.setHeader("Accept", "application/json"); + request.setConfig(requestConfig); + + response = httpClient.execute(request); + + int state = response.getStatusLine().getStatusCode(); + if (state != HttpStatus.SC_OK) { + LOGGER.error("[HttpDao.get]: failed to request: {}, params: {} response status: {}", + url, params, state); + return null; + } + + entity = response.getEntity(); + responseContent = EntityUtils.toString(entity, "UTF-8"); + LOGGER.debug("[HttpDao.get] response: {}", responseContent); + result = gson.fromJson(responseContent, HttpResult.class); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (response != null) { + response.close(); + } + if (httpClient != null) { + httpClient.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + return result; + } + + public HttpResult post(String url, String paramJson) throws Exception{ + HttpResult result = null; + + CloseableHttpClient httpClient = HttpClients.createDefault(); + CloseableHttpResponse response = null; + HttpEntity entity = null; + String responseContent = null; + try { + URIBuilder uriBuilder = new URIBuilder(url); + + HttpPost request = new HttpPost(uriBuilder.build().toASCIIString()); + request.setHeader("Content-Type", "application/json"); + request.setHeader("Accept", "application/json"); + request.setConfig(requestConfig); + + StringEntity requestEntity = new StringEntity(paramJson, "UTF-8"); + request.setEntity(requestEntity); + + + response = httpClient.execute(request); + + int state = response.getStatusLine().getStatusCode(); + if (state != HttpStatus.SC_OK) { + LOGGER.error("[HttpDao.post]: failed to request: {}, params: {} response status: {}", + url, paramJson, state); + throw new CommonException(CommonError.APIServerError.code, "请求API服务失败:" + state); + } + + entity = response.getEntity(); + responseContent = EntityUtils.toString(entity, "UTF-8"); + result = gson.fromJson(responseContent, HttpResult.class); + } catch (Exception e) { + LOGGER.error("http call error,err:{}",e.getMessage()); + throw e; + } finally { + try { + if (response != null) { + response.close(); + } + if (httpClient != null) { + httpClient.close(); + } + } catch (IOException e) { + LOGGER.error("http call error,err:{}",e.getMessage()); + throw e; + } + } + + return result; + } + + public HttpResult postWithUpload(String url, Map params, String path) { + Gson gson = new Gson(); + HttpResult result = null; + LOGGER.debug("path:{}", path); + + File file = new File(path); + + CloseableHttpClient httpClient = HttpClients.createDefault(); + CloseableHttpResponse response = null; + HttpEntity entity = null; + String responseContent = null; + try { + URIBuilder uriBuilder = new URIBuilder(url); + + HttpPost request = new HttpPost(uriBuilder.build().toASCIIString()); +// request.setHeader("Content-Type", "multipart/form-data"); + request.setHeader("Accept", "application/json"); + request.setConfig(requestConfig); + + MultipartEntityBuilder builder = MultipartEntityBuilder.create(); + builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); + builder.addBinaryBody("fileData", file, ContentType.DEFAULT_BINARY, path); + for(Map.Entry entry : params.entrySet()) { + builder.addTextBody(entry.getKey(), entry.getValue(), ContentType.TEXT_PLAIN.withCharset("UTF-8")); + } + HttpEntity requestEntity = builder.build(); + request.setEntity(requestEntity); + + + response = httpClient.execute(request); + + int state = response.getStatusLine().getStatusCode(); + if (state != HttpStatus.SC_OK) { + LOGGER.error("[HttpDao.postWithUpload]: failed to request: {}, params: {}, file path: {}, response status: {}", + url, params, path, state); + throw new CommonException(CommonError.APIServerError.code, "请求API服务失败:" + state); + } + + entity = response.getEntity(); + responseContent = EntityUtils.toString(entity, "UTF-8"); + result = gson.fromJson(responseContent, HttpResult.class); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (response != null) { + response.close(); + } + if (httpClient != null) { + httpClient.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + return result; + } + + public HttpResult delete(String url, Map params) { + Gson gson = new Gson(); + + CloseableHttpClient httpClient = HttpClients.createDefault(); + CloseableHttpResponse response = null; + HttpEntity entity = null; + String responseContent = null; + + + HttpResult result = null; + + try { + URIBuilder uriBuilder = new URIBuilder(url); + for(Map.Entry entry : params.entrySet()) { + uriBuilder.setParameter(entry.getKey(), entry.getValue()); + } + + HttpDelete request = new HttpDelete(uriBuilder.build().toASCIIString()); + request.setHeader("Content-Type", "application/json"); + request.setHeader("Accept", "application/json"); + request.setConfig(requestConfig); + + response = httpClient.execute(request); + + int state = response.getStatusLine().getStatusCode(); + if (state != HttpStatus.SC_OK) { + LOGGER.error("[HttpDao.delete]: failed to request: {}, params: {} response status: {}", + url, params, state); + return null; + } + + entity = response.getEntity(); + responseContent = EntityUtils.toString(entity, "UTF-8"); + LOGGER.debug("[HttpDao.delete] response: {}", responseContent); + result = gson.fromJson(responseContent, HttpResult.class); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (response != null) { + response.close(); + } + if (httpClient != null) { + httpClient.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + return result; + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/HttpResult.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/HttpResult.java new file mode 100644 index 000000000..d416d87fc --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/HttpResult.java @@ -0,0 +1,71 @@ +package run.mone.mimeter.dashboard.common; + +import java.util.Objects; + +public class HttpResult { + private int code; + + private String data; + + private String message; + + private String method; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getMethod() { + return method; + } + + public void setMethod(String method) { + this.method = method; + } + + @Override + public String toString() { + return "HttpResult{" + + "code=" + code + + ", data='" + data + '\'' + + ", message='" + message + '\'' + + ", method='" + method + '\'' + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + HttpResult that = (HttpResult) o; + return code == that.code && + Objects.equals(data, that.data) && + Objects.equals(message, that.message) && + Objects.equals(method, that.method); + } + + @Override + public int hashCode() { + return Objects.hash(code, data, message, method); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/SceneSource.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/SceneSource.java new file mode 100644 index 000000000..87cc50521 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/SceneSource.java @@ -0,0 +1,15 @@ +package run.mone.mimeter.dashboard.common; + + +public enum SceneSource { + + CONSOLE(0), + OPEN_API(1); + + + public final int code; + + private SceneSource(int code) { + this.code = code; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/SessionAccount.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/SessionAccount.java new file mode 100644 index 000000000..0a6288da5 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/SessionAccount.java @@ -0,0 +1,48 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.common; + +import lombok.Data; + +@Data +public class SessionAccount { + + private String username; + + private String name; + + private String email; + + private String tenant; + + private boolean admin; + + private String idPath; + + + public SessionAccount() { + } + + public SessionAccount(String username, String name, Boolean admin, String idPath) { + this.username = username; + this.name = name; + this.admin = admin; + this.idPath = idPath; + this.tenant = idPath; + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/TaskStatus.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/TaskStatus.java new file mode 100644 index 000000000..4bb78176a --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/TaskStatus.java @@ -0,0 +1,18 @@ +package run.mone.mimeter.dashboard.common; + +public enum TaskStatus { + Init(0), + Success(1), + Failure(2), + Retry(3), + Running(4), + STOPPED(5), + + ; + + public int code; + + private TaskStatus(int code) { + this.code = code; + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/TaskType.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/TaskType.java new file mode 100644 index 000000000..a0a549aec --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/TaskType.java @@ -0,0 +1,20 @@ +package run.mone.mimeter.dashboard.common; + +/** + * @author goodjava@qq.com + * @date 2022/5/19 + */ +public enum TaskType { + + http(1), + dubbo(2), + dag(3), + demo(4); + + + public int code; + + private TaskType(int code) { + this.code = code; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/util/BizUtils.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/util/BizUtils.java new file mode 100644 index 000000000..a07881cb7 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/util/BizUtils.java @@ -0,0 +1,120 @@ +package run.mone.mimeter.dashboard.common.util; + +import run.mone.mimeter.dashboard.bo.sceneapi.OutputOriginEnum; +import run.mone.mimeter.dashboard.bo.sceneapi.SceneApiOutputParam; + +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static run.mone.mimeter.dashboard.bo.common.Constants.*; + +public final class BizUtils { + private BizUtils() { + } + + private static final Pattern EL_PATTERN = Pattern.compile("\\{([^}]*)}"); + + /** + * 处理转换出参定义表达式 + * + * @param outputParams + */ + public static void processOutputParamExpr(List outputParams) { + for (SceneApiOutputParam outputParam : + outputParams) { + if (outputParam.getOrigin() == OutputOriginEnum.BODY_TXT.code) { + continue; + } + //已转换过表达式 + if (outputParam.getParseExpr().contains(DEFAULT_EXPR_PREX) || outputParam.getParseExpr().contains(DEFAULT_EXPR_JSON_PREX)){ + continue; + } + if (outputParam.getOriginParseExpr() == null) { + outputParam.setOriginParseExpr(outputParam.getParseExpr()); + } + + if (outputParam.getParseExpr().contains(EXPR_INT_FLAG)) { + //值为整型 + outputParam.setOriginParseExpr(outputParam.getParseExpr()); + + StringBuilder realExpr = new StringBuilder(DEFAULT_EXPR_JSON_PREX); + Matcher m = EL_PATTERN.matcher(outputParam.getParseExpr()); + + while (m.find()) { + String innerKey = m.group(1); + if (innerKey.contains(EXPR_INT_FLAG)) { + //目标字段 + String k = innerKey.substring(0, innerKey.indexOf(":")); + realExpr.append(".get(").append(k).append(").getAsInt()"); + } else { + realExpr.append(".get(").append(innerKey).append(")"); + } + } + outputParam.setParseExpr(realExpr.toString()); + } else if (outputParam.getParseExpr().contains(EXPR_STRING_FLAG)) { + //转为字符串 + outputParam.setOriginParseExpr(outputParam.getParseExpr()); + + StringBuilder realExpr = new StringBuilder(DEFAULT_EXPR_JSON_PREX); + Matcher m = EL_PATTERN.matcher(outputParam.getParseExpr()); + + while (m.find()) { + String innerKey = m.group(1); + if (innerKey.contains(EXPR_STRING_FLAG)) { + //目标字段 + String k = innerKey.substring(0, innerKey.indexOf(":")); + realExpr.append(".get(").append(k).append(").getAsString()"); + } else { + realExpr.append(".get(").append(innerKey).append(")"); + } + } + outputParam.setParseExpr(realExpr.toString()); + } else if (outputParam.getParseExpr().contains(EXPR_LIST_FLAG)) { + outputParam.setOriginParseExpr(outputParam.getParseExpr()); + + StringBuilder realExpr = new StringBuilder(DEFAULT_EXPR_JSON_PREX); + Matcher m = EL_PATTERN.matcher(outputParam.getParseExpr()); + + while (m.find()) { + String innerKey = m.group(1); + if (innerKey.contains(EXPR_LIST_FLAG)) { + //目标字段 + //{data}{goodIds::list[0].string} + //turn to params.json().get(data).get(goodIds)|0.string + String k = innerKey.substring(0, innerKey.indexOf(":")); + String index = innerKey.substring(innerKey.indexOf('[') + 1, innerKey.lastIndexOf(']')); + realExpr.append(".get(").append(k).append(")|").append(index); + if (innerKey.contains(".")){ + String valType = innerKey.substring(innerKey.indexOf(".")+1); + realExpr.append(".").append(valType); + } + } else { + realExpr.append(".get(").append(innerKey).append(")"); + } + } + outputParam.setParseExpr(realExpr.toString()); + } else if (outputParam.getParseExpr().contains(EXPR_BOOLEAN_FLAG)) { + //转为布尔值 + outputParam.setOriginParseExpr(outputParam.getParseExpr()); + + StringBuilder realExpr = new StringBuilder(DEFAULT_EXPR_JSON_PREX); + Matcher m = EL_PATTERN.matcher(outputParam.getParseExpr()); + + while (m.find()) { + String innerKey = m.group(1); + if (innerKey.contains(EXPR_BOOLEAN_FLAG)) { + //目标字段 + String k = innerKey.substring(0, innerKey.indexOf(":")); + realExpr.append(".get(").append(k).append(").getAsBoolean()"); + } else { + realExpr.append(".get(").append(innerKey).append(")"); + } + } + outputParam.setParseExpr(realExpr.toString()); + } else { + outputParam.setParseExpr(DEFAULT_EXPR_PREX + outputParam.getParseExpr()); + } + } + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/util/DubboParamUtils.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/util/DubboParamUtils.java new file mode 100644 index 000000000..4eb10f008 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/util/DubboParamUtils.java @@ -0,0 +1,109 @@ +package run.mone.mimeter.dashboard.common.util; + +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; +import run.mone.mimeter.dashboard.common.DubboParamItem; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.*; + +import static com.xiaomi.mone.http.docs.core.Constants.*; + +@Slf4j +public class DubboParamUtils { + + public static Object initWithDefaultValue(List layerItems) { + try { + List reqList = new ArrayList<>(); + if (!layerItems.isEmpty()){ + layerItems.forEach(layerItem -> reqList.add(initWithDefaultValue0(layerItem))); + } + return reqList; + } catch (Exception e) { + log.warn("DubboParamUtils.initWithDefaultValue, error msg: " + e.getMessage()); + return EMPTY_OBJECT_INSTANCE; + } + } + + private static Object initWithDefaultValue(DubboParamItem layerItem) { + try { + return initWithDefaultValue0(layerItem); + } catch (Exception e) { + log.warn("DubboParamUtils.initWithDefaultValue, error msg: " + e.getMessage()); + return EMPTY_OBJECT_INSTANCE; + } + } + + private static Object initWithDefaultValue0(DubboParamItem layerItem) { + Class classType = layerItem.getItemClass(); + String defaultValue = layerItem.getDefaultValue(); + if (Integer.class.isAssignableFrom(classType) || int.class.isAssignableFrom(classType)) { + return (StringUtils.isEmpty(defaultValue) || !NumberUtils.isDigits(defaultValue)) ? 0 : Integer.valueOf(defaultValue); + } else if (Byte.class.isAssignableFrom(classType) || byte.class.isAssignableFrom(classType)) { + return StringUtils.isEmpty(defaultValue) ? (byte) 0 : defaultValue; + } else if (Long.class.isAssignableFrom(classType) || long.class.isAssignableFrom(classType)) { + return (StringUtils.isEmpty(defaultValue) || !NumberUtils.isDigits(defaultValue)) ? 0L : Long.valueOf(defaultValue); + } else if (Double.class.isAssignableFrom(classType) || double.class.isAssignableFrom(classType)) { + return (StringUtils.isEmpty(defaultValue) || !NumberUtils.isNumber(defaultValue)) ? 0.0D : Double.valueOf(defaultValue); + } else if (Float.class.isAssignableFrom(classType) || float.class.isAssignableFrom(classType)) { + return (StringUtils.isEmpty(defaultValue) || !NumberUtils.isNumber(defaultValue)) ? 0.0F : Float.valueOf(defaultValue); + } else if (String.class.isAssignableFrom(classType)) { + return StringUtils.isEmpty(defaultValue) + ? (StringUtils.isEmpty(layerItem.getExampleValue()) ? "demoString" : layerItem.getExampleValue()) + : defaultValue; + } else if (Character.class.isAssignableFrom(classType) || char.class.isAssignableFrom(classType)) { + return StringUtils.isEmpty(defaultValue) ? 'c' : defaultValue; + } else if (Short.class.isAssignableFrom(classType) || short.class.isAssignableFrom(classType)) { + return (StringUtils.isEmpty(defaultValue) || !NumberUtils.isDigits(defaultValue)) ? (short) 0 : Short.valueOf(defaultValue); + } else if (Boolean.class.isAssignableFrom(classType) || boolean.class.isAssignableFrom(classType)) { + return StringUtils.isEmpty(defaultValue) ? false : Boolean.valueOf(defaultValue); + } else if (Date.class.isAssignableFrom(classType)) { + return StringUtils.isEmpty(defaultValue) ? "【" + Date.class.getName() + "】yyyy-MM-dd HH:mm:ss" : defaultValue; + } else if (LocalDate.class.isAssignableFrom(classType)) { + return StringUtils.isEmpty(defaultValue) ? "【" + LocalDate.class.getName() + "】yyyy-MM-dd" : defaultValue; + } else if (LocalDateTime.class.isAssignableFrom(classType)) { + return StringUtils.isEmpty(defaultValue) ? "【" + LocalDateTime.class.getName() + "】yyyy-MM-dd HH:mm:ss" : defaultValue; + } else if (BigDecimal.class.isAssignableFrom(classType)) { + return 0; + } else if (BigInteger.class.isAssignableFrom(classType)) { + return 0; + } else if (Enum.class.isAssignableFrom(classType)) { + Object[] enumConstants = classType.getEnumConstants(); + StringBuilder sb = new StringBuilder(ENUM_VALUES_SEPARATOR); + try { + Method getName = classType.getMethod(METHOD_NAME_NAME); + for (Object obj : enumConstants) { + sb.append(getName.invoke(obj)).append(ENUM_VALUES_SEPARATOR); + } + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { + log.error(e.getMessage(), e); + } + return sb.toString(); + } else if (Map.class.isAssignableFrom(classType)) { + Map resMap = new HashMap<>(); + resMap.put(initWithDefaultValue(layerItem.getItemValue().get(0)), initWithDefaultValue(layerItem.getItemValue().get(1))); + return resMap; + } else if (classType.isArray() || Collection.class.isAssignableFrom(classType)) { + List resList = new ArrayList<>(); + resList.add(initWithDefaultValue(layerItem.getItemValue().get(0))); + return resList; + } else { + if (layerItem.getItemValue() == null) { + return EMPTY_OBJECT_INSTANCE; + } + + Map res = new HashMap<>(); + for (DubboParamItem perLayerItem : layerItem.getItemValue()) { + res.put(perLayerItem.getItemName(), initWithDefaultValue(perLayerItem)); + } + return res; + } + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/util/FileUtils.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/util/FileUtils.java new file mode 100644 index 000000000..d6fefc593 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/util/FileUtils.java @@ -0,0 +1,180 @@ +package run.mone.mimeter.dashboard.common.util; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * @author dingpei + * @date 2022-07-18 + */ +public class FileUtils { + + public static final HashMap mFileTypes = new HashMap(); + + static { + // images + mFileTypes.put("FFD8FF", "jpg"); + mFileTypes.put("89504E47", "png"); + mFileTypes.put("47494638", "gif"); + mFileTypes.put("49492A00", "tif"); + mFileTypes.put("424D", "bmp"); + /*CAD*/ + mFileTypes.put("41433130", "dwg"); + mFileTypes.put("38425053", "psd"); + /* 日记本 */ + mFileTypes.put("7B5C727466", "rtf"); + mFileTypes.put("3C3F786D6C", "xml"); + mFileTypes.put("68746D6C3E", "html"); + // 邮件 + mFileTypes.put("44656C69766572792D646174653A", "eml"); + mFileTypes.put("D0CF11E0", "doc"); + //excel2003版本文件 + mFileTypes.put("D0CF11E0", "xls"); + mFileTypes.put("5374616E64617264204A", "mdb"); + mFileTypes.put("252150532D41646F6265", "ps"); + mFileTypes.put("25504446", "pdf"); + mFileTypes.put("504B0304", "docx"); + //excel2007以上版本文件 + mFileTypes.put("504B0304", "xlsx"); + mFileTypes.put("52617221", "rar"); + mFileTypes.put("57415645", "wav"); + mFileTypes.put("41564920", "avi"); + mFileTypes.put("2E524D46", "rm"); + mFileTypes.put("000001BA", "mpg"); + mFileTypes.put("000001B3", "mpg"); + mFileTypes.put("6D6F6F76", "mov"); + mFileTypes.put("3026B2758E66CF11", "asf"); + mFileTypes.put("4D546864", "mid"); + mFileTypes.put("1F8B08", "gz"); + } + + /** + *

Title:getFileType

+ *

Description: 根据文件路径获取文件头信息

+ * + * @param filePath 文件路径(非网络文件) + * @return 文件头信息 + */ + public static String getFileType(String filePath) { + //返回十六进制 如:504B0304 + return mFileTypes.get(getFileHeader(filePath)); + } + + /** + *

Title:getFileTypeByFileInputStream

+ *

Description: 根据文件流获取文件头信息

+ * + * @param is 文件流 + * @return 文件头信息 + */ + public static String getFileTypeByFileInputStream(InputStream is) { + return mFileTypes.get(getFileHeaderByFileInputStream(is)); + } + + /** + *

Title:getFileHeader

+ *

Description: 根据文件路径获取文件头信息

+ * + * @param filePath 文件路径 + * @return 十六进制文件头信息 + */ + private static String getFileHeader(String filePath) { + FileInputStream is = null; + String value = null; + try { + is = new FileInputStream(filePath); + byte[] b = new byte[4]; + /* + * int read() 从此输入流中读取一个数据字节。int read(byte[] b) 从此输入流中将最多 b.length + * 个字节的数据读入一个 byte 数组中。 int read(byte[] b, int off, int len) + * 从此输入流中将最多 len 个字节的数据读入一个 byte 数组中。 + */ + is.read(b, 0, b.length); + value = bytesToHexString(b); + } catch (Exception e) { + } finally { + if (null != is) { + try { + is.close(); + } catch (IOException e) { + } + } + } + return value; + } + + /** + *

Title:getFileHeaderByFileInputStream

+ *

Description: 根据文件流获取文件头信息

+ * + * @param is 文件流 + * @return 十六进制文件头信息 + */ + private static String getFileHeaderByFileInputStream(InputStream is) { + String value = null; + try { + byte[] b = new byte[4]; + /* + * int read() 从此输入流中读取一个数据字节。int read(byte[] b) 从此输入流中将最多 b.length + * 个字节的数据读入一个 byte 数组中。 int read(byte[] b, int off, int len) + * 从此输入流中将最多 len 个字节的数据读入一个 byte 数组中。 + */ + is.read(b, 0, b.length); + value = bytesToHexString(b); + } catch (Exception e) { + } finally { + if (null != is) { + try { + is.close(); + } catch (IOException e) { + } + } + } + return value; + } + + /** + *

Title:bytesToHexString

+ *

Description: 将要读取文件头信息的文件的byte数组转换成string类型表示

+ * + * @param src 要读取文件头信息的文件的byte数组 + * @return 文件头信息 + */ + private static String bytesToHexString(byte[] src) { + StringBuilder builder = new StringBuilder(); + if (src == null || src.length <= 0) { + return null; + } + String hv; + for (int i = 0; i < src.length; i++) { + // 以十六进制(基数 16)无符号整数形式返回一个整数参数的字符串表示形式,并转换为大写 + hv = Integer.toHexString(src[i] & 0xFF).toUpperCase(); + if (hv.length() < 2) { + builder.append(0); + } + builder.append(hv); + } + //System.out.println(builder.toString()); + return builder.toString(); + } + + public static List parseCsv(String line) { + Pattern pattern = Pattern.compile("[^,\"]+|,,|(?:\"[^,\"]*\"[^\"]*\"[^\"]*)\"|\"(?:[^\"])*\""); + + List list = new ArrayList<>(); + + Matcher matcher = pattern.matcher(line); + while (matcher.find()) { + String cell = matcher.group(); + list.add(cell); + } + return list; + } + +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/util/MapTypeAdapter.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/util/MapTypeAdapter.java new file mode 100644 index 000000000..91a536630 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/util/MapTypeAdapter.java @@ -0,0 +1,112 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.common.util; + +import com.google.gson.Gson; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.internal.LinkedTreeMap; +import com.google.gson.internal.bind.ObjectTypeAdapter; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonToken; +import com.google.gson.stream.JsonWriter; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public final class MapTypeAdapter extends TypeAdapter { + public static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (type.getRawType() == Object.class) { + return (TypeAdapter) new MapTypeAdapter(gson); + } + return null; + } + }; + + private final Gson gson; + + private MapTypeAdapter(Gson gson) { + this.gson = gson; + } + + @Override + public Object read(JsonReader in) throws IOException { + JsonToken token = in.peek(); + //判断字符串的实际类型 + switch (token) { + case BEGIN_ARRAY: + List list = new ArrayList<>(); + in.beginArray(); + while (in.hasNext()) { + list.add(read(in)); + } + in.endArray(); + return list; + + case BEGIN_OBJECT: + Map map = new LinkedTreeMap<>(); + in.beginObject(); + while (in.hasNext()) { + map.put(in.nextName(), read(in)); + } + in.endObject(); + return map; + case STRING: + return in.nextString(); + case NUMBER: + String s = in.nextString(); + if (s.contains(".")) { + return Double.valueOf(s); + } else { + try { + return Integer.valueOf(s); + } catch (Exception e) { + return Long.valueOf(s); + } + } + case BOOLEAN: + return in.nextBoolean(); + case NULL: + in.nextNull(); + return null; + default: + throw new IllegalStateException(); + } + } + + @Override + public void write(JsonWriter out, Object value) throws IOException { + if (value == null) { + out.nullValue(); + return; + } + //noinspection unchecked + TypeAdapter typeAdapter = (TypeAdapter) gson.getAdapter(value.getClass()); + if (typeAdapter instanceof ObjectTypeAdapter) { + out.beginObject(); + out.endObject(); + return; + } + typeAdapter.write(out, value); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/util/Util.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/util/Util.java new file mode 100644 index 000000000..135840c1d --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/util/Util.java @@ -0,0 +1,36 @@ +package run.mone.mimeter.dashboard.common.util; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.internal.bind.ObjectTypeAdapter; + +import java.lang.reflect.Field; +import java.util.Collections; +import java.util.List; + +public class Util { + + public static Gson getGson() { + Gson gson = new GsonBuilder().create(); + try { + Field factories = Gson.class.getDeclaredField("factories"); + factories.setAccessible(true); + Object o = factories.get(gson); + Class[] declaredClasses = Collections.class.getDeclaredClasses(); + for (Class c : declaredClasses) { + if ("java.util.Collections$UnmodifiableList".equals(c.getName())) { + Field listField = c.getDeclaredField("list"); + listField.setAccessible(true); + List list = (List) listField.get(o); + int i = list.indexOf(ObjectTypeAdapter.FACTORY); + list.set(i, MapTypeAdapter.FACTORY); + break; + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return gson; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/util/Utility.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/util/Utility.java new file mode 100644 index 000000000..d140890aa --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/common/util/Utility.java @@ -0,0 +1,93 @@ +package run.mone.mimeter.dashboard.common.util; + +import org.apache.commons.codec.digest.DigestUtils; +import run.mone.mimeter.dashboard.pojo.common.Pageable; + +import java.util.HashMap; +import java.util.Map; + +import static com.google.common.base.Preconditions.checkArgument; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/6/22 + */ +public class Utility { + + public static void handlePagination(Pageable example, Integer pageSize, Integer pageNo) { + if (pageSize == null) { + return; + } + example.setLimit(pageSize); + + if (pageNo != null) { + checkArgument(pageNo >= 1, "invalid pageNo " + pageNo); + example.setOffset((pageNo - 1L) * pageSize); + } + } + + public static String generateId() { + return generateId(0L); + } + + public static String generateId(Long salt) { + long ts = System.currentTimeMillis(); + long base10 = 0; + long prefix = salt == null ? 0L : rehashSalt(salt, 2); + long multiplier = 1; + + for (int i = 0; i < 11; i++) { + base10 += (ts % 10) * multiplier; + multiplier *= 10; + ts /= 10; + } + base10 += prefix * multiplier; + return Long.toString(base10, 36).toUpperCase(); + } + + public static int rehashSalt(Long salt, int bits) { + if (salt == null || salt == 0 || bits <= 0) { + return 0; + } + if (salt < 0) { + salt = -salt; + } + int result = 0; + + while (salt > 0) { + long val = 0; + int multiplier = 1; + + for (int i = 0; i < bits && salt > 0; i++) { + val += (salt % 10) * multiplier; + salt /= 10; + multiplier *= 10; + } + result += val; + } + return result % 100; + } + + public static String saltVersionedId(long salt, int version) { + checkArgument(version >= 0 && salt >= 0, "invalid version or salt"); + String str = String.format("%08d%02d%08d", rehashSalt(salt, 8), version, + rehashSalt(System.currentTimeMillis() / 1000, 8)); + return Long.toString(Long.parseLong(str), 36).toUpperCase(); + } + + public static String generateSha256(String originalString) { + return DigestUtils.sha256Hex(originalString); + } + + public static Map convertMapType(Map map1) { + Map dict = new HashMap<>(); + + map1.forEach((k, v) -> { + if (k != null && v != null) { + dict.put(k, v.intValue()); + } + }); + return dict; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/es/Es.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/es/Es.java new file mode 100644 index 000000000..76ce692cc --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/es/Es.java @@ -0,0 +1,36 @@ +package run.mone.mimeter.dashboard.es; + +import com.xiaomi.mone.es.EsClient; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @author dingpei + */ +@Slf4j +@Configuration +public class Es { + + @Value("${es.address}") + private String address; + + @Value("${es.user}") + private String user; + + @Value("${es.pwd}") + private String pwd; + + @Bean + public EsClient esClient() throws Exception { + try { + return new EsClient(address, user, pwd); + } catch (Exception e) { + log.error("Es.esClient error, address:{}, user:{}, pwd:{}, msg:{}", address, user, pwd, e.getMessage(), e); + throw new Exception(); + } + } + + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/AgentApplyInfoMapper.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/AgentApplyInfoMapper.java new file mode 100644 index 000000000..e9906be62 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/AgentApplyInfoMapper.java @@ -0,0 +1,34 @@ +package run.mone.mimeter.dashboard.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import run.mone.mimeter.dashboard.pojo.AgentApplyInfo; +import run.mone.mimeter.dashboard.pojo.AgentApplyInfoExample; + +public interface AgentApplyInfoMapper { + long countByExample(AgentApplyInfoExample example); + + int deleteByExample(AgentApplyInfoExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(AgentApplyInfo record); + + int insertSelective(AgentApplyInfo record); + + List selectByExample(AgentApplyInfoExample example); + + AgentApplyInfo selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") AgentApplyInfo record, @Param("example") AgentApplyInfoExample example); + + int updateByExample(@Param("record") AgentApplyInfo record, @Param("example") AgentApplyInfoExample example); + + int updateByPrimaryKeySelective(AgentApplyInfo record); + + int updateByPrimaryKey(AgentApplyInfo record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") AgentApplyInfo.Column ... selective); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/AgentInfoMapper.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/AgentInfoMapper.java new file mode 100644 index 000000000..2473adbab --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/AgentInfoMapper.java @@ -0,0 +1,40 @@ +package run.mone.mimeter.dashboard.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import run.mone.mimeter.dashboard.pojo.AgentInfo; +import run.mone.mimeter.dashboard.pojo.AgentInfoExample; + +public interface AgentInfoMapper { + long countByExample(AgentInfoExample example); + + int deleteByExample(AgentInfoExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(AgentInfo record); + + int insertSelective(AgentInfo record); + + List selectByExampleWithBLOBs(AgentInfoExample example); + + List selectByExample(AgentInfoExample example); + + AgentInfo selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") AgentInfo record, @Param("example") AgentInfoExample example); + + int updateByExampleWithBLOBs(@Param("record") AgentInfo record, @Param("example") AgentInfoExample example); + + int updateByExample(@Param("record") AgentInfo record, @Param("example") AgentInfoExample example); + + int updateByPrimaryKeySelective(AgentInfo record); + + int updateByPrimaryKeyWithBLOBs(AgentInfo record); + + int updateByPrimaryKey(AgentInfo record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") AgentInfo.Column ... selective); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/ApiStatMapper.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/ApiStatMapper.java new file mode 100644 index 000000000..ae01a9084 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/ApiStatMapper.java @@ -0,0 +1,39 @@ +package run.mone.mimeter.dashboard.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import run.mone.mimeter.dashboard.pojo.ApiStat; +import run.mone.mimeter.dashboard.pojo.ApiStatExample; + +@Mapper +public interface ApiStatMapper { + long countByExample(ApiStatExample example); + + int deleteByExample(ApiStatExample example); + + int deleteByPrimaryKey(Long id); + + int insert(ApiStat record); + + int insertSelective(ApiStat record); + + List selectByExample(ApiStatExample example); + + ApiStat selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") ApiStat record, @Param("example") ApiStatExample example); + + int updateByExample(@Param("record") ApiStat record, @Param("example") ApiStatExample example); + + int updateByPrimaryKeySelective(ApiStat record); + + int updateByPrimaryKey(ApiStat record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") ApiStat.Column ... selective); + + int saveAccumulative(ApiStat record); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/CheckPointInfoMapper.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/CheckPointInfoMapper.java new file mode 100644 index 000000000..3c95ae394 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/CheckPointInfoMapper.java @@ -0,0 +1,40 @@ +package run.mone.mimeter.dashboard.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import run.mone.mimeter.dashboard.pojo.CheckPointInfo; +import run.mone.mimeter.dashboard.pojo.CheckPointInfoExample; + +public interface CheckPointInfoMapper { + long countByExample(CheckPointInfoExample example); + + int deleteByExample(CheckPointInfoExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(CheckPointInfo record); + + int insertSelective(CheckPointInfo record); + + List selectByExampleWithBLOBs(CheckPointInfoExample example); + + List selectByExample(CheckPointInfoExample example); + + CheckPointInfo selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") CheckPointInfo record, @Param("example") CheckPointInfoExample example); + + int updateByExampleWithBLOBs(@Param("record") CheckPointInfo record, @Param("example") CheckPointInfoExample example); + + int updateByExample(@Param("record") CheckPointInfo record, @Param("example") CheckPointInfoExample example); + + int updateByPrimaryKeySelective(CheckPointInfo record); + + int updateByPrimaryKeyWithBLOBs(CheckPointInfo record); + + int updateByPrimaryKey(CheckPointInfo record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") CheckPointInfo.Column ... selective); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/DatasetMapper.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/DatasetMapper.java new file mode 100644 index 000000000..78d52557b --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/DatasetMapper.java @@ -0,0 +1,40 @@ +package run.mone.mimeter.dashboard.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import run.mone.mimeter.dashboard.pojo.Dataset; +import run.mone.mimeter.dashboard.pojo.DatasetExample; + +public interface DatasetMapper { + long countByExample(DatasetExample example); + + int deleteByExample(DatasetExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(Dataset record); + + int insertSelective(Dataset record); + + List selectByExampleWithBLOBs(DatasetExample example); + + List selectByExample(DatasetExample example); + + Dataset selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") Dataset record, @Param("example") DatasetExample example); + + int updateByExampleWithBLOBs(@Param("record") Dataset record, @Param("example") DatasetExample example); + + int updateByExample(@Param("record") Dataset record, @Param("example") DatasetExample example); + + int updateByPrimaryKeySelective(Dataset record); + + int updateByPrimaryKeyWithBLOBs(Dataset record); + + int updateByPrimaryKey(Dataset record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") Dataset.Column ... selective); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/DatasetSceneRelationMapper.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/DatasetSceneRelationMapper.java new file mode 100644 index 000000000..e15114da8 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/DatasetSceneRelationMapper.java @@ -0,0 +1,34 @@ +package run.mone.mimeter.dashboard.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import run.mone.mimeter.dashboard.pojo.DatasetSceneRelation; +import run.mone.mimeter.dashboard.pojo.DatasetSceneRelationExample; + +public interface DatasetSceneRelationMapper { + long countByExample(DatasetSceneRelationExample example); + + int deleteByExample(DatasetSceneRelationExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(DatasetSceneRelation record); + + int insertSelective(DatasetSceneRelation record); + + List selectByExample(DatasetSceneRelationExample example); + + DatasetSceneRelation selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") DatasetSceneRelation record, @Param("example") DatasetSceneRelationExample example); + + int updateByExample(@Param("record") DatasetSceneRelation record, @Param("example") DatasetSceneRelationExample example); + + int updateByPrimaryKeySelective(DatasetSceneRelation record); + + int updateByPrimaryKey(DatasetSceneRelation record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") DatasetSceneRelation.Column ... selective); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/DomainApplyInfoMapper.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/DomainApplyInfoMapper.java new file mode 100644 index 000000000..da85c2efc --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/DomainApplyInfoMapper.java @@ -0,0 +1,40 @@ +package run.mone.mimeter.dashboard.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import run.mone.mimeter.dashboard.pojo.DomainApplyInfo; +import run.mone.mimeter.dashboard.pojo.DomainApplyInfoExample; + +public interface DomainApplyInfoMapper { + long countByExample(DomainApplyInfoExample example); + + int deleteByExample(DomainApplyInfoExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(DomainApplyInfo record); + + int insertSelective(DomainApplyInfo record); + + List selectByExampleWithBLOBs(DomainApplyInfoExample example); + + List selectByExample(DomainApplyInfoExample example); + + DomainApplyInfo selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") DomainApplyInfo record, @Param("example") DomainApplyInfoExample example); + + int updateByExampleWithBLOBs(@Param("record") DomainApplyInfo record, @Param("example") DomainApplyInfoExample example); + + int updateByExample(@Param("record") DomainApplyInfo record, @Param("example") DomainApplyInfoExample example); + + int updateByPrimaryKeySelective(DomainApplyInfo record); + + int updateByPrimaryKeyWithBLOBs(DomainApplyInfo record); + + int updateByPrimaryKey(DomainApplyInfo record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") DomainApplyInfo.Column ... selective); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/MibenchTaskMapper.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/MibenchTaskMapper.java new file mode 100644 index 000000000..6db978c88 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/MibenchTaskMapper.java @@ -0,0 +1,40 @@ +package run.mone.mimeter.dashboard.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import run.mone.mimeter.dashboard.pojo.MibenchTask; +import run.mone.mimeter.dashboard.pojo.MibenchTaskExample; + +public interface MibenchTaskMapper { + long countByExample(MibenchTaskExample example); + + int deleteByExample(MibenchTaskExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(MibenchTask record); + + int insertSelective(MibenchTask record); + + List selectByExampleWithBLOBs(MibenchTaskExample example); + + List selectByExample(MibenchTaskExample example); + + MibenchTask selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") MibenchTask record, @Param("example") MibenchTaskExample example); + + int updateByExampleWithBLOBs(@Param("record") MibenchTask record, @Param("example") MibenchTaskExample example); + + int updateByExample(@Param("record") MibenchTask record, @Param("example") MibenchTaskExample example); + + int updateByPrimaryKeySelective(MibenchTask record); + + int updateByPrimaryKeyWithBLOBs(MibenchTask record); + + int updateByPrimaryKey(MibenchTask record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") MibenchTask.Column ... selective); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/OperationLogMapper.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/OperationLogMapper.java new file mode 100644 index 000000000..fb4cc6d92 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/OperationLogMapper.java @@ -0,0 +1,40 @@ +package run.mone.mimeter.dashboard.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import run.mone.mimeter.dashboard.pojo.OperationLog; +import run.mone.mimeter.dashboard.pojo.OperationLogExample; + +public interface OperationLogMapper { + long countByExample(OperationLogExample example); + + int deleteByExample(OperationLogExample example); + + int deleteByPrimaryKey(Long id); + + int insert(OperationLog record); + + int insertSelective(OperationLog record); + + List selectByExampleWithBLOBs(OperationLogExample example); + + List selectByExample(OperationLogExample example); + + OperationLog selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") OperationLog record, @Param("example") OperationLogExample example); + + int updateByExampleWithBLOBs(@Param("record") OperationLog record, @Param("example") OperationLogExample example); + + int updateByExample(@Param("record") OperationLog record, @Param("example") OperationLogExample example); + + int updateByPrimaryKeySelective(OperationLog record); + + int updateByPrimaryKeyWithBLOBs(OperationLog record); + + int updateByPrimaryKey(OperationLog record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") OperationLog.Column ... selective); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/ReportInfoMapper.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/ReportInfoMapper.java new file mode 100644 index 000000000..ff5f1e4ff --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/ReportInfoMapper.java @@ -0,0 +1,40 @@ +package run.mone.mimeter.dashboard.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import run.mone.mimeter.dashboard.pojo.ReportInfo; +import run.mone.mimeter.dashboard.pojo.ReportInfoExample; + +public interface ReportInfoMapper { + long countByExample(ReportInfoExample example); + + int deleteByExample(ReportInfoExample example); + + int deleteByPrimaryKey(Long id); + + int insert(ReportInfo record); + + int insertSelective(ReportInfo record); + + List selectByExampleWithBLOBs(ReportInfoExample example); + + List selectByExample(ReportInfoExample example); + + ReportInfo selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") ReportInfo record, @Param("example") ReportInfoExample example); + + int updateByExampleWithBLOBs(@Param("record") ReportInfo record, @Param("example") ReportInfoExample example); + + int updateByExample(@Param("record") ReportInfo record, @Param("example") ReportInfoExample example); + + int updateByPrimaryKeySelective(ReportInfo record); + + int updateByPrimaryKeyWithBLOBs(ReportInfo record); + + int updateByPrimaryKey(ReportInfo record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") ReportInfo.Column ... selective); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/ReportStatMapper.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/ReportStatMapper.java new file mode 100644 index 000000000..847b8e471 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/ReportStatMapper.java @@ -0,0 +1,39 @@ +package run.mone.mimeter.dashboard.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import run.mone.mimeter.dashboard.pojo.ReportStat; +import run.mone.mimeter.dashboard.pojo.ReportStatExample; + +@Mapper +public interface ReportStatMapper { + long countByExample(ReportStatExample example); + + int deleteByExample(ReportStatExample example); + + int deleteByPrimaryKey(Long id); + + int insert(ReportStat record); + + int insertSelective(ReportStat record); + + List selectByExample(ReportStatExample example); + + ReportStat selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") ReportStat record, @Param("example") ReportStatExample example); + + int updateByExample(@Param("record") ReportStat record, @Param("example") ReportStatExample example); + + int updateByPrimaryKeySelective(ReportStat record); + + int updateByPrimaryKey(ReportStat record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") ReportStat.Column ... selective); + + int saveAccumulative(ReportStat record); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SceneApiInfoMapper.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SceneApiInfoMapper.java new file mode 100644 index 000000000..f2860871e --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SceneApiInfoMapper.java @@ -0,0 +1,40 @@ +package run.mone.mimeter.dashboard.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import run.mone.mimeter.dashboard.pojo.SceneApiInfo; +import run.mone.mimeter.dashboard.pojo.SceneApiInfoExample; + +public interface SceneApiInfoMapper { + long countByExample(SceneApiInfoExample example); + + int deleteByExample(SceneApiInfoExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(SceneApiInfo record); + + int insertSelective(SceneApiInfo record); + + List selectByExampleWithBLOBs(SceneApiInfoExample example); + + List selectByExample(SceneApiInfoExample example); + + SceneApiInfo selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") SceneApiInfo record, @Param("example") SceneApiInfoExample example); + + int updateByExampleWithBLOBs(@Param("record") SceneApiInfo record, @Param("example") SceneApiInfoExample example); + + int updateByExample(@Param("record") SceneApiInfo record, @Param("example") SceneApiInfoExample example); + + int updateByPrimaryKeySelective(SceneApiInfo record); + + int updateByPrimaryKeyWithBLOBs(SceneApiInfo record); + + int updateByPrimaryKey(SceneApiInfo record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") SceneApiInfo.Column ... selective); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SceneGroupMapper.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SceneGroupMapper.java new file mode 100644 index 000000000..c212f2922 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SceneGroupMapper.java @@ -0,0 +1,34 @@ +package run.mone.mimeter.dashboard.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import run.mone.mimeter.dashboard.pojo.SceneGroup; +import run.mone.mimeter.dashboard.pojo.SceneGroupExample; + +public interface SceneGroupMapper { + long countByExample(SceneGroupExample example); + + int deleteByExample(SceneGroupExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(SceneGroup record); + + int insertSelective(SceneGroup record); + + List selectByExample(SceneGroupExample example); + + SceneGroup selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") SceneGroup record, @Param("example") SceneGroupExample example); + + int updateByExample(@Param("record") SceneGroup record, @Param("example") SceneGroupExample example); + + int updateByPrimaryKeySelective(SceneGroup record); + + int updateByPrimaryKey(SceneGroup record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") SceneGroup.Column ... selective); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SceneInfoMapper.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SceneInfoMapper.java new file mode 100644 index 000000000..01172b6ee --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SceneInfoMapper.java @@ -0,0 +1,40 @@ +package run.mone.mimeter.dashboard.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import run.mone.mimeter.dashboard.pojo.SceneInfo; +import run.mone.mimeter.dashboard.pojo.SceneInfoExample; + +public interface SceneInfoMapper { + long countByExample(SceneInfoExample example); + + int deleteByExample(SceneInfoExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(SceneInfo record); + + int insertSelective(SceneInfo record); + + List selectByExampleWithBLOBs(SceneInfoExample example); + + List selectByExample(SceneInfoExample example); + + SceneInfo selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") SceneInfo record, @Param("example") SceneInfoExample example); + + int updateByExampleWithBLOBs(@Param("record") SceneInfo record, @Param("example") SceneInfoExample example); + + int updateByExample(@Param("record") SceneInfo record, @Param("example") SceneInfoExample example); + + int updateByPrimaryKeySelective(SceneInfo record); + + int updateByPrimaryKeyWithBLOBs(SceneInfo record); + + int updateByPrimaryKey(SceneInfo record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") SceneInfo.Column ... selective); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SceneSnapshotMapper.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SceneSnapshotMapper.java new file mode 100644 index 000000000..6efacf430 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SceneSnapshotMapper.java @@ -0,0 +1,40 @@ +package run.mone.mimeter.dashboard.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import run.mone.mimeter.dashboard.pojo.SceneSnapshot; +import run.mone.mimeter.dashboard.pojo.SceneSnapshotExample; + +public interface SceneSnapshotMapper { + long countByExample(SceneSnapshotExample example); + + int deleteByExample(SceneSnapshotExample example); + + int deleteByPrimaryKey(Long id); + + int insert(SceneSnapshot record); + + int insertSelective(SceneSnapshot record); + + List selectByExampleWithBLOBs(SceneSnapshotExample example); + + List selectByExample(SceneSnapshotExample example); + + SceneSnapshot selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") SceneSnapshot record, @Param("example") SceneSnapshotExample example); + + int updateByExampleWithBLOBs(@Param("record") SceneSnapshot record, @Param("example") SceneSnapshotExample example); + + int updateByExample(@Param("record") SceneSnapshot record, @Param("example") SceneSnapshotExample example); + + int updateByPrimaryKeySelective(SceneSnapshot record); + + int updateByPrimaryKeyWithBLOBs(SceneSnapshot record); + + int updateByPrimaryKey(SceneSnapshot record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") SceneSnapshot.Column ... selective); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SerialLinkMapper.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SerialLinkMapper.java new file mode 100644 index 000000000..8134184c0 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SerialLinkMapper.java @@ -0,0 +1,37 @@ +package run.mone.mimeter.dashboard.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import run.mone.mimeter.dashboard.pojo.SerialLink; +import run.mone.mimeter.dashboard.pojo.SerialLinkExample; + +@Mapper +public interface SerialLinkMapper { + long countByExample(SerialLinkExample example); + + int deleteByExample(SerialLinkExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(SerialLink record); + + int insertSelective(SerialLink record); + + List selectByExample(SerialLinkExample example); + + SerialLink selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") SerialLink record, @Param("example") SerialLinkExample example); + + int updateByExample(@Param("record") SerialLink record, @Param("example") SerialLinkExample example); + + int updateByPrimaryKeySelective(SerialLink record); + + int updateByPrimaryKey(SerialLink record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") SerialLink.Column ... selective); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SlaMapper.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SlaMapper.java new file mode 100644 index 000000000..d1796f571 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SlaMapper.java @@ -0,0 +1,34 @@ +package run.mone.mimeter.dashboard.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import run.mone.mimeter.dashboard.pojo.Sla; +import run.mone.mimeter.dashboard.pojo.SlaExample; + +public interface SlaMapper { + long countByExample(SlaExample example); + + int deleteByExample(SlaExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(Sla record); + + int insertSelective(Sla record); + + List selectByExample(SlaExample example); + + Sla selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") Sla record, @Param("example") SlaExample example); + + int updateByExample(@Param("record") Sla record, @Param("example") SlaExample example); + + int updateByPrimaryKeySelective(Sla record); + + int updateByPrimaryKey(Sla record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") Sla.Column ... selective); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SlaRuleMapper.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SlaRuleMapper.java new file mode 100644 index 000000000..a9f22ba02 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/mapper/SlaRuleMapper.java @@ -0,0 +1,34 @@ +package run.mone.mimeter.dashboard.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import run.mone.mimeter.dashboard.pojo.SlaRule; +import run.mone.mimeter.dashboard.pojo.SlaRuleExample; + +public interface SlaRuleMapper { + long countByExample(SlaRuleExample example); + + int deleteByExample(SlaRuleExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(SlaRule record); + + int insertSelective(SlaRule record); + + List selectByExample(SlaRuleExample example); + + SlaRule selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") SlaRule record, @Param("example") SlaRuleExample example); + + int updateByExample(@Param("record") SlaRule record, @Param("example") SlaRuleExample example); + + int updateByPrimaryKeySelective(SlaRule record); + + int updateByPrimaryKey(SlaRule record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") SlaRule.Column ... selective); +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/AgentApplyInfo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/AgentApplyInfo.java new file mode 100644 index 000000000..b99ea76ec --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/AgentApplyInfo.java @@ -0,0 +1,164 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; + +public class AgentApplyInfo { + private Integer id; + + private String applyUser; + + private String applyOrgId; + + private String applyOrgName; + + private String agentIp; + + private String agentHostname; + + private Integer applyStatus; + + private Long ctime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getApplyUser() { + return applyUser; + } + + public void setApplyUser(String applyUser) { + this.applyUser = applyUser == null ? null : applyUser.trim(); + } + + public String getApplyOrgId() { + return applyOrgId; + } + + public void setApplyOrgId(String applyOrgId) { + this.applyOrgId = applyOrgId == null ? null : applyOrgId.trim(); + } + + public String getApplyOrgName() { + return applyOrgName; + } + + public void setApplyOrgName(String applyOrgName) { + this.applyOrgName = applyOrgName == null ? null : applyOrgName.trim(); + } + + public String getAgentIp() { + return agentIp; + } + + public void setAgentIp(String agentIp) { + this.agentIp = agentIp == null ? null : agentIp.trim(); + } + + public String getAgentHostname() { + return agentHostname; + } + + public void setAgentHostname(String agentHostname) { + this.agentHostname = agentHostname == null ? null : agentHostname.trim(); + } + + public Integer getApplyStatus() { + return applyStatus; + } + + public void setApplyStatus(Integer applyStatus) { + this.applyStatus = applyStatus; + } + + public Long getCtime() { + return ctime; + } + + public void setCtime(Long ctime) { + this.ctime = ctime; + } + + public enum Column { + id("id", "id", "INTEGER", false), + applyUser("apply_user", "applyUser", "VARCHAR", false), + applyOrgId("apply_org_id", "applyOrgId", "VARCHAR", false), + applyOrgName("apply_org_name", "applyOrgName", "VARCHAR", false), + agentIp("agent_ip", "agentIp", "VARCHAR", false), + agentHostname("agent_hostname", "agentHostname", "VARCHAR", false), + applyStatus("apply_status", "applyStatus", "INTEGER", false), + ctime("ctime", "ctime", "BIGINT", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/AgentApplyInfoExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/AgentApplyInfoExample.java new file mode 100644 index 000000000..ded48efcb --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/AgentApplyInfoExample.java @@ -0,0 +1,730 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class AgentApplyInfoExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public AgentApplyInfoExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andApplyUserIsNull() { + addCriterion("apply_user is null"); + return (Criteria) this; + } + + public Criteria andApplyUserIsNotNull() { + addCriterion("apply_user is not null"); + return (Criteria) this; + } + + public Criteria andApplyUserEqualTo(String value) { + addCriterion("apply_user =", value, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserNotEqualTo(String value) { + addCriterion("apply_user <>", value, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserGreaterThan(String value) { + addCriterion("apply_user >", value, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserGreaterThanOrEqualTo(String value) { + addCriterion("apply_user >=", value, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserLessThan(String value) { + addCriterion("apply_user <", value, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserLessThanOrEqualTo(String value) { + addCriterion("apply_user <=", value, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserLike(String value) { + addCriterion("apply_user like", value, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserNotLike(String value) { + addCriterion("apply_user not like", value, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserIn(List values) { + addCriterion("apply_user in", values, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserNotIn(List values) { + addCriterion("apply_user not in", values, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserBetween(String value1, String value2) { + addCriterion("apply_user between", value1, value2, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserNotBetween(String value1, String value2) { + addCriterion("apply_user not between", value1, value2, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyOrgIdIsNull() { + addCriterion("apply_org_id is null"); + return (Criteria) this; + } + + public Criteria andApplyOrgIdIsNotNull() { + addCriterion("apply_org_id is not null"); + return (Criteria) this; + } + + public Criteria andApplyOrgIdEqualTo(String value) { + addCriterion("apply_org_id =", value, "applyOrgId"); + return (Criteria) this; + } + + public Criteria andApplyOrgIdNotEqualTo(String value) { + addCriterion("apply_org_id <>", value, "applyOrgId"); + return (Criteria) this; + } + + public Criteria andApplyOrgIdGreaterThan(String value) { + addCriterion("apply_org_id >", value, "applyOrgId"); + return (Criteria) this; + } + + public Criteria andApplyOrgIdGreaterThanOrEqualTo(String value) { + addCriterion("apply_org_id >=", value, "applyOrgId"); + return (Criteria) this; + } + + public Criteria andApplyOrgIdLessThan(String value) { + addCriterion("apply_org_id <", value, "applyOrgId"); + return (Criteria) this; + } + + public Criteria andApplyOrgIdLessThanOrEqualTo(String value) { + addCriterion("apply_org_id <=", value, "applyOrgId"); + return (Criteria) this; + } + + public Criteria andApplyOrgIdLike(String value) { + addCriterion("apply_org_id like", value, "applyOrgId"); + return (Criteria) this; + } + + public Criteria andApplyOrgIdNotLike(String value) { + addCriterion("apply_org_id not like", value, "applyOrgId"); + return (Criteria) this; + } + + public Criteria andApplyOrgIdIn(List values) { + addCriterion("apply_org_id in", values, "applyOrgId"); + return (Criteria) this; + } + + public Criteria andApplyOrgIdNotIn(List values) { + addCriterion("apply_org_id not in", values, "applyOrgId"); + return (Criteria) this; + } + + public Criteria andApplyOrgIdBetween(String value1, String value2) { + addCriterion("apply_org_id between", value1, value2, "applyOrgId"); + return (Criteria) this; + } + + public Criteria andApplyOrgIdNotBetween(String value1, String value2) { + addCriterion("apply_org_id not between", value1, value2, "applyOrgId"); + return (Criteria) this; + } + + public Criteria andApplyOrgNameIsNull() { + addCriterion("apply_org_name is null"); + return (Criteria) this; + } + + public Criteria andApplyOrgNameIsNotNull() { + addCriterion("apply_org_name is not null"); + return (Criteria) this; + } + + public Criteria andApplyOrgNameEqualTo(String value) { + addCriterion("apply_org_name =", value, "applyOrgName"); + return (Criteria) this; + } + + public Criteria andApplyOrgNameNotEqualTo(String value) { + addCriterion("apply_org_name <>", value, "applyOrgName"); + return (Criteria) this; + } + + public Criteria andApplyOrgNameGreaterThan(String value) { + addCriterion("apply_org_name >", value, "applyOrgName"); + return (Criteria) this; + } + + public Criteria andApplyOrgNameGreaterThanOrEqualTo(String value) { + addCriterion("apply_org_name >=", value, "applyOrgName"); + return (Criteria) this; + } + + public Criteria andApplyOrgNameLessThan(String value) { + addCriterion("apply_org_name <", value, "applyOrgName"); + return (Criteria) this; + } + + public Criteria andApplyOrgNameLessThanOrEqualTo(String value) { + addCriterion("apply_org_name <=", value, "applyOrgName"); + return (Criteria) this; + } + + public Criteria andApplyOrgNameLike(String value) { + addCriterion("apply_org_name like", value, "applyOrgName"); + return (Criteria) this; + } + + public Criteria andApplyOrgNameNotLike(String value) { + addCriterion("apply_org_name not like", value, "applyOrgName"); + return (Criteria) this; + } + + public Criteria andApplyOrgNameIn(List values) { + addCriterion("apply_org_name in", values, "applyOrgName"); + return (Criteria) this; + } + + public Criteria andApplyOrgNameNotIn(List values) { + addCriterion("apply_org_name not in", values, "applyOrgName"); + return (Criteria) this; + } + + public Criteria andApplyOrgNameBetween(String value1, String value2) { + addCriterion("apply_org_name between", value1, value2, "applyOrgName"); + return (Criteria) this; + } + + public Criteria andApplyOrgNameNotBetween(String value1, String value2) { + addCriterion("apply_org_name not between", value1, value2, "applyOrgName"); + return (Criteria) this; + } + + public Criteria andAgentIpIsNull() { + addCriterion("agent_ip is null"); + return (Criteria) this; + } + + public Criteria andAgentIpIsNotNull() { + addCriterion("agent_ip is not null"); + return (Criteria) this; + } + + public Criteria andAgentIpEqualTo(String value) { + addCriterion("agent_ip =", value, "agentIp"); + return (Criteria) this; + } + + public Criteria andAgentIpNotEqualTo(String value) { + addCriterion("agent_ip <>", value, "agentIp"); + return (Criteria) this; + } + + public Criteria andAgentIpGreaterThan(String value) { + addCriterion("agent_ip >", value, "agentIp"); + return (Criteria) this; + } + + public Criteria andAgentIpGreaterThanOrEqualTo(String value) { + addCriterion("agent_ip >=", value, "agentIp"); + return (Criteria) this; + } + + public Criteria andAgentIpLessThan(String value) { + addCriterion("agent_ip <", value, "agentIp"); + return (Criteria) this; + } + + public Criteria andAgentIpLessThanOrEqualTo(String value) { + addCriterion("agent_ip <=", value, "agentIp"); + return (Criteria) this; + } + + public Criteria andAgentIpLike(String value) { + addCriterion("agent_ip like", value, "agentIp"); + return (Criteria) this; + } + + public Criteria andAgentIpNotLike(String value) { + addCriterion("agent_ip not like", value, "agentIp"); + return (Criteria) this; + } + + public Criteria andAgentIpIn(List values) { + addCriterion("agent_ip in", values, "agentIp"); + return (Criteria) this; + } + + public Criteria andAgentIpNotIn(List values) { + addCriterion("agent_ip not in", values, "agentIp"); + return (Criteria) this; + } + + public Criteria andAgentIpBetween(String value1, String value2) { + addCriterion("agent_ip between", value1, value2, "agentIp"); + return (Criteria) this; + } + + public Criteria andAgentIpNotBetween(String value1, String value2) { + addCriterion("agent_ip not between", value1, value2, "agentIp"); + return (Criteria) this; + } + + public Criteria andAgentHostnameIsNull() { + addCriterion("agent_hostname is null"); + return (Criteria) this; + } + + public Criteria andAgentHostnameIsNotNull() { + addCriterion("agent_hostname is not null"); + return (Criteria) this; + } + + public Criteria andAgentHostnameEqualTo(String value) { + addCriterion("agent_hostname =", value, "agentHostname"); + return (Criteria) this; + } + + public Criteria andAgentHostnameNotEqualTo(String value) { + addCriterion("agent_hostname <>", value, "agentHostname"); + return (Criteria) this; + } + + public Criteria andAgentHostnameGreaterThan(String value) { + addCriterion("agent_hostname >", value, "agentHostname"); + return (Criteria) this; + } + + public Criteria andAgentHostnameGreaterThanOrEqualTo(String value) { + addCriterion("agent_hostname >=", value, "agentHostname"); + return (Criteria) this; + } + + public Criteria andAgentHostnameLessThan(String value) { + addCriterion("agent_hostname <", value, "agentHostname"); + return (Criteria) this; + } + + public Criteria andAgentHostnameLessThanOrEqualTo(String value) { + addCriterion("agent_hostname <=", value, "agentHostname"); + return (Criteria) this; + } + + public Criteria andAgentHostnameLike(String value) { + addCriterion("agent_hostname like", value, "agentHostname"); + return (Criteria) this; + } + + public Criteria andAgentHostnameNotLike(String value) { + addCriterion("agent_hostname not like", value, "agentHostname"); + return (Criteria) this; + } + + public Criteria andAgentHostnameIn(List values) { + addCriterion("agent_hostname in", values, "agentHostname"); + return (Criteria) this; + } + + public Criteria andAgentHostnameNotIn(List values) { + addCriterion("agent_hostname not in", values, "agentHostname"); + return (Criteria) this; + } + + public Criteria andAgentHostnameBetween(String value1, String value2) { + addCriterion("agent_hostname between", value1, value2, "agentHostname"); + return (Criteria) this; + } + + public Criteria andAgentHostnameNotBetween(String value1, String value2) { + addCriterion("agent_hostname not between", value1, value2, "agentHostname"); + return (Criteria) this; + } + + public Criteria andApplyStatusIsNull() { + addCriterion("apply_status is null"); + return (Criteria) this; + } + + public Criteria andApplyStatusIsNotNull() { + addCriterion("apply_status is not null"); + return (Criteria) this; + } + + public Criteria andApplyStatusEqualTo(Integer value) { + addCriterion("apply_status =", value, "applyStatus"); + return (Criteria) this; + } + + public Criteria andApplyStatusNotEqualTo(Integer value) { + addCriterion("apply_status <>", value, "applyStatus"); + return (Criteria) this; + } + + public Criteria andApplyStatusGreaterThan(Integer value) { + addCriterion("apply_status >", value, "applyStatus"); + return (Criteria) this; + } + + public Criteria andApplyStatusGreaterThanOrEqualTo(Integer value) { + addCriterion("apply_status >=", value, "applyStatus"); + return (Criteria) this; + } + + public Criteria andApplyStatusLessThan(Integer value) { + addCriterion("apply_status <", value, "applyStatus"); + return (Criteria) this; + } + + public Criteria andApplyStatusLessThanOrEqualTo(Integer value) { + addCriterion("apply_status <=", value, "applyStatus"); + return (Criteria) this; + } + + public Criteria andApplyStatusIn(List values) { + addCriterion("apply_status in", values, "applyStatus"); + return (Criteria) this; + } + + public Criteria andApplyStatusNotIn(List values) { + addCriterion("apply_status not in", values, "applyStatus"); + return (Criteria) this; + } + + public Criteria andApplyStatusBetween(Integer value1, Integer value2) { + addCriterion("apply_status between", value1, value2, "applyStatus"); + return (Criteria) this; + } + + public Criteria andApplyStatusNotBetween(Integer value1, Integer value2) { + addCriterion("apply_status not between", value1, value2, "applyStatus"); + return (Criteria) this; + } + + public Criteria andCtimeIsNull() { + addCriterion("ctime is null"); + return (Criteria) this; + } + + public Criteria andCtimeIsNotNull() { + addCriterion("ctime is not null"); + return (Criteria) this; + } + + public Criteria andCtimeEqualTo(Long value) { + addCriterion("ctime =", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotEqualTo(Long value) { + addCriterion("ctime <>", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThan(Long value) { + addCriterion("ctime >", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThanOrEqualTo(Long value) { + addCriterion("ctime >=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThan(Long value) { + addCriterion("ctime <", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThanOrEqualTo(Long value) { + addCriterion("ctime <=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeIn(List values) { + addCriterion("ctime in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotIn(List values) { + addCriterion("ctime not in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeBetween(Long value1, Long value2) { + addCriterion("ctime between", value1, value2, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotBetween(Long value1, Long value2) { + addCriterion("ctime not between", value1, value2, "ctime"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/AgentInfo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/AgentInfo.java new file mode 100644 index 000000000..f40c2f01a --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/AgentInfo.java @@ -0,0 +1,263 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; + +public class AgentInfo { + private Integer id; + + private String serverName; + + private String ip; + + private Integer port; + + private Integer cpu; + + private Long mem; + + private Integer useCpu; + + private Long useMem; + + private String hostname; + + private String clientDesc; + + private Long ctime; + + private Long utime; + + private Boolean enable; + + private String nodeIp; + + private String tenant; + + private String tenantCn; + + private String domainConf; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getServerName() { + return serverName; + } + + public void setServerName(String serverName) { + this.serverName = serverName == null ? null : serverName.trim(); + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip == null ? null : ip.trim(); + } + + public Integer getPort() { + return port; + } + + public void setPort(Integer port) { + this.port = port; + } + + public Integer getCpu() { + return cpu; + } + + public void setCpu(Integer cpu) { + this.cpu = cpu; + } + + public Long getMem() { + return mem; + } + + public void setMem(Long mem) { + this.mem = mem; + } + + public Integer getUseCpu() { + return useCpu; + } + + public void setUseCpu(Integer useCpu) { + this.useCpu = useCpu; + } + + public Long getUseMem() { + return useMem; + } + + public void setUseMem(Long useMem) { + this.useMem = useMem; + } + + public String getHostname() { + return hostname; + } + + public void setHostname(String hostname) { + this.hostname = hostname == null ? null : hostname.trim(); + } + + public String getClientDesc() { + return clientDesc; + } + + public void setClientDesc(String clientDesc) { + this.clientDesc = clientDesc == null ? null : clientDesc.trim(); + } + + public Long getCtime() { + return ctime; + } + + public void setCtime(Long ctime) { + this.ctime = ctime; + } + + public Long getUtime() { + return utime; + } + + public void setUtime(Long utime) { + this.utime = utime; + } + + public Boolean getEnable() { + return enable; + } + + public void setEnable(Boolean enable) { + this.enable = enable; + } + + public String getNodeIp() { + return nodeIp; + } + + public void setNodeIp(String nodeIp) { + this.nodeIp = nodeIp == null ? null : nodeIp.trim(); + } + + public String getTenant() { + return tenant; + } + + public void setTenant(String tenant) { + this.tenant = tenant == null ? null : tenant.trim(); + } + + public String getTenantCn() { + return tenantCn; + } + + public void setTenantCn(String tenantCn) { + this.tenantCn = tenantCn == null ? null : tenantCn.trim(); + } + + public String getDomainConf() { + return domainConf; + } + + public void setDomainConf(String domainConf) { + this.domainConf = domainConf == null ? null : domainConf.trim(); + } + + public enum Column { + id("id", "id", "INTEGER", false), + serverName("server_name", "serverName", "VARCHAR", false), + ip("ip", "ip", "VARCHAR", false), + port("port", "port", "INTEGER", false), + cpu("cpu", "cpu", "INTEGER", false), + mem("mem", "mem", "BIGINT", false), + useCpu("use_cpu", "useCpu", "INTEGER", false), + useMem("use_mem", "useMem", "BIGINT", false), + hostname("hostname", "hostname", "VARCHAR", false), + clientDesc("client_desc", "clientDesc", "VARCHAR", false), + ctime("ctime", "ctime", "BIGINT", false), + utime("utime", "utime", "BIGINT", false), + enable("enable", "enable", "BIT", false), + nodeIp("node_ip", "nodeIp", "VARCHAR", false), + tenant("tenant", "tenant", "VARCHAR", false), + tenantCn("tenant_cn", "tenantCn", "VARCHAR", false), + domainConf("domain_conf", "domainConf", "LONGVARCHAR", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/AgentInfoExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/AgentInfoExample.java new file mode 100644 index 000000000..4847c2489 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/AgentInfoExample.java @@ -0,0 +1,1230 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class AgentInfoExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public AgentInfoExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andServerNameIsNull() { + addCriterion("server_name is null"); + return (Criteria) this; + } + + public Criteria andServerNameIsNotNull() { + addCriterion("server_name is not null"); + return (Criteria) this; + } + + public Criteria andServerNameEqualTo(String value) { + addCriterion("server_name =", value, "serverName"); + return (Criteria) this; + } + + public Criteria andServerNameNotEqualTo(String value) { + addCriterion("server_name <>", value, "serverName"); + return (Criteria) this; + } + + public Criteria andServerNameGreaterThan(String value) { + addCriterion("server_name >", value, "serverName"); + return (Criteria) this; + } + + public Criteria andServerNameGreaterThanOrEqualTo(String value) { + addCriterion("server_name >=", value, "serverName"); + return (Criteria) this; + } + + public Criteria andServerNameLessThan(String value) { + addCriterion("server_name <", value, "serverName"); + return (Criteria) this; + } + + public Criteria andServerNameLessThanOrEqualTo(String value) { + addCriterion("server_name <=", value, "serverName"); + return (Criteria) this; + } + + public Criteria andServerNameLike(String value) { + addCriterion("server_name like", value, "serverName"); + return (Criteria) this; + } + + public Criteria andServerNameNotLike(String value) { + addCriterion("server_name not like", value, "serverName"); + return (Criteria) this; + } + + public Criteria andServerNameIn(List values) { + addCriterion("server_name in", values, "serverName"); + return (Criteria) this; + } + + public Criteria andServerNameNotIn(List values) { + addCriterion("server_name not in", values, "serverName"); + return (Criteria) this; + } + + public Criteria andServerNameBetween(String value1, String value2) { + addCriterion("server_name between", value1, value2, "serverName"); + return (Criteria) this; + } + + public Criteria andServerNameNotBetween(String value1, String value2) { + addCriterion("server_name not between", value1, value2, "serverName"); + return (Criteria) this; + } + + public Criteria andIpIsNull() { + addCriterion("ip is null"); + return (Criteria) this; + } + + public Criteria andIpIsNotNull() { + addCriterion("ip is not null"); + return (Criteria) this; + } + + public Criteria andIpEqualTo(String value) { + addCriterion("ip =", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpNotEqualTo(String value) { + addCriterion("ip <>", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpGreaterThan(String value) { + addCriterion("ip >", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpGreaterThanOrEqualTo(String value) { + addCriterion("ip >=", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpLessThan(String value) { + addCriterion("ip <", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpLessThanOrEqualTo(String value) { + addCriterion("ip <=", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpLike(String value) { + addCriterion("ip like", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpNotLike(String value) { + addCriterion("ip not like", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpIn(List values) { + addCriterion("ip in", values, "ip"); + return (Criteria) this; + } + + public Criteria andIpNotIn(List values) { + addCriterion("ip not in", values, "ip"); + return (Criteria) this; + } + + public Criteria andIpBetween(String value1, String value2) { + addCriterion("ip between", value1, value2, "ip"); + return (Criteria) this; + } + + public Criteria andIpNotBetween(String value1, String value2) { + addCriterion("ip not between", value1, value2, "ip"); + return (Criteria) this; + } + + public Criteria andPortIsNull() { + addCriterion("port is null"); + return (Criteria) this; + } + + public Criteria andPortIsNotNull() { + addCriterion("port is not null"); + return (Criteria) this; + } + + public Criteria andPortEqualTo(Integer value) { + addCriterion("port =", value, "port"); + return (Criteria) this; + } + + public Criteria andPortNotEqualTo(Integer value) { + addCriterion("port <>", value, "port"); + return (Criteria) this; + } + + public Criteria andPortGreaterThan(Integer value) { + addCriterion("port >", value, "port"); + return (Criteria) this; + } + + public Criteria andPortGreaterThanOrEqualTo(Integer value) { + addCriterion("port >=", value, "port"); + return (Criteria) this; + } + + public Criteria andPortLessThan(Integer value) { + addCriterion("port <", value, "port"); + return (Criteria) this; + } + + public Criteria andPortLessThanOrEqualTo(Integer value) { + addCriterion("port <=", value, "port"); + return (Criteria) this; + } + + public Criteria andPortIn(List values) { + addCriterion("port in", values, "port"); + return (Criteria) this; + } + + public Criteria andPortNotIn(List values) { + addCriterion("port not in", values, "port"); + return (Criteria) this; + } + + public Criteria andPortBetween(Integer value1, Integer value2) { + addCriterion("port between", value1, value2, "port"); + return (Criteria) this; + } + + public Criteria andPortNotBetween(Integer value1, Integer value2) { + addCriterion("port not between", value1, value2, "port"); + return (Criteria) this; + } + + public Criteria andCpuIsNull() { + addCriterion("cpu is null"); + return (Criteria) this; + } + + public Criteria andCpuIsNotNull() { + addCriterion("cpu is not null"); + return (Criteria) this; + } + + public Criteria andCpuEqualTo(Integer value) { + addCriterion("cpu =", value, "cpu"); + return (Criteria) this; + } + + public Criteria andCpuNotEqualTo(Integer value) { + addCriterion("cpu <>", value, "cpu"); + return (Criteria) this; + } + + public Criteria andCpuGreaterThan(Integer value) { + addCriterion("cpu >", value, "cpu"); + return (Criteria) this; + } + + public Criteria andCpuGreaterThanOrEqualTo(Integer value) { + addCriterion("cpu >=", value, "cpu"); + return (Criteria) this; + } + + public Criteria andCpuLessThan(Integer value) { + addCriterion("cpu <", value, "cpu"); + return (Criteria) this; + } + + public Criteria andCpuLessThanOrEqualTo(Integer value) { + addCriterion("cpu <=", value, "cpu"); + return (Criteria) this; + } + + public Criteria andCpuIn(List values) { + addCriterion("cpu in", values, "cpu"); + return (Criteria) this; + } + + public Criteria andCpuNotIn(List values) { + addCriterion("cpu not in", values, "cpu"); + return (Criteria) this; + } + + public Criteria andCpuBetween(Integer value1, Integer value2) { + addCriterion("cpu between", value1, value2, "cpu"); + return (Criteria) this; + } + + public Criteria andCpuNotBetween(Integer value1, Integer value2) { + addCriterion("cpu not between", value1, value2, "cpu"); + return (Criteria) this; + } + + public Criteria andMemIsNull() { + addCriterion("mem is null"); + return (Criteria) this; + } + + public Criteria andMemIsNotNull() { + addCriterion("mem is not null"); + return (Criteria) this; + } + + public Criteria andMemEqualTo(Long value) { + addCriterion("mem =", value, "mem"); + return (Criteria) this; + } + + public Criteria andMemNotEqualTo(Long value) { + addCriterion("mem <>", value, "mem"); + return (Criteria) this; + } + + public Criteria andMemGreaterThan(Long value) { + addCriterion("mem >", value, "mem"); + return (Criteria) this; + } + + public Criteria andMemGreaterThanOrEqualTo(Long value) { + addCriterion("mem >=", value, "mem"); + return (Criteria) this; + } + + public Criteria andMemLessThan(Long value) { + addCriterion("mem <", value, "mem"); + return (Criteria) this; + } + + public Criteria andMemLessThanOrEqualTo(Long value) { + addCriterion("mem <=", value, "mem"); + return (Criteria) this; + } + + public Criteria andMemIn(List values) { + addCriterion("mem in", values, "mem"); + return (Criteria) this; + } + + public Criteria andMemNotIn(List values) { + addCriterion("mem not in", values, "mem"); + return (Criteria) this; + } + + public Criteria andMemBetween(Long value1, Long value2) { + addCriterion("mem between", value1, value2, "mem"); + return (Criteria) this; + } + + public Criteria andMemNotBetween(Long value1, Long value2) { + addCriterion("mem not between", value1, value2, "mem"); + return (Criteria) this; + } + + public Criteria andUseCpuIsNull() { + addCriterion("use_cpu is null"); + return (Criteria) this; + } + + public Criteria andUseCpuIsNotNull() { + addCriterion("use_cpu is not null"); + return (Criteria) this; + } + + public Criteria andUseCpuEqualTo(Integer value) { + addCriterion("use_cpu =", value, "useCpu"); + return (Criteria) this; + } + + public Criteria andUseCpuNotEqualTo(Integer value) { + addCriterion("use_cpu <>", value, "useCpu"); + return (Criteria) this; + } + + public Criteria andUseCpuGreaterThan(Integer value) { + addCriterion("use_cpu >", value, "useCpu"); + return (Criteria) this; + } + + public Criteria andUseCpuGreaterThanOrEqualTo(Integer value) { + addCriterion("use_cpu >=", value, "useCpu"); + return (Criteria) this; + } + + public Criteria andUseCpuLessThan(Integer value) { + addCriterion("use_cpu <", value, "useCpu"); + return (Criteria) this; + } + + public Criteria andUseCpuLessThanOrEqualTo(Integer value) { + addCriterion("use_cpu <=", value, "useCpu"); + return (Criteria) this; + } + + public Criteria andUseCpuIn(List values) { + addCriterion("use_cpu in", values, "useCpu"); + return (Criteria) this; + } + + public Criteria andUseCpuNotIn(List values) { + addCriterion("use_cpu not in", values, "useCpu"); + return (Criteria) this; + } + + public Criteria andUseCpuBetween(Integer value1, Integer value2) { + addCriterion("use_cpu between", value1, value2, "useCpu"); + return (Criteria) this; + } + + public Criteria andUseCpuNotBetween(Integer value1, Integer value2) { + addCriterion("use_cpu not between", value1, value2, "useCpu"); + return (Criteria) this; + } + + public Criteria andUseMemIsNull() { + addCriterion("use_mem is null"); + return (Criteria) this; + } + + public Criteria andUseMemIsNotNull() { + addCriterion("use_mem is not null"); + return (Criteria) this; + } + + public Criteria andUseMemEqualTo(Long value) { + addCriterion("use_mem =", value, "useMem"); + return (Criteria) this; + } + + public Criteria andUseMemNotEqualTo(Long value) { + addCriterion("use_mem <>", value, "useMem"); + return (Criteria) this; + } + + public Criteria andUseMemGreaterThan(Long value) { + addCriterion("use_mem >", value, "useMem"); + return (Criteria) this; + } + + public Criteria andUseMemGreaterThanOrEqualTo(Long value) { + addCriterion("use_mem >=", value, "useMem"); + return (Criteria) this; + } + + public Criteria andUseMemLessThan(Long value) { + addCriterion("use_mem <", value, "useMem"); + return (Criteria) this; + } + + public Criteria andUseMemLessThanOrEqualTo(Long value) { + addCriterion("use_mem <=", value, "useMem"); + return (Criteria) this; + } + + public Criteria andUseMemIn(List values) { + addCriterion("use_mem in", values, "useMem"); + return (Criteria) this; + } + + public Criteria andUseMemNotIn(List values) { + addCriterion("use_mem not in", values, "useMem"); + return (Criteria) this; + } + + public Criteria andUseMemBetween(Long value1, Long value2) { + addCriterion("use_mem between", value1, value2, "useMem"); + return (Criteria) this; + } + + public Criteria andUseMemNotBetween(Long value1, Long value2) { + addCriterion("use_mem not between", value1, value2, "useMem"); + return (Criteria) this; + } + + public Criteria andHostnameIsNull() { + addCriterion("hostname is null"); + return (Criteria) this; + } + + public Criteria andHostnameIsNotNull() { + addCriterion("hostname is not null"); + return (Criteria) this; + } + + public Criteria andHostnameEqualTo(String value) { + addCriterion("hostname =", value, "hostname"); + return (Criteria) this; + } + + public Criteria andHostnameNotEqualTo(String value) { + addCriterion("hostname <>", value, "hostname"); + return (Criteria) this; + } + + public Criteria andHostnameGreaterThan(String value) { + addCriterion("hostname >", value, "hostname"); + return (Criteria) this; + } + + public Criteria andHostnameGreaterThanOrEqualTo(String value) { + addCriterion("hostname >=", value, "hostname"); + return (Criteria) this; + } + + public Criteria andHostnameLessThan(String value) { + addCriterion("hostname <", value, "hostname"); + return (Criteria) this; + } + + public Criteria andHostnameLessThanOrEqualTo(String value) { + addCriterion("hostname <=", value, "hostname"); + return (Criteria) this; + } + + public Criteria andHostnameLike(String value) { + addCriterion("hostname like", value, "hostname"); + return (Criteria) this; + } + + public Criteria andHostnameNotLike(String value) { + addCriterion("hostname not like", value, "hostname"); + return (Criteria) this; + } + + public Criteria andHostnameIn(List values) { + addCriterion("hostname in", values, "hostname"); + return (Criteria) this; + } + + public Criteria andHostnameNotIn(List values) { + addCriterion("hostname not in", values, "hostname"); + return (Criteria) this; + } + + public Criteria andHostnameBetween(String value1, String value2) { + addCriterion("hostname between", value1, value2, "hostname"); + return (Criteria) this; + } + + public Criteria andHostnameNotBetween(String value1, String value2) { + addCriterion("hostname not between", value1, value2, "hostname"); + return (Criteria) this; + } + + public Criteria andClientDescIsNull() { + addCriterion("client_desc is null"); + return (Criteria) this; + } + + public Criteria andClientDescIsNotNull() { + addCriterion("client_desc is not null"); + return (Criteria) this; + } + + public Criteria andClientDescEqualTo(String value) { + addCriterion("client_desc =", value, "clientDesc"); + return (Criteria) this; + } + + public Criteria andClientDescNotEqualTo(String value) { + addCriterion("client_desc <>", value, "clientDesc"); + return (Criteria) this; + } + + public Criteria andClientDescGreaterThan(String value) { + addCriterion("client_desc >", value, "clientDesc"); + return (Criteria) this; + } + + public Criteria andClientDescGreaterThanOrEqualTo(String value) { + addCriterion("client_desc >=", value, "clientDesc"); + return (Criteria) this; + } + + public Criteria andClientDescLessThan(String value) { + addCriterion("client_desc <", value, "clientDesc"); + return (Criteria) this; + } + + public Criteria andClientDescLessThanOrEqualTo(String value) { + addCriterion("client_desc <=", value, "clientDesc"); + return (Criteria) this; + } + + public Criteria andClientDescLike(String value) { + addCriterion("client_desc like", value, "clientDesc"); + return (Criteria) this; + } + + public Criteria andClientDescNotLike(String value) { + addCriterion("client_desc not like", value, "clientDesc"); + return (Criteria) this; + } + + public Criteria andClientDescIn(List values) { + addCriterion("client_desc in", values, "clientDesc"); + return (Criteria) this; + } + + public Criteria andClientDescNotIn(List values) { + addCriterion("client_desc not in", values, "clientDesc"); + return (Criteria) this; + } + + public Criteria andClientDescBetween(String value1, String value2) { + addCriterion("client_desc between", value1, value2, "clientDesc"); + return (Criteria) this; + } + + public Criteria andClientDescNotBetween(String value1, String value2) { + addCriterion("client_desc not between", value1, value2, "clientDesc"); + return (Criteria) this; + } + + public Criteria andCtimeIsNull() { + addCriterion("ctime is null"); + return (Criteria) this; + } + + public Criteria andCtimeIsNotNull() { + addCriterion("ctime is not null"); + return (Criteria) this; + } + + public Criteria andCtimeEqualTo(Long value) { + addCriterion("ctime =", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotEqualTo(Long value) { + addCriterion("ctime <>", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThan(Long value) { + addCriterion("ctime >", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThanOrEqualTo(Long value) { + addCriterion("ctime >=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThan(Long value) { + addCriterion("ctime <", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThanOrEqualTo(Long value) { + addCriterion("ctime <=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeIn(List values) { + addCriterion("ctime in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotIn(List values) { + addCriterion("ctime not in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeBetween(Long value1, Long value2) { + addCriterion("ctime between", value1, value2, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotBetween(Long value1, Long value2) { + addCriterion("ctime not between", value1, value2, "ctime"); + return (Criteria) this; + } + + public Criteria andUtimeIsNull() { + addCriterion("utime is null"); + return (Criteria) this; + } + + public Criteria andUtimeIsNotNull() { + addCriterion("utime is not null"); + return (Criteria) this; + } + + public Criteria andUtimeEqualTo(Long value) { + addCriterion("utime =", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotEqualTo(Long value) { + addCriterion("utime <>", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeGreaterThan(Long value) { + addCriterion("utime >", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeGreaterThanOrEqualTo(Long value) { + addCriterion("utime >=", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeLessThan(Long value) { + addCriterion("utime <", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeLessThanOrEqualTo(Long value) { + addCriterion("utime <=", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeIn(List values) { + addCriterion("utime in", values, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotIn(List values) { + addCriterion("utime not in", values, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeBetween(Long value1, Long value2) { + addCriterion("utime between", value1, value2, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotBetween(Long value1, Long value2) { + addCriterion("utime not between", value1, value2, "utime"); + return (Criteria) this; + } + + public Criteria andEnableIsNull() { + addCriterion("enable is null"); + return (Criteria) this; + } + + public Criteria andEnableIsNotNull() { + addCriterion("enable is not null"); + return (Criteria) this; + } + + public Criteria andEnableEqualTo(Boolean value) { + addCriterion("enable =", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableNotEqualTo(Boolean value) { + addCriterion("enable <>", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableGreaterThan(Boolean value) { + addCriterion("enable >", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableGreaterThanOrEqualTo(Boolean value) { + addCriterion("enable >=", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableLessThan(Boolean value) { + addCriterion("enable <", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableLessThanOrEqualTo(Boolean value) { + addCriterion("enable <=", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableIn(List values) { + addCriterion("enable in", values, "enable"); + return (Criteria) this; + } + + public Criteria andEnableNotIn(List values) { + addCriterion("enable not in", values, "enable"); + return (Criteria) this; + } + + public Criteria andEnableBetween(Boolean value1, Boolean value2) { + addCriterion("enable between", value1, value2, "enable"); + return (Criteria) this; + } + + public Criteria andEnableNotBetween(Boolean value1, Boolean value2) { + addCriterion("enable not between", value1, value2, "enable"); + return (Criteria) this; + } + + public Criteria andNodeIpIsNull() { + addCriterion("node_ip is null"); + return (Criteria) this; + } + + public Criteria andNodeIpIsNotNull() { + addCriterion("node_ip is not null"); + return (Criteria) this; + } + + public Criteria andNodeIpEqualTo(String value) { + addCriterion("node_ip =", value, "nodeIp"); + return (Criteria) this; + } + + public Criteria andNodeIpNotEqualTo(String value) { + addCriterion("node_ip <>", value, "nodeIp"); + return (Criteria) this; + } + + public Criteria andNodeIpGreaterThan(String value) { + addCriterion("node_ip >", value, "nodeIp"); + return (Criteria) this; + } + + public Criteria andNodeIpGreaterThanOrEqualTo(String value) { + addCriterion("node_ip >=", value, "nodeIp"); + return (Criteria) this; + } + + public Criteria andNodeIpLessThan(String value) { + addCriterion("node_ip <", value, "nodeIp"); + return (Criteria) this; + } + + public Criteria andNodeIpLessThanOrEqualTo(String value) { + addCriterion("node_ip <=", value, "nodeIp"); + return (Criteria) this; + } + + public Criteria andNodeIpLike(String value) { + addCriterion("node_ip like", value, "nodeIp"); + return (Criteria) this; + } + + public Criteria andNodeIpNotLike(String value) { + addCriterion("node_ip not like", value, "nodeIp"); + return (Criteria) this; + } + + public Criteria andNodeIpIn(List values) { + addCriterion("node_ip in", values, "nodeIp"); + return (Criteria) this; + } + + public Criteria andNodeIpNotIn(List values) { + addCriterion("node_ip not in", values, "nodeIp"); + return (Criteria) this; + } + + public Criteria andNodeIpBetween(String value1, String value2) { + addCriterion("node_ip between", value1, value2, "nodeIp"); + return (Criteria) this; + } + + public Criteria andNodeIpNotBetween(String value1, String value2) { + addCriterion("node_ip not between", value1, value2, "nodeIp"); + return (Criteria) this; + } + + public Criteria andTenantIsNull() { + addCriterion("tenant is null"); + return (Criteria) this; + } + + public Criteria andTenantIsNotNull() { + addCriterion("tenant is not null"); + return (Criteria) this; + } + + public Criteria andTenantEqualTo(String value) { + addCriterion("tenant =", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotEqualTo(String value) { + addCriterion("tenant <>", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantGreaterThan(String value) { + addCriterion("tenant >", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantGreaterThanOrEqualTo(String value) { + addCriterion("tenant >=", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantLessThan(String value) { + addCriterion("tenant <", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantLessThanOrEqualTo(String value) { + addCriterion("tenant <=", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantLike(String value) { + addCriterion("tenant like", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotLike(String value) { + addCriterion("tenant not like", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantIn(List values) { + addCriterion("tenant in", values, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotIn(List values) { + addCriterion("tenant not in", values, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantBetween(String value1, String value2) { + addCriterion("tenant between", value1, value2, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotBetween(String value1, String value2) { + addCriterion("tenant not between", value1, value2, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantCnIsNull() { + addCriterion("tenant_cn is null"); + return (Criteria) this; + } + + public Criteria andTenantCnIsNotNull() { + addCriterion("tenant_cn is not null"); + return (Criteria) this; + } + + public Criteria andTenantCnEqualTo(String value) { + addCriterion("tenant_cn =", value, "tenantCn"); + return (Criteria) this; + } + + public Criteria andTenantCnNotEqualTo(String value) { + addCriterion("tenant_cn <>", value, "tenantCn"); + return (Criteria) this; + } + + public Criteria andTenantCnGreaterThan(String value) { + addCriterion("tenant_cn >", value, "tenantCn"); + return (Criteria) this; + } + + public Criteria andTenantCnGreaterThanOrEqualTo(String value) { + addCriterion("tenant_cn >=", value, "tenantCn"); + return (Criteria) this; + } + + public Criteria andTenantCnLessThan(String value) { + addCriterion("tenant_cn <", value, "tenantCn"); + return (Criteria) this; + } + + public Criteria andTenantCnLessThanOrEqualTo(String value) { + addCriterion("tenant_cn <=", value, "tenantCn"); + return (Criteria) this; + } + + public Criteria andTenantCnLike(String value) { + addCriterion("tenant_cn like", value, "tenantCn"); + return (Criteria) this; + } + + public Criteria andTenantCnNotLike(String value) { + addCriterion("tenant_cn not like", value, "tenantCn"); + return (Criteria) this; + } + + public Criteria andTenantCnIn(List values) { + addCriterion("tenant_cn in", values, "tenantCn"); + return (Criteria) this; + } + + public Criteria andTenantCnNotIn(List values) { + addCriterion("tenant_cn not in", values, "tenantCn"); + return (Criteria) this; + } + + public Criteria andTenantCnBetween(String value1, String value2) { + addCriterion("tenant_cn between", value1, value2, "tenantCn"); + return (Criteria) this; + } + + public Criteria andTenantCnNotBetween(String value1, String value2) { + addCriterion("tenant_cn not between", value1, value2, "tenantCn"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/ApiStat.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/ApiStat.java new file mode 100644 index 000000000..325cee8ee --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/ApiStat.java @@ -0,0 +1,341 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; + +public class ApiStat { + private Long id; + + private Long sceneId; + + private String reportId; + + private Long apiId; + + private Integer reqSucc; + + private Integer reqFail; + + private Integer tps; + + private Integer tpsMax; + + private Integer rt; + + private Integer rtMax; + + private Integer rt99; + + private Integer rt90; + + private Integer rt70; + + private Integer rt50; + + private Integer connDuration; + + private Integer recvDuration; + + private Integer sendDuration; + + private Integer waitDuration; + + private Date createTime; + + private Date updateTime; + + private String apiUri; + + private String apiMethod; + + private Long serialId; + + private Long taskId; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getSceneId() { + return sceneId; + } + + public void setSceneId(Long sceneId) { + this.sceneId = sceneId; + } + + public String getReportId() { + return reportId; + } + + public void setReportId(String reportId) { + this.reportId = reportId == null ? null : reportId.trim(); + } + + public Long getApiId() { + return apiId; + } + + public void setApiId(Long apiId) { + this.apiId = apiId; + } + + public Integer getReqSucc() { + return reqSucc; + } + + public void setReqSucc(Integer reqSucc) { + this.reqSucc = reqSucc; + } + + public Integer getReqFail() { + return reqFail; + } + + public void setReqFail(Integer reqFail) { + this.reqFail = reqFail; + } + + public Integer getTps() { + return tps; + } + + public void setTps(Integer tps) { + this.tps = tps; + } + + public Integer getTpsMax() { + return tpsMax; + } + + public void setTpsMax(Integer tpsMax) { + this.tpsMax = tpsMax; + } + + public Integer getRt() { + return rt; + } + + public void setRt(Integer rt) { + this.rt = rt; + } + + public Integer getRtMax() { + return rtMax; + } + + public void setRtMax(Integer rtMax) { + this.rtMax = rtMax; + } + + public Integer getRt99() { + return rt99; + } + + public void setRt99(Integer rt99) { + this.rt99 = rt99; + } + + public Integer getRt90() { + return rt90; + } + + public void setRt90(Integer rt90) { + this.rt90 = rt90; + } + + public Integer getRt70() { + return rt70; + } + + public void setRt70(Integer rt70) { + this.rt70 = rt70; + } + + public Integer getRt50() { + return rt50; + } + + public void setRt50(Integer rt50) { + this.rt50 = rt50; + } + + public Integer getConnDuration() { + return connDuration; + } + + public void setConnDuration(Integer connDuration) { + this.connDuration = connDuration; + } + + public Integer getRecvDuration() { + return recvDuration; + } + + public void setRecvDuration(Integer recvDuration) { + this.recvDuration = recvDuration; + } + + public Integer getSendDuration() { + return sendDuration; + } + + public void setSendDuration(Integer sendDuration) { + this.sendDuration = sendDuration; + } + + public Integer getWaitDuration() { + return waitDuration; + } + + public void setWaitDuration(Integer waitDuration) { + this.waitDuration = waitDuration; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getApiUri() { + return apiUri; + } + + public void setApiUri(String apiUri) { + this.apiUri = apiUri == null ? null : apiUri.trim(); + } + + public String getApiMethod() { + return apiMethod; + } + + public void setApiMethod(String apiMethod) { + this.apiMethod = apiMethod == null ? null : apiMethod.trim(); + } + + public Long getSerialId() { + return serialId; + } + + public void setSerialId(Long serialId) { + this.serialId = serialId; + } + + public Long getTaskId() { + return taskId; + } + + public void setTaskId(Long taskId) { + this.taskId = taskId; + } + + public enum Column { + id("id", "id", "BIGINT", false), + sceneId("scene_id", "sceneId", "BIGINT", false), + reportId("report_id", "reportId", "VARCHAR", false), + apiId("api_id", "apiId", "BIGINT", false), + reqSucc("req_succ", "reqSucc", "INTEGER", false), + reqFail("req_fail", "reqFail", "INTEGER", false), + tps("tps", "tps", "INTEGER", false), + tpsMax("tps_max", "tpsMax", "INTEGER", false), + rt("rt", "rt", "INTEGER", false), + rtMax("rt_max", "rtMax", "INTEGER", false), + rt99("rt99", "rt99", "INTEGER", false), + rt90("rt90", "rt90", "INTEGER", false), + rt70("rt70", "rt70", "INTEGER", false), + rt50("rt50", "rt50", "INTEGER", false), + connDuration("conn_duration", "connDuration", "INTEGER", false), + recvDuration("recv_duration", "recvDuration", "INTEGER", false), + sendDuration("send_duration", "sendDuration", "INTEGER", false), + waitDuration("wait_duration", "waitDuration", "INTEGER", false), + createTime("create_time", "createTime", "TIMESTAMP", false), + updateTime("update_time", "updateTime", "TIMESTAMP", false), + apiUri("api_uri", "apiUri", "VARCHAR", false), + apiMethod("api_method", "apiMethod", "VARCHAR", false), + serialId("serial_id", "serialId", "BIGINT", false), + taskId("task_id", "taskId", "BIGINT", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/ApiStatExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/ApiStatExample.java new file mode 100644 index 000000000..78f7f19ce --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/ApiStatExample.java @@ -0,0 +1,1691 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class ApiStatExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + public ApiStatExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNull() { + addCriterion("scene_id is null"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNotNull() { + addCriterion("scene_id is not null"); + return (Criteria) this; + } + + public Criteria andSceneIdEqualTo(Long value) { + addCriterion("scene_id =", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotEqualTo(Long value) { + addCriterion("scene_id <>", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThan(Long value) { + addCriterion("scene_id >", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThanOrEqualTo(Long value) { + addCriterion("scene_id >=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThan(Long value) { + addCriterion("scene_id <", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThanOrEqualTo(Long value) { + addCriterion("scene_id <=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdIn(List values) { + addCriterion("scene_id in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotIn(List values) { + addCriterion("scene_id not in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdBetween(Long value1, Long value2) { + addCriterion("scene_id between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotBetween(Long value1, Long value2) { + addCriterion("scene_id not between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andReportIdIsNull() { + addCriterion("report_id is null"); + return (Criteria) this; + } + + public Criteria andReportIdIsNotNull() { + addCriterion("report_id is not null"); + return (Criteria) this; + } + + public Criteria andReportIdEqualTo(String value) { + addCriterion("report_id =", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotEqualTo(String value) { + addCriterion("report_id <>", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdGreaterThan(String value) { + addCriterion("report_id >", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdGreaterThanOrEqualTo(String value) { + addCriterion("report_id >=", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLessThan(String value) { + addCriterion("report_id <", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLessThanOrEqualTo(String value) { + addCriterion("report_id <=", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLike(String value) { + addCriterion("report_id like", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotLike(String value) { + addCriterion("report_id not like", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdIn(List values) { + addCriterion("report_id in", values, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotIn(List values) { + addCriterion("report_id not in", values, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdBetween(String value1, String value2) { + addCriterion("report_id between", value1, value2, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotBetween(String value1, String value2) { + addCriterion("report_id not between", value1, value2, "reportId"); + return (Criteria) this; + } + + public Criteria andApiIdIsNull() { + addCriterion("api_id is null"); + return (Criteria) this; + } + + public Criteria andApiIdIsNotNull() { + addCriterion("api_id is not null"); + return (Criteria) this; + } + + public Criteria andApiIdEqualTo(Long value) { + addCriterion("api_id =", value, "apiId"); + return (Criteria) this; + } + + public Criteria andApiIdNotEqualTo(Long value) { + addCriterion("api_id <>", value, "apiId"); + return (Criteria) this; + } + + public Criteria andApiIdGreaterThan(Long value) { + addCriterion("api_id >", value, "apiId"); + return (Criteria) this; + } + + public Criteria andApiIdGreaterThanOrEqualTo(Long value) { + addCriterion("api_id >=", value, "apiId"); + return (Criteria) this; + } + + public Criteria andApiIdLessThan(Long value) { + addCriterion("api_id <", value, "apiId"); + return (Criteria) this; + } + + public Criteria andApiIdLessThanOrEqualTo(Long value) { + addCriterion("api_id <=", value, "apiId"); + return (Criteria) this; + } + + public Criteria andApiIdIn(List values) { + addCriterion("api_id in", values, "apiId"); + return (Criteria) this; + } + + public Criteria andApiIdNotIn(List values) { + addCriterion("api_id not in", values, "apiId"); + return (Criteria) this; + } + + public Criteria andApiIdBetween(Long value1, Long value2) { + addCriterion("api_id between", value1, value2, "apiId"); + return (Criteria) this; + } + + public Criteria andApiIdNotBetween(Long value1, Long value2) { + addCriterion("api_id not between", value1, value2, "apiId"); + return (Criteria) this; + } + + public Criteria andReqSuccIsNull() { + addCriterion("req_succ is null"); + return (Criteria) this; + } + + public Criteria andReqSuccIsNotNull() { + addCriterion("req_succ is not null"); + return (Criteria) this; + } + + public Criteria andReqSuccEqualTo(Integer value) { + addCriterion("req_succ =", value, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqSuccNotEqualTo(Integer value) { + addCriterion("req_succ <>", value, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqSuccGreaterThan(Integer value) { + addCriterion("req_succ >", value, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqSuccGreaterThanOrEqualTo(Integer value) { + addCriterion("req_succ >=", value, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqSuccLessThan(Integer value) { + addCriterion("req_succ <", value, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqSuccLessThanOrEqualTo(Integer value) { + addCriterion("req_succ <=", value, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqSuccIn(List values) { + addCriterion("req_succ in", values, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqSuccNotIn(List values) { + addCriterion("req_succ not in", values, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqSuccBetween(Integer value1, Integer value2) { + addCriterion("req_succ between", value1, value2, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqSuccNotBetween(Integer value1, Integer value2) { + addCriterion("req_succ not between", value1, value2, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqFailIsNull() { + addCriterion("req_fail is null"); + return (Criteria) this; + } + + public Criteria andReqFailIsNotNull() { + addCriterion("req_fail is not null"); + return (Criteria) this; + } + + public Criteria andReqFailEqualTo(Integer value) { + addCriterion("req_fail =", value, "reqFail"); + return (Criteria) this; + } + + public Criteria andReqFailNotEqualTo(Integer value) { + addCriterion("req_fail <>", value, "reqFail"); + return (Criteria) this; + } + + public Criteria andReqFailGreaterThan(Integer value) { + addCriterion("req_fail >", value, "reqFail"); + return (Criteria) this; + } + + public Criteria andReqFailGreaterThanOrEqualTo(Integer value) { + addCriterion("req_fail >=", value, "reqFail"); + return (Criteria) this; + } + + public Criteria andReqFailLessThan(Integer value) { + addCriterion("req_fail <", value, "reqFail"); + return (Criteria) this; + } + + public Criteria andReqFailLessThanOrEqualTo(Integer value) { + addCriterion("req_fail <=", value, "reqFail"); + return (Criteria) this; + } + + public Criteria andReqFailIn(List values) { + addCriterion("req_fail in", values, "reqFail"); + return (Criteria) this; + } + + public Criteria andReqFailNotIn(List values) { + addCriterion("req_fail not in", values, "reqFail"); + return (Criteria) this; + } + + public Criteria andReqFailBetween(Integer value1, Integer value2) { + addCriterion("req_fail between", value1, value2, "reqFail"); + return (Criteria) this; + } + + public Criteria andReqFailNotBetween(Integer value1, Integer value2) { + addCriterion("req_fail not between", value1, value2, "reqFail"); + return (Criteria) this; + } + + public Criteria andTpsIsNull() { + addCriterion("tps is null"); + return (Criteria) this; + } + + public Criteria andTpsIsNotNull() { + addCriterion("tps is not null"); + return (Criteria) this; + } + + public Criteria andTpsEqualTo(Integer value) { + addCriterion("tps =", value, "tps"); + return (Criteria) this; + } + + public Criteria andTpsNotEqualTo(Integer value) { + addCriterion("tps <>", value, "tps"); + return (Criteria) this; + } + + public Criteria andTpsGreaterThan(Integer value) { + addCriterion("tps >", value, "tps"); + return (Criteria) this; + } + + public Criteria andTpsGreaterThanOrEqualTo(Integer value) { + addCriterion("tps >=", value, "tps"); + return (Criteria) this; + } + + public Criteria andTpsLessThan(Integer value) { + addCriterion("tps <", value, "tps"); + return (Criteria) this; + } + + public Criteria andTpsLessThanOrEqualTo(Integer value) { + addCriterion("tps <=", value, "tps"); + return (Criteria) this; + } + + public Criteria andTpsIn(List values) { + addCriterion("tps in", values, "tps"); + return (Criteria) this; + } + + public Criteria andTpsNotIn(List values) { + addCriterion("tps not in", values, "tps"); + return (Criteria) this; + } + + public Criteria andTpsBetween(Integer value1, Integer value2) { + addCriterion("tps between", value1, value2, "tps"); + return (Criteria) this; + } + + public Criteria andTpsNotBetween(Integer value1, Integer value2) { + addCriterion("tps not between", value1, value2, "tps"); + return (Criteria) this; + } + + public Criteria andTpsMaxIsNull() { + addCriterion("tps_max is null"); + return (Criteria) this; + } + + public Criteria andTpsMaxIsNotNull() { + addCriterion("tps_max is not null"); + return (Criteria) this; + } + + public Criteria andTpsMaxEqualTo(Integer value) { + addCriterion("tps_max =", value, "tpsMax"); + return (Criteria) this; + } + + public Criteria andTpsMaxNotEqualTo(Integer value) { + addCriterion("tps_max <>", value, "tpsMax"); + return (Criteria) this; + } + + public Criteria andTpsMaxGreaterThan(Integer value) { + addCriterion("tps_max >", value, "tpsMax"); + return (Criteria) this; + } + + public Criteria andTpsMaxGreaterThanOrEqualTo(Integer value) { + addCriterion("tps_max >=", value, "tpsMax"); + return (Criteria) this; + } + + public Criteria andTpsMaxLessThan(Integer value) { + addCriterion("tps_max <", value, "tpsMax"); + return (Criteria) this; + } + + public Criteria andTpsMaxLessThanOrEqualTo(Integer value) { + addCriterion("tps_max <=", value, "tpsMax"); + return (Criteria) this; + } + + public Criteria andTpsMaxIn(List values) { + addCriterion("tps_max in", values, "tpsMax"); + return (Criteria) this; + } + + public Criteria andTpsMaxNotIn(List values) { + addCriterion("tps_max not in", values, "tpsMax"); + return (Criteria) this; + } + + public Criteria andTpsMaxBetween(Integer value1, Integer value2) { + addCriterion("tps_max between", value1, value2, "tpsMax"); + return (Criteria) this; + } + + public Criteria andTpsMaxNotBetween(Integer value1, Integer value2) { + addCriterion("tps_max not between", value1, value2, "tpsMax"); + return (Criteria) this; + } + + public Criteria andRtIsNull() { + addCriterion("rt is null"); + return (Criteria) this; + } + + public Criteria andRtIsNotNull() { + addCriterion("rt is not null"); + return (Criteria) this; + } + + public Criteria andRtEqualTo(Integer value) { + addCriterion("rt =", value, "rt"); + return (Criteria) this; + } + + public Criteria andRtNotEqualTo(Integer value) { + addCriterion("rt <>", value, "rt"); + return (Criteria) this; + } + + public Criteria andRtGreaterThan(Integer value) { + addCriterion("rt >", value, "rt"); + return (Criteria) this; + } + + public Criteria andRtGreaterThanOrEqualTo(Integer value) { + addCriterion("rt >=", value, "rt"); + return (Criteria) this; + } + + public Criteria andRtLessThan(Integer value) { + addCriterion("rt <", value, "rt"); + return (Criteria) this; + } + + public Criteria andRtLessThanOrEqualTo(Integer value) { + addCriterion("rt <=", value, "rt"); + return (Criteria) this; + } + + public Criteria andRtIn(List values) { + addCriterion("rt in", values, "rt"); + return (Criteria) this; + } + + public Criteria andRtNotIn(List values) { + addCriterion("rt not in", values, "rt"); + return (Criteria) this; + } + + public Criteria andRtBetween(Integer value1, Integer value2) { + addCriterion("rt between", value1, value2, "rt"); + return (Criteria) this; + } + + public Criteria andRtNotBetween(Integer value1, Integer value2) { + addCriterion("rt not between", value1, value2, "rt"); + return (Criteria) this; + } + + public Criteria andRtMaxIsNull() { + addCriterion("rt_max is null"); + return (Criteria) this; + } + + public Criteria andRtMaxIsNotNull() { + addCriterion("rt_max is not null"); + return (Criteria) this; + } + + public Criteria andRtMaxEqualTo(Integer value) { + addCriterion("rt_max =", value, "rtMax"); + return (Criteria) this; + } + + public Criteria andRtMaxNotEqualTo(Integer value) { + addCriterion("rt_max <>", value, "rtMax"); + return (Criteria) this; + } + + public Criteria andRtMaxGreaterThan(Integer value) { + addCriterion("rt_max >", value, "rtMax"); + return (Criteria) this; + } + + public Criteria andRtMaxGreaterThanOrEqualTo(Integer value) { + addCriterion("rt_max >=", value, "rtMax"); + return (Criteria) this; + } + + public Criteria andRtMaxLessThan(Integer value) { + addCriterion("rt_max <", value, "rtMax"); + return (Criteria) this; + } + + public Criteria andRtMaxLessThanOrEqualTo(Integer value) { + addCriterion("rt_max <=", value, "rtMax"); + return (Criteria) this; + } + + public Criteria andRtMaxIn(List values) { + addCriterion("rt_max in", values, "rtMax"); + return (Criteria) this; + } + + public Criteria andRtMaxNotIn(List values) { + addCriterion("rt_max not in", values, "rtMax"); + return (Criteria) this; + } + + public Criteria andRtMaxBetween(Integer value1, Integer value2) { + addCriterion("rt_max between", value1, value2, "rtMax"); + return (Criteria) this; + } + + public Criteria andRtMaxNotBetween(Integer value1, Integer value2) { + addCriterion("rt_max not between", value1, value2, "rtMax"); + return (Criteria) this; + } + + public Criteria andRt99IsNull() { + addCriterion("rt99 is null"); + return (Criteria) this; + } + + public Criteria andRt99IsNotNull() { + addCriterion("rt99 is not null"); + return (Criteria) this; + } + + public Criteria andRt99EqualTo(Integer value) { + addCriterion("rt99 =", value, "rt99"); + return (Criteria) this; + } + + public Criteria andRt99NotEqualTo(Integer value) { + addCriterion("rt99 <>", value, "rt99"); + return (Criteria) this; + } + + public Criteria andRt99GreaterThan(Integer value) { + addCriterion("rt99 >", value, "rt99"); + return (Criteria) this; + } + + public Criteria andRt99GreaterThanOrEqualTo(Integer value) { + addCriterion("rt99 >=", value, "rt99"); + return (Criteria) this; + } + + public Criteria andRt99LessThan(Integer value) { + addCriterion("rt99 <", value, "rt99"); + return (Criteria) this; + } + + public Criteria andRt99LessThanOrEqualTo(Integer value) { + addCriterion("rt99 <=", value, "rt99"); + return (Criteria) this; + } + + public Criteria andRt99In(List values) { + addCriterion("rt99 in", values, "rt99"); + return (Criteria) this; + } + + public Criteria andRt99NotIn(List values) { + addCriterion("rt99 not in", values, "rt99"); + return (Criteria) this; + } + + public Criteria andRt99Between(Integer value1, Integer value2) { + addCriterion("rt99 between", value1, value2, "rt99"); + return (Criteria) this; + } + + public Criteria andRt99NotBetween(Integer value1, Integer value2) { + addCriterion("rt99 not between", value1, value2, "rt99"); + return (Criteria) this; + } + + public Criteria andRt90IsNull() { + addCriterion("rt90 is null"); + return (Criteria) this; + } + + public Criteria andRt90IsNotNull() { + addCriterion("rt90 is not null"); + return (Criteria) this; + } + + public Criteria andRt90EqualTo(Integer value) { + addCriterion("rt90 =", value, "rt90"); + return (Criteria) this; + } + + public Criteria andRt90NotEqualTo(Integer value) { + addCriterion("rt90 <>", value, "rt90"); + return (Criteria) this; + } + + public Criteria andRt90GreaterThan(Integer value) { + addCriterion("rt90 >", value, "rt90"); + return (Criteria) this; + } + + public Criteria andRt90GreaterThanOrEqualTo(Integer value) { + addCriterion("rt90 >=", value, "rt90"); + return (Criteria) this; + } + + public Criteria andRt90LessThan(Integer value) { + addCriterion("rt90 <", value, "rt90"); + return (Criteria) this; + } + + public Criteria andRt90LessThanOrEqualTo(Integer value) { + addCriterion("rt90 <=", value, "rt90"); + return (Criteria) this; + } + + public Criteria andRt90In(List values) { + addCriterion("rt90 in", values, "rt90"); + return (Criteria) this; + } + + public Criteria andRt90NotIn(List values) { + addCriterion("rt90 not in", values, "rt90"); + return (Criteria) this; + } + + public Criteria andRt90Between(Integer value1, Integer value2) { + addCriterion("rt90 between", value1, value2, "rt90"); + return (Criteria) this; + } + + public Criteria andRt90NotBetween(Integer value1, Integer value2) { + addCriterion("rt90 not between", value1, value2, "rt90"); + return (Criteria) this; + } + + public Criteria andRt70IsNull() { + addCriterion("rt70 is null"); + return (Criteria) this; + } + + public Criteria andRt70IsNotNull() { + addCriterion("rt70 is not null"); + return (Criteria) this; + } + + public Criteria andRt70EqualTo(Integer value) { + addCriterion("rt70 =", value, "rt70"); + return (Criteria) this; + } + + public Criteria andRt70NotEqualTo(Integer value) { + addCriterion("rt70 <>", value, "rt70"); + return (Criteria) this; + } + + public Criteria andRt70GreaterThan(Integer value) { + addCriterion("rt70 >", value, "rt70"); + return (Criteria) this; + } + + public Criteria andRt70GreaterThanOrEqualTo(Integer value) { + addCriterion("rt70 >=", value, "rt70"); + return (Criteria) this; + } + + public Criteria andRt70LessThan(Integer value) { + addCriterion("rt70 <", value, "rt70"); + return (Criteria) this; + } + + public Criteria andRt70LessThanOrEqualTo(Integer value) { + addCriterion("rt70 <=", value, "rt70"); + return (Criteria) this; + } + + public Criteria andRt70In(List values) { + addCriterion("rt70 in", values, "rt70"); + return (Criteria) this; + } + + public Criteria andRt70NotIn(List values) { + addCriterion("rt70 not in", values, "rt70"); + return (Criteria) this; + } + + public Criteria andRt70Between(Integer value1, Integer value2) { + addCriterion("rt70 between", value1, value2, "rt70"); + return (Criteria) this; + } + + public Criteria andRt70NotBetween(Integer value1, Integer value2) { + addCriterion("rt70 not between", value1, value2, "rt70"); + return (Criteria) this; + } + + public Criteria andRt50IsNull() { + addCriterion("rt50 is null"); + return (Criteria) this; + } + + public Criteria andRt50IsNotNull() { + addCriterion("rt50 is not null"); + return (Criteria) this; + } + + public Criteria andRt50EqualTo(Integer value) { + addCriterion("rt50 =", value, "rt50"); + return (Criteria) this; + } + + public Criteria andRt50NotEqualTo(Integer value) { + addCriterion("rt50 <>", value, "rt50"); + return (Criteria) this; + } + + public Criteria andRt50GreaterThan(Integer value) { + addCriterion("rt50 >", value, "rt50"); + return (Criteria) this; + } + + public Criteria andRt50GreaterThanOrEqualTo(Integer value) { + addCriterion("rt50 >=", value, "rt50"); + return (Criteria) this; + } + + public Criteria andRt50LessThan(Integer value) { + addCriterion("rt50 <", value, "rt50"); + return (Criteria) this; + } + + public Criteria andRt50LessThanOrEqualTo(Integer value) { + addCriterion("rt50 <=", value, "rt50"); + return (Criteria) this; + } + + public Criteria andRt50In(List values) { + addCriterion("rt50 in", values, "rt50"); + return (Criteria) this; + } + + public Criteria andRt50NotIn(List values) { + addCriterion("rt50 not in", values, "rt50"); + return (Criteria) this; + } + + public Criteria andRt50Between(Integer value1, Integer value2) { + addCriterion("rt50 between", value1, value2, "rt50"); + return (Criteria) this; + } + + public Criteria andRt50NotBetween(Integer value1, Integer value2) { + addCriterion("rt50 not between", value1, value2, "rt50"); + return (Criteria) this; + } + + public Criteria andConnDurationIsNull() { + addCriterion("conn_duration is null"); + return (Criteria) this; + } + + public Criteria andConnDurationIsNotNull() { + addCriterion("conn_duration is not null"); + return (Criteria) this; + } + + public Criteria andConnDurationEqualTo(Integer value) { + addCriterion("conn_duration =", value, "connDuration"); + return (Criteria) this; + } + + public Criteria andConnDurationNotEqualTo(Integer value) { + addCriterion("conn_duration <>", value, "connDuration"); + return (Criteria) this; + } + + public Criteria andConnDurationGreaterThan(Integer value) { + addCriterion("conn_duration >", value, "connDuration"); + return (Criteria) this; + } + + public Criteria andConnDurationGreaterThanOrEqualTo(Integer value) { + addCriterion("conn_duration >=", value, "connDuration"); + return (Criteria) this; + } + + public Criteria andConnDurationLessThan(Integer value) { + addCriterion("conn_duration <", value, "connDuration"); + return (Criteria) this; + } + + public Criteria andConnDurationLessThanOrEqualTo(Integer value) { + addCriterion("conn_duration <=", value, "connDuration"); + return (Criteria) this; + } + + public Criteria andConnDurationIn(List values) { + addCriterion("conn_duration in", values, "connDuration"); + return (Criteria) this; + } + + public Criteria andConnDurationNotIn(List values) { + addCriterion("conn_duration not in", values, "connDuration"); + return (Criteria) this; + } + + public Criteria andConnDurationBetween(Integer value1, Integer value2) { + addCriterion("conn_duration between", value1, value2, "connDuration"); + return (Criteria) this; + } + + public Criteria andConnDurationNotBetween(Integer value1, Integer value2) { + addCriterion("conn_duration not between", value1, value2, "connDuration"); + return (Criteria) this; + } + + public Criteria andRecvDurationIsNull() { + addCriterion("recv_duration is null"); + return (Criteria) this; + } + + public Criteria andRecvDurationIsNotNull() { + addCriterion("recv_duration is not null"); + return (Criteria) this; + } + + public Criteria andRecvDurationEqualTo(Integer value) { + addCriterion("recv_duration =", value, "recvDuration"); + return (Criteria) this; + } + + public Criteria andRecvDurationNotEqualTo(Integer value) { + addCriterion("recv_duration <>", value, "recvDuration"); + return (Criteria) this; + } + + public Criteria andRecvDurationGreaterThan(Integer value) { + addCriterion("recv_duration >", value, "recvDuration"); + return (Criteria) this; + } + + public Criteria andRecvDurationGreaterThanOrEqualTo(Integer value) { + addCriterion("recv_duration >=", value, "recvDuration"); + return (Criteria) this; + } + + public Criteria andRecvDurationLessThan(Integer value) { + addCriterion("recv_duration <", value, "recvDuration"); + return (Criteria) this; + } + + public Criteria andRecvDurationLessThanOrEqualTo(Integer value) { + addCriterion("recv_duration <=", value, "recvDuration"); + return (Criteria) this; + } + + public Criteria andRecvDurationIn(List values) { + addCriterion("recv_duration in", values, "recvDuration"); + return (Criteria) this; + } + + public Criteria andRecvDurationNotIn(List values) { + addCriterion("recv_duration not in", values, "recvDuration"); + return (Criteria) this; + } + + public Criteria andRecvDurationBetween(Integer value1, Integer value2) { + addCriterion("recv_duration between", value1, value2, "recvDuration"); + return (Criteria) this; + } + + public Criteria andRecvDurationNotBetween(Integer value1, Integer value2) { + addCriterion("recv_duration not between", value1, value2, "recvDuration"); + return (Criteria) this; + } + + public Criteria andSendDurationIsNull() { + addCriterion("send_duration is null"); + return (Criteria) this; + } + + public Criteria andSendDurationIsNotNull() { + addCriterion("send_duration is not null"); + return (Criteria) this; + } + + public Criteria andSendDurationEqualTo(Integer value) { + addCriterion("send_duration =", value, "sendDuration"); + return (Criteria) this; + } + + public Criteria andSendDurationNotEqualTo(Integer value) { + addCriterion("send_duration <>", value, "sendDuration"); + return (Criteria) this; + } + + public Criteria andSendDurationGreaterThan(Integer value) { + addCriterion("send_duration >", value, "sendDuration"); + return (Criteria) this; + } + + public Criteria andSendDurationGreaterThanOrEqualTo(Integer value) { + addCriterion("send_duration >=", value, "sendDuration"); + return (Criteria) this; + } + + public Criteria andSendDurationLessThan(Integer value) { + addCriterion("send_duration <", value, "sendDuration"); + return (Criteria) this; + } + + public Criteria andSendDurationLessThanOrEqualTo(Integer value) { + addCriterion("send_duration <=", value, "sendDuration"); + return (Criteria) this; + } + + public Criteria andSendDurationIn(List values) { + addCriterion("send_duration in", values, "sendDuration"); + return (Criteria) this; + } + + public Criteria andSendDurationNotIn(List values) { + addCriterion("send_duration not in", values, "sendDuration"); + return (Criteria) this; + } + + public Criteria andSendDurationBetween(Integer value1, Integer value2) { + addCriterion("send_duration between", value1, value2, "sendDuration"); + return (Criteria) this; + } + + public Criteria andSendDurationNotBetween(Integer value1, Integer value2) { + addCriterion("send_duration not between", value1, value2, "sendDuration"); + return (Criteria) this; + } + + public Criteria andWaitDurationIsNull() { + addCriterion("wait_duration is null"); + return (Criteria) this; + } + + public Criteria andWaitDurationIsNotNull() { + addCriterion("wait_duration is not null"); + return (Criteria) this; + } + + public Criteria andWaitDurationEqualTo(Integer value) { + addCriterion("wait_duration =", value, "waitDuration"); + return (Criteria) this; + } + + public Criteria andWaitDurationNotEqualTo(Integer value) { + addCriterion("wait_duration <>", value, "waitDuration"); + return (Criteria) this; + } + + public Criteria andWaitDurationGreaterThan(Integer value) { + addCriterion("wait_duration >", value, "waitDuration"); + return (Criteria) this; + } + + public Criteria andWaitDurationGreaterThanOrEqualTo(Integer value) { + addCriterion("wait_duration >=", value, "waitDuration"); + return (Criteria) this; + } + + public Criteria andWaitDurationLessThan(Integer value) { + addCriterion("wait_duration <", value, "waitDuration"); + return (Criteria) this; + } + + public Criteria andWaitDurationLessThanOrEqualTo(Integer value) { + addCriterion("wait_duration <=", value, "waitDuration"); + return (Criteria) this; + } + + public Criteria andWaitDurationIn(List values) { + addCriterion("wait_duration in", values, "waitDuration"); + return (Criteria) this; + } + + public Criteria andWaitDurationNotIn(List values) { + addCriterion("wait_duration not in", values, "waitDuration"); + return (Criteria) this; + } + + public Criteria andWaitDurationBetween(Integer value1, Integer value2) { + addCriterion("wait_duration between", value1, value2, "waitDuration"); + return (Criteria) this; + } + + public Criteria andWaitDurationNotBetween(Integer value1, Integer value2) { + addCriterion("wait_duration not between", value1, value2, "waitDuration"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andApiUriIsNull() { + addCriterion("api_uri is null"); + return (Criteria) this; + } + + public Criteria andApiUriIsNotNull() { + addCriterion("api_uri is not null"); + return (Criteria) this; + } + + public Criteria andApiUriEqualTo(String value) { + addCriterion("api_uri =", value, "apiUri"); + return (Criteria) this; + } + + public Criteria andApiUriNotEqualTo(String value) { + addCriterion("api_uri <>", value, "apiUri"); + return (Criteria) this; + } + + public Criteria andApiUriGreaterThan(String value) { + addCriterion("api_uri >", value, "apiUri"); + return (Criteria) this; + } + + public Criteria andApiUriGreaterThanOrEqualTo(String value) { + addCriterion("api_uri >=", value, "apiUri"); + return (Criteria) this; + } + + public Criteria andApiUriLessThan(String value) { + addCriterion("api_uri <", value, "apiUri"); + return (Criteria) this; + } + + public Criteria andApiUriLessThanOrEqualTo(String value) { + addCriterion("api_uri <=", value, "apiUri"); + return (Criteria) this; + } + + public Criteria andApiUriLike(String value) { + addCriterion("api_uri like", value, "apiUri"); + return (Criteria) this; + } + + public Criteria andApiUriNotLike(String value) { + addCriterion("api_uri not like", value, "apiUri"); + return (Criteria) this; + } + + public Criteria andApiUriIn(List values) { + addCriterion("api_uri in", values, "apiUri"); + return (Criteria) this; + } + + public Criteria andApiUriNotIn(List values) { + addCriterion("api_uri not in", values, "apiUri"); + return (Criteria) this; + } + + public Criteria andApiUriBetween(String value1, String value2) { + addCriterion("api_uri between", value1, value2, "apiUri"); + return (Criteria) this; + } + + public Criteria andApiUriNotBetween(String value1, String value2) { + addCriterion("api_uri not between", value1, value2, "apiUri"); + return (Criteria) this; + } + + public Criteria andApiMethodIsNull() { + addCriterion("api_method is null"); + return (Criteria) this; + } + + public Criteria andApiMethodIsNotNull() { + addCriterion("api_method is not null"); + return (Criteria) this; + } + + public Criteria andApiMethodEqualTo(String value) { + addCriterion("api_method =", value, "apiMethod"); + return (Criteria) this; + } + + public Criteria andApiMethodNotEqualTo(String value) { + addCriterion("api_method <>", value, "apiMethod"); + return (Criteria) this; + } + + public Criteria andApiMethodGreaterThan(String value) { + addCriterion("api_method >", value, "apiMethod"); + return (Criteria) this; + } + + public Criteria andApiMethodGreaterThanOrEqualTo(String value) { + addCriterion("api_method >=", value, "apiMethod"); + return (Criteria) this; + } + + public Criteria andApiMethodLessThan(String value) { + addCriterion("api_method <", value, "apiMethod"); + return (Criteria) this; + } + + public Criteria andApiMethodLessThanOrEqualTo(String value) { + addCriterion("api_method <=", value, "apiMethod"); + return (Criteria) this; + } + + public Criteria andApiMethodLike(String value) { + addCriterion("api_method like", value, "apiMethod"); + return (Criteria) this; + } + + public Criteria andApiMethodNotLike(String value) { + addCriterion("api_method not like", value, "apiMethod"); + return (Criteria) this; + } + + public Criteria andApiMethodIn(List values) { + addCriterion("api_method in", values, "apiMethod"); + return (Criteria) this; + } + + public Criteria andApiMethodNotIn(List values) { + addCriterion("api_method not in", values, "apiMethod"); + return (Criteria) this; + } + + public Criteria andApiMethodBetween(String value1, String value2) { + addCriterion("api_method between", value1, value2, "apiMethod"); + return (Criteria) this; + } + + public Criteria andApiMethodNotBetween(String value1, String value2) { + addCriterion("api_method not between", value1, value2, "apiMethod"); + return (Criteria) this; + } + + public Criteria andSerialIdIsNull() { + addCriterion("serial_id is null"); + return (Criteria) this; + } + + public Criteria andSerialIdIsNotNull() { + addCriterion("serial_id is not null"); + return (Criteria) this; + } + + public Criteria andSerialIdEqualTo(Long value) { + addCriterion("serial_id =", value, "serialId"); + return (Criteria) this; + } + + public Criteria andSerialIdNotEqualTo(Long value) { + addCriterion("serial_id <>", value, "serialId"); + return (Criteria) this; + } + + public Criteria andSerialIdGreaterThan(Long value) { + addCriterion("serial_id >", value, "serialId"); + return (Criteria) this; + } + + public Criteria andSerialIdGreaterThanOrEqualTo(Long value) { + addCriterion("serial_id >=", value, "serialId"); + return (Criteria) this; + } + + public Criteria andSerialIdLessThan(Long value) { + addCriterion("serial_id <", value, "serialId"); + return (Criteria) this; + } + + public Criteria andSerialIdLessThanOrEqualTo(Long value) { + addCriterion("serial_id <=", value, "serialId"); + return (Criteria) this; + } + + public Criteria andSerialIdIn(List values) { + addCriterion("serial_id in", values, "serialId"); + return (Criteria) this; + } + + public Criteria andSerialIdNotIn(List values) { + addCriterion("serial_id not in", values, "serialId"); + return (Criteria) this; + } + + public Criteria andSerialIdBetween(Long value1, Long value2) { + addCriterion("serial_id between", value1, value2, "serialId"); + return (Criteria) this; + } + + public Criteria andSerialIdNotBetween(Long value1, Long value2) { + addCriterion("serial_id not between", value1, value2, "serialId"); + return (Criteria) this; + } + + public Criteria andTaskIdIsNull() { + addCriterion("task_id is null"); + return (Criteria) this; + } + + public Criteria andTaskIdIsNotNull() { + addCriterion("task_id is not null"); + return (Criteria) this; + } + + public Criteria andTaskIdEqualTo(Long value) { + addCriterion("task_id =", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdNotEqualTo(Long value) { + addCriterion("task_id <>", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdGreaterThan(Long value) { + addCriterion("task_id >", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdGreaterThanOrEqualTo(Long value) { + addCriterion("task_id >=", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdLessThan(Long value) { + addCriterion("task_id <", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdLessThanOrEqualTo(Long value) { + addCriterion("task_id <=", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdIn(List values) { + addCriterion("task_id in", values, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdNotIn(List values) { + addCriterion("task_id not in", values, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdBetween(Long value1, Long value2) { + addCriterion("task_id between", value1, value2, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdNotBetween(Long value1, Long value2) { + addCriterion("task_id not between", value1, value2, "taskId"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/CheckPointInfo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/CheckPointInfo.java new file mode 100644 index 000000000..bfbdddf69 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/CheckPointInfo.java @@ -0,0 +1,131 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; + +public class CheckPointInfo { + private Integer id; + + private Integer checkType; + + private String checkObj; + + private Integer checkCondition; + + private String checkContent; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCheckType() { + return checkType; + } + + public void setCheckType(Integer checkType) { + this.checkType = checkType; + } + + public String getCheckObj() { + return checkObj; + } + + public void setCheckObj(String checkObj) { + this.checkObj = checkObj == null ? null : checkObj.trim(); + } + + public Integer getCheckCondition() { + return checkCondition; + } + + public void setCheckCondition(Integer checkCondition) { + this.checkCondition = checkCondition; + } + + public String getCheckContent() { + return checkContent; + } + + public void setCheckContent(String checkContent) { + this.checkContent = checkContent == null ? null : checkContent.trim(); + } + + public enum Column { + id("id", "id", "INTEGER", false), + checkType("check_type", "checkType", "INTEGER", false), + checkObj("check_obj", "checkObj", "VARCHAR", false), + checkCondition("check_condition", "checkCondition", "INTEGER", false), + checkContent("check_content", "checkContent", "LONGVARCHAR", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/CheckPointInfoExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/CheckPointInfoExample.java new file mode 100644 index 000000000..6efd991ec --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/CheckPointInfoExample.java @@ -0,0 +1,450 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class CheckPointInfoExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public CheckPointInfoExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andCheckTypeIsNull() { + addCriterion("check_type is null"); + return (Criteria) this; + } + + public Criteria andCheckTypeIsNotNull() { + addCriterion("check_type is not null"); + return (Criteria) this; + } + + public Criteria andCheckTypeEqualTo(Integer value) { + addCriterion("check_type =", value, "checkType"); + return (Criteria) this; + } + + public Criteria andCheckTypeNotEqualTo(Integer value) { + addCriterion("check_type <>", value, "checkType"); + return (Criteria) this; + } + + public Criteria andCheckTypeGreaterThan(Integer value) { + addCriterion("check_type >", value, "checkType"); + return (Criteria) this; + } + + public Criteria andCheckTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("check_type >=", value, "checkType"); + return (Criteria) this; + } + + public Criteria andCheckTypeLessThan(Integer value) { + addCriterion("check_type <", value, "checkType"); + return (Criteria) this; + } + + public Criteria andCheckTypeLessThanOrEqualTo(Integer value) { + addCriterion("check_type <=", value, "checkType"); + return (Criteria) this; + } + + public Criteria andCheckTypeIn(List values) { + addCriterion("check_type in", values, "checkType"); + return (Criteria) this; + } + + public Criteria andCheckTypeNotIn(List values) { + addCriterion("check_type not in", values, "checkType"); + return (Criteria) this; + } + + public Criteria andCheckTypeBetween(Integer value1, Integer value2) { + addCriterion("check_type between", value1, value2, "checkType"); + return (Criteria) this; + } + + public Criteria andCheckTypeNotBetween(Integer value1, Integer value2) { + addCriterion("check_type not between", value1, value2, "checkType"); + return (Criteria) this; + } + + public Criteria andCheckObjIsNull() { + addCriterion("check_obj is null"); + return (Criteria) this; + } + + public Criteria andCheckObjIsNotNull() { + addCriterion("check_obj is not null"); + return (Criteria) this; + } + + public Criteria andCheckObjEqualTo(String value) { + addCriterion("check_obj =", value, "checkObj"); + return (Criteria) this; + } + + public Criteria andCheckObjNotEqualTo(String value) { + addCriterion("check_obj <>", value, "checkObj"); + return (Criteria) this; + } + + public Criteria andCheckObjGreaterThan(String value) { + addCriterion("check_obj >", value, "checkObj"); + return (Criteria) this; + } + + public Criteria andCheckObjGreaterThanOrEqualTo(String value) { + addCriterion("check_obj >=", value, "checkObj"); + return (Criteria) this; + } + + public Criteria andCheckObjLessThan(String value) { + addCriterion("check_obj <", value, "checkObj"); + return (Criteria) this; + } + + public Criteria andCheckObjLessThanOrEqualTo(String value) { + addCriterion("check_obj <=", value, "checkObj"); + return (Criteria) this; + } + + public Criteria andCheckObjLike(String value) { + addCriterion("check_obj like", value, "checkObj"); + return (Criteria) this; + } + + public Criteria andCheckObjNotLike(String value) { + addCriterion("check_obj not like", value, "checkObj"); + return (Criteria) this; + } + + public Criteria andCheckObjIn(List values) { + addCriterion("check_obj in", values, "checkObj"); + return (Criteria) this; + } + + public Criteria andCheckObjNotIn(List values) { + addCriterion("check_obj not in", values, "checkObj"); + return (Criteria) this; + } + + public Criteria andCheckObjBetween(String value1, String value2) { + addCriterion("check_obj between", value1, value2, "checkObj"); + return (Criteria) this; + } + + public Criteria andCheckObjNotBetween(String value1, String value2) { + addCriterion("check_obj not between", value1, value2, "checkObj"); + return (Criteria) this; + } + + public Criteria andCheckConditionIsNull() { + addCriterion("check_condition is null"); + return (Criteria) this; + } + + public Criteria andCheckConditionIsNotNull() { + addCriterion("check_condition is not null"); + return (Criteria) this; + } + + public Criteria andCheckConditionEqualTo(Integer value) { + addCriterion("check_condition =", value, "checkCondition"); + return (Criteria) this; + } + + public Criteria andCheckConditionNotEqualTo(Integer value) { + addCriterion("check_condition <>", value, "checkCondition"); + return (Criteria) this; + } + + public Criteria andCheckConditionGreaterThan(Integer value) { + addCriterion("check_condition >", value, "checkCondition"); + return (Criteria) this; + } + + public Criteria andCheckConditionGreaterThanOrEqualTo(Integer value) { + addCriterion("check_condition >=", value, "checkCondition"); + return (Criteria) this; + } + + public Criteria andCheckConditionLessThan(Integer value) { + addCriterion("check_condition <", value, "checkCondition"); + return (Criteria) this; + } + + public Criteria andCheckConditionLessThanOrEqualTo(Integer value) { + addCriterion("check_condition <=", value, "checkCondition"); + return (Criteria) this; + } + + public Criteria andCheckConditionIn(List values) { + addCriterion("check_condition in", values, "checkCondition"); + return (Criteria) this; + } + + public Criteria andCheckConditionNotIn(List values) { + addCriterion("check_condition not in", values, "checkCondition"); + return (Criteria) this; + } + + public Criteria andCheckConditionBetween(Integer value1, Integer value2) { + addCriterion("check_condition between", value1, value2, "checkCondition"); + return (Criteria) this; + } + + public Criteria andCheckConditionNotBetween(Integer value1, Integer value2) { + addCriterion("check_condition not between", value1, value2, "checkCondition"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/Dataset.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/Dataset.java new file mode 100644 index 000000000..19282baed --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/Dataset.java @@ -0,0 +1,296 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; + +public class Dataset { + private Integer id; + + private String name; + + private String note; + + private Integer type; + + private String defaultParamName; + + private Integer ignoreFirstRow; + + private String fileName; + + private String fileUrl; + + private String fileKsKey; + + private Long fileRows; + + private Long fileSize; + + private String interfaceUrl; + + private Integer trafficRecordId; + + private Long ctime; + + private Long utime; + + private String creator; + + private String updater; + + private String tenant; + + private String previewFileRows; + + private String header; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name == null ? null : name.trim(); + } + + public String getNote() { + return note; + } + + public void setNote(String note) { + this.note = note == null ? null : note.trim(); + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getDefaultParamName() { + return defaultParamName; + } + + public void setDefaultParamName(String defaultParamName) { + this.defaultParamName = defaultParamName == null ? null : defaultParamName.trim(); + } + + public Integer getIgnoreFirstRow() { + return ignoreFirstRow; + } + + public void setIgnoreFirstRow(Integer ignoreFirstRow) { + this.ignoreFirstRow = ignoreFirstRow; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName == null ? null : fileName.trim(); + } + + public String getFileUrl() { + return fileUrl; + } + + public void setFileUrl(String fileUrl) { + this.fileUrl = fileUrl == null ? null : fileUrl.trim(); + } + + public String getFileKsKey() { + return fileKsKey; + } + + public void setFileKsKey(String fileKsKey) { + this.fileKsKey = fileKsKey == null ? null : fileKsKey.trim(); + } + + public Long getFileRows() { + return fileRows; + } + + public void setFileRows(Long fileRows) { + this.fileRows = fileRows; + } + + public Long getFileSize() { + return fileSize; + } + + public void setFileSize(Long fileSize) { + this.fileSize = fileSize; + } + + public String getInterfaceUrl() { + return interfaceUrl; + } + + public void setInterfaceUrl(String interfaceUrl) { + this.interfaceUrl = interfaceUrl == null ? null : interfaceUrl.trim(); + } + + public Integer getTrafficRecordId() { + return trafficRecordId; + } + + public void setTrafficRecordId(Integer trafficRecordId) { + this.trafficRecordId = trafficRecordId; + } + + public Long getCtime() { + return ctime; + } + + public void setCtime(Long ctime) { + this.ctime = ctime; + } + + public Long getUtime() { + return utime; + } + + public void setUtime(Long utime) { + this.utime = utime; + } + + public String getCreator() { + return creator; + } + + public void setCreator(String creator) { + this.creator = creator == null ? null : creator.trim(); + } + + public String getUpdater() { + return updater; + } + + public void setUpdater(String updater) { + this.updater = updater == null ? null : updater.trim(); + } + + public String getTenant() { + return tenant; + } + + public void setTenant(String tenant) { + this.tenant = tenant == null ? null : tenant.trim(); + } + + public String getPreviewFileRows() { + return previewFileRows; + } + + public void setPreviewFileRows(String previewFileRows) { + this.previewFileRows = previewFileRows == null ? null : previewFileRows.trim(); + } + + public String getHeader() { + return header; + } + + public void setHeader(String header) { + this.header = header == null ? null : header.trim(); + } + + public enum Column { + id("id", "id", "INTEGER", false), + name("name", "name", "VARCHAR", false), + note("note", "note", "VARCHAR", false), + type("type", "type", "INTEGER", false), + defaultParamName("default_param_name", "defaultParamName", "VARCHAR", false), + ignoreFirstRow("ignore_first_row", "ignoreFirstRow", "INTEGER", false), + fileName("file_name", "fileName", "VARCHAR", false), + fileUrl("file_url", "fileUrl", "VARCHAR", false), + fileKsKey("file_ks_key", "fileKsKey", "VARCHAR", false), + fileRows("file_rows", "fileRows", "BIGINT", false), + fileSize("file_size", "fileSize", "BIGINT", false), + interfaceUrl("interface_url", "interfaceUrl", "VARCHAR", false), + trafficRecordId("traffic_record_id", "trafficRecordId", "INTEGER", false), + ctime("ctime", "ctime", "BIGINT", false), + utime("utime", "utime", "BIGINT", false), + creator("creator", "creator", "VARCHAR", false), + updater("updater", "updater", "VARCHAR", false), + tenant("tenant", "tenant", "VARCHAR", false), + previewFileRows("preview_file_rows", "previewFileRows", "LONGVARCHAR", false), + header("header", "header", "LONGVARCHAR", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/DatasetExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/DatasetExample.java new file mode 100644 index 000000000..34981f96e --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/DatasetExample.java @@ -0,0 +1,1380 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class DatasetExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public DatasetExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andNameIsNull() { + addCriterion("name is null"); + return (Criteria) this; + } + + public Criteria andNameIsNotNull() { + addCriterion("name is not null"); + return (Criteria) this; + } + + public Criteria andNameEqualTo(String value) { + addCriterion("name =", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotEqualTo(String value) { + addCriterion("name <>", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThan(String value) { + addCriterion("name >", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThanOrEqualTo(String value) { + addCriterion("name >=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThan(String value) { + addCriterion("name <", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThanOrEqualTo(String value) { + addCriterion("name <=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLike(String value) { + addCriterion("name like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotLike(String value) { + addCriterion("name not like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameIn(List values) { + addCriterion("name in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameNotIn(List values) { + addCriterion("name not in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameBetween(String value1, String value2) { + addCriterion("name between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNameNotBetween(String value1, String value2) { + addCriterion("name not between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNoteIsNull() { + addCriterion("note is null"); + return (Criteria) this; + } + + public Criteria andNoteIsNotNull() { + addCriterion("note is not null"); + return (Criteria) this; + } + + public Criteria andNoteEqualTo(String value) { + addCriterion("note =", value, "note"); + return (Criteria) this; + } + + public Criteria andNoteNotEqualTo(String value) { + addCriterion("note <>", value, "note"); + return (Criteria) this; + } + + public Criteria andNoteGreaterThan(String value) { + addCriterion("note >", value, "note"); + return (Criteria) this; + } + + public Criteria andNoteGreaterThanOrEqualTo(String value) { + addCriterion("note >=", value, "note"); + return (Criteria) this; + } + + public Criteria andNoteLessThan(String value) { + addCriterion("note <", value, "note"); + return (Criteria) this; + } + + public Criteria andNoteLessThanOrEqualTo(String value) { + addCriterion("note <=", value, "note"); + return (Criteria) this; + } + + public Criteria andNoteLike(String value) { + addCriterion("note like", value, "note"); + return (Criteria) this; + } + + public Criteria andNoteNotLike(String value) { + addCriterion("note not like", value, "note"); + return (Criteria) this; + } + + public Criteria andNoteIn(List values) { + addCriterion("note in", values, "note"); + return (Criteria) this; + } + + public Criteria andNoteNotIn(List values) { + addCriterion("note not in", values, "note"); + return (Criteria) this; + } + + public Criteria andNoteBetween(String value1, String value2) { + addCriterion("note between", value1, value2, "note"); + return (Criteria) this; + } + + public Criteria andNoteNotBetween(String value1, String value2) { + addCriterion("note not between", value1, value2, "note"); + return (Criteria) this; + } + + public Criteria andTypeIsNull() { + addCriterion("type is null"); + return (Criteria) this; + } + + public Criteria andTypeIsNotNull() { + addCriterion("type is not null"); + return (Criteria) this; + } + + public Criteria andTypeEqualTo(Integer value) { + addCriterion("type =", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotEqualTo(Integer value) { + addCriterion("type <>", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThan(Integer value) { + addCriterion("type >", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("type >=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThan(Integer value) { + addCriterion("type <", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThanOrEqualTo(Integer value) { + addCriterion("type <=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeIn(List values) { + addCriterion("type in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotIn(List values) { + addCriterion("type not in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeBetween(Integer value1, Integer value2) { + addCriterion("type between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotBetween(Integer value1, Integer value2) { + addCriterion("type not between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andDefaultParamNameIsNull() { + addCriterion("default_param_name is null"); + return (Criteria) this; + } + + public Criteria andDefaultParamNameIsNotNull() { + addCriterion("default_param_name is not null"); + return (Criteria) this; + } + + public Criteria andDefaultParamNameEqualTo(String value) { + addCriterion("default_param_name =", value, "defaultParamName"); + return (Criteria) this; + } + + public Criteria andDefaultParamNameNotEqualTo(String value) { + addCriterion("default_param_name <>", value, "defaultParamName"); + return (Criteria) this; + } + + public Criteria andDefaultParamNameGreaterThan(String value) { + addCriterion("default_param_name >", value, "defaultParamName"); + return (Criteria) this; + } + + public Criteria andDefaultParamNameGreaterThanOrEqualTo(String value) { + addCriterion("default_param_name >=", value, "defaultParamName"); + return (Criteria) this; + } + + public Criteria andDefaultParamNameLessThan(String value) { + addCriterion("default_param_name <", value, "defaultParamName"); + return (Criteria) this; + } + + public Criteria andDefaultParamNameLessThanOrEqualTo(String value) { + addCriterion("default_param_name <=", value, "defaultParamName"); + return (Criteria) this; + } + + public Criteria andDefaultParamNameLike(String value) { + addCriterion("default_param_name like", value, "defaultParamName"); + return (Criteria) this; + } + + public Criteria andDefaultParamNameNotLike(String value) { + addCriterion("default_param_name not like", value, "defaultParamName"); + return (Criteria) this; + } + + public Criteria andDefaultParamNameIn(List values) { + addCriterion("default_param_name in", values, "defaultParamName"); + return (Criteria) this; + } + + public Criteria andDefaultParamNameNotIn(List values) { + addCriterion("default_param_name not in", values, "defaultParamName"); + return (Criteria) this; + } + + public Criteria andDefaultParamNameBetween(String value1, String value2) { + addCriterion("default_param_name between", value1, value2, "defaultParamName"); + return (Criteria) this; + } + + public Criteria andDefaultParamNameNotBetween(String value1, String value2) { + addCriterion("default_param_name not between", value1, value2, "defaultParamName"); + return (Criteria) this; + } + + public Criteria andIgnoreFirstRowIsNull() { + addCriterion("ignore_first_row is null"); + return (Criteria) this; + } + + public Criteria andIgnoreFirstRowIsNotNull() { + addCriterion("ignore_first_row is not null"); + return (Criteria) this; + } + + public Criteria andIgnoreFirstRowEqualTo(Integer value) { + addCriterion("ignore_first_row =", value, "ignoreFirstRow"); + return (Criteria) this; + } + + public Criteria andIgnoreFirstRowNotEqualTo(Integer value) { + addCriterion("ignore_first_row <>", value, "ignoreFirstRow"); + return (Criteria) this; + } + + public Criteria andIgnoreFirstRowGreaterThan(Integer value) { + addCriterion("ignore_first_row >", value, "ignoreFirstRow"); + return (Criteria) this; + } + + public Criteria andIgnoreFirstRowGreaterThanOrEqualTo(Integer value) { + addCriterion("ignore_first_row >=", value, "ignoreFirstRow"); + return (Criteria) this; + } + + public Criteria andIgnoreFirstRowLessThan(Integer value) { + addCriterion("ignore_first_row <", value, "ignoreFirstRow"); + return (Criteria) this; + } + + public Criteria andIgnoreFirstRowLessThanOrEqualTo(Integer value) { + addCriterion("ignore_first_row <=", value, "ignoreFirstRow"); + return (Criteria) this; + } + + public Criteria andIgnoreFirstRowIn(List values) { + addCriterion("ignore_first_row in", values, "ignoreFirstRow"); + return (Criteria) this; + } + + public Criteria andIgnoreFirstRowNotIn(List values) { + addCriterion("ignore_first_row not in", values, "ignoreFirstRow"); + return (Criteria) this; + } + + public Criteria andIgnoreFirstRowBetween(Integer value1, Integer value2) { + addCriterion("ignore_first_row between", value1, value2, "ignoreFirstRow"); + return (Criteria) this; + } + + public Criteria andIgnoreFirstRowNotBetween(Integer value1, Integer value2) { + addCriterion("ignore_first_row not between", value1, value2, "ignoreFirstRow"); + return (Criteria) this; + } + + public Criteria andFileNameIsNull() { + addCriterion("file_name is null"); + return (Criteria) this; + } + + public Criteria andFileNameIsNotNull() { + addCriterion("file_name is not null"); + return (Criteria) this; + } + + public Criteria andFileNameEqualTo(String value) { + addCriterion("file_name =", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameNotEqualTo(String value) { + addCriterion("file_name <>", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameGreaterThan(String value) { + addCriterion("file_name >", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameGreaterThanOrEqualTo(String value) { + addCriterion("file_name >=", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameLessThan(String value) { + addCriterion("file_name <", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameLessThanOrEqualTo(String value) { + addCriterion("file_name <=", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameLike(String value) { + addCriterion("file_name like", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameNotLike(String value) { + addCriterion("file_name not like", value, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameIn(List values) { + addCriterion("file_name in", values, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameNotIn(List values) { + addCriterion("file_name not in", values, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameBetween(String value1, String value2) { + addCriterion("file_name between", value1, value2, "fileName"); + return (Criteria) this; + } + + public Criteria andFileNameNotBetween(String value1, String value2) { + addCriterion("file_name not between", value1, value2, "fileName"); + return (Criteria) this; + } + + public Criteria andFileUrlIsNull() { + addCriterion("file_url is null"); + return (Criteria) this; + } + + public Criteria andFileUrlIsNotNull() { + addCriterion("file_url is not null"); + return (Criteria) this; + } + + public Criteria andFileUrlEqualTo(String value) { + addCriterion("file_url =", value, "fileUrl"); + return (Criteria) this; + } + + public Criteria andFileUrlNotEqualTo(String value) { + addCriterion("file_url <>", value, "fileUrl"); + return (Criteria) this; + } + + public Criteria andFileUrlGreaterThan(String value) { + addCriterion("file_url >", value, "fileUrl"); + return (Criteria) this; + } + + public Criteria andFileUrlGreaterThanOrEqualTo(String value) { + addCriterion("file_url >=", value, "fileUrl"); + return (Criteria) this; + } + + public Criteria andFileUrlLessThan(String value) { + addCriterion("file_url <", value, "fileUrl"); + return (Criteria) this; + } + + public Criteria andFileUrlLessThanOrEqualTo(String value) { + addCriterion("file_url <=", value, "fileUrl"); + return (Criteria) this; + } + + public Criteria andFileUrlLike(String value) { + addCriterion("file_url like", value, "fileUrl"); + return (Criteria) this; + } + + public Criteria andFileUrlNotLike(String value) { + addCriterion("file_url not like", value, "fileUrl"); + return (Criteria) this; + } + + public Criteria andFileUrlIn(List values) { + addCriterion("file_url in", values, "fileUrl"); + return (Criteria) this; + } + + public Criteria andFileUrlNotIn(List values) { + addCriterion("file_url not in", values, "fileUrl"); + return (Criteria) this; + } + + public Criteria andFileUrlBetween(String value1, String value2) { + addCriterion("file_url between", value1, value2, "fileUrl"); + return (Criteria) this; + } + + public Criteria andFileUrlNotBetween(String value1, String value2) { + addCriterion("file_url not between", value1, value2, "fileUrl"); + return (Criteria) this; + } + + public Criteria andFileKsKeyIsNull() { + addCriterion("file_ks_key is null"); + return (Criteria) this; + } + + public Criteria andFileKsKeyIsNotNull() { + addCriterion("file_ks_key is not null"); + return (Criteria) this; + } + + public Criteria andFileKsKeyEqualTo(String value) { + addCriterion("file_ks_key =", value, "fileKsKey"); + return (Criteria) this; + } + + public Criteria andFileKsKeyNotEqualTo(String value) { + addCriterion("file_ks_key <>", value, "fileKsKey"); + return (Criteria) this; + } + + public Criteria andFileKsKeyGreaterThan(String value) { + addCriterion("file_ks_key >", value, "fileKsKey"); + return (Criteria) this; + } + + public Criteria andFileKsKeyGreaterThanOrEqualTo(String value) { + addCriterion("file_ks_key >=", value, "fileKsKey"); + return (Criteria) this; + } + + public Criteria andFileKsKeyLessThan(String value) { + addCriterion("file_ks_key <", value, "fileKsKey"); + return (Criteria) this; + } + + public Criteria andFileKsKeyLessThanOrEqualTo(String value) { + addCriterion("file_ks_key <=", value, "fileKsKey"); + return (Criteria) this; + } + + public Criteria andFileKsKeyLike(String value) { + addCriterion("file_ks_key like", value, "fileKsKey"); + return (Criteria) this; + } + + public Criteria andFileKsKeyNotLike(String value) { + addCriterion("file_ks_key not like", value, "fileKsKey"); + return (Criteria) this; + } + + public Criteria andFileKsKeyIn(List values) { + addCriterion("file_ks_key in", values, "fileKsKey"); + return (Criteria) this; + } + + public Criteria andFileKsKeyNotIn(List values) { + addCriterion("file_ks_key not in", values, "fileKsKey"); + return (Criteria) this; + } + + public Criteria andFileKsKeyBetween(String value1, String value2) { + addCriterion("file_ks_key between", value1, value2, "fileKsKey"); + return (Criteria) this; + } + + public Criteria andFileKsKeyNotBetween(String value1, String value2) { + addCriterion("file_ks_key not between", value1, value2, "fileKsKey"); + return (Criteria) this; + } + + public Criteria andFileRowsIsNull() { + addCriterion("file_rows is null"); + return (Criteria) this; + } + + public Criteria andFileRowsIsNotNull() { + addCriterion("file_rows is not null"); + return (Criteria) this; + } + + public Criteria andFileRowsEqualTo(Long value) { + addCriterion("file_rows =", value, "fileRows"); + return (Criteria) this; + } + + public Criteria andFileRowsNotEqualTo(Long value) { + addCriterion("file_rows <>", value, "fileRows"); + return (Criteria) this; + } + + public Criteria andFileRowsGreaterThan(Long value) { + addCriterion("file_rows >", value, "fileRows"); + return (Criteria) this; + } + + public Criteria andFileRowsGreaterThanOrEqualTo(Long value) { + addCriterion("file_rows >=", value, "fileRows"); + return (Criteria) this; + } + + public Criteria andFileRowsLessThan(Long value) { + addCriterion("file_rows <", value, "fileRows"); + return (Criteria) this; + } + + public Criteria andFileRowsLessThanOrEqualTo(Long value) { + addCriterion("file_rows <=", value, "fileRows"); + return (Criteria) this; + } + + public Criteria andFileRowsIn(List values) { + addCriterion("file_rows in", values, "fileRows"); + return (Criteria) this; + } + + public Criteria andFileRowsNotIn(List values) { + addCriterion("file_rows not in", values, "fileRows"); + return (Criteria) this; + } + + public Criteria andFileRowsBetween(Long value1, Long value2) { + addCriterion("file_rows between", value1, value2, "fileRows"); + return (Criteria) this; + } + + public Criteria andFileRowsNotBetween(Long value1, Long value2) { + addCriterion("file_rows not between", value1, value2, "fileRows"); + return (Criteria) this; + } + + public Criteria andFileSizeIsNull() { + addCriterion("file_size is null"); + return (Criteria) this; + } + + public Criteria andFileSizeIsNotNull() { + addCriterion("file_size is not null"); + return (Criteria) this; + } + + public Criteria andFileSizeEqualTo(Long value) { + addCriterion("file_size =", value, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeNotEqualTo(Long value) { + addCriterion("file_size <>", value, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeGreaterThan(Long value) { + addCriterion("file_size >", value, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeGreaterThanOrEqualTo(Long value) { + addCriterion("file_size >=", value, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeLessThan(Long value) { + addCriterion("file_size <", value, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeLessThanOrEqualTo(Long value) { + addCriterion("file_size <=", value, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeIn(List values) { + addCriterion("file_size in", values, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeNotIn(List values) { + addCriterion("file_size not in", values, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeBetween(Long value1, Long value2) { + addCriterion("file_size between", value1, value2, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeNotBetween(Long value1, Long value2) { + addCriterion("file_size not between", value1, value2, "fileSize"); + return (Criteria) this; + } + + public Criteria andInterfaceUrlIsNull() { + addCriterion("interface_url is null"); + return (Criteria) this; + } + + public Criteria andInterfaceUrlIsNotNull() { + addCriterion("interface_url is not null"); + return (Criteria) this; + } + + public Criteria andInterfaceUrlEqualTo(String value) { + addCriterion("interface_url =", value, "interfaceUrl"); + return (Criteria) this; + } + + public Criteria andInterfaceUrlNotEqualTo(String value) { + addCriterion("interface_url <>", value, "interfaceUrl"); + return (Criteria) this; + } + + public Criteria andInterfaceUrlGreaterThan(String value) { + addCriterion("interface_url >", value, "interfaceUrl"); + return (Criteria) this; + } + + public Criteria andInterfaceUrlGreaterThanOrEqualTo(String value) { + addCriterion("interface_url >=", value, "interfaceUrl"); + return (Criteria) this; + } + + public Criteria andInterfaceUrlLessThan(String value) { + addCriterion("interface_url <", value, "interfaceUrl"); + return (Criteria) this; + } + + public Criteria andInterfaceUrlLessThanOrEqualTo(String value) { + addCriterion("interface_url <=", value, "interfaceUrl"); + return (Criteria) this; + } + + public Criteria andInterfaceUrlLike(String value) { + addCriterion("interface_url like", value, "interfaceUrl"); + return (Criteria) this; + } + + public Criteria andInterfaceUrlNotLike(String value) { + addCriterion("interface_url not like", value, "interfaceUrl"); + return (Criteria) this; + } + + public Criteria andInterfaceUrlIn(List values) { + addCriterion("interface_url in", values, "interfaceUrl"); + return (Criteria) this; + } + + public Criteria andInterfaceUrlNotIn(List values) { + addCriterion("interface_url not in", values, "interfaceUrl"); + return (Criteria) this; + } + + public Criteria andInterfaceUrlBetween(String value1, String value2) { + addCriterion("interface_url between", value1, value2, "interfaceUrl"); + return (Criteria) this; + } + + public Criteria andInterfaceUrlNotBetween(String value1, String value2) { + addCriterion("interface_url not between", value1, value2, "interfaceUrl"); + return (Criteria) this; + } + + public Criteria andTrafficRecordIdIsNull() { + addCriterion("traffic_record_id is null"); + return (Criteria) this; + } + + public Criteria andTrafficRecordIdIsNotNull() { + addCriterion("traffic_record_id is not null"); + return (Criteria) this; + } + + public Criteria andTrafficRecordIdEqualTo(Integer value) { + addCriterion("traffic_record_id =", value, "trafficRecordId"); + return (Criteria) this; + } + + public Criteria andTrafficRecordIdNotEqualTo(Integer value) { + addCriterion("traffic_record_id <>", value, "trafficRecordId"); + return (Criteria) this; + } + + public Criteria andTrafficRecordIdGreaterThan(Integer value) { + addCriterion("traffic_record_id >", value, "trafficRecordId"); + return (Criteria) this; + } + + public Criteria andTrafficRecordIdGreaterThanOrEqualTo(Integer value) { + addCriterion("traffic_record_id >=", value, "trafficRecordId"); + return (Criteria) this; + } + + public Criteria andTrafficRecordIdLessThan(Integer value) { + addCriterion("traffic_record_id <", value, "trafficRecordId"); + return (Criteria) this; + } + + public Criteria andTrafficRecordIdLessThanOrEqualTo(Integer value) { + addCriterion("traffic_record_id <=", value, "trafficRecordId"); + return (Criteria) this; + } + + public Criteria andTrafficRecordIdIn(List values) { + addCriterion("traffic_record_id in", values, "trafficRecordId"); + return (Criteria) this; + } + + public Criteria andTrafficRecordIdNotIn(List values) { + addCriterion("traffic_record_id not in", values, "trafficRecordId"); + return (Criteria) this; + } + + public Criteria andTrafficRecordIdBetween(Integer value1, Integer value2) { + addCriterion("traffic_record_id between", value1, value2, "trafficRecordId"); + return (Criteria) this; + } + + public Criteria andTrafficRecordIdNotBetween(Integer value1, Integer value2) { + addCriterion("traffic_record_id not between", value1, value2, "trafficRecordId"); + return (Criteria) this; + } + + public Criteria andCtimeIsNull() { + addCriterion("ctime is null"); + return (Criteria) this; + } + + public Criteria andCtimeIsNotNull() { + addCriterion("ctime is not null"); + return (Criteria) this; + } + + public Criteria andCtimeEqualTo(Long value) { + addCriterion("ctime =", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotEqualTo(Long value) { + addCriterion("ctime <>", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThan(Long value) { + addCriterion("ctime >", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThanOrEqualTo(Long value) { + addCriterion("ctime >=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThan(Long value) { + addCriterion("ctime <", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThanOrEqualTo(Long value) { + addCriterion("ctime <=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeIn(List values) { + addCriterion("ctime in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotIn(List values) { + addCriterion("ctime not in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeBetween(Long value1, Long value2) { + addCriterion("ctime between", value1, value2, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotBetween(Long value1, Long value2) { + addCriterion("ctime not between", value1, value2, "ctime"); + return (Criteria) this; + } + + public Criteria andUtimeIsNull() { + addCriterion("utime is null"); + return (Criteria) this; + } + + public Criteria andUtimeIsNotNull() { + addCriterion("utime is not null"); + return (Criteria) this; + } + + public Criteria andUtimeEqualTo(Long value) { + addCriterion("utime =", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotEqualTo(Long value) { + addCriterion("utime <>", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeGreaterThan(Long value) { + addCriterion("utime >", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeGreaterThanOrEqualTo(Long value) { + addCriterion("utime >=", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeLessThan(Long value) { + addCriterion("utime <", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeLessThanOrEqualTo(Long value) { + addCriterion("utime <=", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeIn(List values) { + addCriterion("utime in", values, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotIn(List values) { + addCriterion("utime not in", values, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeBetween(Long value1, Long value2) { + addCriterion("utime between", value1, value2, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotBetween(Long value1, Long value2) { + addCriterion("utime not between", value1, value2, "utime"); + return (Criteria) this; + } + + public Criteria andCreatorIsNull() { + addCriterion("creator is null"); + return (Criteria) this; + } + + public Criteria andCreatorIsNotNull() { + addCriterion("creator is not null"); + return (Criteria) this; + } + + public Criteria andCreatorEqualTo(String value) { + addCriterion("creator =", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotEqualTo(String value) { + addCriterion("creator <>", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorGreaterThan(String value) { + addCriterion("creator >", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorGreaterThanOrEqualTo(String value) { + addCriterion("creator >=", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorLessThan(String value) { + addCriterion("creator <", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorLessThanOrEqualTo(String value) { + addCriterion("creator <=", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorLike(String value) { + addCriterion("creator like", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotLike(String value) { + addCriterion("creator not like", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorIn(List values) { + addCriterion("creator in", values, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotIn(List values) { + addCriterion("creator not in", values, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorBetween(String value1, String value2) { + addCriterion("creator between", value1, value2, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotBetween(String value1, String value2) { + addCriterion("creator not between", value1, value2, "creator"); + return (Criteria) this; + } + + public Criteria andUpdaterIsNull() { + addCriterion("updater is null"); + return (Criteria) this; + } + + public Criteria andUpdaterIsNotNull() { + addCriterion("updater is not null"); + return (Criteria) this; + } + + public Criteria andUpdaterEqualTo(String value) { + addCriterion("updater =", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterNotEqualTo(String value) { + addCriterion("updater <>", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterGreaterThan(String value) { + addCriterion("updater >", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterGreaterThanOrEqualTo(String value) { + addCriterion("updater >=", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterLessThan(String value) { + addCriterion("updater <", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterLessThanOrEqualTo(String value) { + addCriterion("updater <=", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterLike(String value) { + addCriterion("updater like", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterNotLike(String value) { + addCriterion("updater not like", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterIn(List values) { + addCriterion("updater in", values, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterNotIn(List values) { + addCriterion("updater not in", values, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterBetween(String value1, String value2) { + addCriterion("updater between", value1, value2, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterNotBetween(String value1, String value2) { + addCriterion("updater not between", value1, value2, "updater"); + return (Criteria) this; + } + + public Criteria andTenantIsNull() { + addCriterion("tenant is null"); + return (Criteria) this; + } + + public Criteria andTenantIsNotNull() { + addCriterion("tenant is not null"); + return (Criteria) this; + } + + public Criteria andTenantEqualTo(String value) { + addCriterion("tenant =", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotEqualTo(String value) { + addCriterion("tenant <>", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantGreaterThan(String value) { + addCriterion("tenant >", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantGreaterThanOrEqualTo(String value) { + addCriterion("tenant >=", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantLessThan(String value) { + addCriterion("tenant <", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantLessThanOrEqualTo(String value) { + addCriterion("tenant <=", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantLike(String value) { + addCriterion("tenant like", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotLike(String value) { + addCriterion("tenant not like", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantIn(List values) { + addCriterion("tenant in", values, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotIn(List values) { + addCriterion("tenant not in", values, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantBetween(String value1, String value2) { + addCriterion("tenant between", value1, value2, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotBetween(String value1, String value2) { + addCriterion("tenant not between", value1, value2, "tenant"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/DatasetSceneRelation.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/DatasetSceneRelation.java new file mode 100644 index 000000000..35883f630 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/DatasetSceneRelation.java @@ -0,0 +1,164 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; + +public class DatasetSceneRelation { + private Integer id; + + private Integer datasetId; + + private Integer sceneId; + + private Long ctime; + + private Long utime; + + private String creator; + + private String updater; + + private Boolean enable; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getDatasetId() { + return datasetId; + } + + public void setDatasetId(Integer datasetId) { + this.datasetId = datasetId; + } + + public Integer getSceneId() { + return sceneId; + } + + public void setSceneId(Integer sceneId) { + this.sceneId = sceneId; + } + + public Long getCtime() { + return ctime; + } + + public void setCtime(Long ctime) { + this.ctime = ctime; + } + + public Long getUtime() { + return utime; + } + + public void setUtime(Long utime) { + this.utime = utime; + } + + public String getCreator() { + return creator; + } + + public void setCreator(String creator) { + this.creator = creator == null ? null : creator.trim(); + } + + public String getUpdater() { + return updater; + } + + public void setUpdater(String updater) { + this.updater = updater == null ? null : updater.trim(); + } + + public Boolean getEnable() { + return enable; + } + + public void setEnable(Boolean enable) { + this.enable = enable; + } + + public enum Column { + id("id", "id", "INTEGER", false), + datasetId("dataset_id", "datasetId", "INTEGER", false), + sceneId("scene_id", "sceneId", "INTEGER", false), + ctime("ctime", "ctime", "BIGINT", false), + utime("utime", "utime", "BIGINT", false), + creator("creator", "creator", "VARCHAR", false), + updater("updater", "updater", "VARCHAR", false), + enable("enable", "enable", "BIT", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/DatasetSceneRelationExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/DatasetSceneRelationExample.java new file mode 100644 index 000000000..01a8101da --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/DatasetSceneRelationExample.java @@ -0,0 +1,700 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class DatasetSceneRelationExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public DatasetSceneRelationExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andDatasetIdIsNull() { + addCriterion("dataset_id is null"); + return (Criteria) this; + } + + public Criteria andDatasetIdIsNotNull() { + addCriterion("dataset_id is not null"); + return (Criteria) this; + } + + public Criteria andDatasetIdEqualTo(Integer value) { + addCriterion("dataset_id =", value, "datasetId"); + return (Criteria) this; + } + + public Criteria andDatasetIdNotEqualTo(Integer value) { + addCriterion("dataset_id <>", value, "datasetId"); + return (Criteria) this; + } + + public Criteria andDatasetIdGreaterThan(Integer value) { + addCriterion("dataset_id >", value, "datasetId"); + return (Criteria) this; + } + + public Criteria andDatasetIdGreaterThanOrEqualTo(Integer value) { + addCriterion("dataset_id >=", value, "datasetId"); + return (Criteria) this; + } + + public Criteria andDatasetIdLessThan(Integer value) { + addCriterion("dataset_id <", value, "datasetId"); + return (Criteria) this; + } + + public Criteria andDatasetIdLessThanOrEqualTo(Integer value) { + addCriterion("dataset_id <=", value, "datasetId"); + return (Criteria) this; + } + + public Criteria andDatasetIdIn(List values) { + addCriterion("dataset_id in", values, "datasetId"); + return (Criteria) this; + } + + public Criteria andDatasetIdNotIn(List values) { + addCriterion("dataset_id not in", values, "datasetId"); + return (Criteria) this; + } + + public Criteria andDatasetIdBetween(Integer value1, Integer value2) { + addCriterion("dataset_id between", value1, value2, "datasetId"); + return (Criteria) this; + } + + public Criteria andDatasetIdNotBetween(Integer value1, Integer value2) { + addCriterion("dataset_id not between", value1, value2, "datasetId"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNull() { + addCriterion("scene_id is null"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNotNull() { + addCriterion("scene_id is not null"); + return (Criteria) this; + } + + public Criteria andSceneIdEqualTo(Integer value) { + addCriterion("scene_id =", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotEqualTo(Integer value) { + addCriterion("scene_id <>", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThan(Integer value) { + addCriterion("scene_id >", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThanOrEqualTo(Integer value) { + addCriterion("scene_id >=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThan(Integer value) { + addCriterion("scene_id <", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThanOrEqualTo(Integer value) { + addCriterion("scene_id <=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdIn(List values) { + addCriterion("scene_id in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotIn(List values) { + addCriterion("scene_id not in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdBetween(Integer value1, Integer value2) { + addCriterion("scene_id between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotBetween(Integer value1, Integer value2) { + addCriterion("scene_id not between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andCtimeIsNull() { + addCriterion("ctime is null"); + return (Criteria) this; + } + + public Criteria andCtimeIsNotNull() { + addCriterion("ctime is not null"); + return (Criteria) this; + } + + public Criteria andCtimeEqualTo(Long value) { + addCriterion("ctime =", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotEqualTo(Long value) { + addCriterion("ctime <>", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThan(Long value) { + addCriterion("ctime >", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThanOrEqualTo(Long value) { + addCriterion("ctime >=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThan(Long value) { + addCriterion("ctime <", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThanOrEqualTo(Long value) { + addCriterion("ctime <=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeIn(List values) { + addCriterion("ctime in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotIn(List values) { + addCriterion("ctime not in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeBetween(Long value1, Long value2) { + addCriterion("ctime between", value1, value2, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotBetween(Long value1, Long value2) { + addCriterion("ctime not between", value1, value2, "ctime"); + return (Criteria) this; + } + + public Criteria andUtimeIsNull() { + addCriterion("utime is null"); + return (Criteria) this; + } + + public Criteria andUtimeIsNotNull() { + addCriterion("utime is not null"); + return (Criteria) this; + } + + public Criteria andUtimeEqualTo(Long value) { + addCriterion("utime =", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotEqualTo(Long value) { + addCriterion("utime <>", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeGreaterThan(Long value) { + addCriterion("utime >", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeGreaterThanOrEqualTo(Long value) { + addCriterion("utime >=", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeLessThan(Long value) { + addCriterion("utime <", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeLessThanOrEqualTo(Long value) { + addCriterion("utime <=", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeIn(List values) { + addCriterion("utime in", values, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotIn(List values) { + addCriterion("utime not in", values, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeBetween(Long value1, Long value2) { + addCriterion("utime between", value1, value2, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotBetween(Long value1, Long value2) { + addCriterion("utime not between", value1, value2, "utime"); + return (Criteria) this; + } + + public Criteria andCreatorIsNull() { + addCriterion("creator is null"); + return (Criteria) this; + } + + public Criteria andCreatorIsNotNull() { + addCriterion("creator is not null"); + return (Criteria) this; + } + + public Criteria andCreatorEqualTo(String value) { + addCriterion("creator =", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotEqualTo(String value) { + addCriterion("creator <>", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorGreaterThan(String value) { + addCriterion("creator >", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorGreaterThanOrEqualTo(String value) { + addCriterion("creator >=", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorLessThan(String value) { + addCriterion("creator <", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorLessThanOrEqualTo(String value) { + addCriterion("creator <=", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorLike(String value) { + addCriterion("creator like", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotLike(String value) { + addCriterion("creator not like", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorIn(List values) { + addCriterion("creator in", values, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotIn(List values) { + addCriterion("creator not in", values, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorBetween(String value1, String value2) { + addCriterion("creator between", value1, value2, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotBetween(String value1, String value2) { + addCriterion("creator not between", value1, value2, "creator"); + return (Criteria) this; + } + + public Criteria andUpdaterIsNull() { + addCriterion("updater is null"); + return (Criteria) this; + } + + public Criteria andUpdaterIsNotNull() { + addCriterion("updater is not null"); + return (Criteria) this; + } + + public Criteria andUpdaterEqualTo(String value) { + addCriterion("updater =", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterNotEqualTo(String value) { + addCriterion("updater <>", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterGreaterThan(String value) { + addCriterion("updater >", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterGreaterThanOrEqualTo(String value) { + addCriterion("updater >=", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterLessThan(String value) { + addCriterion("updater <", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterLessThanOrEqualTo(String value) { + addCriterion("updater <=", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterLike(String value) { + addCriterion("updater like", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterNotLike(String value) { + addCriterion("updater not like", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterIn(List values) { + addCriterion("updater in", values, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterNotIn(List values) { + addCriterion("updater not in", values, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterBetween(String value1, String value2) { + addCriterion("updater between", value1, value2, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterNotBetween(String value1, String value2) { + addCriterion("updater not between", value1, value2, "updater"); + return (Criteria) this; + } + + public Criteria andEnableIsNull() { + addCriterion("enable is null"); + return (Criteria) this; + } + + public Criteria andEnableIsNotNull() { + addCriterion("enable is not null"); + return (Criteria) this; + } + + public Criteria andEnableEqualTo(Boolean value) { + addCriterion("enable =", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableNotEqualTo(Boolean value) { + addCriterion("enable <>", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableGreaterThan(Boolean value) { + addCriterion("enable >", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableGreaterThanOrEqualTo(Boolean value) { + addCriterion("enable >=", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableLessThan(Boolean value) { + addCriterion("enable <", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableLessThanOrEqualTo(Boolean value) { + addCriterion("enable <=", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableIn(List values) { + addCriterion("enable in", values, "enable"); + return (Criteria) this; + } + + public Criteria andEnableNotIn(List values) { + addCriterion("enable not in", values, "enable"); + return (Criteria) this; + } + + public Criteria andEnableBetween(Boolean value1, Boolean value2) { + addCriterion("enable between", value1, value2, "enable"); + return (Criteria) this; + } + + public Criteria andEnableNotBetween(Boolean value1, Boolean value2) { + addCriterion("enable not between", value1, value2, "enable"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/DomainApplyInfo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/DomainApplyInfo.java new file mode 100644 index 000000000..1edffe568 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/DomainApplyInfo.java @@ -0,0 +1,153 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; + +public class DomainApplyInfo { + private Integer id; + + private String applyUser; + + private String domain; + + private String ip; + + private Integer applyStatus; + + private Long ctime; + + private String agentIpList; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getApplyUser() { + return applyUser; + } + + public void setApplyUser(String applyUser) { + this.applyUser = applyUser == null ? null : applyUser.trim(); + } + + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain == null ? null : domain.trim(); + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip == null ? null : ip.trim(); + } + + public Integer getApplyStatus() { + return applyStatus; + } + + public void setApplyStatus(Integer applyStatus) { + this.applyStatus = applyStatus; + } + + public Long getCtime() { + return ctime; + } + + public void setCtime(Long ctime) { + this.ctime = ctime; + } + + public String getAgentIpList() { + return agentIpList; + } + + public void setAgentIpList(String agentIpList) { + this.agentIpList = agentIpList == null ? null : agentIpList.trim(); + } + + public enum Column { + id("id", "id", "INTEGER", false), + applyUser("apply_user", "applyUser", "VARCHAR", false), + domain("domain", "domain", "VARCHAR", false), + ip("ip", "ip", "VARCHAR", false), + applyStatus("apply_status", "applyStatus", "INTEGER", false), + ctime("ctime", "ctime", "BIGINT", false), + agentIpList("agent_ip_list", "agentIpList", "LONGVARCHAR", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/DomainApplyInfoExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/DomainApplyInfoExample.java new file mode 100644 index 000000000..d87d8627f --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/DomainApplyInfoExample.java @@ -0,0 +1,590 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class DomainApplyInfoExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public DomainApplyInfoExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andApplyUserIsNull() { + addCriterion("apply_user is null"); + return (Criteria) this; + } + + public Criteria andApplyUserIsNotNull() { + addCriterion("apply_user is not null"); + return (Criteria) this; + } + + public Criteria andApplyUserEqualTo(String value) { + addCriterion("apply_user =", value, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserNotEqualTo(String value) { + addCriterion("apply_user <>", value, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserGreaterThan(String value) { + addCriterion("apply_user >", value, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserGreaterThanOrEqualTo(String value) { + addCriterion("apply_user >=", value, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserLessThan(String value) { + addCriterion("apply_user <", value, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserLessThanOrEqualTo(String value) { + addCriterion("apply_user <=", value, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserLike(String value) { + addCriterion("apply_user like", value, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserNotLike(String value) { + addCriterion("apply_user not like", value, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserIn(List values) { + addCriterion("apply_user in", values, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserNotIn(List values) { + addCriterion("apply_user not in", values, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserBetween(String value1, String value2) { + addCriterion("apply_user between", value1, value2, "applyUser"); + return (Criteria) this; + } + + public Criteria andApplyUserNotBetween(String value1, String value2) { + addCriterion("apply_user not between", value1, value2, "applyUser"); + return (Criteria) this; + } + + public Criteria andDomainIsNull() { + addCriterion("domain is null"); + return (Criteria) this; + } + + public Criteria andDomainIsNotNull() { + addCriterion("domain is not null"); + return (Criteria) this; + } + + public Criteria andDomainEqualTo(String value) { + addCriterion("domain =", value, "domain"); + return (Criteria) this; + } + + public Criteria andDomainNotEqualTo(String value) { + addCriterion("domain <>", value, "domain"); + return (Criteria) this; + } + + public Criteria andDomainGreaterThan(String value) { + addCriterion("domain >", value, "domain"); + return (Criteria) this; + } + + public Criteria andDomainGreaterThanOrEqualTo(String value) { + addCriterion("domain >=", value, "domain"); + return (Criteria) this; + } + + public Criteria andDomainLessThan(String value) { + addCriterion("domain <", value, "domain"); + return (Criteria) this; + } + + public Criteria andDomainLessThanOrEqualTo(String value) { + addCriterion("domain <=", value, "domain"); + return (Criteria) this; + } + + public Criteria andDomainLike(String value) { + addCriterion("domain like", value, "domain"); + return (Criteria) this; + } + + public Criteria andDomainNotLike(String value) { + addCriterion("domain not like", value, "domain"); + return (Criteria) this; + } + + public Criteria andDomainIn(List values) { + addCriterion("domain in", values, "domain"); + return (Criteria) this; + } + + public Criteria andDomainNotIn(List values) { + addCriterion("domain not in", values, "domain"); + return (Criteria) this; + } + + public Criteria andDomainBetween(String value1, String value2) { + addCriterion("domain between", value1, value2, "domain"); + return (Criteria) this; + } + + public Criteria andDomainNotBetween(String value1, String value2) { + addCriterion("domain not between", value1, value2, "domain"); + return (Criteria) this; + } + + public Criteria andIpIsNull() { + addCriterion("ip is null"); + return (Criteria) this; + } + + public Criteria andIpIsNotNull() { + addCriterion("ip is not null"); + return (Criteria) this; + } + + public Criteria andIpEqualTo(String value) { + addCriterion("ip =", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpNotEqualTo(String value) { + addCriterion("ip <>", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpGreaterThan(String value) { + addCriterion("ip >", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpGreaterThanOrEqualTo(String value) { + addCriterion("ip >=", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpLessThan(String value) { + addCriterion("ip <", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpLessThanOrEqualTo(String value) { + addCriterion("ip <=", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpLike(String value) { + addCriterion("ip like", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpNotLike(String value) { + addCriterion("ip not like", value, "ip"); + return (Criteria) this; + } + + public Criteria andIpIn(List values) { + addCriterion("ip in", values, "ip"); + return (Criteria) this; + } + + public Criteria andIpNotIn(List values) { + addCriterion("ip not in", values, "ip"); + return (Criteria) this; + } + + public Criteria andIpBetween(String value1, String value2) { + addCriterion("ip between", value1, value2, "ip"); + return (Criteria) this; + } + + public Criteria andIpNotBetween(String value1, String value2) { + addCriterion("ip not between", value1, value2, "ip"); + return (Criteria) this; + } + + public Criteria andApplyStatusIsNull() { + addCriterion("apply_status is null"); + return (Criteria) this; + } + + public Criteria andApplyStatusIsNotNull() { + addCriterion("apply_status is not null"); + return (Criteria) this; + } + + public Criteria andApplyStatusEqualTo(Integer value) { + addCriterion("apply_status =", value, "applyStatus"); + return (Criteria) this; + } + + public Criteria andApplyStatusNotEqualTo(Integer value) { + addCriterion("apply_status <>", value, "applyStatus"); + return (Criteria) this; + } + + public Criteria andApplyStatusGreaterThan(Integer value) { + addCriterion("apply_status >", value, "applyStatus"); + return (Criteria) this; + } + + public Criteria andApplyStatusGreaterThanOrEqualTo(Integer value) { + addCriterion("apply_status >=", value, "applyStatus"); + return (Criteria) this; + } + + public Criteria andApplyStatusLessThan(Integer value) { + addCriterion("apply_status <", value, "applyStatus"); + return (Criteria) this; + } + + public Criteria andApplyStatusLessThanOrEqualTo(Integer value) { + addCriterion("apply_status <=", value, "applyStatus"); + return (Criteria) this; + } + + public Criteria andApplyStatusIn(List values) { + addCriterion("apply_status in", values, "applyStatus"); + return (Criteria) this; + } + + public Criteria andApplyStatusNotIn(List values) { + addCriterion("apply_status not in", values, "applyStatus"); + return (Criteria) this; + } + + public Criteria andApplyStatusBetween(Integer value1, Integer value2) { + addCriterion("apply_status between", value1, value2, "applyStatus"); + return (Criteria) this; + } + + public Criteria andApplyStatusNotBetween(Integer value1, Integer value2) { + addCriterion("apply_status not between", value1, value2, "applyStatus"); + return (Criteria) this; + } + + public Criteria andCtimeIsNull() { + addCriterion("ctime is null"); + return (Criteria) this; + } + + public Criteria andCtimeIsNotNull() { + addCriterion("ctime is not null"); + return (Criteria) this; + } + + public Criteria andCtimeEqualTo(Long value) { + addCriterion("ctime =", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotEqualTo(Long value) { + addCriterion("ctime <>", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThan(Long value) { + addCriterion("ctime >", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThanOrEqualTo(Long value) { + addCriterion("ctime >=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThan(Long value) { + addCriterion("ctime <", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThanOrEqualTo(Long value) { + addCriterion("ctime <=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeIn(List values) { + addCriterion("ctime in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotIn(List values) { + addCriterion("ctime not in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeBetween(Long value1, Long value2) { + addCriterion("ctime between", value1, value2, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotBetween(Long value1, Long value2) { + addCriterion("ctime not between", value1, value2, "ctime"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/Hello.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/Hello.java new file mode 100644 index 000000000..913becba2 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/Hello.java @@ -0,0 +1,98 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; + +public class Hello { + private Integer id; + + private String name; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name == null ? null : name.trim(); + } + + public enum Column { + id("id", "id", "INTEGER", false), + name("name", "name", "VARCHAR", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/HelloExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/HelloExample.java new file mode 100644 index 000000000..853897c40 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/HelloExample.java @@ -0,0 +1,330 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class HelloExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public HelloExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andNameIsNull() { + addCriterion("name is null"); + return (Criteria) this; + } + + public Criteria andNameIsNotNull() { + addCriterion("name is not null"); + return (Criteria) this; + } + + public Criteria andNameEqualTo(String value) { + addCriterion("name =", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotEqualTo(String value) { + addCriterion("name <>", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThan(String value) { + addCriterion("name >", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThanOrEqualTo(String value) { + addCriterion("name >=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThan(String value) { + addCriterion("name <", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThanOrEqualTo(String value) { + addCriterion("name <=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLike(String value) { + addCriterion("name like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotLike(String value) { + addCriterion("name not like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameIn(List values) { + addCriterion("name in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameNotIn(List values) { + addCriterion("name not in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameBetween(String value1, String value2) { + addCriterion("name between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNameNotBetween(String value1, String value2) { + addCriterion("name not between", value1, value2, "name"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/MibenchTask.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/MibenchTask.java new file mode 100644 index 000000000..c339f33cf --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/MibenchTask.java @@ -0,0 +1,450 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; + +public class MibenchTask { + private Integer id; + + private Integer qps; + + private Integer originQps; + + private Integer maxQps; + + private Integer sceneId; + + private Integer serialLinkId; + + private Integer sceneApiId; + + private Integer time; + + private Integer agentNum; + + private Integer finishAgentNum; + + private Long ctime; + + private Long utime; + + private Integer state; + + private Integer version; + + private Long successNum; + + private Long failureNum; + + private Integer taskType; + + private Integer parentTaskId; + + private String reportId; + + private Integer reqParamType; + + private Boolean ok; + + private Integer connectTaskNum; + + private Integer debugRt; + + private Integer debugSize; + + private Integer benchMode; + + private Integer increaseMode; + + private Integer increasePercent; + + private String debugResult; + + private String debugResultHeader; + + private String requestParams; + + private String debugTriggerCp; + + private String debugTriggerFilterCondition; + + private String debugReqHeaders; + + private String debugUrl; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getQps() { + return qps; + } + + public void setQps(Integer qps) { + this.qps = qps; + } + + public Integer getOriginQps() { + return originQps; + } + + public void setOriginQps(Integer originQps) { + this.originQps = originQps; + } + + public Integer getMaxQps() { + return maxQps; + } + + public void setMaxQps(Integer maxQps) { + this.maxQps = maxQps; + } + + public Integer getSceneId() { + return sceneId; + } + + public void setSceneId(Integer sceneId) { + this.sceneId = sceneId; + } + + public Integer getSerialLinkId() { + return serialLinkId; + } + + public void setSerialLinkId(Integer serialLinkId) { + this.serialLinkId = serialLinkId; + } + + public Integer getSceneApiId() { + return sceneApiId; + } + + public void setSceneApiId(Integer sceneApiId) { + this.sceneApiId = sceneApiId; + } + + public Integer getTime() { + return time; + } + + public void setTime(Integer time) { + this.time = time; + } + + public Integer getAgentNum() { + return agentNum; + } + + public void setAgentNum(Integer agentNum) { + this.agentNum = agentNum; + } + + public Integer getFinishAgentNum() { + return finishAgentNum; + } + + public void setFinishAgentNum(Integer finishAgentNum) { + this.finishAgentNum = finishAgentNum; + } + + public Long getCtime() { + return ctime; + } + + public void setCtime(Long ctime) { + this.ctime = ctime; + } + + public Long getUtime() { + return utime; + } + + public void setUtime(Long utime) { + this.utime = utime; + } + + public Integer getState() { + return state; + } + + public void setState(Integer state) { + this.state = state; + } + + public Integer getVersion() { + return version; + } + + public void setVersion(Integer version) { + this.version = version; + } + + public Long getSuccessNum() { + return successNum; + } + + public void setSuccessNum(Long successNum) { + this.successNum = successNum; + } + + public Long getFailureNum() { + return failureNum; + } + + public void setFailureNum(Long failureNum) { + this.failureNum = failureNum; + } + + public Integer getTaskType() { + return taskType; + } + + public void setTaskType(Integer taskType) { + this.taskType = taskType; + } + + public Integer getParentTaskId() { + return parentTaskId; + } + + public void setParentTaskId(Integer parentTaskId) { + this.parentTaskId = parentTaskId; + } + + public String getReportId() { + return reportId; + } + + public void setReportId(String reportId) { + this.reportId = reportId == null ? null : reportId.trim(); + } + + public Integer getReqParamType() { + return reqParamType; + } + + public void setReqParamType(Integer reqParamType) { + this.reqParamType = reqParamType; + } + + public Boolean getOk() { + return ok; + } + + public void setOk(Boolean ok) { + this.ok = ok; + } + + public Integer getConnectTaskNum() { + return connectTaskNum; + } + + public void setConnectTaskNum(Integer connectTaskNum) { + this.connectTaskNum = connectTaskNum; + } + + public Integer getDebugRt() { + return debugRt; + } + + public void setDebugRt(Integer debugRt) { + this.debugRt = debugRt; + } + + public Integer getDebugSize() { + return debugSize; + } + + public void setDebugSize(Integer debugSize) { + this.debugSize = debugSize; + } + + public Integer getBenchMode() { + return benchMode; + } + + public void setBenchMode(Integer benchMode) { + this.benchMode = benchMode; + } + + public Integer getIncreaseMode() { + return increaseMode; + } + + public void setIncreaseMode(Integer increaseMode) { + this.increaseMode = increaseMode; + } + + public Integer getIncreasePercent() { + return increasePercent; + } + + public void setIncreasePercent(Integer increasePercent) { + this.increasePercent = increasePercent; + } + + public String getDebugResult() { + return debugResult; + } + + public void setDebugResult(String debugResult) { + this.debugResult = debugResult == null ? null : debugResult.trim(); + } + + public String getDebugResultHeader() { + return debugResultHeader; + } + + public void setDebugResultHeader(String debugResultHeader) { + this.debugResultHeader = debugResultHeader == null ? null : debugResultHeader.trim(); + } + + public String getRequestParams() { + return requestParams; + } + + public void setRequestParams(String requestParams) { + this.requestParams = requestParams == null ? null : requestParams.trim(); + } + + public String getDebugTriggerCp() { + return debugTriggerCp; + } + + public void setDebugTriggerCp(String debugTriggerCp) { + this.debugTriggerCp = debugTriggerCp == null ? null : debugTriggerCp.trim(); + } + + public String getDebugTriggerFilterCondition() { + return debugTriggerFilterCondition; + } + + public void setDebugTriggerFilterCondition(String debugTriggerFilterCondition) { + this.debugTriggerFilterCondition = debugTriggerFilterCondition == null ? null : debugTriggerFilterCondition.trim(); + } + + public String getDebugReqHeaders() { + return debugReqHeaders; + } + + public void setDebugReqHeaders(String debugReqHeaders) { + this.debugReqHeaders = debugReqHeaders == null ? null : debugReqHeaders.trim(); + } + + public String getDebugUrl() { + return debugUrl; + } + + public void setDebugUrl(String debugUrl) { + this.debugUrl = debugUrl == null ? null : debugUrl.trim(); + } + + public enum Column { + id("id", "id", "INTEGER", false), + qps("qps", "qps", "INTEGER", false), + originQps("origin_qps", "originQps", "INTEGER", false), + maxQps("max_qps", "maxQps", "INTEGER", false), + sceneId("scene_id", "sceneId", "INTEGER", false), + serialLinkId("serial_link_id", "serialLinkId", "INTEGER", false), + sceneApiId("scene_api_id", "sceneApiId", "INTEGER", false), + time("time", "time", "INTEGER", false), + agentNum("agent_num", "agentNum", "INTEGER", false), + finishAgentNum("finish_agent_num", "finishAgentNum", "INTEGER", false), + ctime("ctime", "ctime", "BIGINT", false), + utime("utime", "utime", "BIGINT", false), + state("state", "state", "INTEGER", false), + version("version", "version", "INTEGER", false), + successNum("success_num", "successNum", "BIGINT", false), + failureNum("failure_num", "failureNum", "BIGINT", false), + taskType("task_type", "taskType", "INTEGER", false), + parentTaskId("parent_task_id", "parentTaskId", "INTEGER", false), + reportId("report_id", "reportId", "VARCHAR", false), + reqParamType("req_param_type", "reqParamType", "INTEGER", false), + ok("ok", "ok", "BIT", false), + connectTaskNum("connect_task_num", "connectTaskNum", "INTEGER", false), + debugRt("debug_rt", "debugRt", "INTEGER", false), + debugSize("debug_size", "debugSize", "INTEGER", false), + benchMode("bench_mode", "benchMode", "INTEGER", false), + increaseMode("increase_mode", "increaseMode", "INTEGER", false), + increasePercent("increase_percent", "increasePercent", "INTEGER", false), + debugResult("debug_result", "debugResult", "LONGVARCHAR", false), + debugResultHeader("debug_result_header", "debugResultHeader", "LONGVARCHAR", false), + requestParams("request_params", "requestParams", "LONGVARCHAR", false), + debugTriggerCp("debug_trigger_cp", "debugTriggerCp", "LONGVARCHAR", false), + debugTriggerFilterCondition("debug_trigger_filter_condition", "debugTriggerFilterCondition", "LONGVARCHAR", false), + debugReqHeaders("debug_req_headers", "debugReqHeaders", "LONGVARCHAR", false), + debugUrl("debug_url", "debugUrl", "LONGVARCHAR", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/MibenchTaskExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/MibenchTaskExample.java new file mode 100644 index 000000000..c24dbf071 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/MibenchTaskExample.java @@ -0,0 +1,1830 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class MibenchTaskExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public MibenchTaskExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andQpsIsNull() { + addCriterion("qps is null"); + return (Criteria) this; + } + + public Criteria andQpsIsNotNull() { + addCriterion("qps is not null"); + return (Criteria) this; + } + + public Criteria andQpsEqualTo(Integer value) { + addCriterion("qps =", value, "qps"); + return (Criteria) this; + } + + public Criteria andQpsNotEqualTo(Integer value) { + addCriterion("qps <>", value, "qps"); + return (Criteria) this; + } + + public Criteria andQpsGreaterThan(Integer value) { + addCriterion("qps >", value, "qps"); + return (Criteria) this; + } + + public Criteria andQpsGreaterThanOrEqualTo(Integer value) { + addCriterion("qps >=", value, "qps"); + return (Criteria) this; + } + + public Criteria andQpsLessThan(Integer value) { + addCriterion("qps <", value, "qps"); + return (Criteria) this; + } + + public Criteria andQpsLessThanOrEqualTo(Integer value) { + addCriterion("qps <=", value, "qps"); + return (Criteria) this; + } + + public Criteria andQpsIn(List values) { + addCriterion("qps in", values, "qps"); + return (Criteria) this; + } + + public Criteria andQpsNotIn(List values) { + addCriterion("qps not in", values, "qps"); + return (Criteria) this; + } + + public Criteria andQpsBetween(Integer value1, Integer value2) { + addCriterion("qps between", value1, value2, "qps"); + return (Criteria) this; + } + + public Criteria andQpsNotBetween(Integer value1, Integer value2) { + addCriterion("qps not between", value1, value2, "qps"); + return (Criteria) this; + } + + public Criteria andOriginQpsIsNull() { + addCriterion("origin_qps is null"); + return (Criteria) this; + } + + public Criteria andOriginQpsIsNotNull() { + addCriterion("origin_qps is not null"); + return (Criteria) this; + } + + public Criteria andOriginQpsEqualTo(Integer value) { + addCriterion("origin_qps =", value, "originQps"); + return (Criteria) this; + } + + public Criteria andOriginQpsNotEqualTo(Integer value) { + addCriterion("origin_qps <>", value, "originQps"); + return (Criteria) this; + } + + public Criteria andOriginQpsGreaterThan(Integer value) { + addCriterion("origin_qps >", value, "originQps"); + return (Criteria) this; + } + + public Criteria andOriginQpsGreaterThanOrEqualTo(Integer value) { + addCriterion("origin_qps >=", value, "originQps"); + return (Criteria) this; + } + + public Criteria andOriginQpsLessThan(Integer value) { + addCriterion("origin_qps <", value, "originQps"); + return (Criteria) this; + } + + public Criteria andOriginQpsLessThanOrEqualTo(Integer value) { + addCriterion("origin_qps <=", value, "originQps"); + return (Criteria) this; + } + + public Criteria andOriginQpsIn(List values) { + addCriterion("origin_qps in", values, "originQps"); + return (Criteria) this; + } + + public Criteria andOriginQpsNotIn(List values) { + addCriterion("origin_qps not in", values, "originQps"); + return (Criteria) this; + } + + public Criteria andOriginQpsBetween(Integer value1, Integer value2) { + addCriterion("origin_qps between", value1, value2, "originQps"); + return (Criteria) this; + } + + public Criteria andOriginQpsNotBetween(Integer value1, Integer value2) { + addCriterion("origin_qps not between", value1, value2, "originQps"); + return (Criteria) this; + } + + public Criteria andMaxQpsIsNull() { + addCriterion("max_qps is null"); + return (Criteria) this; + } + + public Criteria andMaxQpsIsNotNull() { + addCriterion("max_qps is not null"); + return (Criteria) this; + } + + public Criteria andMaxQpsEqualTo(Integer value) { + addCriterion("max_qps =", value, "maxQps"); + return (Criteria) this; + } + + public Criteria andMaxQpsNotEqualTo(Integer value) { + addCriterion("max_qps <>", value, "maxQps"); + return (Criteria) this; + } + + public Criteria andMaxQpsGreaterThan(Integer value) { + addCriterion("max_qps >", value, "maxQps"); + return (Criteria) this; + } + + public Criteria andMaxQpsGreaterThanOrEqualTo(Integer value) { + addCriterion("max_qps >=", value, "maxQps"); + return (Criteria) this; + } + + public Criteria andMaxQpsLessThan(Integer value) { + addCriterion("max_qps <", value, "maxQps"); + return (Criteria) this; + } + + public Criteria andMaxQpsLessThanOrEqualTo(Integer value) { + addCriterion("max_qps <=", value, "maxQps"); + return (Criteria) this; + } + + public Criteria andMaxQpsIn(List values) { + addCriterion("max_qps in", values, "maxQps"); + return (Criteria) this; + } + + public Criteria andMaxQpsNotIn(List values) { + addCriterion("max_qps not in", values, "maxQps"); + return (Criteria) this; + } + + public Criteria andMaxQpsBetween(Integer value1, Integer value2) { + addCriterion("max_qps between", value1, value2, "maxQps"); + return (Criteria) this; + } + + public Criteria andMaxQpsNotBetween(Integer value1, Integer value2) { + addCriterion("max_qps not between", value1, value2, "maxQps"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNull() { + addCriterion("scene_id is null"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNotNull() { + addCriterion("scene_id is not null"); + return (Criteria) this; + } + + public Criteria andSceneIdEqualTo(Integer value) { + addCriterion("scene_id =", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotEqualTo(Integer value) { + addCriterion("scene_id <>", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThan(Integer value) { + addCriterion("scene_id >", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThanOrEqualTo(Integer value) { + addCriterion("scene_id >=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThan(Integer value) { + addCriterion("scene_id <", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThanOrEqualTo(Integer value) { + addCriterion("scene_id <=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdIn(List values) { + addCriterion("scene_id in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotIn(List values) { + addCriterion("scene_id not in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdBetween(Integer value1, Integer value2) { + addCriterion("scene_id between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotBetween(Integer value1, Integer value2) { + addCriterion("scene_id not between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdIsNull() { + addCriterion("serial_link_id is null"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdIsNotNull() { + addCriterion("serial_link_id is not null"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdEqualTo(Integer value) { + addCriterion("serial_link_id =", value, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdNotEqualTo(Integer value) { + addCriterion("serial_link_id <>", value, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdGreaterThan(Integer value) { + addCriterion("serial_link_id >", value, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdGreaterThanOrEqualTo(Integer value) { + addCriterion("serial_link_id >=", value, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdLessThan(Integer value) { + addCriterion("serial_link_id <", value, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdLessThanOrEqualTo(Integer value) { + addCriterion("serial_link_id <=", value, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdIn(List values) { + addCriterion("serial_link_id in", values, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdNotIn(List values) { + addCriterion("serial_link_id not in", values, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdBetween(Integer value1, Integer value2) { + addCriterion("serial_link_id between", value1, value2, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdNotBetween(Integer value1, Integer value2) { + addCriterion("serial_link_id not between", value1, value2, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSceneApiIdIsNull() { + addCriterion("scene_api_id is null"); + return (Criteria) this; + } + + public Criteria andSceneApiIdIsNotNull() { + addCriterion("scene_api_id is not null"); + return (Criteria) this; + } + + public Criteria andSceneApiIdEqualTo(Integer value) { + addCriterion("scene_api_id =", value, "sceneApiId"); + return (Criteria) this; + } + + public Criteria andSceneApiIdNotEqualTo(Integer value) { + addCriterion("scene_api_id <>", value, "sceneApiId"); + return (Criteria) this; + } + + public Criteria andSceneApiIdGreaterThan(Integer value) { + addCriterion("scene_api_id >", value, "sceneApiId"); + return (Criteria) this; + } + + public Criteria andSceneApiIdGreaterThanOrEqualTo(Integer value) { + addCriterion("scene_api_id >=", value, "sceneApiId"); + return (Criteria) this; + } + + public Criteria andSceneApiIdLessThan(Integer value) { + addCriterion("scene_api_id <", value, "sceneApiId"); + return (Criteria) this; + } + + public Criteria andSceneApiIdLessThanOrEqualTo(Integer value) { + addCriterion("scene_api_id <=", value, "sceneApiId"); + return (Criteria) this; + } + + public Criteria andSceneApiIdIn(List values) { + addCriterion("scene_api_id in", values, "sceneApiId"); + return (Criteria) this; + } + + public Criteria andSceneApiIdNotIn(List values) { + addCriterion("scene_api_id not in", values, "sceneApiId"); + return (Criteria) this; + } + + public Criteria andSceneApiIdBetween(Integer value1, Integer value2) { + addCriterion("scene_api_id between", value1, value2, "sceneApiId"); + return (Criteria) this; + } + + public Criteria andSceneApiIdNotBetween(Integer value1, Integer value2) { + addCriterion("scene_api_id not between", value1, value2, "sceneApiId"); + return (Criteria) this; + } + + public Criteria andTimeIsNull() { + addCriterion("time is null"); + return (Criteria) this; + } + + public Criteria andTimeIsNotNull() { + addCriterion("time is not null"); + return (Criteria) this; + } + + public Criteria andTimeEqualTo(Integer value) { + addCriterion("time =", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeNotEqualTo(Integer value) { + addCriterion("time <>", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeGreaterThan(Integer value) { + addCriterion("time >", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeGreaterThanOrEqualTo(Integer value) { + addCriterion("time >=", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeLessThan(Integer value) { + addCriterion("time <", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeLessThanOrEqualTo(Integer value) { + addCriterion("time <=", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeIn(List values) { + addCriterion("time in", values, "time"); + return (Criteria) this; + } + + public Criteria andTimeNotIn(List values) { + addCriterion("time not in", values, "time"); + return (Criteria) this; + } + + public Criteria andTimeBetween(Integer value1, Integer value2) { + addCriterion("time between", value1, value2, "time"); + return (Criteria) this; + } + + public Criteria andTimeNotBetween(Integer value1, Integer value2) { + addCriterion("time not between", value1, value2, "time"); + return (Criteria) this; + } + + public Criteria andAgentNumIsNull() { + addCriterion("agent_num is null"); + return (Criteria) this; + } + + public Criteria andAgentNumIsNotNull() { + addCriterion("agent_num is not null"); + return (Criteria) this; + } + + public Criteria andAgentNumEqualTo(Integer value) { + addCriterion("agent_num =", value, "agentNum"); + return (Criteria) this; + } + + public Criteria andAgentNumNotEqualTo(Integer value) { + addCriterion("agent_num <>", value, "agentNum"); + return (Criteria) this; + } + + public Criteria andAgentNumGreaterThan(Integer value) { + addCriterion("agent_num >", value, "agentNum"); + return (Criteria) this; + } + + public Criteria andAgentNumGreaterThanOrEqualTo(Integer value) { + addCriterion("agent_num >=", value, "agentNum"); + return (Criteria) this; + } + + public Criteria andAgentNumLessThan(Integer value) { + addCriterion("agent_num <", value, "agentNum"); + return (Criteria) this; + } + + public Criteria andAgentNumLessThanOrEqualTo(Integer value) { + addCriterion("agent_num <=", value, "agentNum"); + return (Criteria) this; + } + + public Criteria andAgentNumIn(List values) { + addCriterion("agent_num in", values, "agentNum"); + return (Criteria) this; + } + + public Criteria andAgentNumNotIn(List values) { + addCriterion("agent_num not in", values, "agentNum"); + return (Criteria) this; + } + + public Criteria andAgentNumBetween(Integer value1, Integer value2) { + addCriterion("agent_num between", value1, value2, "agentNum"); + return (Criteria) this; + } + + public Criteria andAgentNumNotBetween(Integer value1, Integer value2) { + addCriterion("agent_num not between", value1, value2, "agentNum"); + return (Criteria) this; + } + + public Criteria andFinishAgentNumIsNull() { + addCriterion("finish_agent_num is null"); + return (Criteria) this; + } + + public Criteria andFinishAgentNumIsNotNull() { + addCriterion("finish_agent_num is not null"); + return (Criteria) this; + } + + public Criteria andFinishAgentNumEqualTo(Integer value) { + addCriterion("finish_agent_num =", value, "finishAgentNum"); + return (Criteria) this; + } + + public Criteria andFinishAgentNumNotEqualTo(Integer value) { + addCriterion("finish_agent_num <>", value, "finishAgentNum"); + return (Criteria) this; + } + + public Criteria andFinishAgentNumGreaterThan(Integer value) { + addCriterion("finish_agent_num >", value, "finishAgentNum"); + return (Criteria) this; + } + + public Criteria andFinishAgentNumGreaterThanOrEqualTo(Integer value) { + addCriterion("finish_agent_num >=", value, "finishAgentNum"); + return (Criteria) this; + } + + public Criteria andFinishAgentNumLessThan(Integer value) { + addCriterion("finish_agent_num <", value, "finishAgentNum"); + return (Criteria) this; + } + + public Criteria andFinishAgentNumLessThanOrEqualTo(Integer value) { + addCriterion("finish_agent_num <=", value, "finishAgentNum"); + return (Criteria) this; + } + + public Criteria andFinishAgentNumIn(List values) { + addCriterion("finish_agent_num in", values, "finishAgentNum"); + return (Criteria) this; + } + + public Criteria andFinishAgentNumNotIn(List values) { + addCriterion("finish_agent_num not in", values, "finishAgentNum"); + return (Criteria) this; + } + + public Criteria andFinishAgentNumBetween(Integer value1, Integer value2) { + addCriterion("finish_agent_num between", value1, value2, "finishAgentNum"); + return (Criteria) this; + } + + public Criteria andFinishAgentNumNotBetween(Integer value1, Integer value2) { + addCriterion("finish_agent_num not between", value1, value2, "finishAgentNum"); + return (Criteria) this; + } + + public Criteria andCtimeIsNull() { + addCriterion("ctime is null"); + return (Criteria) this; + } + + public Criteria andCtimeIsNotNull() { + addCriterion("ctime is not null"); + return (Criteria) this; + } + + public Criteria andCtimeEqualTo(Long value) { + addCriterion("ctime =", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotEqualTo(Long value) { + addCriterion("ctime <>", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThan(Long value) { + addCriterion("ctime >", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThanOrEqualTo(Long value) { + addCriterion("ctime >=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThan(Long value) { + addCriterion("ctime <", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThanOrEqualTo(Long value) { + addCriterion("ctime <=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeIn(List values) { + addCriterion("ctime in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotIn(List values) { + addCriterion("ctime not in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeBetween(Long value1, Long value2) { + addCriterion("ctime between", value1, value2, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotBetween(Long value1, Long value2) { + addCriterion("ctime not between", value1, value2, "ctime"); + return (Criteria) this; + } + + public Criteria andUtimeIsNull() { + addCriterion("utime is null"); + return (Criteria) this; + } + + public Criteria andUtimeIsNotNull() { + addCriterion("utime is not null"); + return (Criteria) this; + } + + public Criteria andUtimeEqualTo(Long value) { + addCriterion("utime =", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotEqualTo(Long value) { + addCriterion("utime <>", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeGreaterThan(Long value) { + addCriterion("utime >", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeGreaterThanOrEqualTo(Long value) { + addCriterion("utime >=", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeLessThan(Long value) { + addCriterion("utime <", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeLessThanOrEqualTo(Long value) { + addCriterion("utime <=", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeIn(List values) { + addCriterion("utime in", values, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotIn(List values) { + addCriterion("utime not in", values, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeBetween(Long value1, Long value2) { + addCriterion("utime between", value1, value2, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotBetween(Long value1, Long value2) { + addCriterion("utime not between", value1, value2, "utime"); + return (Criteria) this; + } + + public Criteria andStateIsNull() { + addCriterion("state is null"); + return (Criteria) this; + } + + public Criteria andStateIsNotNull() { + addCriterion("state is not null"); + return (Criteria) this; + } + + public Criteria andStateEqualTo(Integer value) { + addCriterion("state =", value, "state"); + return (Criteria) this; + } + + public Criteria andStateNotEqualTo(Integer value) { + addCriterion("state <>", value, "state"); + return (Criteria) this; + } + + public Criteria andStateGreaterThan(Integer value) { + addCriterion("state >", value, "state"); + return (Criteria) this; + } + + public Criteria andStateGreaterThanOrEqualTo(Integer value) { + addCriterion("state >=", value, "state"); + return (Criteria) this; + } + + public Criteria andStateLessThan(Integer value) { + addCriterion("state <", value, "state"); + return (Criteria) this; + } + + public Criteria andStateLessThanOrEqualTo(Integer value) { + addCriterion("state <=", value, "state"); + return (Criteria) this; + } + + public Criteria andStateIn(List values) { + addCriterion("state in", values, "state"); + return (Criteria) this; + } + + public Criteria andStateNotIn(List values) { + addCriterion("state not in", values, "state"); + return (Criteria) this; + } + + public Criteria andStateBetween(Integer value1, Integer value2) { + addCriterion("state between", value1, value2, "state"); + return (Criteria) this; + } + + public Criteria andStateNotBetween(Integer value1, Integer value2) { + addCriterion("state not between", value1, value2, "state"); + return (Criteria) this; + } + + public Criteria andVersionIsNull() { + addCriterion("version is null"); + return (Criteria) this; + } + + public Criteria andVersionIsNotNull() { + addCriterion("version is not null"); + return (Criteria) this; + } + + public Criteria andVersionEqualTo(Integer value) { + addCriterion("version =", value, "version"); + return (Criteria) this; + } + + public Criteria andVersionNotEqualTo(Integer value) { + addCriterion("version <>", value, "version"); + return (Criteria) this; + } + + public Criteria andVersionGreaterThan(Integer value) { + addCriterion("version >", value, "version"); + return (Criteria) this; + } + + public Criteria andVersionGreaterThanOrEqualTo(Integer value) { + addCriterion("version >=", value, "version"); + return (Criteria) this; + } + + public Criteria andVersionLessThan(Integer value) { + addCriterion("version <", value, "version"); + return (Criteria) this; + } + + public Criteria andVersionLessThanOrEqualTo(Integer value) { + addCriterion("version <=", value, "version"); + return (Criteria) this; + } + + public Criteria andVersionIn(List values) { + addCriterion("version in", values, "version"); + return (Criteria) this; + } + + public Criteria andVersionNotIn(List values) { + addCriterion("version not in", values, "version"); + return (Criteria) this; + } + + public Criteria andVersionBetween(Integer value1, Integer value2) { + addCriterion("version between", value1, value2, "version"); + return (Criteria) this; + } + + public Criteria andVersionNotBetween(Integer value1, Integer value2) { + addCriterion("version not between", value1, value2, "version"); + return (Criteria) this; + } + + public Criteria andSuccessNumIsNull() { + addCriterion("success_num is null"); + return (Criteria) this; + } + + public Criteria andSuccessNumIsNotNull() { + addCriterion("success_num is not null"); + return (Criteria) this; + } + + public Criteria andSuccessNumEqualTo(Long value) { + addCriterion("success_num =", value, "successNum"); + return (Criteria) this; + } + + public Criteria andSuccessNumNotEqualTo(Long value) { + addCriterion("success_num <>", value, "successNum"); + return (Criteria) this; + } + + public Criteria andSuccessNumGreaterThan(Long value) { + addCriterion("success_num >", value, "successNum"); + return (Criteria) this; + } + + public Criteria andSuccessNumGreaterThanOrEqualTo(Long value) { + addCriterion("success_num >=", value, "successNum"); + return (Criteria) this; + } + + public Criteria andSuccessNumLessThan(Long value) { + addCriterion("success_num <", value, "successNum"); + return (Criteria) this; + } + + public Criteria andSuccessNumLessThanOrEqualTo(Long value) { + addCriterion("success_num <=", value, "successNum"); + return (Criteria) this; + } + + public Criteria andSuccessNumIn(List values) { + addCriterion("success_num in", values, "successNum"); + return (Criteria) this; + } + + public Criteria andSuccessNumNotIn(List values) { + addCriterion("success_num not in", values, "successNum"); + return (Criteria) this; + } + + public Criteria andSuccessNumBetween(Long value1, Long value2) { + addCriterion("success_num between", value1, value2, "successNum"); + return (Criteria) this; + } + + public Criteria andSuccessNumNotBetween(Long value1, Long value2) { + addCriterion("success_num not between", value1, value2, "successNum"); + return (Criteria) this; + } + + public Criteria andFailureNumIsNull() { + addCriterion("failure_num is null"); + return (Criteria) this; + } + + public Criteria andFailureNumIsNotNull() { + addCriterion("failure_num is not null"); + return (Criteria) this; + } + + public Criteria andFailureNumEqualTo(Long value) { + addCriterion("failure_num =", value, "failureNum"); + return (Criteria) this; + } + + public Criteria andFailureNumNotEqualTo(Long value) { + addCriterion("failure_num <>", value, "failureNum"); + return (Criteria) this; + } + + public Criteria andFailureNumGreaterThan(Long value) { + addCriterion("failure_num >", value, "failureNum"); + return (Criteria) this; + } + + public Criteria andFailureNumGreaterThanOrEqualTo(Long value) { + addCriterion("failure_num >=", value, "failureNum"); + return (Criteria) this; + } + + public Criteria andFailureNumLessThan(Long value) { + addCriterion("failure_num <", value, "failureNum"); + return (Criteria) this; + } + + public Criteria andFailureNumLessThanOrEqualTo(Long value) { + addCriterion("failure_num <=", value, "failureNum"); + return (Criteria) this; + } + + public Criteria andFailureNumIn(List values) { + addCriterion("failure_num in", values, "failureNum"); + return (Criteria) this; + } + + public Criteria andFailureNumNotIn(List values) { + addCriterion("failure_num not in", values, "failureNum"); + return (Criteria) this; + } + + public Criteria andFailureNumBetween(Long value1, Long value2) { + addCriterion("failure_num between", value1, value2, "failureNum"); + return (Criteria) this; + } + + public Criteria andFailureNumNotBetween(Long value1, Long value2) { + addCriterion("failure_num not between", value1, value2, "failureNum"); + return (Criteria) this; + } + + public Criteria andTaskTypeIsNull() { + addCriterion("task_type is null"); + return (Criteria) this; + } + + public Criteria andTaskTypeIsNotNull() { + addCriterion("task_type is not null"); + return (Criteria) this; + } + + public Criteria andTaskTypeEqualTo(Integer value) { + addCriterion("task_type =", value, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeNotEqualTo(Integer value) { + addCriterion("task_type <>", value, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeGreaterThan(Integer value) { + addCriterion("task_type >", value, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("task_type >=", value, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeLessThan(Integer value) { + addCriterion("task_type <", value, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeLessThanOrEqualTo(Integer value) { + addCriterion("task_type <=", value, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeIn(List values) { + addCriterion("task_type in", values, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeNotIn(List values) { + addCriterion("task_type not in", values, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeBetween(Integer value1, Integer value2) { + addCriterion("task_type between", value1, value2, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeNotBetween(Integer value1, Integer value2) { + addCriterion("task_type not between", value1, value2, "taskType"); + return (Criteria) this; + } + + public Criteria andParentTaskIdIsNull() { + addCriterion("parent_task_id is null"); + return (Criteria) this; + } + + public Criteria andParentTaskIdIsNotNull() { + addCriterion("parent_task_id is not null"); + return (Criteria) this; + } + + public Criteria andParentTaskIdEqualTo(Integer value) { + addCriterion("parent_task_id =", value, "parentTaskId"); + return (Criteria) this; + } + + public Criteria andParentTaskIdNotEqualTo(Integer value) { + addCriterion("parent_task_id <>", value, "parentTaskId"); + return (Criteria) this; + } + + public Criteria andParentTaskIdGreaterThan(Integer value) { + addCriterion("parent_task_id >", value, "parentTaskId"); + return (Criteria) this; + } + + public Criteria andParentTaskIdGreaterThanOrEqualTo(Integer value) { + addCriterion("parent_task_id >=", value, "parentTaskId"); + return (Criteria) this; + } + + public Criteria andParentTaskIdLessThan(Integer value) { + addCriterion("parent_task_id <", value, "parentTaskId"); + return (Criteria) this; + } + + public Criteria andParentTaskIdLessThanOrEqualTo(Integer value) { + addCriterion("parent_task_id <=", value, "parentTaskId"); + return (Criteria) this; + } + + public Criteria andParentTaskIdIn(List values) { + addCriterion("parent_task_id in", values, "parentTaskId"); + return (Criteria) this; + } + + public Criteria andParentTaskIdNotIn(List values) { + addCriterion("parent_task_id not in", values, "parentTaskId"); + return (Criteria) this; + } + + public Criteria andParentTaskIdBetween(Integer value1, Integer value2) { + addCriterion("parent_task_id between", value1, value2, "parentTaskId"); + return (Criteria) this; + } + + public Criteria andParentTaskIdNotBetween(Integer value1, Integer value2) { + addCriterion("parent_task_id not between", value1, value2, "parentTaskId"); + return (Criteria) this; + } + + public Criteria andReportIdIsNull() { + addCriterion("report_id is null"); + return (Criteria) this; + } + + public Criteria andReportIdIsNotNull() { + addCriterion("report_id is not null"); + return (Criteria) this; + } + + public Criteria andReportIdEqualTo(String value) { + addCriterion("report_id =", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotEqualTo(String value) { + addCriterion("report_id <>", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdGreaterThan(String value) { + addCriterion("report_id >", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdGreaterThanOrEqualTo(String value) { + addCriterion("report_id >=", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLessThan(String value) { + addCriterion("report_id <", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLessThanOrEqualTo(String value) { + addCriterion("report_id <=", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLike(String value) { + addCriterion("report_id like", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotLike(String value) { + addCriterion("report_id not like", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdIn(List values) { + addCriterion("report_id in", values, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotIn(List values) { + addCriterion("report_id not in", values, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdBetween(String value1, String value2) { + addCriterion("report_id between", value1, value2, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotBetween(String value1, String value2) { + addCriterion("report_id not between", value1, value2, "reportId"); + return (Criteria) this; + } + + public Criteria andReqParamTypeIsNull() { + addCriterion("req_param_type is null"); + return (Criteria) this; + } + + public Criteria andReqParamTypeIsNotNull() { + addCriterion("req_param_type is not null"); + return (Criteria) this; + } + + public Criteria andReqParamTypeEqualTo(Integer value) { + addCriterion("req_param_type =", value, "reqParamType"); + return (Criteria) this; + } + + public Criteria andReqParamTypeNotEqualTo(Integer value) { + addCriterion("req_param_type <>", value, "reqParamType"); + return (Criteria) this; + } + + public Criteria andReqParamTypeGreaterThan(Integer value) { + addCriterion("req_param_type >", value, "reqParamType"); + return (Criteria) this; + } + + public Criteria andReqParamTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("req_param_type >=", value, "reqParamType"); + return (Criteria) this; + } + + public Criteria andReqParamTypeLessThan(Integer value) { + addCriterion("req_param_type <", value, "reqParamType"); + return (Criteria) this; + } + + public Criteria andReqParamTypeLessThanOrEqualTo(Integer value) { + addCriterion("req_param_type <=", value, "reqParamType"); + return (Criteria) this; + } + + public Criteria andReqParamTypeIn(List values) { + addCriterion("req_param_type in", values, "reqParamType"); + return (Criteria) this; + } + + public Criteria andReqParamTypeNotIn(List values) { + addCriterion("req_param_type not in", values, "reqParamType"); + return (Criteria) this; + } + + public Criteria andReqParamTypeBetween(Integer value1, Integer value2) { + addCriterion("req_param_type between", value1, value2, "reqParamType"); + return (Criteria) this; + } + + public Criteria andReqParamTypeNotBetween(Integer value1, Integer value2) { + addCriterion("req_param_type not between", value1, value2, "reqParamType"); + return (Criteria) this; + } + + public Criteria andOkIsNull() { + addCriterion("ok is null"); + return (Criteria) this; + } + + public Criteria andOkIsNotNull() { + addCriterion("ok is not null"); + return (Criteria) this; + } + + public Criteria andOkEqualTo(Boolean value) { + addCriterion("ok =", value, "ok"); + return (Criteria) this; + } + + public Criteria andOkNotEqualTo(Boolean value) { + addCriterion("ok <>", value, "ok"); + return (Criteria) this; + } + + public Criteria andOkGreaterThan(Boolean value) { + addCriterion("ok >", value, "ok"); + return (Criteria) this; + } + + public Criteria andOkGreaterThanOrEqualTo(Boolean value) { + addCriterion("ok >=", value, "ok"); + return (Criteria) this; + } + + public Criteria andOkLessThan(Boolean value) { + addCriterion("ok <", value, "ok"); + return (Criteria) this; + } + + public Criteria andOkLessThanOrEqualTo(Boolean value) { + addCriterion("ok <=", value, "ok"); + return (Criteria) this; + } + + public Criteria andOkIn(List values) { + addCriterion("ok in", values, "ok"); + return (Criteria) this; + } + + public Criteria andOkNotIn(List values) { + addCriterion("ok not in", values, "ok"); + return (Criteria) this; + } + + public Criteria andOkBetween(Boolean value1, Boolean value2) { + addCriterion("ok between", value1, value2, "ok"); + return (Criteria) this; + } + + public Criteria andOkNotBetween(Boolean value1, Boolean value2) { + addCriterion("ok not between", value1, value2, "ok"); + return (Criteria) this; + } + + public Criteria andConnectTaskNumIsNull() { + addCriterion("connect_task_num is null"); + return (Criteria) this; + } + + public Criteria andConnectTaskNumIsNotNull() { + addCriterion("connect_task_num is not null"); + return (Criteria) this; + } + + public Criteria andConnectTaskNumEqualTo(Integer value) { + addCriterion("connect_task_num =", value, "connectTaskNum"); + return (Criteria) this; + } + + public Criteria andConnectTaskNumNotEqualTo(Integer value) { + addCriterion("connect_task_num <>", value, "connectTaskNum"); + return (Criteria) this; + } + + public Criteria andConnectTaskNumGreaterThan(Integer value) { + addCriterion("connect_task_num >", value, "connectTaskNum"); + return (Criteria) this; + } + + public Criteria andConnectTaskNumGreaterThanOrEqualTo(Integer value) { + addCriterion("connect_task_num >=", value, "connectTaskNum"); + return (Criteria) this; + } + + public Criteria andConnectTaskNumLessThan(Integer value) { + addCriterion("connect_task_num <", value, "connectTaskNum"); + return (Criteria) this; + } + + public Criteria andConnectTaskNumLessThanOrEqualTo(Integer value) { + addCriterion("connect_task_num <=", value, "connectTaskNum"); + return (Criteria) this; + } + + public Criteria andConnectTaskNumIn(List values) { + addCriterion("connect_task_num in", values, "connectTaskNum"); + return (Criteria) this; + } + + public Criteria andConnectTaskNumNotIn(List values) { + addCriterion("connect_task_num not in", values, "connectTaskNum"); + return (Criteria) this; + } + + public Criteria andConnectTaskNumBetween(Integer value1, Integer value2) { + addCriterion("connect_task_num between", value1, value2, "connectTaskNum"); + return (Criteria) this; + } + + public Criteria andConnectTaskNumNotBetween(Integer value1, Integer value2) { + addCriterion("connect_task_num not between", value1, value2, "connectTaskNum"); + return (Criteria) this; + } + + public Criteria andDebugRtIsNull() { + addCriterion("debug_rt is null"); + return (Criteria) this; + } + + public Criteria andDebugRtIsNotNull() { + addCriterion("debug_rt is not null"); + return (Criteria) this; + } + + public Criteria andDebugRtEqualTo(Integer value) { + addCriterion("debug_rt =", value, "debugRt"); + return (Criteria) this; + } + + public Criteria andDebugRtNotEqualTo(Integer value) { + addCriterion("debug_rt <>", value, "debugRt"); + return (Criteria) this; + } + + public Criteria andDebugRtGreaterThan(Integer value) { + addCriterion("debug_rt >", value, "debugRt"); + return (Criteria) this; + } + + public Criteria andDebugRtGreaterThanOrEqualTo(Integer value) { + addCriterion("debug_rt >=", value, "debugRt"); + return (Criteria) this; + } + + public Criteria andDebugRtLessThan(Integer value) { + addCriterion("debug_rt <", value, "debugRt"); + return (Criteria) this; + } + + public Criteria andDebugRtLessThanOrEqualTo(Integer value) { + addCriterion("debug_rt <=", value, "debugRt"); + return (Criteria) this; + } + + public Criteria andDebugRtIn(List values) { + addCriterion("debug_rt in", values, "debugRt"); + return (Criteria) this; + } + + public Criteria andDebugRtNotIn(List values) { + addCriterion("debug_rt not in", values, "debugRt"); + return (Criteria) this; + } + + public Criteria andDebugRtBetween(Integer value1, Integer value2) { + addCriterion("debug_rt between", value1, value2, "debugRt"); + return (Criteria) this; + } + + public Criteria andDebugRtNotBetween(Integer value1, Integer value2) { + addCriterion("debug_rt not between", value1, value2, "debugRt"); + return (Criteria) this; + } + + public Criteria andDebugSizeIsNull() { + addCriterion("debug_size is null"); + return (Criteria) this; + } + + public Criteria andDebugSizeIsNotNull() { + addCriterion("debug_size is not null"); + return (Criteria) this; + } + + public Criteria andDebugSizeEqualTo(Integer value) { + addCriterion("debug_size =", value, "debugSize"); + return (Criteria) this; + } + + public Criteria andDebugSizeNotEqualTo(Integer value) { + addCriterion("debug_size <>", value, "debugSize"); + return (Criteria) this; + } + + public Criteria andDebugSizeGreaterThan(Integer value) { + addCriterion("debug_size >", value, "debugSize"); + return (Criteria) this; + } + + public Criteria andDebugSizeGreaterThanOrEqualTo(Integer value) { + addCriterion("debug_size >=", value, "debugSize"); + return (Criteria) this; + } + + public Criteria andDebugSizeLessThan(Integer value) { + addCriterion("debug_size <", value, "debugSize"); + return (Criteria) this; + } + + public Criteria andDebugSizeLessThanOrEqualTo(Integer value) { + addCriterion("debug_size <=", value, "debugSize"); + return (Criteria) this; + } + + public Criteria andDebugSizeIn(List values) { + addCriterion("debug_size in", values, "debugSize"); + return (Criteria) this; + } + + public Criteria andDebugSizeNotIn(List values) { + addCriterion("debug_size not in", values, "debugSize"); + return (Criteria) this; + } + + public Criteria andDebugSizeBetween(Integer value1, Integer value2) { + addCriterion("debug_size between", value1, value2, "debugSize"); + return (Criteria) this; + } + + public Criteria andDebugSizeNotBetween(Integer value1, Integer value2) { + addCriterion("debug_size not between", value1, value2, "debugSize"); + return (Criteria) this; + } + + public Criteria andBenchModeIsNull() { + addCriterion("bench_mode is null"); + return (Criteria) this; + } + + public Criteria andBenchModeIsNotNull() { + addCriterion("bench_mode is not null"); + return (Criteria) this; + } + + public Criteria andBenchModeEqualTo(Integer value) { + addCriterion("bench_mode =", value, "benchMode"); + return (Criteria) this; + } + + public Criteria andBenchModeNotEqualTo(Integer value) { + addCriterion("bench_mode <>", value, "benchMode"); + return (Criteria) this; + } + + public Criteria andBenchModeGreaterThan(Integer value) { + addCriterion("bench_mode >", value, "benchMode"); + return (Criteria) this; + } + + public Criteria andBenchModeGreaterThanOrEqualTo(Integer value) { + addCriterion("bench_mode >=", value, "benchMode"); + return (Criteria) this; + } + + public Criteria andBenchModeLessThan(Integer value) { + addCriterion("bench_mode <", value, "benchMode"); + return (Criteria) this; + } + + public Criteria andBenchModeLessThanOrEqualTo(Integer value) { + addCriterion("bench_mode <=", value, "benchMode"); + return (Criteria) this; + } + + public Criteria andBenchModeIn(List values) { + addCriterion("bench_mode in", values, "benchMode"); + return (Criteria) this; + } + + public Criteria andBenchModeNotIn(List values) { + addCriterion("bench_mode not in", values, "benchMode"); + return (Criteria) this; + } + + public Criteria andBenchModeBetween(Integer value1, Integer value2) { + addCriterion("bench_mode between", value1, value2, "benchMode"); + return (Criteria) this; + } + + public Criteria andBenchModeNotBetween(Integer value1, Integer value2) { + addCriterion("bench_mode not between", value1, value2, "benchMode"); + return (Criteria) this; + } + + public Criteria andIncreaseModeIsNull() { + addCriterion("increase_mode is null"); + return (Criteria) this; + } + + public Criteria andIncreaseModeIsNotNull() { + addCriterion("increase_mode is not null"); + return (Criteria) this; + } + + public Criteria andIncreaseModeEqualTo(Integer value) { + addCriterion("increase_mode =", value, "increaseMode"); + return (Criteria) this; + } + + public Criteria andIncreaseModeNotEqualTo(Integer value) { + addCriterion("increase_mode <>", value, "increaseMode"); + return (Criteria) this; + } + + public Criteria andIncreaseModeGreaterThan(Integer value) { + addCriterion("increase_mode >", value, "increaseMode"); + return (Criteria) this; + } + + public Criteria andIncreaseModeGreaterThanOrEqualTo(Integer value) { + addCriterion("increase_mode >=", value, "increaseMode"); + return (Criteria) this; + } + + public Criteria andIncreaseModeLessThan(Integer value) { + addCriterion("increase_mode <", value, "increaseMode"); + return (Criteria) this; + } + + public Criteria andIncreaseModeLessThanOrEqualTo(Integer value) { + addCriterion("increase_mode <=", value, "increaseMode"); + return (Criteria) this; + } + + public Criteria andIncreaseModeIn(List values) { + addCriterion("increase_mode in", values, "increaseMode"); + return (Criteria) this; + } + + public Criteria andIncreaseModeNotIn(List values) { + addCriterion("increase_mode not in", values, "increaseMode"); + return (Criteria) this; + } + + public Criteria andIncreaseModeBetween(Integer value1, Integer value2) { + addCriterion("increase_mode between", value1, value2, "increaseMode"); + return (Criteria) this; + } + + public Criteria andIncreaseModeNotBetween(Integer value1, Integer value2) { + addCriterion("increase_mode not between", value1, value2, "increaseMode"); + return (Criteria) this; + } + + public Criteria andIncreasePercentIsNull() { + addCriterion("increase_percent is null"); + return (Criteria) this; + } + + public Criteria andIncreasePercentIsNotNull() { + addCriterion("increase_percent is not null"); + return (Criteria) this; + } + + public Criteria andIncreasePercentEqualTo(Integer value) { + addCriterion("increase_percent =", value, "increasePercent"); + return (Criteria) this; + } + + public Criteria andIncreasePercentNotEqualTo(Integer value) { + addCriterion("increase_percent <>", value, "increasePercent"); + return (Criteria) this; + } + + public Criteria andIncreasePercentGreaterThan(Integer value) { + addCriterion("increase_percent >", value, "increasePercent"); + return (Criteria) this; + } + + public Criteria andIncreasePercentGreaterThanOrEqualTo(Integer value) { + addCriterion("increase_percent >=", value, "increasePercent"); + return (Criteria) this; + } + + public Criteria andIncreasePercentLessThan(Integer value) { + addCriterion("increase_percent <", value, "increasePercent"); + return (Criteria) this; + } + + public Criteria andIncreasePercentLessThanOrEqualTo(Integer value) { + addCriterion("increase_percent <=", value, "increasePercent"); + return (Criteria) this; + } + + public Criteria andIncreasePercentIn(List values) { + addCriterion("increase_percent in", values, "increasePercent"); + return (Criteria) this; + } + + public Criteria andIncreasePercentNotIn(List values) { + addCriterion("increase_percent not in", values, "increasePercent"); + return (Criteria) this; + } + + public Criteria andIncreasePercentBetween(Integer value1, Integer value2) { + addCriterion("increase_percent between", value1, value2, "increasePercent"); + return (Criteria) this; + } + + public Criteria andIncreasePercentNotBetween(Integer value1, Integer value2) { + addCriterion("increase_percent not between", value1, value2, "increasePercent"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/OperationLog.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/OperationLog.java new file mode 100644 index 000000000..137a75a5a --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/OperationLog.java @@ -0,0 +1,175 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; + +public class OperationLog { + private Long id; + + private String reportId; + + private Integer sceneId; + + private Integer type; + + private String createBy; + + private Long createTime; + + private Long updateTime; + + private String content; + + private String supportOperation; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getReportId() { + return reportId; + } + + public void setReportId(String reportId) { + this.reportId = reportId == null ? null : reportId.trim(); + } + + public Integer getSceneId() { + return sceneId; + } + + public void setSceneId(Integer sceneId) { + this.sceneId = sceneId; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy == null ? null : createBy.trim(); + } + + public Long getCreateTime() { + return createTime; + } + + public void setCreateTime(Long createTime) { + this.createTime = createTime; + } + + public Long getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Long updateTime) { + this.updateTime = updateTime; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content == null ? null : content.trim(); + } + + public String getSupportOperation() { + return supportOperation; + } + + public void setSupportOperation(String supportOperation) { + this.supportOperation = supportOperation == null ? null : supportOperation.trim(); + } + + public enum Column { + id("id", "id", "BIGINT", false), + reportId("report_id", "reportId", "VARCHAR", false), + sceneId("scene_id", "sceneId", "INTEGER", false), + type("type", "type", "INTEGER", false), + createBy("create_by", "createBy", "VARCHAR", false), + createTime("create_time", "createTime", "BIGINT", false), + updateTime("update_time", "updateTime", "BIGINT", false), + content("content", "content", "LONGVARCHAR", false), + supportOperation("support_operation", "supportOperation", "LONGVARCHAR", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/OperationLogExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/OperationLogExample.java new file mode 100644 index 000000000..2ff36783b --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/OperationLogExample.java @@ -0,0 +1,640 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class OperationLogExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public OperationLogExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andReportIdIsNull() { + addCriterion("report_id is null"); + return (Criteria) this; + } + + public Criteria andReportIdIsNotNull() { + addCriterion("report_id is not null"); + return (Criteria) this; + } + + public Criteria andReportIdEqualTo(String value) { + addCriterion("report_id =", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotEqualTo(String value) { + addCriterion("report_id <>", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdGreaterThan(String value) { + addCriterion("report_id >", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdGreaterThanOrEqualTo(String value) { + addCriterion("report_id >=", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLessThan(String value) { + addCriterion("report_id <", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLessThanOrEqualTo(String value) { + addCriterion("report_id <=", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLike(String value) { + addCriterion("report_id like", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotLike(String value) { + addCriterion("report_id not like", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdIn(List values) { + addCriterion("report_id in", values, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotIn(List values) { + addCriterion("report_id not in", values, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdBetween(String value1, String value2) { + addCriterion("report_id between", value1, value2, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotBetween(String value1, String value2) { + addCriterion("report_id not between", value1, value2, "reportId"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNull() { + addCriterion("scene_id is null"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNotNull() { + addCriterion("scene_id is not null"); + return (Criteria) this; + } + + public Criteria andSceneIdEqualTo(Integer value) { + addCriterion("scene_id =", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotEqualTo(Integer value) { + addCriterion("scene_id <>", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThan(Integer value) { + addCriterion("scene_id >", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThanOrEqualTo(Integer value) { + addCriterion("scene_id >=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThan(Integer value) { + addCriterion("scene_id <", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThanOrEqualTo(Integer value) { + addCriterion("scene_id <=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdIn(List values) { + addCriterion("scene_id in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotIn(List values) { + addCriterion("scene_id not in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdBetween(Integer value1, Integer value2) { + addCriterion("scene_id between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotBetween(Integer value1, Integer value2) { + addCriterion("scene_id not between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andTypeIsNull() { + addCriterion("type is null"); + return (Criteria) this; + } + + public Criteria andTypeIsNotNull() { + addCriterion("type is not null"); + return (Criteria) this; + } + + public Criteria andTypeEqualTo(Integer value) { + addCriterion("type =", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotEqualTo(Integer value) { + addCriterion("type <>", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThan(Integer value) { + addCriterion("type >", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("type >=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThan(Integer value) { + addCriterion("type <", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThanOrEqualTo(Integer value) { + addCriterion("type <=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeIn(List values) { + addCriterion("type in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotIn(List values) { + addCriterion("type not in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeBetween(Integer value1, Integer value2) { + addCriterion("type between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotBetween(Integer value1, Integer value2) { + addCriterion("type not between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andCreateByIsNull() { + addCriterion("create_by is null"); + return (Criteria) this; + } + + public Criteria andCreateByIsNotNull() { + addCriterion("create_by is not null"); + return (Criteria) this; + } + + public Criteria andCreateByEqualTo(String value) { + addCriterion("create_by =", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotEqualTo(String value) { + addCriterion("create_by <>", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByGreaterThan(String value) { + addCriterion("create_by >", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByGreaterThanOrEqualTo(String value) { + addCriterion("create_by >=", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByLessThan(String value) { + addCriterion("create_by <", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByLessThanOrEqualTo(String value) { + addCriterion("create_by <=", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByLike(String value) { + addCriterion("create_by like", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotLike(String value) { + addCriterion("create_by not like", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByIn(List values) { + addCriterion("create_by in", values, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotIn(List values) { + addCriterion("create_by not in", values, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByBetween(String value1, String value2) { + addCriterion("create_by between", value1, value2, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotBetween(String value1, String value2) { + addCriterion("create_by not between", value1, value2, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Long value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Long value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Long value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Long value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Long value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Long value1, Long value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Long value1, Long value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Long value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Long value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Long value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Long value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Long value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Long value1, Long value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Long value1, Long value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/ReportInfo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/ReportInfo.java new file mode 100644 index 000000000..0dadcbf07 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/ReportInfo.java @@ -0,0 +1,308 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; + +public class ReportInfo { + private Long id; + + private Long sceneId; + + private String snapshotId; + + private String reportId; + + private String reportName; + + private Integer duration; + + private Integer concurrency; + + private Integer concurrencyMax; + + private String createBy; + + private Date createTime; + + private Date updateTime; + + private Integer status; + + private Long taskId; + + private String filePath; + + private Long finishTime; + + private String tenant; + + private String agents; + + private String extra; + + private String slaEventList; + + private String totalStatAnalysisEventList; + + private String linkToDagId; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getSceneId() { + return sceneId; + } + + public void setSceneId(Long sceneId) { + this.sceneId = sceneId; + } + + public String getSnapshotId() { + return snapshotId; + } + + public void setSnapshotId(String snapshotId) { + this.snapshotId = snapshotId == null ? null : snapshotId.trim(); + } + + public String getReportId() { + return reportId; + } + + public void setReportId(String reportId) { + this.reportId = reportId == null ? null : reportId.trim(); + } + + public String getReportName() { + return reportName; + } + + public void setReportName(String reportName) { + this.reportName = reportName == null ? null : reportName.trim(); + } + + public Integer getDuration() { + return duration; + } + + public void setDuration(Integer duration) { + this.duration = duration; + } + + public Integer getConcurrency() { + return concurrency; + } + + public void setConcurrency(Integer concurrency) { + this.concurrency = concurrency; + } + + public Integer getConcurrencyMax() { + return concurrencyMax; + } + + public void setConcurrencyMax(Integer concurrencyMax) { + this.concurrencyMax = concurrencyMax; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy == null ? null : createBy.trim(); + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public Long getTaskId() { + return taskId; + } + + public void setTaskId(Long taskId) { + this.taskId = taskId; + } + + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath == null ? null : filePath.trim(); + } + + public Long getFinishTime() { + return finishTime; + } + + public void setFinishTime(Long finishTime) { + this.finishTime = finishTime; + } + + public String getTenant() { + return tenant; + } + + public void setTenant(String tenant) { + this.tenant = tenant == null ? null : tenant.trim(); + } + + public String getAgents() { + return agents; + } + + public void setAgents(String agents) { + this.agents = agents == null ? null : agents.trim(); + } + + public String getExtra() { + return extra; + } + + public void setExtra(String extra) { + this.extra = extra == null ? null : extra.trim(); + } + + public String getSlaEventList() { + return slaEventList; + } + + public void setSlaEventList(String slaEventList) { + this.slaEventList = slaEventList == null ? null : slaEventList.trim(); + } + + public String getTotalStatAnalysisEventList() { + return totalStatAnalysisEventList; + } + + public void setTotalStatAnalysisEventList(String totalStatAnalysisEventList) { + this.totalStatAnalysisEventList = totalStatAnalysisEventList == null ? null : totalStatAnalysisEventList.trim(); + } + + public String getLinkToDagId() { + return linkToDagId; + } + + public void setLinkToDagId(String linkToDagId) { + this.linkToDagId = linkToDagId == null ? null : linkToDagId.trim(); + } + + public enum Column { + id("id", "id", "BIGINT", false), + sceneId("scene_id", "sceneId", "BIGINT", false), + snapshotId("snapshot_id", "snapshotId", "VARCHAR", false), + reportId("report_id", "reportId", "VARCHAR", false), + reportName("report_name", "reportName", "VARCHAR", false), + duration("duration", "duration", "INTEGER", false), + concurrency("concurrency", "concurrency", "INTEGER", false), + concurrencyMax("concurrency_max", "concurrencyMax", "INTEGER", false), + createBy("create_by", "createBy", "VARCHAR", false), + createTime("create_time", "createTime", "TIMESTAMP", false), + updateTime("update_time", "updateTime", "TIMESTAMP", false), + status("status", "status", "INTEGER", false), + taskId("task_id", "taskId", "BIGINT", false), + filePath("file_path", "filePath", "VARCHAR", false), + finishTime("finish_time", "finishTime", "BIGINT", false), + tenant("tenant", "tenant", "VARCHAR", false), + agents("agents", "agents", "LONGVARCHAR", false), + extra("extra", "extra", "LONGVARCHAR", false), + slaEventList("sla_event_list", "slaEventList", "LONGVARCHAR", false), + totalStatAnalysisEventList("total_stat_analysis_event_list", "totalStatAnalysisEventList", "LONGVARCHAR", false), + linkToDagId("link_to_dag_id", "linkToDagId", "LONGVARCHAR", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/ReportInfoExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/ReportInfoExample.java new file mode 100644 index 000000000..50c14fdcd --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/ReportInfoExample.java @@ -0,0 +1,1242 @@ +package run.mone.mimeter.dashboard.pojo; + +import run.mone.mimeter.dashboard.pojo.common.Pageable; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class ReportInfoExample implements Pageable { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + private Long offset; + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + public ReportInfoExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNull() { + addCriterion("scene_id is null"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNotNull() { + addCriterion("scene_id is not null"); + return (Criteria) this; + } + + public Criteria andSceneIdEqualTo(Long value) { + addCriterion("scene_id =", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotEqualTo(Long value) { + addCriterion("scene_id <>", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThan(Long value) { + addCriterion("scene_id >", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThanOrEqualTo(Long value) { + addCriterion("scene_id >=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThan(Long value) { + addCriterion("scene_id <", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThanOrEqualTo(Long value) { + addCriterion("scene_id <=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdIn(List values) { + addCriterion("scene_id in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotIn(List values) { + addCriterion("scene_id not in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdBetween(Long value1, Long value2) { + addCriterion("scene_id between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotBetween(Long value1, Long value2) { + addCriterion("scene_id not between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdIsNull() { + addCriterion("snapshot_id is null"); + return (Criteria) this; + } + + public Criteria andSnapshotIdIsNotNull() { + addCriterion("snapshot_id is not null"); + return (Criteria) this; + } + + public Criteria andSnapshotIdEqualTo(String value) { + addCriterion("snapshot_id =", value, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdNotEqualTo(String value) { + addCriterion("snapshot_id <>", value, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdGreaterThan(String value) { + addCriterion("snapshot_id >", value, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdGreaterThanOrEqualTo(String value) { + addCriterion("snapshot_id >=", value, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdLessThan(String value) { + addCriterion("snapshot_id <", value, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdLessThanOrEqualTo(String value) { + addCriterion("snapshot_id <=", value, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdLike(String value) { + addCriterion("snapshot_id like", value, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdNotLike(String value) { + addCriterion("snapshot_id not like", value, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdIn(List values) { + addCriterion("snapshot_id in", values, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdNotIn(List values) { + addCriterion("snapshot_id not in", values, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdBetween(String value1, String value2) { + addCriterion("snapshot_id between", value1, value2, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdNotBetween(String value1, String value2) { + addCriterion("snapshot_id not between", value1, value2, "snapshotId"); + return (Criteria) this; + } + + public Criteria andReportIdIsNull() { + addCriterion("report_id is null"); + return (Criteria) this; + } + + public Criteria andReportIdIsNotNull() { + addCriterion("report_id is not null"); + return (Criteria) this; + } + + public Criteria andReportIdEqualTo(String value) { + addCriterion("report_id =", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotEqualTo(String value) { + addCriterion("report_id <>", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdGreaterThan(String value) { + addCriterion("report_id >", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdGreaterThanOrEqualTo(String value) { + addCriterion("report_id >=", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLessThan(String value) { + addCriterion("report_id <", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLessThanOrEqualTo(String value) { + addCriterion("report_id <=", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLike(String value) { + addCriterion("report_id like", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotLike(String value) { + addCriterion("report_id not like", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdIn(List values) { + addCriterion("report_id in", values, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotIn(List values) { + addCriterion("report_id not in", values, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdBetween(String value1, String value2) { + addCriterion("report_id between", value1, value2, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotBetween(String value1, String value2) { + addCriterion("report_id not between", value1, value2, "reportId"); + return (Criteria) this; + } + + public Criteria andReportNameIsNull() { + addCriterion("report_name is null"); + return (Criteria) this; + } + + public Criteria andReportNameIsNotNull() { + addCriterion("report_name is not null"); + return (Criteria) this; + } + + public Criteria andReportNameEqualTo(String value) { + addCriterion("report_name =", value, "reportName"); + return (Criteria) this; + } + + public Criteria andReportNameNotEqualTo(String value) { + addCriterion("report_name <>", value, "reportName"); + return (Criteria) this; + } + + public Criteria andReportNameGreaterThan(String value) { + addCriterion("report_name >", value, "reportName"); + return (Criteria) this; + } + + public Criteria andReportNameGreaterThanOrEqualTo(String value) { + addCriterion("report_name >=", value, "reportName"); + return (Criteria) this; + } + + public Criteria andReportNameLessThan(String value) { + addCriterion("report_name <", value, "reportName"); + return (Criteria) this; + } + + public Criteria andReportNameLessThanOrEqualTo(String value) { + addCriterion("report_name <=", value, "reportName"); + return (Criteria) this; + } + + public Criteria andReportNameLike(String value) { + addCriterion("report_name like", value, "reportName"); + return (Criteria) this; + } + + public Criteria andReportNameNotLike(String value) { + addCriterion("report_name not like", value, "reportName"); + return (Criteria) this; + } + + public Criteria andReportNameIn(List values) { + addCriterion("report_name in", values, "reportName"); + return (Criteria) this; + } + + public Criteria andReportNameNotIn(List values) { + addCriterion("report_name not in", values, "reportName"); + return (Criteria) this; + } + + public Criteria andReportNameBetween(String value1, String value2) { + addCriterion("report_name between", value1, value2, "reportName"); + return (Criteria) this; + } + + public Criteria andReportNameNotBetween(String value1, String value2) { + addCriterion("report_name not between", value1, value2, "reportName"); + return (Criteria) this; + } + + public Criteria andDurationIsNull() { + addCriterion("duration is null"); + return (Criteria) this; + } + + public Criteria andDurationIsNotNull() { + addCriterion("duration is not null"); + return (Criteria) this; + } + + public Criteria andDurationEqualTo(Integer value) { + addCriterion("duration =", value, "duration"); + return (Criteria) this; + } + + public Criteria andDurationNotEqualTo(Integer value) { + addCriterion("duration <>", value, "duration"); + return (Criteria) this; + } + + public Criteria andDurationGreaterThan(Integer value) { + addCriterion("duration >", value, "duration"); + return (Criteria) this; + } + + public Criteria andDurationGreaterThanOrEqualTo(Integer value) { + addCriterion("duration >=", value, "duration"); + return (Criteria) this; + } + + public Criteria andDurationLessThan(Integer value) { + addCriterion("duration <", value, "duration"); + return (Criteria) this; + } + + public Criteria andDurationLessThanOrEqualTo(Integer value) { + addCriterion("duration <=", value, "duration"); + return (Criteria) this; + } + + public Criteria andDurationIn(List values) { + addCriterion("duration in", values, "duration"); + return (Criteria) this; + } + + public Criteria andDurationNotIn(List values) { + addCriterion("duration not in", values, "duration"); + return (Criteria) this; + } + + public Criteria andDurationBetween(Integer value1, Integer value2) { + addCriterion("duration between", value1, value2, "duration"); + return (Criteria) this; + } + + public Criteria andDurationNotBetween(Integer value1, Integer value2) { + addCriterion("duration not between", value1, value2, "duration"); + return (Criteria) this; + } + + public Criteria andConcurrencyIsNull() { + addCriterion("concurrency is null"); + return (Criteria) this; + } + + public Criteria andConcurrencyIsNotNull() { + addCriterion("concurrency is not null"); + return (Criteria) this; + } + + public Criteria andConcurrencyEqualTo(Integer value) { + addCriterion("concurrency =", value, "concurrency"); + return (Criteria) this; + } + + public Criteria andConcurrencyNotEqualTo(Integer value) { + addCriterion("concurrency <>", value, "concurrency"); + return (Criteria) this; + } + + public Criteria andConcurrencyGreaterThan(Integer value) { + addCriterion("concurrency >", value, "concurrency"); + return (Criteria) this; + } + + public Criteria andConcurrencyGreaterThanOrEqualTo(Integer value) { + addCriterion("concurrency >=", value, "concurrency"); + return (Criteria) this; + } + + public Criteria andConcurrencyLessThan(Integer value) { + addCriterion("concurrency <", value, "concurrency"); + return (Criteria) this; + } + + public Criteria andConcurrencyLessThanOrEqualTo(Integer value) { + addCriterion("concurrency <=", value, "concurrency"); + return (Criteria) this; + } + + public Criteria andConcurrencyIn(List values) { + addCriterion("concurrency in", values, "concurrency"); + return (Criteria) this; + } + + public Criteria andConcurrencyNotIn(List values) { + addCriterion("concurrency not in", values, "concurrency"); + return (Criteria) this; + } + + public Criteria andConcurrencyBetween(Integer value1, Integer value2) { + addCriterion("concurrency between", value1, value2, "concurrency"); + return (Criteria) this; + } + + public Criteria andConcurrencyNotBetween(Integer value1, Integer value2) { + addCriterion("concurrency not between", value1, value2, "concurrency"); + return (Criteria) this; + } + + public Criteria andConcurrencyMaxIsNull() { + addCriterion("concurrency_max is null"); + return (Criteria) this; + } + + public Criteria andConcurrencyMaxIsNotNull() { + addCriterion("concurrency_max is not null"); + return (Criteria) this; + } + + public Criteria andConcurrencyMaxEqualTo(Integer value) { + addCriterion("concurrency_max =", value, "concurrencyMax"); + return (Criteria) this; + } + + public Criteria andConcurrencyMaxNotEqualTo(Integer value) { + addCriterion("concurrency_max <>", value, "concurrencyMax"); + return (Criteria) this; + } + + public Criteria andConcurrencyMaxGreaterThan(Integer value) { + addCriterion("concurrency_max >", value, "concurrencyMax"); + return (Criteria) this; + } + + public Criteria andConcurrencyMaxGreaterThanOrEqualTo(Integer value) { + addCriterion("concurrency_max >=", value, "concurrencyMax"); + return (Criteria) this; + } + + public Criteria andConcurrencyMaxLessThan(Integer value) { + addCriterion("concurrency_max <", value, "concurrencyMax"); + return (Criteria) this; + } + + public Criteria andConcurrencyMaxLessThanOrEqualTo(Integer value) { + addCriterion("concurrency_max <=", value, "concurrencyMax"); + return (Criteria) this; + } + + public Criteria andConcurrencyMaxIn(List values) { + addCriterion("concurrency_max in", values, "concurrencyMax"); + return (Criteria) this; + } + + public Criteria andConcurrencyMaxNotIn(List values) { + addCriterion("concurrency_max not in", values, "concurrencyMax"); + return (Criteria) this; + } + + public Criteria andConcurrencyMaxBetween(Integer value1, Integer value2) { + addCriterion("concurrency_max between", value1, value2, "concurrencyMax"); + return (Criteria) this; + } + + public Criteria andConcurrencyMaxNotBetween(Integer value1, Integer value2) { + addCriterion("concurrency_max not between", value1, value2, "concurrencyMax"); + return (Criteria) this; + } + + public Criteria andCreateByIsNull() { + addCriterion("create_by is null"); + return (Criteria) this; + } + + public Criteria andCreateByIsNotNull() { + addCriterion("create_by is not null"); + return (Criteria) this; + } + + public Criteria andCreateByEqualTo(String value) { + addCriterion("create_by =", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotEqualTo(String value) { + addCriterion("create_by <>", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByGreaterThan(String value) { + addCriterion("create_by >", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByGreaterThanOrEqualTo(String value) { + addCriterion("create_by >=", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByLessThan(String value) { + addCriterion("create_by <", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByLessThanOrEqualTo(String value) { + addCriterion("create_by <=", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByLike(String value) { + addCriterion("create_by like", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotLike(String value) { + addCriterion("create_by not like", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByIn(List values) { + addCriterion("create_by in", values, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotIn(List values) { + addCriterion("create_by not in", values, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByBetween(String value1, String value2) { + addCriterion("create_by between", value1, value2, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotBetween(String value1, String value2) { + addCriterion("create_by not between", value1, value2, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andStatusIsNull() { + addCriterion("status is null"); + return (Criteria) this; + } + + public Criteria andStatusIsNotNull() { + addCriterion("status is not null"); + return (Criteria) this; + } + + public Criteria andStatusEqualTo(Integer value) { + addCriterion("status =", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotEqualTo(Integer value) { + addCriterion("status <>", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThan(Integer value) { + addCriterion("status >", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThanOrEqualTo(Integer value) { + addCriterion("status >=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThan(Integer value) { + addCriterion("status <", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThanOrEqualTo(Integer value) { + addCriterion("status <=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusIn(List values) { + addCriterion("status in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotIn(List values) { + addCriterion("status not in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusBetween(Integer value1, Integer value2) { + addCriterion("status between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotBetween(Integer value1, Integer value2) { + addCriterion("status not between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andTaskIdIsNull() { + addCriterion("task_id is null"); + return (Criteria) this; + } + + public Criteria andTaskIdIsNotNull() { + addCriterion("task_id is not null"); + return (Criteria) this; + } + + public Criteria andTaskIdEqualTo(Long value) { + addCriterion("task_id =", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdNotEqualTo(Long value) { + addCriterion("task_id <>", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdGreaterThan(Long value) { + addCriterion("task_id >", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdGreaterThanOrEqualTo(Long value) { + addCriterion("task_id >=", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdLessThan(Long value) { + addCriterion("task_id <", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdLessThanOrEqualTo(Long value) { + addCriterion("task_id <=", value, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdIn(List values) { + addCriterion("task_id in", values, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdNotIn(List values) { + addCriterion("task_id not in", values, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdBetween(Long value1, Long value2) { + addCriterion("task_id between", value1, value2, "taskId"); + return (Criteria) this; + } + + public Criteria andTaskIdNotBetween(Long value1, Long value2) { + addCriterion("task_id not between", value1, value2, "taskId"); + return (Criteria) this; + } + + public Criteria andFilePathIsNull() { + addCriterion("file_path is null"); + return (Criteria) this; + } + + public Criteria andFilePathIsNotNull() { + addCriterion("file_path is not null"); + return (Criteria) this; + } + + public Criteria andFilePathEqualTo(String value) { + addCriterion("file_path =", value, "filePath"); + return (Criteria) this; + } + + public Criteria andFilePathNotEqualTo(String value) { + addCriterion("file_path <>", value, "filePath"); + return (Criteria) this; + } + + public Criteria andFilePathGreaterThan(String value) { + addCriterion("file_path >", value, "filePath"); + return (Criteria) this; + } + + public Criteria andFilePathGreaterThanOrEqualTo(String value) { + addCriterion("file_path >=", value, "filePath"); + return (Criteria) this; + } + + public Criteria andFilePathLessThan(String value) { + addCriterion("file_path <", value, "filePath"); + return (Criteria) this; + } + + public Criteria andFilePathLessThanOrEqualTo(String value) { + addCriterion("file_path <=", value, "filePath"); + return (Criteria) this; + } + + public Criteria andFilePathLike(String value) { + addCriterion("file_path like", value, "filePath"); + return (Criteria) this; + } + + public Criteria andFilePathNotLike(String value) { + addCriterion("file_path not like", value, "filePath"); + return (Criteria) this; + } + + public Criteria andFilePathIn(List values) { + addCriterion("file_path in", values, "filePath"); + return (Criteria) this; + } + + public Criteria andFilePathNotIn(List values) { + addCriterion("file_path not in", values, "filePath"); + return (Criteria) this; + } + + public Criteria andFilePathBetween(String value1, String value2) { + addCriterion("file_path between", value1, value2, "filePath"); + return (Criteria) this; + } + + public Criteria andFilePathNotBetween(String value1, String value2) { + addCriterion("file_path not between", value1, value2, "filePath"); + return (Criteria) this; + } + + public Criteria andFinishTimeIsNull() { + addCriterion("finish_time is null"); + return (Criteria) this; + } + + public Criteria andFinishTimeIsNotNull() { + addCriterion("finish_time is not null"); + return (Criteria) this; + } + + public Criteria andFinishTimeEqualTo(Long value) { + addCriterion("finish_time =", value, "finishTime"); + return (Criteria) this; + } + + public Criteria andFinishTimeNotEqualTo(Long value) { + addCriterion("finish_time <>", value, "finishTime"); + return (Criteria) this; + } + + public Criteria andFinishTimeGreaterThan(Long value) { + addCriterion("finish_time >", value, "finishTime"); + return (Criteria) this; + } + + public Criteria andFinishTimeGreaterThanOrEqualTo(Long value) { + addCriterion("finish_time >=", value, "finishTime"); + return (Criteria) this; + } + + public Criteria andFinishTimeLessThan(Long value) { + addCriterion("finish_time <", value, "finishTime"); + return (Criteria) this; + } + + public Criteria andFinishTimeLessThanOrEqualTo(Long value) { + addCriterion("finish_time <=", value, "finishTime"); + return (Criteria) this; + } + + public Criteria andFinishTimeIn(List values) { + addCriterion("finish_time in", values, "finishTime"); + return (Criteria) this; + } + + public Criteria andFinishTimeNotIn(List values) { + addCriterion("finish_time not in", values, "finishTime"); + return (Criteria) this; + } + + public Criteria andFinishTimeBetween(Long value1, Long value2) { + addCriterion("finish_time between", value1, value2, "finishTime"); + return (Criteria) this; + } + + public Criteria andFinishTimeNotBetween(Long value1, Long value2) { + addCriterion("finish_time not between", value1, value2, "finishTime"); + return (Criteria) this; + } + + public Criteria andTenantIsNull() { + addCriterion("tenant is null"); + return (Criteria) this; + } + + public Criteria andTenantIsNotNull() { + addCriterion("tenant is not null"); + return (Criteria) this; + } + + public Criteria andTenantEqualTo(String value) { + addCriterion("tenant =", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotEqualTo(String value) { + addCriterion("tenant <>", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantGreaterThan(String value) { + addCriterion("tenant >", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantGreaterThanOrEqualTo(String value) { + addCriterion("tenant >=", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantLessThan(String value) { + addCriterion("tenant <", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantLessThanOrEqualTo(String value) { + addCriterion("tenant <=", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantLike(String value) { + addCriterion("tenant like", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotLike(String value) { + addCriterion("tenant not like", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantIn(List values) { + addCriterion("tenant in", values, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotIn(List values) { + addCriterion("tenant not in", values, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantBetween(String value1, String value2) { + addCriterion("tenant between", value1, value2, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotBetween(String value1, String value2) { + addCriterion("tenant not between", value1, value2, "tenant"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/ReportStat.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/ReportStat.java new file mode 100644 index 000000000..bdaec4390 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/ReportStat.java @@ -0,0 +1,242 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; + +public class ReportStat { + private Long id; + + private Long sceneId; + + private String reportId; + + private Integer bizSucc; + + private Integer bizFail; + + private Integer reqSucc; + + private Integer reqFail; + + private Integer tps; + + private Integer tpsMax; + + private Integer rt; + + private Integer rtMax; + + private Integer rt99; + + private Integer rt90; + + private Date createTime; + + private Date updateTime; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getSceneId() { + return sceneId; + } + + public void setSceneId(Long sceneId) { + this.sceneId = sceneId; + } + + public String getReportId() { + return reportId; + } + + public void setReportId(String reportId) { + this.reportId = reportId == null ? null : reportId.trim(); + } + + public Integer getBizSucc() { + return bizSucc; + } + + public void setBizSucc(Integer bizSucc) { + this.bizSucc = bizSucc; + } + + public Integer getBizFail() { + return bizFail; + } + + public void setBizFail(Integer bizFail) { + this.bizFail = bizFail; + } + + public Integer getReqSucc() { + return reqSucc; + } + + public void setReqSucc(Integer reqSucc) { + this.reqSucc = reqSucc; + } + + public Integer getReqFail() { + return reqFail; + } + + public void setReqFail(Integer reqFail) { + this.reqFail = reqFail; + } + + public Integer getTps() { + return tps; + } + + public void setTps(Integer tps) { + this.tps = tps; + } + + public Integer getTpsMax() { + return tpsMax; + } + + public void setTpsMax(Integer tpsMax) { + this.tpsMax = tpsMax; + } + + public Integer getRt() { + return rt; + } + + public void setRt(Integer rt) { + this.rt = rt; + } + + public Integer getRtMax() { + return rtMax; + } + + public void setRtMax(Integer rtMax) { + this.rtMax = rtMax; + } + + public Integer getRt99() { + return rt99; + } + + public void setRt99(Integer rt99) { + this.rt99 = rt99; + } + + public Integer getRt90() { + return rt90; + } + + public void setRt90(Integer rt90) { + this.rt90 = rt90; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public enum Column { + id("id", "id", "BIGINT", false), + sceneId("scene_id", "sceneId", "BIGINT", false), + reportId("report_id", "reportId", "VARCHAR", false), + bizSucc("biz_succ", "bizSucc", "INTEGER", false), + bizFail("biz_fail", "bizFail", "INTEGER", false), + reqSucc("req_succ", "reqSucc", "INTEGER", false), + reqFail("req_fail", "reqFail", "INTEGER", false), + tps("tps", "tps", "INTEGER", false), + tpsMax("tps_max", "tpsMax", "INTEGER", false), + rt("rt", "rt", "INTEGER", false), + rtMax("rt_max", "rtMax", "INTEGER", false), + rt99("rt99", "rt99", "INTEGER", false), + rt90("rt90", "rt90", "INTEGER", false), + createTime("create_time", "createTime", "TIMESTAMP", false), + updateTime("update_time", "updateTime", "TIMESTAMP", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/ReportStatExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/ReportStatExample.java new file mode 100644 index 000000000..029d406d0 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/ReportStatExample.java @@ -0,0 +1,1131 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class ReportStatExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + public ReportStatExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNull() { + addCriterion("scene_id is null"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNotNull() { + addCriterion("scene_id is not null"); + return (Criteria) this; + } + + public Criteria andSceneIdEqualTo(Long value) { + addCriterion("scene_id =", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotEqualTo(Long value) { + addCriterion("scene_id <>", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThan(Long value) { + addCriterion("scene_id >", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThanOrEqualTo(Long value) { + addCriterion("scene_id >=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThan(Long value) { + addCriterion("scene_id <", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThanOrEqualTo(Long value) { + addCriterion("scene_id <=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdIn(List values) { + addCriterion("scene_id in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotIn(List values) { + addCriterion("scene_id not in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdBetween(Long value1, Long value2) { + addCriterion("scene_id between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotBetween(Long value1, Long value2) { + addCriterion("scene_id not between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andReportIdIsNull() { + addCriterion("report_id is null"); + return (Criteria) this; + } + + public Criteria andReportIdIsNotNull() { + addCriterion("report_id is not null"); + return (Criteria) this; + } + + public Criteria andReportIdEqualTo(String value) { + addCriterion("report_id =", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotEqualTo(String value) { + addCriterion("report_id <>", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdGreaterThan(String value) { + addCriterion("report_id >", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdGreaterThanOrEqualTo(String value) { + addCriterion("report_id >=", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLessThan(String value) { + addCriterion("report_id <", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLessThanOrEqualTo(String value) { + addCriterion("report_id <=", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLike(String value) { + addCriterion("report_id like", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotLike(String value) { + addCriterion("report_id not like", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdIn(List values) { + addCriterion("report_id in", values, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotIn(List values) { + addCriterion("report_id not in", values, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdBetween(String value1, String value2) { + addCriterion("report_id between", value1, value2, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotBetween(String value1, String value2) { + addCriterion("report_id not between", value1, value2, "reportId"); + return (Criteria) this; + } + + public Criteria andBizSuccIsNull() { + addCriterion("biz_succ is null"); + return (Criteria) this; + } + + public Criteria andBizSuccIsNotNull() { + addCriterion("biz_succ is not null"); + return (Criteria) this; + } + + public Criteria andBizSuccEqualTo(Integer value) { + addCriterion("biz_succ =", value, "bizSucc"); + return (Criteria) this; + } + + public Criteria andBizSuccNotEqualTo(Integer value) { + addCriterion("biz_succ <>", value, "bizSucc"); + return (Criteria) this; + } + + public Criteria andBizSuccGreaterThan(Integer value) { + addCriterion("biz_succ >", value, "bizSucc"); + return (Criteria) this; + } + + public Criteria andBizSuccGreaterThanOrEqualTo(Integer value) { + addCriterion("biz_succ >=", value, "bizSucc"); + return (Criteria) this; + } + + public Criteria andBizSuccLessThan(Integer value) { + addCriterion("biz_succ <", value, "bizSucc"); + return (Criteria) this; + } + + public Criteria andBizSuccLessThanOrEqualTo(Integer value) { + addCriterion("biz_succ <=", value, "bizSucc"); + return (Criteria) this; + } + + public Criteria andBizSuccIn(List values) { + addCriterion("biz_succ in", values, "bizSucc"); + return (Criteria) this; + } + + public Criteria andBizSuccNotIn(List values) { + addCriterion("biz_succ not in", values, "bizSucc"); + return (Criteria) this; + } + + public Criteria andBizSuccBetween(Integer value1, Integer value2) { + addCriterion("biz_succ between", value1, value2, "bizSucc"); + return (Criteria) this; + } + + public Criteria andBizSuccNotBetween(Integer value1, Integer value2) { + addCriterion("biz_succ not between", value1, value2, "bizSucc"); + return (Criteria) this; + } + + public Criteria andBizFailIsNull() { + addCriterion("biz_fail is null"); + return (Criteria) this; + } + + public Criteria andBizFailIsNotNull() { + addCriterion("biz_fail is not null"); + return (Criteria) this; + } + + public Criteria andBizFailEqualTo(Integer value) { + addCriterion("biz_fail =", value, "bizFail"); + return (Criteria) this; + } + + public Criteria andBizFailNotEqualTo(Integer value) { + addCriterion("biz_fail <>", value, "bizFail"); + return (Criteria) this; + } + + public Criteria andBizFailGreaterThan(Integer value) { + addCriterion("biz_fail >", value, "bizFail"); + return (Criteria) this; + } + + public Criteria andBizFailGreaterThanOrEqualTo(Integer value) { + addCriterion("biz_fail >=", value, "bizFail"); + return (Criteria) this; + } + + public Criteria andBizFailLessThan(Integer value) { + addCriterion("biz_fail <", value, "bizFail"); + return (Criteria) this; + } + + public Criteria andBizFailLessThanOrEqualTo(Integer value) { + addCriterion("biz_fail <=", value, "bizFail"); + return (Criteria) this; + } + + public Criteria andBizFailIn(List values) { + addCriterion("biz_fail in", values, "bizFail"); + return (Criteria) this; + } + + public Criteria andBizFailNotIn(List values) { + addCriterion("biz_fail not in", values, "bizFail"); + return (Criteria) this; + } + + public Criteria andBizFailBetween(Integer value1, Integer value2) { + addCriterion("biz_fail between", value1, value2, "bizFail"); + return (Criteria) this; + } + + public Criteria andBizFailNotBetween(Integer value1, Integer value2) { + addCriterion("biz_fail not between", value1, value2, "bizFail"); + return (Criteria) this; + } + + public Criteria andReqSuccIsNull() { + addCriterion("req_succ is null"); + return (Criteria) this; + } + + public Criteria andReqSuccIsNotNull() { + addCriterion("req_succ is not null"); + return (Criteria) this; + } + + public Criteria andReqSuccEqualTo(Integer value) { + addCriterion("req_succ =", value, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqSuccNotEqualTo(Integer value) { + addCriterion("req_succ <>", value, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqSuccGreaterThan(Integer value) { + addCriterion("req_succ >", value, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqSuccGreaterThanOrEqualTo(Integer value) { + addCriterion("req_succ >=", value, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqSuccLessThan(Integer value) { + addCriterion("req_succ <", value, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqSuccLessThanOrEqualTo(Integer value) { + addCriterion("req_succ <=", value, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqSuccIn(List values) { + addCriterion("req_succ in", values, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqSuccNotIn(List values) { + addCriterion("req_succ not in", values, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqSuccBetween(Integer value1, Integer value2) { + addCriterion("req_succ between", value1, value2, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqSuccNotBetween(Integer value1, Integer value2) { + addCriterion("req_succ not between", value1, value2, "reqSucc"); + return (Criteria) this; + } + + public Criteria andReqFailIsNull() { + addCriterion("req_fail is null"); + return (Criteria) this; + } + + public Criteria andReqFailIsNotNull() { + addCriterion("req_fail is not null"); + return (Criteria) this; + } + + public Criteria andReqFailEqualTo(Integer value) { + addCriterion("req_fail =", value, "reqFail"); + return (Criteria) this; + } + + public Criteria andReqFailNotEqualTo(Integer value) { + addCriterion("req_fail <>", value, "reqFail"); + return (Criteria) this; + } + + public Criteria andReqFailGreaterThan(Integer value) { + addCriterion("req_fail >", value, "reqFail"); + return (Criteria) this; + } + + public Criteria andReqFailGreaterThanOrEqualTo(Integer value) { + addCriterion("req_fail >=", value, "reqFail"); + return (Criteria) this; + } + + public Criteria andReqFailLessThan(Integer value) { + addCriterion("req_fail <", value, "reqFail"); + return (Criteria) this; + } + + public Criteria andReqFailLessThanOrEqualTo(Integer value) { + addCriterion("req_fail <=", value, "reqFail"); + return (Criteria) this; + } + + public Criteria andReqFailIn(List values) { + addCriterion("req_fail in", values, "reqFail"); + return (Criteria) this; + } + + public Criteria andReqFailNotIn(List values) { + addCriterion("req_fail not in", values, "reqFail"); + return (Criteria) this; + } + + public Criteria andReqFailBetween(Integer value1, Integer value2) { + addCriterion("req_fail between", value1, value2, "reqFail"); + return (Criteria) this; + } + + public Criteria andReqFailNotBetween(Integer value1, Integer value2) { + addCriterion("req_fail not between", value1, value2, "reqFail"); + return (Criteria) this; + } + + public Criteria andTpsIsNull() { + addCriterion("tps is null"); + return (Criteria) this; + } + + public Criteria andTpsIsNotNull() { + addCriterion("tps is not null"); + return (Criteria) this; + } + + public Criteria andTpsEqualTo(Integer value) { + addCriterion("tps =", value, "tps"); + return (Criteria) this; + } + + public Criteria andTpsNotEqualTo(Integer value) { + addCriterion("tps <>", value, "tps"); + return (Criteria) this; + } + + public Criteria andTpsGreaterThan(Integer value) { + addCriterion("tps >", value, "tps"); + return (Criteria) this; + } + + public Criteria andTpsGreaterThanOrEqualTo(Integer value) { + addCriterion("tps >=", value, "tps"); + return (Criteria) this; + } + + public Criteria andTpsLessThan(Integer value) { + addCriterion("tps <", value, "tps"); + return (Criteria) this; + } + + public Criteria andTpsLessThanOrEqualTo(Integer value) { + addCriterion("tps <=", value, "tps"); + return (Criteria) this; + } + + public Criteria andTpsIn(List values) { + addCriterion("tps in", values, "tps"); + return (Criteria) this; + } + + public Criteria andTpsNotIn(List values) { + addCriterion("tps not in", values, "tps"); + return (Criteria) this; + } + + public Criteria andTpsBetween(Integer value1, Integer value2) { + addCriterion("tps between", value1, value2, "tps"); + return (Criteria) this; + } + + public Criteria andTpsNotBetween(Integer value1, Integer value2) { + addCriterion("tps not between", value1, value2, "tps"); + return (Criteria) this; + } + + public Criteria andTpsMaxIsNull() { + addCriterion("tps_max is null"); + return (Criteria) this; + } + + public Criteria andTpsMaxIsNotNull() { + addCriterion("tps_max is not null"); + return (Criteria) this; + } + + public Criteria andTpsMaxEqualTo(Integer value) { + addCriterion("tps_max =", value, "tpsMax"); + return (Criteria) this; + } + + public Criteria andTpsMaxNotEqualTo(Integer value) { + addCriterion("tps_max <>", value, "tpsMax"); + return (Criteria) this; + } + + public Criteria andTpsMaxGreaterThan(Integer value) { + addCriterion("tps_max >", value, "tpsMax"); + return (Criteria) this; + } + + public Criteria andTpsMaxGreaterThanOrEqualTo(Integer value) { + addCriterion("tps_max >=", value, "tpsMax"); + return (Criteria) this; + } + + public Criteria andTpsMaxLessThan(Integer value) { + addCriterion("tps_max <", value, "tpsMax"); + return (Criteria) this; + } + + public Criteria andTpsMaxLessThanOrEqualTo(Integer value) { + addCriterion("tps_max <=", value, "tpsMax"); + return (Criteria) this; + } + + public Criteria andTpsMaxIn(List values) { + addCriterion("tps_max in", values, "tpsMax"); + return (Criteria) this; + } + + public Criteria andTpsMaxNotIn(List values) { + addCriterion("tps_max not in", values, "tpsMax"); + return (Criteria) this; + } + + public Criteria andTpsMaxBetween(Integer value1, Integer value2) { + addCriterion("tps_max between", value1, value2, "tpsMax"); + return (Criteria) this; + } + + public Criteria andTpsMaxNotBetween(Integer value1, Integer value2) { + addCriterion("tps_max not between", value1, value2, "tpsMax"); + return (Criteria) this; + } + + public Criteria andRtIsNull() { + addCriterion("rt is null"); + return (Criteria) this; + } + + public Criteria andRtIsNotNull() { + addCriterion("rt is not null"); + return (Criteria) this; + } + + public Criteria andRtEqualTo(Integer value) { + addCriterion("rt =", value, "rt"); + return (Criteria) this; + } + + public Criteria andRtNotEqualTo(Integer value) { + addCriterion("rt <>", value, "rt"); + return (Criteria) this; + } + + public Criteria andRtGreaterThan(Integer value) { + addCriterion("rt >", value, "rt"); + return (Criteria) this; + } + + public Criteria andRtGreaterThanOrEqualTo(Integer value) { + addCriterion("rt >=", value, "rt"); + return (Criteria) this; + } + + public Criteria andRtLessThan(Integer value) { + addCriterion("rt <", value, "rt"); + return (Criteria) this; + } + + public Criteria andRtLessThanOrEqualTo(Integer value) { + addCriterion("rt <=", value, "rt"); + return (Criteria) this; + } + + public Criteria andRtIn(List values) { + addCriterion("rt in", values, "rt"); + return (Criteria) this; + } + + public Criteria andRtNotIn(List values) { + addCriterion("rt not in", values, "rt"); + return (Criteria) this; + } + + public Criteria andRtBetween(Integer value1, Integer value2) { + addCriterion("rt between", value1, value2, "rt"); + return (Criteria) this; + } + + public Criteria andRtNotBetween(Integer value1, Integer value2) { + addCriterion("rt not between", value1, value2, "rt"); + return (Criteria) this; + } + + public Criteria andRtMaxIsNull() { + addCriterion("rt_max is null"); + return (Criteria) this; + } + + public Criteria andRtMaxIsNotNull() { + addCriterion("rt_max is not null"); + return (Criteria) this; + } + + public Criteria andRtMaxEqualTo(Integer value) { + addCriterion("rt_max =", value, "rtMax"); + return (Criteria) this; + } + + public Criteria andRtMaxNotEqualTo(Integer value) { + addCriterion("rt_max <>", value, "rtMax"); + return (Criteria) this; + } + + public Criteria andRtMaxGreaterThan(Integer value) { + addCriterion("rt_max >", value, "rtMax"); + return (Criteria) this; + } + + public Criteria andRtMaxGreaterThanOrEqualTo(Integer value) { + addCriterion("rt_max >=", value, "rtMax"); + return (Criteria) this; + } + + public Criteria andRtMaxLessThan(Integer value) { + addCriterion("rt_max <", value, "rtMax"); + return (Criteria) this; + } + + public Criteria andRtMaxLessThanOrEqualTo(Integer value) { + addCriterion("rt_max <=", value, "rtMax"); + return (Criteria) this; + } + + public Criteria andRtMaxIn(List values) { + addCriterion("rt_max in", values, "rtMax"); + return (Criteria) this; + } + + public Criteria andRtMaxNotIn(List values) { + addCriterion("rt_max not in", values, "rtMax"); + return (Criteria) this; + } + + public Criteria andRtMaxBetween(Integer value1, Integer value2) { + addCriterion("rt_max between", value1, value2, "rtMax"); + return (Criteria) this; + } + + public Criteria andRtMaxNotBetween(Integer value1, Integer value2) { + addCriterion("rt_max not between", value1, value2, "rtMax"); + return (Criteria) this; + } + + public Criteria andRt99IsNull() { + addCriterion("rt99 is null"); + return (Criteria) this; + } + + public Criteria andRt99IsNotNull() { + addCriterion("rt99 is not null"); + return (Criteria) this; + } + + public Criteria andRt99EqualTo(Integer value) { + addCriterion("rt99 =", value, "rt99"); + return (Criteria) this; + } + + public Criteria andRt99NotEqualTo(Integer value) { + addCriterion("rt99 <>", value, "rt99"); + return (Criteria) this; + } + + public Criteria andRt99GreaterThan(Integer value) { + addCriterion("rt99 >", value, "rt99"); + return (Criteria) this; + } + + public Criteria andRt99GreaterThanOrEqualTo(Integer value) { + addCriterion("rt99 >=", value, "rt99"); + return (Criteria) this; + } + + public Criteria andRt99LessThan(Integer value) { + addCriterion("rt99 <", value, "rt99"); + return (Criteria) this; + } + + public Criteria andRt99LessThanOrEqualTo(Integer value) { + addCriterion("rt99 <=", value, "rt99"); + return (Criteria) this; + } + + public Criteria andRt99In(List values) { + addCriterion("rt99 in", values, "rt99"); + return (Criteria) this; + } + + public Criteria andRt99NotIn(List values) { + addCriterion("rt99 not in", values, "rt99"); + return (Criteria) this; + } + + public Criteria andRt99Between(Integer value1, Integer value2) { + addCriterion("rt99 between", value1, value2, "rt99"); + return (Criteria) this; + } + + public Criteria andRt99NotBetween(Integer value1, Integer value2) { + addCriterion("rt99 not between", value1, value2, "rt99"); + return (Criteria) this; + } + + public Criteria andRt90IsNull() { + addCriterion("rt90 is null"); + return (Criteria) this; + } + + public Criteria andRt90IsNotNull() { + addCriterion("rt90 is not null"); + return (Criteria) this; + } + + public Criteria andRt90EqualTo(Integer value) { + addCriterion("rt90 =", value, "rt90"); + return (Criteria) this; + } + + public Criteria andRt90NotEqualTo(Integer value) { + addCriterion("rt90 <>", value, "rt90"); + return (Criteria) this; + } + + public Criteria andRt90GreaterThan(Integer value) { + addCriterion("rt90 >", value, "rt90"); + return (Criteria) this; + } + + public Criteria andRt90GreaterThanOrEqualTo(Integer value) { + addCriterion("rt90 >=", value, "rt90"); + return (Criteria) this; + } + + public Criteria andRt90LessThan(Integer value) { + addCriterion("rt90 <", value, "rt90"); + return (Criteria) this; + } + + public Criteria andRt90LessThanOrEqualTo(Integer value) { + addCriterion("rt90 <=", value, "rt90"); + return (Criteria) this; + } + + public Criteria andRt90In(List values) { + addCriterion("rt90 in", values, "rt90"); + return (Criteria) this; + } + + public Criteria andRt90NotIn(List values) { + addCriterion("rt90 not in", values, "rt90"); + return (Criteria) this; + } + + public Criteria andRt90Between(Integer value1, Integer value2) { + addCriterion("rt90 between", value1, value2, "rt90"); + return (Criteria) this; + } + + public Criteria andRt90NotBetween(Integer value1, Integer value2) { + addCriterion("rt90 not between", value1, value2, "rt90"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneApiInfo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneApiInfo.java new file mode 100644 index 000000000..ce8b912ae --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneApiInfo.java @@ -0,0 +1,395 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; + +public class SceneApiInfo { + private Integer id; + + private Integer sceneId; + + private Integer apiOrder; + + private String apiName; + + private Integer sourceType; + + private Integer apiType; + + private Integer requestMethod; + + private Integer requestTimeout; + + private Boolean needLogin; + + private Integer tokenType; + + private String contentType; + + private Integer nacosType; + + private String serviceName; + + private String methodName; + + private String paramTypeList; + + private String dubboGroup; + + private String dubboVersion; + + private Integer serialLinkId; + + private String apiUrl; + + private String apiHeader; + + private String requestParamInfo; + + private String outputParamInfo; + + private String requestBody; + + private String dubboParamJson; + + private String checkPoint; + + private String filterCondition; + + private String apiTspAuth; + + private String apiTrafficInfo; + + private String apiX5Info; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getSceneId() { + return sceneId; + } + + public void setSceneId(Integer sceneId) { + this.sceneId = sceneId; + } + + public Integer getApiOrder() { + return apiOrder; + } + + public void setApiOrder(Integer apiOrder) { + this.apiOrder = apiOrder; + } + + public String getApiName() { + return apiName; + } + + public void setApiName(String apiName) { + this.apiName = apiName == null ? null : apiName.trim(); + } + + public Integer getSourceType() { + return sourceType; + } + + public void setSourceType(Integer sourceType) { + this.sourceType = sourceType; + } + + public Integer getApiType() { + return apiType; + } + + public void setApiType(Integer apiType) { + this.apiType = apiType; + } + + public Integer getRequestMethod() { + return requestMethod; + } + + public void setRequestMethod(Integer requestMethod) { + this.requestMethod = requestMethod; + } + + public Integer getRequestTimeout() { + return requestTimeout; + } + + public void setRequestTimeout(Integer requestTimeout) { + this.requestTimeout = requestTimeout; + } + + public Boolean getNeedLogin() { + return needLogin; + } + + public void setNeedLogin(Boolean needLogin) { + this.needLogin = needLogin; + } + + public Integer getTokenType() { + return tokenType; + } + + public void setTokenType(Integer tokenType) { + this.tokenType = tokenType; + } + + public String getContentType() { + return contentType; + } + + public void setContentType(String contentType) { + this.contentType = contentType == null ? null : contentType.trim(); + } + + public Integer getNacosType() { + return nacosType; + } + + public void setNacosType(Integer nacosType) { + this.nacosType = nacosType; + } + + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName == null ? null : serviceName.trim(); + } + + public String getMethodName() { + return methodName; + } + + public void setMethodName(String methodName) { + this.methodName = methodName == null ? null : methodName.trim(); + } + + public String getParamTypeList() { + return paramTypeList; + } + + public void setParamTypeList(String paramTypeList) { + this.paramTypeList = paramTypeList == null ? null : paramTypeList.trim(); + } + + public String getDubboGroup() { + return dubboGroup; + } + + public void setDubboGroup(String dubboGroup) { + this.dubboGroup = dubboGroup == null ? null : dubboGroup.trim(); + } + + public String getDubboVersion() { + return dubboVersion; + } + + public void setDubboVersion(String dubboVersion) { + this.dubboVersion = dubboVersion == null ? null : dubboVersion.trim(); + } + + public Integer getSerialLinkId() { + return serialLinkId; + } + + public void setSerialLinkId(Integer serialLinkId) { + this.serialLinkId = serialLinkId; + } + + public String getApiUrl() { + return apiUrl; + } + + public void setApiUrl(String apiUrl) { + this.apiUrl = apiUrl == null ? null : apiUrl.trim(); + } + + public String getApiHeader() { + return apiHeader; + } + + public void setApiHeader(String apiHeader) { + this.apiHeader = apiHeader == null ? null : apiHeader.trim(); + } + + public String getRequestParamInfo() { + return requestParamInfo; + } + + public void setRequestParamInfo(String requestParamInfo) { + this.requestParamInfo = requestParamInfo == null ? null : requestParamInfo.trim(); + } + + public String getOutputParamInfo() { + return outputParamInfo; + } + + public void setOutputParamInfo(String outputParamInfo) { + this.outputParamInfo = outputParamInfo == null ? null : outputParamInfo.trim(); + } + + public String getRequestBody() { + return requestBody; + } + + public void setRequestBody(String requestBody) { + this.requestBody = requestBody == null ? null : requestBody.trim(); + } + + public String getDubboParamJson() { + return dubboParamJson; + } + + public void setDubboParamJson(String dubboParamJson) { + this.dubboParamJson = dubboParamJson == null ? null : dubboParamJson.trim(); + } + + public String getCheckPoint() { + return checkPoint; + } + + public void setCheckPoint(String checkPoint) { + this.checkPoint = checkPoint == null ? null : checkPoint.trim(); + } + + public String getFilterCondition() { + return filterCondition; + } + + public void setFilterCondition(String filterCondition) { + this.filterCondition = filterCondition == null ? null : filterCondition.trim(); + } + + public String getApiTspAuth() { + return apiTspAuth; + } + + public void setApiTspAuth(String apiTspAuth) { + this.apiTspAuth = apiTspAuth == null ? null : apiTspAuth.trim(); + } + + public String getApiTrafficInfo() { + return apiTrafficInfo; + } + + public void setApiTrafficInfo(String apiTrafficInfo) { + this.apiTrafficInfo = apiTrafficInfo == null ? null : apiTrafficInfo.trim(); + } + + public String getApiX5Info() { + return apiX5Info; + } + + public void setApiX5Info(String apiX5Info) { + this.apiX5Info = apiX5Info == null ? null : apiX5Info.trim(); + } + + public enum Column { + id("id", "id", "INTEGER", false), + sceneId("scene_id", "sceneId", "INTEGER", false), + apiOrder("api_order", "apiOrder", "INTEGER", false), + apiName("api_name", "apiName", "VARCHAR", false), + sourceType("source_type", "sourceType", "INTEGER", false), + apiType("api_type", "apiType", "INTEGER", false), + requestMethod("request_method", "requestMethod", "INTEGER", false), + requestTimeout("request_timeout", "requestTimeout", "INTEGER", false), + needLogin("need_login", "needLogin", "BIT", false), + tokenType("token_type", "tokenType", "INTEGER", false), + contentType("content_type", "contentType", "VARCHAR", false), + nacosType("nacos_type", "nacosType", "INTEGER", false), + serviceName("service_name", "serviceName", "VARCHAR", false), + methodName("method_name", "methodName", "VARCHAR", false), + paramTypeList("param_type_list", "paramTypeList", "VARCHAR", false), + dubboGroup("dubbo_group", "dubboGroup", "VARCHAR", false), + dubboVersion("dubbo_version", "dubboVersion", "VARCHAR", false), + serialLinkId("serial_link_id", "serialLinkId", "INTEGER", false), + apiUrl("api_url", "apiUrl", "LONGVARCHAR", false), + apiHeader("api_header", "apiHeader", "LONGVARCHAR", false), + requestParamInfo("request_param_info", "requestParamInfo", "LONGVARCHAR", false), + outputParamInfo("output_param_info", "outputParamInfo", "LONGVARCHAR", false), + requestBody("request_body", "requestBody", "LONGVARCHAR", false), + dubboParamJson("dubbo_param_json", "dubboParamJson", "LONGVARCHAR", false), + checkPoint("check_point", "checkPoint", "LONGVARCHAR", false), + filterCondition("filter_condition", "filterCondition", "LONGVARCHAR", false), + apiTspAuth("api_tsp_auth", "apiTspAuth", "LONGVARCHAR", false), + apiTrafficInfo("api_traffic_info", "apiTrafficInfo", "LONGVARCHAR", false), + apiX5Info("api_x5_info", "apiX5Info", "LONGVARCHAR", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneApiInfoExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneApiInfoExample.java new file mode 100644 index 000000000..7ce33cc13 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneApiInfoExample.java @@ -0,0 +1,1350 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class SceneApiInfoExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public SceneApiInfoExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNull() { + addCriterion("scene_id is null"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNotNull() { + addCriterion("scene_id is not null"); + return (Criteria) this; + } + + public Criteria andSceneIdEqualTo(Integer value) { + addCriterion("scene_id =", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotEqualTo(Integer value) { + addCriterion("scene_id <>", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThan(Integer value) { + addCriterion("scene_id >", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThanOrEqualTo(Integer value) { + addCriterion("scene_id >=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThan(Integer value) { + addCriterion("scene_id <", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThanOrEqualTo(Integer value) { + addCriterion("scene_id <=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdIn(List values) { + addCriterion("scene_id in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotIn(List values) { + addCriterion("scene_id not in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdBetween(Integer value1, Integer value2) { + addCriterion("scene_id between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotBetween(Integer value1, Integer value2) { + addCriterion("scene_id not between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andApiOrderIsNull() { + addCriterion("api_order is null"); + return (Criteria) this; + } + + public Criteria andApiOrderIsNotNull() { + addCriterion("api_order is not null"); + return (Criteria) this; + } + + public Criteria andApiOrderEqualTo(Integer value) { + addCriterion("api_order =", value, "apiOrder"); + return (Criteria) this; + } + + public Criteria andApiOrderNotEqualTo(Integer value) { + addCriterion("api_order <>", value, "apiOrder"); + return (Criteria) this; + } + + public Criteria andApiOrderGreaterThan(Integer value) { + addCriterion("api_order >", value, "apiOrder"); + return (Criteria) this; + } + + public Criteria andApiOrderGreaterThanOrEqualTo(Integer value) { + addCriterion("api_order >=", value, "apiOrder"); + return (Criteria) this; + } + + public Criteria andApiOrderLessThan(Integer value) { + addCriterion("api_order <", value, "apiOrder"); + return (Criteria) this; + } + + public Criteria andApiOrderLessThanOrEqualTo(Integer value) { + addCriterion("api_order <=", value, "apiOrder"); + return (Criteria) this; + } + + public Criteria andApiOrderIn(List values) { + addCriterion("api_order in", values, "apiOrder"); + return (Criteria) this; + } + + public Criteria andApiOrderNotIn(List values) { + addCriterion("api_order not in", values, "apiOrder"); + return (Criteria) this; + } + + public Criteria andApiOrderBetween(Integer value1, Integer value2) { + addCriterion("api_order between", value1, value2, "apiOrder"); + return (Criteria) this; + } + + public Criteria andApiOrderNotBetween(Integer value1, Integer value2) { + addCriterion("api_order not between", value1, value2, "apiOrder"); + return (Criteria) this; + } + + public Criteria andApiNameIsNull() { + addCriterion("api_name is null"); + return (Criteria) this; + } + + public Criteria andApiNameIsNotNull() { + addCriterion("api_name is not null"); + return (Criteria) this; + } + + public Criteria andApiNameEqualTo(String value) { + addCriterion("api_name =", value, "apiName"); + return (Criteria) this; + } + + public Criteria andApiNameNotEqualTo(String value) { + addCriterion("api_name <>", value, "apiName"); + return (Criteria) this; + } + + public Criteria andApiNameGreaterThan(String value) { + addCriterion("api_name >", value, "apiName"); + return (Criteria) this; + } + + public Criteria andApiNameGreaterThanOrEqualTo(String value) { + addCriterion("api_name >=", value, "apiName"); + return (Criteria) this; + } + + public Criteria andApiNameLessThan(String value) { + addCriterion("api_name <", value, "apiName"); + return (Criteria) this; + } + + public Criteria andApiNameLessThanOrEqualTo(String value) { + addCriterion("api_name <=", value, "apiName"); + return (Criteria) this; + } + + public Criteria andApiNameLike(String value) { + addCriterion("api_name like", value, "apiName"); + return (Criteria) this; + } + + public Criteria andApiNameNotLike(String value) { + addCriterion("api_name not like", value, "apiName"); + return (Criteria) this; + } + + public Criteria andApiNameIn(List values) { + addCriterion("api_name in", values, "apiName"); + return (Criteria) this; + } + + public Criteria andApiNameNotIn(List values) { + addCriterion("api_name not in", values, "apiName"); + return (Criteria) this; + } + + public Criteria andApiNameBetween(String value1, String value2) { + addCriterion("api_name between", value1, value2, "apiName"); + return (Criteria) this; + } + + public Criteria andApiNameNotBetween(String value1, String value2) { + addCriterion("api_name not between", value1, value2, "apiName"); + return (Criteria) this; + } + + public Criteria andSourceTypeIsNull() { + addCriterion("source_type is null"); + return (Criteria) this; + } + + public Criteria andSourceTypeIsNotNull() { + addCriterion("source_type is not null"); + return (Criteria) this; + } + + public Criteria andSourceTypeEqualTo(Integer value) { + addCriterion("source_type =", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeNotEqualTo(Integer value) { + addCriterion("source_type <>", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeGreaterThan(Integer value) { + addCriterion("source_type >", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("source_type >=", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeLessThan(Integer value) { + addCriterion("source_type <", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeLessThanOrEqualTo(Integer value) { + addCriterion("source_type <=", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeIn(List values) { + addCriterion("source_type in", values, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeNotIn(List values) { + addCriterion("source_type not in", values, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeBetween(Integer value1, Integer value2) { + addCriterion("source_type between", value1, value2, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeNotBetween(Integer value1, Integer value2) { + addCriterion("source_type not between", value1, value2, "sourceType"); + return (Criteria) this; + } + + public Criteria andApiTypeIsNull() { + addCriterion("api_type is null"); + return (Criteria) this; + } + + public Criteria andApiTypeIsNotNull() { + addCriterion("api_type is not null"); + return (Criteria) this; + } + + public Criteria andApiTypeEqualTo(Integer value) { + addCriterion("api_type =", value, "apiType"); + return (Criteria) this; + } + + public Criteria andApiTypeNotEqualTo(Integer value) { + addCriterion("api_type <>", value, "apiType"); + return (Criteria) this; + } + + public Criteria andApiTypeGreaterThan(Integer value) { + addCriterion("api_type >", value, "apiType"); + return (Criteria) this; + } + + public Criteria andApiTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("api_type >=", value, "apiType"); + return (Criteria) this; + } + + public Criteria andApiTypeLessThan(Integer value) { + addCriterion("api_type <", value, "apiType"); + return (Criteria) this; + } + + public Criteria andApiTypeLessThanOrEqualTo(Integer value) { + addCriterion("api_type <=", value, "apiType"); + return (Criteria) this; + } + + public Criteria andApiTypeIn(List values) { + addCriterion("api_type in", values, "apiType"); + return (Criteria) this; + } + + public Criteria andApiTypeNotIn(List values) { + addCriterion("api_type not in", values, "apiType"); + return (Criteria) this; + } + + public Criteria andApiTypeBetween(Integer value1, Integer value2) { + addCriterion("api_type between", value1, value2, "apiType"); + return (Criteria) this; + } + + public Criteria andApiTypeNotBetween(Integer value1, Integer value2) { + addCriterion("api_type not between", value1, value2, "apiType"); + return (Criteria) this; + } + + public Criteria andRequestMethodIsNull() { + addCriterion("request_method is null"); + return (Criteria) this; + } + + public Criteria andRequestMethodIsNotNull() { + addCriterion("request_method is not null"); + return (Criteria) this; + } + + public Criteria andRequestMethodEqualTo(Integer value) { + addCriterion("request_method =", value, "requestMethod"); + return (Criteria) this; + } + + public Criteria andRequestMethodNotEqualTo(Integer value) { + addCriterion("request_method <>", value, "requestMethod"); + return (Criteria) this; + } + + public Criteria andRequestMethodGreaterThan(Integer value) { + addCriterion("request_method >", value, "requestMethod"); + return (Criteria) this; + } + + public Criteria andRequestMethodGreaterThanOrEqualTo(Integer value) { + addCriterion("request_method >=", value, "requestMethod"); + return (Criteria) this; + } + + public Criteria andRequestMethodLessThan(Integer value) { + addCriterion("request_method <", value, "requestMethod"); + return (Criteria) this; + } + + public Criteria andRequestMethodLessThanOrEqualTo(Integer value) { + addCriterion("request_method <=", value, "requestMethod"); + return (Criteria) this; + } + + public Criteria andRequestMethodIn(List values) { + addCriterion("request_method in", values, "requestMethod"); + return (Criteria) this; + } + + public Criteria andRequestMethodNotIn(List values) { + addCriterion("request_method not in", values, "requestMethod"); + return (Criteria) this; + } + + public Criteria andRequestMethodBetween(Integer value1, Integer value2) { + addCriterion("request_method between", value1, value2, "requestMethod"); + return (Criteria) this; + } + + public Criteria andRequestMethodNotBetween(Integer value1, Integer value2) { + addCriterion("request_method not between", value1, value2, "requestMethod"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutIsNull() { + addCriterion("request_timeout is null"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutIsNotNull() { + addCriterion("request_timeout is not null"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutEqualTo(Integer value) { + addCriterion("request_timeout =", value, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutNotEqualTo(Integer value) { + addCriterion("request_timeout <>", value, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutGreaterThan(Integer value) { + addCriterion("request_timeout >", value, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutGreaterThanOrEqualTo(Integer value) { + addCriterion("request_timeout >=", value, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutLessThan(Integer value) { + addCriterion("request_timeout <", value, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutLessThanOrEqualTo(Integer value) { + addCriterion("request_timeout <=", value, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutIn(List values) { + addCriterion("request_timeout in", values, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutNotIn(List values) { + addCriterion("request_timeout not in", values, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutBetween(Integer value1, Integer value2) { + addCriterion("request_timeout between", value1, value2, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutNotBetween(Integer value1, Integer value2) { + addCriterion("request_timeout not between", value1, value2, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andNeedLoginIsNull() { + addCriterion("need_login is null"); + return (Criteria) this; + } + + public Criteria andNeedLoginIsNotNull() { + addCriterion("need_login is not null"); + return (Criteria) this; + } + + public Criteria andNeedLoginEqualTo(Boolean value) { + addCriterion("need_login =", value, "needLogin"); + return (Criteria) this; + } + + public Criteria andNeedLoginNotEqualTo(Boolean value) { + addCriterion("need_login <>", value, "needLogin"); + return (Criteria) this; + } + + public Criteria andNeedLoginGreaterThan(Boolean value) { + addCriterion("need_login >", value, "needLogin"); + return (Criteria) this; + } + + public Criteria andNeedLoginGreaterThanOrEqualTo(Boolean value) { + addCriterion("need_login >=", value, "needLogin"); + return (Criteria) this; + } + + public Criteria andNeedLoginLessThan(Boolean value) { + addCriterion("need_login <", value, "needLogin"); + return (Criteria) this; + } + + public Criteria andNeedLoginLessThanOrEqualTo(Boolean value) { + addCriterion("need_login <=", value, "needLogin"); + return (Criteria) this; + } + + public Criteria andNeedLoginIn(List values) { + addCriterion("need_login in", values, "needLogin"); + return (Criteria) this; + } + + public Criteria andNeedLoginNotIn(List values) { + addCriterion("need_login not in", values, "needLogin"); + return (Criteria) this; + } + + public Criteria andNeedLoginBetween(Boolean value1, Boolean value2) { + addCriterion("need_login between", value1, value2, "needLogin"); + return (Criteria) this; + } + + public Criteria andNeedLoginNotBetween(Boolean value1, Boolean value2) { + addCriterion("need_login not between", value1, value2, "needLogin"); + return (Criteria) this; + } + + public Criteria andTokenTypeIsNull() { + addCriterion("token_type is null"); + return (Criteria) this; + } + + public Criteria andTokenTypeIsNotNull() { + addCriterion("token_type is not null"); + return (Criteria) this; + } + + public Criteria andTokenTypeEqualTo(Integer value) { + addCriterion("token_type =", value, "tokenType"); + return (Criteria) this; + } + + public Criteria andTokenTypeNotEqualTo(Integer value) { + addCriterion("token_type <>", value, "tokenType"); + return (Criteria) this; + } + + public Criteria andTokenTypeGreaterThan(Integer value) { + addCriterion("token_type >", value, "tokenType"); + return (Criteria) this; + } + + public Criteria andTokenTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("token_type >=", value, "tokenType"); + return (Criteria) this; + } + + public Criteria andTokenTypeLessThan(Integer value) { + addCriterion("token_type <", value, "tokenType"); + return (Criteria) this; + } + + public Criteria andTokenTypeLessThanOrEqualTo(Integer value) { + addCriterion("token_type <=", value, "tokenType"); + return (Criteria) this; + } + + public Criteria andTokenTypeIn(List values) { + addCriterion("token_type in", values, "tokenType"); + return (Criteria) this; + } + + public Criteria andTokenTypeNotIn(List values) { + addCriterion("token_type not in", values, "tokenType"); + return (Criteria) this; + } + + public Criteria andTokenTypeBetween(Integer value1, Integer value2) { + addCriterion("token_type between", value1, value2, "tokenType"); + return (Criteria) this; + } + + public Criteria andTokenTypeNotBetween(Integer value1, Integer value2) { + addCriterion("token_type not between", value1, value2, "tokenType"); + return (Criteria) this; + } + + public Criteria andContentTypeIsNull() { + addCriterion("content_type is null"); + return (Criteria) this; + } + + public Criteria andContentTypeIsNotNull() { + addCriterion("content_type is not null"); + return (Criteria) this; + } + + public Criteria andContentTypeEqualTo(String value) { + addCriterion("content_type =", value, "contentType"); + return (Criteria) this; + } + + public Criteria andContentTypeNotEqualTo(String value) { + addCriterion("content_type <>", value, "contentType"); + return (Criteria) this; + } + + public Criteria andContentTypeGreaterThan(String value) { + addCriterion("content_type >", value, "contentType"); + return (Criteria) this; + } + + public Criteria andContentTypeGreaterThanOrEqualTo(String value) { + addCriterion("content_type >=", value, "contentType"); + return (Criteria) this; + } + + public Criteria andContentTypeLessThan(String value) { + addCriterion("content_type <", value, "contentType"); + return (Criteria) this; + } + + public Criteria andContentTypeLessThanOrEqualTo(String value) { + addCriterion("content_type <=", value, "contentType"); + return (Criteria) this; + } + + public Criteria andContentTypeLike(String value) { + addCriterion("content_type like", value, "contentType"); + return (Criteria) this; + } + + public Criteria andContentTypeNotLike(String value) { + addCriterion("content_type not like", value, "contentType"); + return (Criteria) this; + } + + public Criteria andContentTypeIn(List values) { + addCriterion("content_type in", values, "contentType"); + return (Criteria) this; + } + + public Criteria andContentTypeNotIn(List values) { + addCriterion("content_type not in", values, "contentType"); + return (Criteria) this; + } + + public Criteria andContentTypeBetween(String value1, String value2) { + addCriterion("content_type between", value1, value2, "contentType"); + return (Criteria) this; + } + + public Criteria andContentTypeNotBetween(String value1, String value2) { + addCriterion("content_type not between", value1, value2, "contentType"); + return (Criteria) this; + } + + public Criteria andNacosTypeIsNull() { + addCriterion("nacos_type is null"); + return (Criteria) this; + } + + public Criteria andNacosTypeIsNotNull() { + addCriterion("nacos_type is not null"); + return (Criteria) this; + } + + public Criteria andNacosTypeEqualTo(Integer value) { + addCriterion("nacos_type =", value, "nacosType"); + return (Criteria) this; + } + + public Criteria andNacosTypeNotEqualTo(Integer value) { + addCriterion("nacos_type <>", value, "nacosType"); + return (Criteria) this; + } + + public Criteria andNacosTypeGreaterThan(Integer value) { + addCriterion("nacos_type >", value, "nacosType"); + return (Criteria) this; + } + + public Criteria andNacosTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("nacos_type >=", value, "nacosType"); + return (Criteria) this; + } + + public Criteria andNacosTypeLessThan(Integer value) { + addCriterion("nacos_type <", value, "nacosType"); + return (Criteria) this; + } + + public Criteria andNacosTypeLessThanOrEqualTo(Integer value) { + addCriterion("nacos_type <=", value, "nacosType"); + return (Criteria) this; + } + + public Criteria andNacosTypeIn(List values) { + addCriterion("nacos_type in", values, "nacosType"); + return (Criteria) this; + } + + public Criteria andNacosTypeNotIn(List values) { + addCriterion("nacos_type not in", values, "nacosType"); + return (Criteria) this; + } + + public Criteria andNacosTypeBetween(Integer value1, Integer value2) { + addCriterion("nacos_type between", value1, value2, "nacosType"); + return (Criteria) this; + } + + public Criteria andNacosTypeNotBetween(Integer value1, Integer value2) { + addCriterion("nacos_type not between", value1, value2, "nacosType"); + return (Criteria) this; + } + + public Criteria andServiceNameIsNull() { + addCriterion("service_name is null"); + return (Criteria) this; + } + + public Criteria andServiceNameIsNotNull() { + addCriterion("service_name is not null"); + return (Criteria) this; + } + + public Criteria andServiceNameEqualTo(String value) { + addCriterion("service_name =", value, "serviceName"); + return (Criteria) this; + } + + public Criteria andServiceNameNotEqualTo(String value) { + addCriterion("service_name <>", value, "serviceName"); + return (Criteria) this; + } + + public Criteria andServiceNameGreaterThan(String value) { + addCriterion("service_name >", value, "serviceName"); + return (Criteria) this; + } + + public Criteria andServiceNameGreaterThanOrEqualTo(String value) { + addCriterion("service_name >=", value, "serviceName"); + return (Criteria) this; + } + + public Criteria andServiceNameLessThan(String value) { + addCriterion("service_name <", value, "serviceName"); + return (Criteria) this; + } + + public Criteria andServiceNameLessThanOrEqualTo(String value) { + addCriterion("service_name <=", value, "serviceName"); + return (Criteria) this; + } + + public Criteria andServiceNameLike(String value) { + addCriterion("service_name like", value, "serviceName"); + return (Criteria) this; + } + + public Criteria andServiceNameNotLike(String value) { + addCriterion("service_name not like", value, "serviceName"); + return (Criteria) this; + } + + public Criteria andServiceNameIn(List values) { + addCriterion("service_name in", values, "serviceName"); + return (Criteria) this; + } + + public Criteria andServiceNameNotIn(List values) { + addCriterion("service_name not in", values, "serviceName"); + return (Criteria) this; + } + + public Criteria andServiceNameBetween(String value1, String value2) { + addCriterion("service_name between", value1, value2, "serviceName"); + return (Criteria) this; + } + + public Criteria andServiceNameNotBetween(String value1, String value2) { + addCriterion("service_name not between", value1, value2, "serviceName"); + return (Criteria) this; + } + + public Criteria andMethodNameIsNull() { + addCriterion("method_name is null"); + return (Criteria) this; + } + + public Criteria andMethodNameIsNotNull() { + addCriterion("method_name is not null"); + return (Criteria) this; + } + + public Criteria andMethodNameEqualTo(String value) { + addCriterion("method_name =", value, "methodName"); + return (Criteria) this; + } + + public Criteria andMethodNameNotEqualTo(String value) { + addCriterion("method_name <>", value, "methodName"); + return (Criteria) this; + } + + public Criteria andMethodNameGreaterThan(String value) { + addCriterion("method_name >", value, "methodName"); + return (Criteria) this; + } + + public Criteria andMethodNameGreaterThanOrEqualTo(String value) { + addCriterion("method_name >=", value, "methodName"); + return (Criteria) this; + } + + public Criteria andMethodNameLessThan(String value) { + addCriterion("method_name <", value, "methodName"); + return (Criteria) this; + } + + public Criteria andMethodNameLessThanOrEqualTo(String value) { + addCriterion("method_name <=", value, "methodName"); + return (Criteria) this; + } + + public Criteria andMethodNameLike(String value) { + addCriterion("method_name like", value, "methodName"); + return (Criteria) this; + } + + public Criteria andMethodNameNotLike(String value) { + addCriterion("method_name not like", value, "methodName"); + return (Criteria) this; + } + + public Criteria andMethodNameIn(List values) { + addCriterion("method_name in", values, "methodName"); + return (Criteria) this; + } + + public Criteria andMethodNameNotIn(List values) { + addCriterion("method_name not in", values, "methodName"); + return (Criteria) this; + } + + public Criteria andMethodNameBetween(String value1, String value2) { + addCriterion("method_name between", value1, value2, "methodName"); + return (Criteria) this; + } + + public Criteria andMethodNameNotBetween(String value1, String value2) { + addCriterion("method_name not between", value1, value2, "methodName"); + return (Criteria) this; + } + + public Criteria andParamTypeListIsNull() { + addCriterion("param_type_list is null"); + return (Criteria) this; + } + + public Criteria andParamTypeListIsNotNull() { + addCriterion("param_type_list is not null"); + return (Criteria) this; + } + + public Criteria andParamTypeListEqualTo(String value) { + addCriterion("param_type_list =", value, "paramTypeList"); + return (Criteria) this; + } + + public Criteria andParamTypeListNotEqualTo(String value) { + addCriterion("param_type_list <>", value, "paramTypeList"); + return (Criteria) this; + } + + public Criteria andParamTypeListGreaterThan(String value) { + addCriterion("param_type_list >", value, "paramTypeList"); + return (Criteria) this; + } + + public Criteria andParamTypeListGreaterThanOrEqualTo(String value) { + addCriterion("param_type_list >=", value, "paramTypeList"); + return (Criteria) this; + } + + public Criteria andParamTypeListLessThan(String value) { + addCriterion("param_type_list <", value, "paramTypeList"); + return (Criteria) this; + } + + public Criteria andParamTypeListLessThanOrEqualTo(String value) { + addCriterion("param_type_list <=", value, "paramTypeList"); + return (Criteria) this; + } + + public Criteria andParamTypeListLike(String value) { + addCriterion("param_type_list like", value, "paramTypeList"); + return (Criteria) this; + } + + public Criteria andParamTypeListNotLike(String value) { + addCriterion("param_type_list not like", value, "paramTypeList"); + return (Criteria) this; + } + + public Criteria andParamTypeListIn(List values) { + addCriterion("param_type_list in", values, "paramTypeList"); + return (Criteria) this; + } + + public Criteria andParamTypeListNotIn(List values) { + addCriterion("param_type_list not in", values, "paramTypeList"); + return (Criteria) this; + } + + public Criteria andParamTypeListBetween(String value1, String value2) { + addCriterion("param_type_list between", value1, value2, "paramTypeList"); + return (Criteria) this; + } + + public Criteria andParamTypeListNotBetween(String value1, String value2) { + addCriterion("param_type_list not between", value1, value2, "paramTypeList"); + return (Criteria) this; + } + + public Criteria andDubboGroupIsNull() { + addCriterion("dubbo_group is null"); + return (Criteria) this; + } + + public Criteria andDubboGroupIsNotNull() { + addCriterion("dubbo_group is not null"); + return (Criteria) this; + } + + public Criteria andDubboGroupEqualTo(String value) { + addCriterion("dubbo_group =", value, "dubboGroup"); + return (Criteria) this; + } + + public Criteria andDubboGroupNotEqualTo(String value) { + addCriterion("dubbo_group <>", value, "dubboGroup"); + return (Criteria) this; + } + + public Criteria andDubboGroupGreaterThan(String value) { + addCriterion("dubbo_group >", value, "dubboGroup"); + return (Criteria) this; + } + + public Criteria andDubboGroupGreaterThanOrEqualTo(String value) { + addCriterion("dubbo_group >=", value, "dubboGroup"); + return (Criteria) this; + } + + public Criteria andDubboGroupLessThan(String value) { + addCriterion("dubbo_group <", value, "dubboGroup"); + return (Criteria) this; + } + + public Criteria andDubboGroupLessThanOrEqualTo(String value) { + addCriterion("dubbo_group <=", value, "dubboGroup"); + return (Criteria) this; + } + + public Criteria andDubboGroupLike(String value) { + addCriterion("dubbo_group like", value, "dubboGroup"); + return (Criteria) this; + } + + public Criteria andDubboGroupNotLike(String value) { + addCriterion("dubbo_group not like", value, "dubboGroup"); + return (Criteria) this; + } + + public Criteria andDubboGroupIn(List values) { + addCriterion("dubbo_group in", values, "dubboGroup"); + return (Criteria) this; + } + + public Criteria andDubboGroupNotIn(List values) { + addCriterion("dubbo_group not in", values, "dubboGroup"); + return (Criteria) this; + } + + public Criteria andDubboGroupBetween(String value1, String value2) { + addCriterion("dubbo_group between", value1, value2, "dubboGroup"); + return (Criteria) this; + } + + public Criteria andDubboGroupNotBetween(String value1, String value2) { + addCriterion("dubbo_group not between", value1, value2, "dubboGroup"); + return (Criteria) this; + } + + public Criteria andDubboVersionIsNull() { + addCriterion("dubbo_version is null"); + return (Criteria) this; + } + + public Criteria andDubboVersionIsNotNull() { + addCriterion("dubbo_version is not null"); + return (Criteria) this; + } + + public Criteria andDubboVersionEqualTo(String value) { + addCriterion("dubbo_version =", value, "dubboVersion"); + return (Criteria) this; + } + + public Criteria andDubboVersionNotEqualTo(String value) { + addCriterion("dubbo_version <>", value, "dubboVersion"); + return (Criteria) this; + } + + public Criteria andDubboVersionGreaterThan(String value) { + addCriterion("dubbo_version >", value, "dubboVersion"); + return (Criteria) this; + } + + public Criteria andDubboVersionGreaterThanOrEqualTo(String value) { + addCriterion("dubbo_version >=", value, "dubboVersion"); + return (Criteria) this; + } + + public Criteria andDubboVersionLessThan(String value) { + addCriterion("dubbo_version <", value, "dubboVersion"); + return (Criteria) this; + } + + public Criteria andDubboVersionLessThanOrEqualTo(String value) { + addCriterion("dubbo_version <=", value, "dubboVersion"); + return (Criteria) this; + } + + public Criteria andDubboVersionLike(String value) { + addCriterion("dubbo_version like", value, "dubboVersion"); + return (Criteria) this; + } + + public Criteria andDubboVersionNotLike(String value) { + addCriterion("dubbo_version not like", value, "dubboVersion"); + return (Criteria) this; + } + + public Criteria andDubboVersionIn(List values) { + addCriterion("dubbo_version in", values, "dubboVersion"); + return (Criteria) this; + } + + public Criteria andDubboVersionNotIn(List values) { + addCriterion("dubbo_version not in", values, "dubboVersion"); + return (Criteria) this; + } + + public Criteria andDubboVersionBetween(String value1, String value2) { + addCriterion("dubbo_version between", value1, value2, "dubboVersion"); + return (Criteria) this; + } + + public Criteria andDubboVersionNotBetween(String value1, String value2) { + addCriterion("dubbo_version not between", value1, value2, "dubboVersion"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdIsNull() { + addCriterion("serial_link_id is null"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdIsNotNull() { + addCriterion("serial_link_id is not null"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdEqualTo(Integer value) { + addCriterion("serial_link_id =", value, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdNotEqualTo(Integer value) { + addCriterion("serial_link_id <>", value, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdGreaterThan(Integer value) { + addCriterion("serial_link_id >", value, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdGreaterThanOrEqualTo(Integer value) { + addCriterion("serial_link_id >=", value, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdLessThan(Integer value) { + addCriterion("serial_link_id <", value, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdLessThanOrEqualTo(Integer value) { + addCriterion("serial_link_id <=", value, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdIn(List values) { + addCriterion("serial_link_id in", values, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdNotIn(List values) { + addCriterion("serial_link_id not in", values, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdBetween(Integer value1, Integer value2) { + addCriterion("serial_link_id between", value1, value2, "serialLinkId"); + return (Criteria) this; + } + + public Criteria andSerialLinkIdNotBetween(Integer value1, Integer value2) { + addCriterion("serial_link_id not between", value1, value2, "serialLinkId"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneGroup.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneGroup.java new file mode 100644 index 000000000..8894d213a --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneGroup.java @@ -0,0 +1,142 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; + +public class SceneGroup { + private Integer id; + + private String groupName; + + private String groupDesc; + + private String creator; + + private Long ctime; + + private String tenant; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getGroupName() { + return groupName; + } + + public void setGroupName(String groupName) { + this.groupName = groupName == null ? null : groupName.trim(); + } + + public String getGroupDesc() { + return groupDesc; + } + + public void setGroupDesc(String groupDesc) { + this.groupDesc = groupDesc == null ? null : groupDesc.trim(); + } + + public String getCreator() { + return creator; + } + + public void setCreator(String creator) { + this.creator = creator == null ? null : creator.trim(); + } + + public Long getCtime() { + return ctime; + } + + public void setCtime(Long ctime) { + this.ctime = ctime; + } + + public String getTenant() { + return tenant; + } + + public void setTenant(String tenant) { + this.tenant = tenant == null ? null : tenant.trim(); + } + + public enum Column { + id("id", "id", "INTEGER", false), + groupName("group_name", "groupName", "VARCHAR", false), + groupDesc("group_desc", "groupDesc", "VARCHAR", false), + creator("creator", "creator", "VARCHAR", false), + ctime("ctime", "ctime", "BIGINT", false), + tenant("tenant", "tenant", "VARCHAR", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneGroupExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneGroupExample.java new file mode 100644 index 000000000..d8fcbc2a2 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneGroupExample.java @@ -0,0 +1,600 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class SceneGroupExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public SceneGroupExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andGroupNameIsNull() { + addCriterion("group_name is null"); + return (Criteria) this; + } + + public Criteria andGroupNameIsNotNull() { + addCriterion("group_name is not null"); + return (Criteria) this; + } + + public Criteria andGroupNameEqualTo(String value) { + addCriterion("group_name =", value, "groupName"); + return (Criteria) this; + } + + public Criteria andGroupNameNotEqualTo(String value) { + addCriterion("group_name <>", value, "groupName"); + return (Criteria) this; + } + + public Criteria andGroupNameGreaterThan(String value) { + addCriterion("group_name >", value, "groupName"); + return (Criteria) this; + } + + public Criteria andGroupNameGreaterThanOrEqualTo(String value) { + addCriterion("group_name >=", value, "groupName"); + return (Criteria) this; + } + + public Criteria andGroupNameLessThan(String value) { + addCriterion("group_name <", value, "groupName"); + return (Criteria) this; + } + + public Criteria andGroupNameLessThanOrEqualTo(String value) { + addCriterion("group_name <=", value, "groupName"); + return (Criteria) this; + } + + public Criteria andGroupNameLike(String value) { + addCriterion("group_name like", value, "groupName"); + return (Criteria) this; + } + + public Criteria andGroupNameNotLike(String value) { + addCriterion("group_name not like", value, "groupName"); + return (Criteria) this; + } + + public Criteria andGroupNameIn(List values) { + addCriterion("group_name in", values, "groupName"); + return (Criteria) this; + } + + public Criteria andGroupNameNotIn(List values) { + addCriterion("group_name not in", values, "groupName"); + return (Criteria) this; + } + + public Criteria andGroupNameBetween(String value1, String value2) { + addCriterion("group_name between", value1, value2, "groupName"); + return (Criteria) this; + } + + public Criteria andGroupNameNotBetween(String value1, String value2) { + addCriterion("group_name not between", value1, value2, "groupName"); + return (Criteria) this; + } + + public Criteria andGroupDescIsNull() { + addCriterion("group_desc is null"); + return (Criteria) this; + } + + public Criteria andGroupDescIsNotNull() { + addCriterion("group_desc is not null"); + return (Criteria) this; + } + + public Criteria andGroupDescEqualTo(String value) { + addCriterion("group_desc =", value, "groupDesc"); + return (Criteria) this; + } + + public Criteria andGroupDescNotEqualTo(String value) { + addCriterion("group_desc <>", value, "groupDesc"); + return (Criteria) this; + } + + public Criteria andGroupDescGreaterThan(String value) { + addCriterion("group_desc >", value, "groupDesc"); + return (Criteria) this; + } + + public Criteria andGroupDescGreaterThanOrEqualTo(String value) { + addCriterion("group_desc >=", value, "groupDesc"); + return (Criteria) this; + } + + public Criteria andGroupDescLessThan(String value) { + addCriterion("group_desc <", value, "groupDesc"); + return (Criteria) this; + } + + public Criteria andGroupDescLessThanOrEqualTo(String value) { + addCriterion("group_desc <=", value, "groupDesc"); + return (Criteria) this; + } + + public Criteria andGroupDescLike(String value) { + addCriterion("group_desc like", value, "groupDesc"); + return (Criteria) this; + } + + public Criteria andGroupDescNotLike(String value) { + addCriterion("group_desc not like", value, "groupDesc"); + return (Criteria) this; + } + + public Criteria andGroupDescIn(List values) { + addCriterion("group_desc in", values, "groupDesc"); + return (Criteria) this; + } + + public Criteria andGroupDescNotIn(List values) { + addCriterion("group_desc not in", values, "groupDesc"); + return (Criteria) this; + } + + public Criteria andGroupDescBetween(String value1, String value2) { + addCriterion("group_desc between", value1, value2, "groupDesc"); + return (Criteria) this; + } + + public Criteria andGroupDescNotBetween(String value1, String value2) { + addCriterion("group_desc not between", value1, value2, "groupDesc"); + return (Criteria) this; + } + + public Criteria andCreatorIsNull() { + addCriterion("creator is null"); + return (Criteria) this; + } + + public Criteria andCreatorIsNotNull() { + addCriterion("creator is not null"); + return (Criteria) this; + } + + public Criteria andCreatorEqualTo(String value) { + addCriterion("creator =", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotEqualTo(String value) { + addCriterion("creator <>", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorGreaterThan(String value) { + addCriterion("creator >", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorGreaterThanOrEqualTo(String value) { + addCriterion("creator >=", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorLessThan(String value) { + addCriterion("creator <", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorLessThanOrEqualTo(String value) { + addCriterion("creator <=", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorLike(String value) { + addCriterion("creator like", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotLike(String value) { + addCriterion("creator not like", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorIn(List values) { + addCriterion("creator in", values, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotIn(List values) { + addCriterion("creator not in", values, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorBetween(String value1, String value2) { + addCriterion("creator between", value1, value2, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotBetween(String value1, String value2) { + addCriterion("creator not between", value1, value2, "creator"); + return (Criteria) this; + } + + public Criteria andCtimeIsNull() { + addCriterion("ctime is null"); + return (Criteria) this; + } + + public Criteria andCtimeIsNotNull() { + addCriterion("ctime is not null"); + return (Criteria) this; + } + + public Criteria andCtimeEqualTo(Long value) { + addCriterion("ctime =", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotEqualTo(Long value) { + addCriterion("ctime <>", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThan(Long value) { + addCriterion("ctime >", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThanOrEqualTo(Long value) { + addCriterion("ctime >=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThan(Long value) { + addCriterion("ctime <", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThanOrEqualTo(Long value) { + addCriterion("ctime <=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeIn(List values) { + addCriterion("ctime in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotIn(List values) { + addCriterion("ctime not in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeBetween(Long value1, Long value2) { + addCriterion("ctime between", value1, value2, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotBetween(Long value1, Long value2) { + addCriterion("ctime not between", value1, value2, "ctime"); + return (Criteria) this; + } + + public Criteria andTenantIsNull() { + addCriterion("tenant is null"); + return (Criteria) this; + } + + public Criteria andTenantIsNotNull() { + addCriterion("tenant is not null"); + return (Criteria) this; + } + + public Criteria andTenantEqualTo(String value) { + addCriterion("tenant =", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotEqualTo(String value) { + addCriterion("tenant <>", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantGreaterThan(String value) { + addCriterion("tenant >", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantGreaterThanOrEqualTo(String value) { + addCriterion("tenant >=", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantLessThan(String value) { + addCriterion("tenant <", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantLessThanOrEqualTo(String value) { + addCriterion("tenant <=", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantLike(String value) { + addCriterion("tenant like", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotLike(String value) { + addCriterion("tenant not like", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantIn(List values) { + addCriterion("tenant in", values, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotIn(List values) { + addCriterion("tenant not in", values, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantBetween(String value1, String value2) { + addCriterion("tenant between", value1, value2, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotBetween(String value1, String value2) { + addCriterion("tenant not between", value1, value2, "tenant"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneInfo.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneInfo.java new file mode 100644 index 000000000..84100b211 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneInfo.java @@ -0,0 +1,450 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; + +public class SceneInfo { + private Integer id; + + private String name; + + private Integer sceneStatus; + + private String creator; + + private String updator; + + private Integer apinum; + + private String remark; + + private Integer sceneType; + + private Integer benchMode; + + private Integer incrementMode; + + private Integer increasePercent; + + private Integer benchTime; + + private Integer maxBenchQps; + + private Integer rpsRate; + + private Integer logRate; + + private Integer requestTimeout; + + private String successCode; + + private Long ctime; + + private Long utime; + + private Integer sceneGroupId; + + private String curReportId; + + private Integer sceneEnv; + + private String tenant; + + private Integer benchCount; + + private Integer sceneSource; + + private Long lastBenchTime; + + private String apiBenchInfos; + + private String sla; + + private String globalHeader; + + private String agentList; + + private String refDatasetIds; + + private String personInCharge; + + private String benchCalendar; + + private String globalTspAuth; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name == null ? null : name.trim(); + } + + public Integer getSceneStatus() { + return sceneStatus; + } + + public void setSceneStatus(Integer sceneStatus) { + this.sceneStatus = sceneStatus; + } + + public String getCreator() { + return creator; + } + + public void setCreator(String creator) { + this.creator = creator == null ? null : creator.trim(); + } + + public String getUpdator() { + return updator; + } + + public void setUpdator(String updator) { + this.updator = updator == null ? null : updator.trim(); + } + + public Integer getApinum() { + return apinum; + } + + public void setApinum(Integer apinum) { + this.apinum = apinum; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark == null ? null : remark.trim(); + } + + public Integer getSceneType() { + return sceneType; + } + + public void setSceneType(Integer sceneType) { + this.sceneType = sceneType; + } + + public Integer getBenchMode() { + return benchMode; + } + + public void setBenchMode(Integer benchMode) { + this.benchMode = benchMode; + } + + public Integer getIncrementMode() { + return incrementMode; + } + + public void setIncrementMode(Integer incrementMode) { + this.incrementMode = incrementMode; + } + + public Integer getIncreasePercent() { + return increasePercent; + } + + public void setIncreasePercent(Integer increasePercent) { + this.increasePercent = increasePercent; + } + + public Integer getBenchTime() { + return benchTime; + } + + public void setBenchTime(Integer benchTime) { + this.benchTime = benchTime; + } + + public Integer getMaxBenchQps() { + return maxBenchQps; + } + + public void setMaxBenchQps(Integer maxBenchQps) { + this.maxBenchQps = maxBenchQps; + } + + public Integer getRpsRate() { + return rpsRate; + } + + public void setRpsRate(Integer rpsRate) { + this.rpsRate = rpsRate; + } + + public Integer getLogRate() { + return logRate; + } + + public void setLogRate(Integer logRate) { + this.logRate = logRate; + } + + public Integer getRequestTimeout() { + return requestTimeout; + } + + public void setRequestTimeout(Integer requestTimeout) { + this.requestTimeout = requestTimeout; + } + + public String getSuccessCode() { + return successCode; + } + + public void setSuccessCode(String successCode) { + this.successCode = successCode == null ? null : successCode.trim(); + } + + public Long getCtime() { + return ctime; + } + + public void setCtime(Long ctime) { + this.ctime = ctime; + } + + public Long getUtime() { + return utime; + } + + public void setUtime(Long utime) { + this.utime = utime; + } + + public Integer getSceneGroupId() { + return sceneGroupId; + } + + public void setSceneGroupId(Integer sceneGroupId) { + this.sceneGroupId = sceneGroupId; + } + + public String getCurReportId() { + return curReportId; + } + + public void setCurReportId(String curReportId) { + this.curReportId = curReportId == null ? null : curReportId.trim(); + } + + public Integer getSceneEnv() { + return sceneEnv; + } + + public void setSceneEnv(Integer sceneEnv) { + this.sceneEnv = sceneEnv; + } + + public String getTenant() { + return tenant; + } + + public void setTenant(String tenant) { + this.tenant = tenant == null ? null : tenant.trim(); + } + + public Integer getBenchCount() { + return benchCount; + } + + public void setBenchCount(Integer benchCount) { + this.benchCount = benchCount; + } + + public Integer getSceneSource() { + return sceneSource; + } + + public void setSceneSource(Integer sceneSource) { + this.sceneSource = sceneSource; + } + + public Long getLastBenchTime() { + return lastBenchTime; + } + + public void setLastBenchTime(Long lastBenchTime) { + this.lastBenchTime = lastBenchTime; + } + + public String getApiBenchInfos() { + return apiBenchInfos; + } + + public void setApiBenchInfos(String apiBenchInfos) { + this.apiBenchInfos = apiBenchInfos == null ? null : apiBenchInfos.trim(); + } + + public String getSla() { + return sla; + } + + public void setSla(String sla) { + this.sla = sla == null ? null : sla.trim(); + } + + public String getGlobalHeader() { + return globalHeader; + } + + public void setGlobalHeader(String globalHeader) { + this.globalHeader = globalHeader == null ? null : globalHeader.trim(); + } + + public String getAgentList() { + return agentList; + } + + public void setAgentList(String agentList) { + this.agentList = agentList == null ? null : agentList.trim(); + } + + public String getRefDatasetIds() { + return refDatasetIds; + } + + public void setRefDatasetIds(String refDatasetIds) { + this.refDatasetIds = refDatasetIds == null ? null : refDatasetIds.trim(); + } + + public String getPersonInCharge() { + return personInCharge; + } + + public void setPersonInCharge(String personInCharge) { + this.personInCharge = personInCharge == null ? null : personInCharge.trim(); + } + + public String getBenchCalendar() { + return benchCalendar; + } + + public void setBenchCalendar(String benchCalendar) { + this.benchCalendar = benchCalendar == null ? null : benchCalendar.trim(); + } + + public String getGlobalTspAuth() { + return globalTspAuth; + } + + public void setGlobalTspAuth(String globalTspAuth) { + this.globalTspAuth = globalTspAuth == null ? null : globalTspAuth.trim(); + } + + public enum Column { + id("id", "id", "INTEGER", false), + name("name", "name", "VARCHAR", false), + sceneStatus("scene_status", "sceneStatus", "INTEGER", false), + creator("creator", "creator", "VARCHAR", false), + updator("updator", "updator", "VARCHAR", false), + apinum("apiNum", "apinum", "INTEGER", false), + remark("remark", "remark", "VARCHAR", false), + sceneType("scene_type", "sceneType", "INTEGER", false), + benchMode("bench_mode", "benchMode", "INTEGER", false), + incrementMode("Increment_mode", "incrementMode", "INTEGER", false), + increasePercent("increase_percent", "increasePercent", "INTEGER", false), + benchTime("bench_time", "benchTime", "INTEGER", false), + maxBenchQps("max_bench_qps", "maxBenchQps", "INTEGER", false), + rpsRate("rps_rate", "rpsRate", "INTEGER", false), + logRate("log_rate", "logRate", "INTEGER", false), + requestTimeout("request_timeout", "requestTimeout", "INTEGER", false), + successCode("success_code", "successCode", "VARCHAR", false), + ctime("ctime", "ctime", "BIGINT", false), + utime("utime", "utime", "BIGINT", false), + sceneGroupId("scene_group_id", "sceneGroupId", "INTEGER", false), + curReportId("cur_report_id", "curReportId", "VARCHAR", false), + sceneEnv("scene_env", "sceneEnv", "INTEGER", false), + tenant("tenant", "tenant", "VARCHAR", false), + benchCount("bench_count", "benchCount", "INTEGER", false), + sceneSource("scene_source", "sceneSource", "INTEGER", false), + lastBenchTime("last_bench_time", "lastBenchTime", "BIGINT", false), + apiBenchInfos("api_bench_infos", "apiBenchInfos", "LONGVARCHAR", false), + sla("sla", "sla", "LONGVARCHAR", false), + globalHeader("global_header", "globalHeader", "LONGVARCHAR", false), + agentList("agent_list", "agentList", "LONGVARCHAR", false), + refDatasetIds("ref_dataset_ids", "refDatasetIds", "LONGVARCHAR", false), + personInCharge("person_in_charge", "personInCharge", "LONGVARCHAR", false), + benchCalendar("bench_calendar", "benchCalendar", "LONGVARCHAR", false), + globalTspAuth("global_tsp_auth", "globalTspAuth", "LONGVARCHAR", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneInfoExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneInfoExample.java new file mode 100644 index 000000000..c1fb796e1 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneInfoExample.java @@ -0,0 +1,1830 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class SceneInfoExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public SceneInfoExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andNameIsNull() { + addCriterion("name is null"); + return (Criteria) this; + } + + public Criteria andNameIsNotNull() { + addCriterion("name is not null"); + return (Criteria) this; + } + + public Criteria andNameEqualTo(String value) { + addCriterion("name =", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotEqualTo(String value) { + addCriterion("name <>", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThan(String value) { + addCriterion("name >", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThanOrEqualTo(String value) { + addCriterion("name >=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThan(String value) { + addCriterion("name <", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThanOrEqualTo(String value) { + addCriterion("name <=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLike(String value) { + addCriterion("name like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotLike(String value) { + addCriterion("name not like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameIn(List values) { + addCriterion("name in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameNotIn(List values) { + addCriterion("name not in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameBetween(String value1, String value2) { + addCriterion("name between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNameNotBetween(String value1, String value2) { + addCriterion("name not between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andSceneStatusIsNull() { + addCriterion("scene_status is null"); + return (Criteria) this; + } + + public Criteria andSceneStatusIsNotNull() { + addCriterion("scene_status is not null"); + return (Criteria) this; + } + + public Criteria andSceneStatusEqualTo(Integer value) { + addCriterion("scene_status =", value, "sceneStatus"); + return (Criteria) this; + } + + public Criteria andSceneStatusNotEqualTo(Integer value) { + addCriterion("scene_status <>", value, "sceneStatus"); + return (Criteria) this; + } + + public Criteria andSceneStatusGreaterThan(Integer value) { + addCriterion("scene_status >", value, "sceneStatus"); + return (Criteria) this; + } + + public Criteria andSceneStatusGreaterThanOrEqualTo(Integer value) { + addCriterion("scene_status >=", value, "sceneStatus"); + return (Criteria) this; + } + + public Criteria andSceneStatusLessThan(Integer value) { + addCriterion("scene_status <", value, "sceneStatus"); + return (Criteria) this; + } + + public Criteria andSceneStatusLessThanOrEqualTo(Integer value) { + addCriterion("scene_status <=", value, "sceneStatus"); + return (Criteria) this; + } + + public Criteria andSceneStatusIn(List values) { + addCriterion("scene_status in", values, "sceneStatus"); + return (Criteria) this; + } + + public Criteria andSceneStatusNotIn(List values) { + addCriterion("scene_status not in", values, "sceneStatus"); + return (Criteria) this; + } + + public Criteria andSceneStatusBetween(Integer value1, Integer value2) { + addCriterion("scene_status between", value1, value2, "sceneStatus"); + return (Criteria) this; + } + + public Criteria andSceneStatusNotBetween(Integer value1, Integer value2) { + addCriterion("scene_status not between", value1, value2, "sceneStatus"); + return (Criteria) this; + } + + public Criteria andCreatorIsNull() { + addCriterion("creator is null"); + return (Criteria) this; + } + + public Criteria andCreatorIsNotNull() { + addCriterion("creator is not null"); + return (Criteria) this; + } + + public Criteria andCreatorEqualTo(String value) { + addCriterion("creator =", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotEqualTo(String value) { + addCriterion("creator <>", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorGreaterThan(String value) { + addCriterion("creator >", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorGreaterThanOrEqualTo(String value) { + addCriterion("creator >=", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorLessThan(String value) { + addCriterion("creator <", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorLessThanOrEqualTo(String value) { + addCriterion("creator <=", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorLike(String value) { + addCriterion("creator like", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotLike(String value) { + addCriterion("creator not like", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorIn(List values) { + addCriterion("creator in", values, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotIn(List values) { + addCriterion("creator not in", values, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorBetween(String value1, String value2) { + addCriterion("creator between", value1, value2, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotBetween(String value1, String value2) { + addCriterion("creator not between", value1, value2, "creator"); + return (Criteria) this; + } + + public Criteria andUpdatorIsNull() { + addCriterion("updator is null"); + return (Criteria) this; + } + + public Criteria andUpdatorIsNotNull() { + addCriterion("updator is not null"); + return (Criteria) this; + } + + public Criteria andUpdatorEqualTo(String value) { + addCriterion("updator =", value, "updator"); + return (Criteria) this; + } + + public Criteria andUpdatorNotEqualTo(String value) { + addCriterion("updator <>", value, "updator"); + return (Criteria) this; + } + + public Criteria andUpdatorGreaterThan(String value) { + addCriterion("updator >", value, "updator"); + return (Criteria) this; + } + + public Criteria andUpdatorGreaterThanOrEqualTo(String value) { + addCriterion("updator >=", value, "updator"); + return (Criteria) this; + } + + public Criteria andUpdatorLessThan(String value) { + addCriterion("updator <", value, "updator"); + return (Criteria) this; + } + + public Criteria andUpdatorLessThanOrEqualTo(String value) { + addCriterion("updator <=", value, "updator"); + return (Criteria) this; + } + + public Criteria andUpdatorLike(String value) { + addCriterion("updator like", value, "updator"); + return (Criteria) this; + } + + public Criteria andUpdatorNotLike(String value) { + addCriterion("updator not like", value, "updator"); + return (Criteria) this; + } + + public Criteria andUpdatorIn(List values) { + addCriterion("updator in", values, "updator"); + return (Criteria) this; + } + + public Criteria andUpdatorNotIn(List values) { + addCriterion("updator not in", values, "updator"); + return (Criteria) this; + } + + public Criteria andUpdatorBetween(String value1, String value2) { + addCriterion("updator between", value1, value2, "updator"); + return (Criteria) this; + } + + public Criteria andUpdatorNotBetween(String value1, String value2) { + addCriterion("updator not between", value1, value2, "updator"); + return (Criteria) this; + } + + public Criteria andApinumIsNull() { + addCriterion("apiNum is null"); + return (Criteria) this; + } + + public Criteria andApinumIsNotNull() { + addCriterion("apiNum is not null"); + return (Criteria) this; + } + + public Criteria andApinumEqualTo(Integer value) { + addCriterion("apiNum =", value, "apinum"); + return (Criteria) this; + } + + public Criteria andApinumNotEqualTo(Integer value) { + addCriterion("apiNum <>", value, "apinum"); + return (Criteria) this; + } + + public Criteria andApinumGreaterThan(Integer value) { + addCriterion("apiNum >", value, "apinum"); + return (Criteria) this; + } + + public Criteria andApinumGreaterThanOrEqualTo(Integer value) { + addCriterion("apiNum >=", value, "apinum"); + return (Criteria) this; + } + + public Criteria andApinumLessThan(Integer value) { + addCriterion("apiNum <", value, "apinum"); + return (Criteria) this; + } + + public Criteria andApinumLessThanOrEqualTo(Integer value) { + addCriterion("apiNum <=", value, "apinum"); + return (Criteria) this; + } + + public Criteria andApinumIn(List values) { + addCriterion("apiNum in", values, "apinum"); + return (Criteria) this; + } + + public Criteria andApinumNotIn(List values) { + addCriterion("apiNum not in", values, "apinum"); + return (Criteria) this; + } + + public Criteria andApinumBetween(Integer value1, Integer value2) { + addCriterion("apiNum between", value1, value2, "apinum"); + return (Criteria) this; + } + + public Criteria andApinumNotBetween(Integer value1, Integer value2) { + addCriterion("apiNum not between", value1, value2, "apinum"); + return (Criteria) this; + } + + public Criteria andRemarkIsNull() { + addCriterion("remark is null"); + return (Criteria) this; + } + + public Criteria andRemarkIsNotNull() { + addCriterion("remark is not null"); + return (Criteria) this; + } + + public Criteria andRemarkEqualTo(String value) { + addCriterion("remark =", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkNotEqualTo(String value) { + addCriterion("remark <>", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkGreaterThan(String value) { + addCriterion("remark >", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkGreaterThanOrEqualTo(String value) { + addCriterion("remark >=", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkLessThan(String value) { + addCriterion("remark <", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkLessThanOrEqualTo(String value) { + addCriterion("remark <=", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkLike(String value) { + addCriterion("remark like", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkNotLike(String value) { + addCriterion("remark not like", value, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkIn(List values) { + addCriterion("remark in", values, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkNotIn(List values) { + addCriterion("remark not in", values, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkBetween(String value1, String value2) { + addCriterion("remark between", value1, value2, "remark"); + return (Criteria) this; + } + + public Criteria andRemarkNotBetween(String value1, String value2) { + addCriterion("remark not between", value1, value2, "remark"); + return (Criteria) this; + } + + public Criteria andSceneTypeIsNull() { + addCriterion("scene_type is null"); + return (Criteria) this; + } + + public Criteria andSceneTypeIsNotNull() { + addCriterion("scene_type is not null"); + return (Criteria) this; + } + + public Criteria andSceneTypeEqualTo(Integer value) { + addCriterion("scene_type =", value, "sceneType"); + return (Criteria) this; + } + + public Criteria andSceneTypeNotEqualTo(Integer value) { + addCriterion("scene_type <>", value, "sceneType"); + return (Criteria) this; + } + + public Criteria andSceneTypeGreaterThan(Integer value) { + addCriterion("scene_type >", value, "sceneType"); + return (Criteria) this; + } + + public Criteria andSceneTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("scene_type >=", value, "sceneType"); + return (Criteria) this; + } + + public Criteria andSceneTypeLessThan(Integer value) { + addCriterion("scene_type <", value, "sceneType"); + return (Criteria) this; + } + + public Criteria andSceneTypeLessThanOrEqualTo(Integer value) { + addCriterion("scene_type <=", value, "sceneType"); + return (Criteria) this; + } + + public Criteria andSceneTypeIn(List values) { + addCriterion("scene_type in", values, "sceneType"); + return (Criteria) this; + } + + public Criteria andSceneTypeNotIn(List values) { + addCriterion("scene_type not in", values, "sceneType"); + return (Criteria) this; + } + + public Criteria andSceneTypeBetween(Integer value1, Integer value2) { + addCriterion("scene_type between", value1, value2, "sceneType"); + return (Criteria) this; + } + + public Criteria andSceneTypeNotBetween(Integer value1, Integer value2) { + addCriterion("scene_type not between", value1, value2, "sceneType"); + return (Criteria) this; + } + + public Criteria andBenchModeIsNull() { + addCriterion("bench_mode is null"); + return (Criteria) this; + } + + public Criteria andBenchModeIsNotNull() { + addCriterion("bench_mode is not null"); + return (Criteria) this; + } + + public Criteria andBenchModeEqualTo(Integer value) { + addCriterion("bench_mode =", value, "benchMode"); + return (Criteria) this; + } + + public Criteria andBenchModeNotEqualTo(Integer value) { + addCriterion("bench_mode <>", value, "benchMode"); + return (Criteria) this; + } + + public Criteria andBenchModeGreaterThan(Integer value) { + addCriterion("bench_mode >", value, "benchMode"); + return (Criteria) this; + } + + public Criteria andBenchModeGreaterThanOrEqualTo(Integer value) { + addCriterion("bench_mode >=", value, "benchMode"); + return (Criteria) this; + } + + public Criteria andBenchModeLessThan(Integer value) { + addCriterion("bench_mode <", value, "benchMode"); + return (Criteria) this; + } + + public Criteria andBenchModeLessThanOrEqualTo(Integer value) { + addCriterion("bench_mode <=", value, "benchMode"); + return (Criteria) this; + } + + public Criteria andBenchModeIn(List values) { + addCriterion("bench_mode in", values, "benchMode"); + return (Criteria) this; + } + + public Criteria andBenchModeNotIn(List values) { + addCriterion("bench_mode not in", values, "benchMode"); + return (Criteria) this; + } + + public Criteria andBenchModeBetween(Integer value1, Integer value2) { + addCriterion("bench_mode between", value1, value2, "benchMode"); + return (Criteria) this; + } + + public Criteria andBenchModeNotBetween(Integer value1, Integer value2) { + addCriterion("bench_mode not between", value1, value2, "benchMode"); + return (Criteria) this; + } + + public Criteria andIncrementModeIsNull() { + addCriterion("Increment_mode is null"); + return (Criteria) this; + } + + public Criteria andIncrementModeIsNotNull() { + addCriterion("Increment_mode is not null"); + return (Criteria) this; + } + + public Criteria andIncrementModeEqualTo(Integer value) { + addCriterion("Increment_mode =", value, "incrementMode"); + return (Criteria) this; + } + + public Criteria andIncrementModeNotEqualTo(Integer value) { + addCriterion("Increment_mode <>", value, "incrementMode"); + return (Criteria) this; + } + + public Criteria andIncrementModeGreaterThan(Integer value) { + addCriterion("Increment_mode >", value, "incrementMode"); + return (Criteria) this; + } + + public Criteria andIncrementModeGreaterThanOrEqualTo(Integer value) { + addCriterion("Increment_mode >=", value, "incrementMode"); + return (Criteria) this; + } + + public Criteria andIncrementModeLessThan(Integer value) { + addCriterion("Increment_mode <", value, "incrementMode"); + return (Criteria) this; + } + + public Criteria andIncrementModeLessThanOrEqualTo(Integer value) { + addCriterion("Increment_mode <=", value, "incrementMode"); + return (Criteria) this; + } + + public Criteria andIncrementModeIn(List values) { + addCriterion("Increment_mode in", values, "incrementMode"); + return (Criteria) this; + } + + public Criteria andIncrementModeNotIn(List values) { + addCriterion("Increment_mode not in", values, "incrementMode"); + return (Criteria) this; + } + + public Criteria andIncrementModeBetween(Integer value1, Integer value2) { + addCriterion("Increment_mode between", value1, value2, "incrementMode"); + return (Criteria) this; + } + + public Criteria andIncrementModeNotBetween(Integer value1, Integer value2) { + addCriterion("Increment_mode not between", value1, value2, "incrementMode"); + return (Criteria) this; + } + + public Criteria andIncreasePercentIsNull() { + addCriterion("increase_percent is null"); + return (Criteria) this; + } + + public Criteria andIncreasePercentIsNotNull() { + addCriterion("increase_percent is not null"); + return (Criteria) this; + } + + public Criteria andIncreasePercentEqualTo(Integer value) { + addCriterion("increase_percent =", value, "increasePercent"); + return (Criteria) this; + } + + public Criteria andIncreasePercentNotEqualTo(Integer value) { + addCriterion("increase_percent <>", value, "increasePercent"); + return (Criteria) this; + } + + public Criteria andIncreasePercentGreaterThan(Integer value) { + addCriterion("increase_percent >", value, "increasePercent"); + return (Criteria) this; + } + + public Criteria andIncreasePercentGreaterThanOrEqualTo(Integer value) { + addCriterion("increase_percent >=", value, "increasePercent"); + return (Criteria) this; + } + + public Criteria andIncreasePercentLessThan(Integer value) { + addCriterion("increase_percent <", value, "increasePercent"); + return (Criteria) this; + } + + public Criteria andIncreasePercentLessThanOrEqualTo(Integer value) { + addCriterion("increase_percent <=", value, "increasePercent"); + return (Criteria) this; + } + + public Criteria andIncreasePercentIn(List values) { + addCriterion("increase_percent in", values, "increasePercent"); + return (Criteria) this; + } + + public Criteria andIncreasePercentNotIn(List values) { + addCriterion("increase_percent not in", values, "increasePercent"); + return (Criteria) this; + } + + public Criteria andIncreasePercentBetween(Integer value1, Integer value2) { + addCriterion("increase_percent between", value1, value2, "increasePercent"); + return (Criteria) this; + } + + public Criteria andIncreasePercentNotBetween(Integer value1, Integer value2) { + addCriterion("increase_percent not between", value1, value2, "increasePercent"); + return (Criteria) this; + } + + public Criteria andBenchTimeIsNull() { + addCriterion("bench_time is null"); + return (Criteria) this; + } + + public Criteria andBenchTimeIsNotNull() { + addCriterion("bench_time is not null"); + return (Criteria) this; + } + + public Criteria andBenchTimeEqualTo(Integer value) { + addCriterion("bench_time =", value, "benchTime"); + return (Criteria) this; + } + + public Criteria andBenchTimeNotEqualTo(Integer value) { + addCriterion("bench_time <>", value, "benchTime"); + return (Criteria) this; + } + + public Criteria andBenchTimeGreaterThan(Integer value) { + addCriterion("bench_time >", value, "benchTime"); + return (Criteria) this; + } + + public Criteria andBenchTimeGreaterThanOrEqualTo(Integer value) { + addCriterion("bench_time >=", value, "benchTime"); + return (Criteria) this; + } + + public Criteria andBenchTimeLessThan(Integer value) { + addCriterion("bench_time <", value, "benchTime"); + return (Criteria) this; + } + + public Criteria andBenchTimeLessThanOrEqualTo(Integer value) { + addCriterion("bench_time <=", value, "benchTime"); + return (Criteria) this; + } + + public Criteria andBenchTimeIn(List values) { + addCriterion("bench_time in", values, "benchTime"); + return (Criteria) this; + } + + public Criteria andBenchTimeNotIn(List values) { + addCriterion("bench_time not in", values, "benchTime"); + return (Criteria) this; + } + + public Criteria andBenchTimeBetween(Integer value1, Integer value2) { + addCriterion("bench_time between", value1, value2, "benchTime"); + return (Criteria) this; + } + + public Criteria andBenchTimeNotBetween(Integer value1, Integer value2) { + addCriterion("bench_time not between", value1, value2, "benchTime"); + return (Criteria) this; + } + + public Criteria andMaxBenchQpsIsNull() { + addCriterion("max_bench_qps is null"); + return (Criteria) this; + } + + public Criteria andMaxBenchQpsIsNotNull() { + addCriterion("max_bench_qps is not null"); + return (Criteria) this; + } + + public Criteria andMaxBenchQpsEqualTo(Integer value) { + addCriterion("max_bench_qps =", value, "maxBenchQps"); + return (Criteria) this; + } + + public Criteria andMaxBenchQpsNotEqualTo(Integer value) { + addCriterion("max_bench_qps <>", value, "maxBenchQps"); + return (Criteria) this; + } + + public Criteria andMaxBenchQpsGreaterThan(Integer value) { + addCriterion("max_bench_qps >", value, "maxBenchQps"); + return (Criteria) this; + } + + public Criteria andMaxBenchQpsGreaterThanOrEqualTo(Integer value) { + addCriterion("max_bench_qps >=", value, "maxBenchQps"); + return (Criteria) this; + } + + public Criteria andMaxBenchQpsLessThan(Integer value) { + addCriterion("max_bench_qps <", value, "maxBenchQps"); + return (Criteria) this; + } + + public Criteria andMaxBenchQpsLessThanOrEqualTo(Integer value) { + addCriterion("max_bench_qps <=", value, "maxBenchQps"); + return (Criteria) this; + } + + public Criteria andMaxBenchQpsIn(List values) { + addCriterion("max_bench_qps in", values, "maxBenchQps"); + return (Criteria) this; + } + + public Criteria andMaxBenchQpsNotIn(List values) { + addCriterion("max_bench_qps not in", values, "maxBenchQps"); + return (Criteria) this; + } + + public Criteria andMaxBenchQpsBetween(Integer value1, Integer value2) { + addCriterion("max_bench_qps between", value1, value2, "maxBenchQps"); + return (Criteria) this; + } + + public Criteria andMaxBenchQpsNotBetween(Integer value1, Integer value2) { + addCriterion("max_bench_qps not between", value1, value2, "maxBenchQps"); + return (Criteria) this; + } + + public Criteria andRpsRateIsNull() { + addCriterion("rps_rate is null"); + return (Criteria) this; + } + + public Criteria andRpsRateIsNotNull() { + addCriterion("rps_rate is not null"); + return (Criteria) this; + } + + public Criteria andRpsRateEqualTo(Integer value) { + addCriterion("rps_rate =", value, "rpsRate"); + return (Criteria) this; + } + + public Criteria andRpsRateNotEqualTo(Integer value) { + addCriterion("rps_rate <>", value, "rpsRate"); + return (Criteria) this; + } + + public Criteria andRpsRateGreaterThan(Integer value) { + addCriterion("rps_rate >", value, "rpsRate"); + return (Criteria) this; + } + + public Criteria andRpsRateGreaterThanOrEqualTo(Integer value) { + addCriterion("rps_rate >=", value, "rpsRate"); + return (Criteria) this; + } + + public Criteria andRpsRateLessThan(Integer value) { + addCriterion("rps_rate <", value, "rpsRate"); + return (Criteria) this; + } + + public Criteria andRpsRateLessThanOrEqualTo(Integer value) { + addCriterion("rps_rate <=", value, "rpsRate"); + return (Criteria) this; + } + + public Criteria andRpsRateIn(List values) { + addCriterion("rps_rate in", values, "rpsRate"); + return (Criteria) this; + } + + public Criteria andRpsRateNotIn(List values) { + addCriterion("rps_rate not in", values, "rpsRate"); + return (Criteria) this; + } + + public Criteria andRpsRateBetween(Integer value1, Integer value2) { + addCriterion("rps_rate between", value1, value2, "rpsRate"); + return (Criteria) this; + } + + public Criteria andRpsRateNotBetween(Integer value1, Integer value2) { + addCriterion("rps_rate not between", value1, value2, "rpsRate"); + return (Criteria) this; + } + + public Criteria andLogRateIsNull() { + addCriterion("log_rate is null"); + return (Criteria) this; + } + + public Criteria andLogRateIsNotNull() { + addCriterion("log_rate is not null"); + return (Criteria) this; + } + + public Criteria andLogRateEqualTo(Integer value) { + addCriterion("log_rate =", value, "logRate"); + return (Criteria) this; + } + + public Criteria andLogRateNotEqualTo(Integer value) { + addCriterion("log_rate <>", value, "logRate"); + return (Criteria) this; + } + + public Criteria andLogRateGreaterThan(Integer value) { + addCriterion("log_rate >", value, "logRate"); + return (Criteria) this; + } + + public Criteria andLogRateGreaterThanOrEqualTo(Integer value) { + addCriterion("log_rate >=", value, "logRate"); + return (Criteria) this; + } + + public Criteria andLogRateLessThan(Integer value) { + addCriterion("log_rate <", value, "logRate"); + return (Criteria) this; + } + + public Criteria andLogRateLessThanOrEqualTo(Integer value) { + addCriterion("log_rate <=", value, "logRate"); + return (Criteria) this; + } + + public Criteria andLogRateIn(List values) { + addCriterion("log_rate in", values, "logRate"); + return (Criteria) this; + } + + public Criteria andLogRateNotIn(List values) { + addCriterion("log_rate not in", values, "logRate"); + return (Criteria) this; + } + + public Criteria andLogRateBetween(Integer value1, Integer value2) { + addCriterion("log_rate between", value1, value2, "logRate"); + return (Criteria) this; + } + + public Criteria andLogRateNotBetween(Integer value1, Integer value2) { + addCriterion("log_rate not between", value1, value2, "logRate"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutIsNull() { + addCriterion("request_timeout is null"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutIsNotNull() { + addCriterion("request_timeout is not null"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutEqualTo(Integer value) { + addCriterion("request_timeout =", value, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutNotEqualTo(Integer value) { + addCriterion("request_timeout <>", value, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutGreaterThan(Integer value) { + addCriterion("request_timeout >", value, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutGreaterThanOrEqualTo(Integer value) { + addCriterion("request_timeout >=", value, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutLessThan(Integer value) { + addCriterion("request_timeout <", value, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutLessThanOrEqualTo(Integer value) { + addCriterion("request_timeout <=", value, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutIn(List values) { + addCriterion("request_timeout in", values, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutNotIn(List values) { + addCriterion("request_timeout not in", values, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutBetween(Integer value1, Integer value2) { + addCriterion("request_timeout between", value1, value2, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andRequestTimeoutNotBetween(Integer value1, Integer value2) { + addCriterion("request_timeout not between", value1, value2, "requestTimeout"); + return (Criteria) this; + } + + public Criteria andSuccessCodeIsNull() { + addCriterion("success_code is null"); + return (Criteria) this; + } + + public Criteria andSuccessCodeIsNotNull() { + addCriterion("success_code is not null"); + return (Criteria) this; + } + + public Criteria andSuccessCodeEqualTo(String value) { + addCriterion("success_code =", value, "successCode"); + return (Criteria) this; + } + + public Criteria andSuccessCodeNotEqualTo(String value) { + addCriterion("success_code <>", value, "successCode"); + return (Criteria) this; + } + + public Criteria andSuccessCodeGreaterThan(String value) { + addCriterion("success_code >", value, "successCode"); + return (Criteria) this; + } + + public Criteria andSuccessCodeGreaterThanOrEqualTo(String value) { + addCriterion("success_code >=", value, "successCode"); + return (Criteria) this; + } + + public Criteria andSuccessCodeLessThan(String value) { + addCriterion("success_code <", value, "successCode"); + return (Criteria) this; + } + + public Criteria andSuccessCodeLessThanOrEqualTo(String value) { + addCriterion("success_code <=", value, "successCode"); + return (Criteria) this; + } + + public Criteria andSuccessCodeLike(String value) { + addCriterion("success_code like", value, "successCode"); + return (Criteria) this; + } + + public Criteria andSuccessCodeNotLike(String value) { + addCriterion("success_code not like", value, "successCode"); + return (Criteria) this; + } + + public Criteria andSuccessCodeIn(List values) { + addCriterion("success_code in", values, "successCode"); + return (Criteria) this; + } + + public Criteria andSuccessCodeNotIn(List values) { + addCriterion("success_code not in", values, "successCode"); + return (Criteria) this; + } + + public Criteria andSuccessCodeBetween(String value1, String value2) { + addCriterion("success_code between", value1, value2, "successCode"); + return (Criteria) this; + } + + public Criteria andSuccessCodeNotBetween(String value1, String value2) { + addCriterion("success_code not between", value1, value2, "successCode"); + return (Criteria) this; + } + + public Criteria andCtimeIsNull() { + addCriterion("ctime is null"); + return (Criteria) this; + } + + public Criteria andCtimeIsNotNull() { + addCriterion("ctime is not null"); + return (Criteria) this; + } + + public Criteria andCtimeEqualTo(Long value) { + addCriterion("ctime =", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotEqualTo(Long value) { + addCriterion("ctime <>", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThan(Long value) { + addCriterion("ctime >", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThanOrEqualTo(Long value) { + addCriterion("ctime >=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThan(Long value) { + addCriterion("ctime <", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThanOrEqualTo(Long value) { + addCriterion("ctime <=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeIn(List values) { + addCriterion("ctime in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotIn(List values) { + addCriterion("ctime not in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeBetween(Long value1, Long value2) { + addCriterion("ctime between", value1, value2, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotBetween(Long value1, Long value2) { + addCriterion("ctime not between", value1, value2, "ctime"); + return (Criteria) this; + } + + public Criteria andUtimeIsNull() { + addCriterion("utime is null"); + return (Criteria) this; + } + + public Criteria andUtimeIsNotNull() { + addCriterion("utime is not null"); + return (Criteria) this; + } + + public Criteria andUtimeEqualTo(Long value) { + addCriterion("utime =", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotEqualTo(Long value) { + addCriterion("utime <>", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeGreaterThan(Long value) { + addCriterion("utime >", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeGreaterThanOrEqualTo(Long value) { + addCriterion("utime >=", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeLessThan(Long value) { + addCriterion("utime <", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeLessThanOrEqualTo(Long value) { + addCriterion("utime <=", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeIn(List values) { + addCriterion("utime in", values, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotIn(List values) { + addCriterion("utime not in", values, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeBetween(Long value1, Long value2) { + addCriterion("utime between", value1, value2, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotBetween(Long value1, Long value2) { + addCriterion("utime not between", value1, value2, "utime"); + return (Criteria) this; + } + + public Criteria andSceneGroupIdIsNull() { + addCriterion("scene_group_id is null"); + return (Criteria) this; + } + + public Criteria andSceneGroupIdIsNotNull() { + addCriterion("scene_group_id is not null"); + return (Criteria) this; + } + + public Criteria andSceneGroupIdEqualTo(Integer value) { + addCriterion("scene_group_id =", value, "sceneGroupId"); + return (Criteria) this; + } + + public Criteria andSceneGroupIdNotEqualTo(Integer value) { + addCriterion("scene_group_id <>", value, "sceneGroupId"); + return (Criteria) this; + } + + public Criteria andSceneGroupIdGreaterThan(Integer value) { + addCriterion("scene_group_id >", value, "sceneGroupId"); + return (Criteria) this; + } + + public Criteria andSceneGroupIdGreaterThanOrEqualTo(Integer value) { + addCriterion("scene_group_id >=", value, "sceneGroupId"); + return (Criteria) this; + } + + public Criteria andSceneGroupIdLessThan(Integer value) { + addCriterion("scene_group_id <", value, "sceneGroupId"); + return (Criteria) this; + } + + public Criteria andSceneGroupIdLessThanOrEqualTo(Integer value) { + addCriterion("scene_group_id <=", value, "sceneGroupId"); + return (Criteria) this; + } + + public Criteria andSceneGroupIdIn(List values) { + addCriterion("scene_group_id in", values, "sceneGroupId"); + return (Criteria) this; + } + + public Criteria andSceneGroupIdNotIn(List values) { + addCriterion("scene_group_id not in", values, "sceneGroupId"); + return (Criteria) this; + } + + public Criteria andSceneGroupIdBetween(Integer value1, Integer value2) { + addCriterion("scene_group_id between", value1, value2, "sceneGroupId"); + return (Criteria) this; + } + + public Criteria andSceneGroupIdNotBetween(Integer value1, Integer value2) { + addCriterion("scene_group_id not between", value1, value2, "sceneGroupId"); + return (Criteria) this; + } + + public Criteria andCurReportIdIsNull() { + addCriterion("cur_report_id is null"); + return (Criteria) this; + } + + public Criteria andCurReportIdIsNotNull() { + addCriterion("cur_report_id is not null"); + return (Criteria) this; + } + + public Criteria andCurReportIdEqualTo(String value) { + addCriterion("cur_report_id =", value, "curReportId"); + return (Criteria) this; + } + + public Criteria andCurReportIdNotEqualTo(String value) { + addCriterion("cur_report_id <>", value, "curReportId"); + return (Criteria) this; + } + + public Criteria andCurReportIdGreaterThan(String value) { + addCriterion("cur_report_id >", value, "curReportId"); + return (Criteria) this; + } + + public Criteria andCurReportIdGreaterThanOrEqualTo(String value) { + addCriterion("cur_report_id >=", value, "curReportId"); + return (Criteria) this; + } + + public Criteria andCurReportIdLessThan(String value) { + addCriterion("cur_report_id <", value, "curReportId"); + return (Criteria) this; + } + + public Criteria andCurReportIdLessThanOrEqualTo(String value) { + addCriterion("cur_report_id <=", value, "curReportId"); + return (Criteria) this; + } + + public Criteria andCurReportIdLike(String value) { + addCriterion("cur_report_id like", value, "curReportId"); + return (Criteria) this; + } + + public Criteria andCurReportIdNotLike(String value) { + addCriterion("cur_report_id not like", value, "curReportId"); + return (Criteria) this; + } + + public Criteria andCurReportIdIn(List values) { + addCriterion("cur_report_id in", values, "curReportId"); + return (Criteria) this; + } + + public Criteria andCurReportIdNotIn(List values) { + addCriterion("cur_report_id not in", values, "curReportId"); + return (Criteria) this; + } + + public Criteria andCurReportIdBetween(String value1, String value2) { + addCriterion("cur_report_id between", value1, value2, "curReportId"); + return (Criteria) this; + } + + public Criteria andCurReportIdNotBetween(String value1, String value2) { + addCriterion("cur_report_id not between", value1, value2, "curReportId"); + return (Criteria) this; + } + + public Criteria andSceneEnvIsNull() { + addCriterion("scene_env is null"); + return (Criteria) this; + } + + public Criteria andSceneEnvIsNotNull() { + addCriterion("scene_env is not null"); + return (Criteria) this; + } + + public Criteria andSceneEnvEqualTo(Integer value) { + addCriterion("scene_env =", value, "sceneEnv"); + return (Criteria) this; + } + + public Criteria andSceneEnvNotEqualTo(Integer value) { + addCriterion("scene_env <>", value, "sceneEnv"); + return (Criteria) this; + } + + public Criteria andSceneEnvGreaterThan(Integer value) { + addCriterion("scene_env >", value, "sceneEnv"); + return (Criteria) this; + } + + public Criteria andSceneEnvGreaterThanOrEqualTo(Integer value) { + addCriterion("scene_env >=", value, "sceneEnv"); + return (Criteria) this; + } + + public Criteria andSceneEnvLessThan(Integer value) { + addCriterion("scene_env <", value, "sceneEnv"); + return (Criteria) this; + } + + public Criteria andSceneEnvLessThanOrEqualTo(Integer value) { + addCriterion("scene_env <=", value, "sceneEnv"); + return (Criteria) this; + } + + public Criteria andSceneEnvIn(List values) { + addCriterion("scene_env in", values, "sceneEnv"); + return (Criteria) this; + } + + public Criteria andSceneEnvNotIn(List values) { + addCriterion("scene_env not in", values, "sceneEnv"); + return (Criteria) this; + } + + public Criteria andSceneEnvBetween(Integer value1, Integer value2) { + addCriterion("scene_env between", value1, value2, "sceneEnv"); + return (Criteria) this; + } + + public Criteria andSceneEnvNotBetween(Integer value1, Integer value2) { + addCriterion("scene_env not between", value1, value2, "sceneEnv"); + return (Criteria) this; + } + + public Criteria andTenantIsNull() { + addCriterion("tenant is null"); + return (Criteria) this; + } + + public Criteria andTenantIsNotNull() { + addCriterion("tenant is not null"); + return (Criteria) this; + } + + public Criteria andTenantEqualTo(String value) { + addCriterion("tenant =", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotEqualTo(String value) { + addCriterion("tenant <>", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantGreaterThan(String value) { + addCriterion("tenant >", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantGreaterThanOrEqualTo(String value) { + addCriterion("tenant >=", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantLessThan(String value) { + addCriterion("tenant <", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantLessThanOrEqualTo(String value) { + addCriterion("tenant <=", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantLike(String value) { + addCriterion("tenant like", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotLike(String value) { + addCriterion("tenant not like", value, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantIn(List values) { + addCriterion("tenant in", values, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotIn(List values) { + addCriterion("tenant not in", values, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantBetween(String value1, String value2) { + addCriterion("tenant between", value1, value2, "tenant"); + return (Criteria) this; + } + + public Criteria andTenantNotBetween(String value1, String value2) { + addCriterion("tenant not between", value1, value2, "tenant"); + return (Criteria) this; + } + + public Criteria andBenchCountIsNull() { + addCriterion("bench_count is null"); + return (Criteria) this; + } + + public Criteria andBenchCountIsNotNull() { + addCriterion("bench_count is not null"); + return (Criteria) this; + } + + public Criteria andBenchCountEqualTo(Integer value) { + addCriterion("bench_count =", value, "benchCount"); + return (Criteria) this; + } + + public Criteria andBenchCountNotEqualTo(Integer value) { + addCriterion("bench_count <>", value, "benchCount"); + return (Criteria) this; + } + + public Criteria andBenchCountGreaterThan(Integer value) { + addCriterion("bench_count >", value, "benchCount"); + return (Criteria) this; + } + + public Criteria andBenchCountGreaterThanOrEqualTo(Integer value) { + addCriterion("bench_count >=", value, "benchCount"); + return (Criteria) this; + } + + public Criteria andBenchCountLessThan(Integer value) { + addCriterion("bench_count <", value, "benchCount"); + return (Criteria) this; + } + + public Criteria andBenchCountLessThanOrEqualTo(Integer value) { + addCriterion("bench_count <=", value, "benchCount"); + return (Criteria) this; + } + + public Criteria andBenchCountIn(List values) { + addCriterion("bench_count in", values, "benchCount"); + return (Criteria) this; + } + + public Criteria andBenchCountNotIn(List values) { + addCriterion("bench_count not in", values, "benchCount"); + return (Criteria) this; + } + + public Criteria andBenchCountBetween(Integer value1, Integer value2) { + addCriterion("bench_count between", value1, value2, "benchCount"); + return (Criteria) this; + } + + public Criteria andBenchCountNotBetween(Integer value1, Integer value2) { + addCriterion("bench_count not between", value1, value2, "benchCount"); + return (Criteria) this; + } + + public Criteria andSceneSourceIsNull() { + addCriterion("scene_source is null"); + return (Criteria) this; + } + + public Criteria andSceneSourceIsNotNull() { + addCriterion("scene_source is not null"); + return (Criteria) this; + } + + public Criteria andSceneSourceEqualTo(Integer value) { + addCriterion("scene_source =", value, "sceneSource"); + return (Criteria) this; + } + + public Criteria andSceneSourceNotEqualTo(Integer value) { + addCriterion("scene_source <>", value, "sceneSource"); + return (Criteria) this; + } + + public Criteria andSceneSourceGreaterThan(Integer value) { + addCriterion("scene_source >", value, "sceneSource"); + return (Criteria) this; + } + + public Criteria andSceneSourceGreaterThanOrEqualTo(Integer value) { + addCriterion("scene_source >=", value, "sceneSource"); + return (Criteria) this; + } + + public Criteria andSceneSourceLessThan(Integer value) { + addCriterion("scene_source <", value, "sceneSource"); + return (Criteria) this; + } + + public Criteria andSceneSourceLessThanOrEqualTo(Integer value) { + addCriterion("scene_source <=", value, "sceneSource"); + return (Criteria) this; + } + + public Criteria andSceneSourceIn(List values) { + addCriterion("scene_source in", values, "sceneSource"); + return (Criteria) this; + } + + public Criteria andSceneSourceNotIn(List values) { + addCriterion("scene_source not in", values, "sceneSource"); + return (Criteria) this; + } + + public Criteria andSceneSourceBetween(Integer value1, Integer value2) { + addCriterion("scene_source between", value1, value2, "sceneSource"); + return (Criteria) this; + } + + public Criteria andSceneSourceNotBetween(Integer value1, Integer value2) { + addCriterion("scene_source not between", value1, value2, "sceneSource"); + return (Criteria) this; + } + + public Criteria andLastBenchTimeIsNull() { + addCriterion("last_bench_time is null"); + return (Criteria) this; + } + + public Criteria andLastBenchTimeIsNotNull() { + addCriterion("last_bench_time is not null"); + return (Criteria) this; + } + + public Criteria andLastBenchTimeEqualTo(Long value) { + addCriterion("last_bench_time =", value, "lastBenchTime"); + return (Criteria) this; + } + + public Criteria andLastBenchTimeNotEqualTo(Long value) { + addCriterion("last_bench_time <>", value, "lastBenchTime"); + return (Criteria) this; + } + + public Criteria andLastBenchTimeGreaterThan(Long value) { + addCriterion("last_bench_time >", value, "lastBenchTime"); + return (Criteria) this; + } + + public Criteria andLastBenchTimeGreaterThanOrEqualTo(Long value) { + addCriterion("last_bench_time >=", value, "lastBenchTime"); + return (Criteria) this; + } + + public Criteria andLastBenchTimeLessThan(Long value) { + addCriterion("last_bench_time <", value, "lastBenchTime"); + return (Criteria) this; + } + + public Criteria andLastBenchTimeLessThanOrEqualTo(Long value) { + addCriterion("last_bench_time <=", value, "lastBenchTime"); + return (Criteria) this; + } + + public Criteria andLastBenchTimeIn(List values) { + addCriterion("last_bench_time in", values, "lastBenchTime"); + return (Criteria) this; + } + + public Criteria andLastBenchTimeNotIn(List values) { + addCriterion("last_bench_time not in", values, "lastBenchTime"); + return (Criteria) this; + } + + public Criteria andLastBenchTimeBetween(Long value1, Long value2) { + addCriterion("last_bench_time between", value1, value2, "lastBenchTime"); + return (Criteria) this; + } + + public Criteria andLastBenchTimeNotBetween(Long value1, Long value2) { + addCriterion("last_bench_time not between", value1, value2, "lastBenchTime"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneSnapshot.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneSnapshot.java new file mode 100644 index 000000000..2aa200f97 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneSnapshot.java @@ -0,0 +1,187 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; + +public class SceneSnapshot { + private Long id; + + private Long sceneId; + + private String snapshotId; + + private Date createTime; + + private Date updateTime; + + private String createBy; + + private Integer version; + + private String md5; + + private Integer type; + + private String scene; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getSceneId() { + return sceneId; + } + + public void setSceneId(Long sceneId) { + this.sceneId = sceneId; + } + + public String getSnapshotId() { + return snapshotId; + } + + public void setSnapshotId(String snapshotId) { + this.snapshotId = snapshotId == null ? null : snapshotId.trim(); + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy == null ? null : createBy.trim(); + } + + public Integer getVersion() { + return version; + } + + public void setVersion(Integer version) { + this.version = version; + } + + public String getMd5() { + return md5; + } + + public void setMd5(String md5) { + this.md5 = md5 == null ? null : md5.trim(); + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getScene() { + return scene; + } + + public void setScene(String scene) { + this.scene = scene == null ? null : scene.trim(); + } + + public enum Column { + id("id", "id", "BIGINT", false), + sceneId("scene_id", "sceneId", "BIGINT", false), + snapshotId("snapshot_id", "snapshotId", "VARCHAR", false), + createTime("create_time", "createTime", "TIMESTAMP", false), + updateTime("update_time", "updateTime", "TIMESTAMP", false), + createBy("create_by", "createBy", "VARCHAR", false), + version("version", "version", "INTEGER", false), + md5("md5", "md5", "VARCHAR", false), + type("type", "type", "INTEGER", false), + scene("scene", "scene", "LONGVARCHAR", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneSnapshotExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneSnapshotExample.java new file mode 100644 index 000000000..66ce719dd --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SceneSnapshotExample.java @@ -0,0 +1,794 @@ +package run.mone.mimeter.dashboard.pojo; + +import run.mone.mimeter.dashboard.pojo.common.Pageable; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class SceneSnapshotExample implements Pageable { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + + private Integer limit; + + private Long offset; + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + public SceneSnapshotExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNull() { + addCriterion("scene_id is null"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNotNull() { + addCriterion("scene_id is not null"); + return (Criteria) this; + } + + public Criteria andSceneIdEqualTo(Long value) { + addCriterion("scene_id =", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotEqualTo(Long value) { + addCriterion("scene_id <>", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThan(Long value) { + addCriterion("scene_id >", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThanOrEqualTo(Long value) { + addCriterion("scene_id >=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThan(Long value) { + addCriterion("scene_id <", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThanOrEqualTo(Long value) { + addCriterion("scene_id <=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdIn(List values) { + addCriterion("scene_id in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotIn(List values) { + addCriterion("scene_id not in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdBetween(Long value1, Long value2) { + addCriterion("scene_id between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotBetween(Long value1, Long value2) { + addCriterion("scene_id not between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdIsNull() { + addCriterion("snapshot_id is null"); + return (Criteria) this; + } + + public Criteria andSnapshotIdIsNotNull() { + addCriterion("snapshot_id is not null"); + return (Criteria) this; + } + + public Criteria andSnapshotIdEqualTo(String value) { + addCriterion("snapshot_id =", value, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdNotEqualTo(String value) { + addCriterion("snapshot_id <>", value, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdGreaterThan(String value) { + addCriterion("snapshot_id >", value, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdGreaterThanOrEqualTo(String value) { + addCriterion("snapshot_id >=", value, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdLessThan(String value) { + addCriterion("snapshot_id <", value, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdLessThanOrEqualTo(String value) { + addCriterion("snapshot_id <=", value, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdLike(String value) { + addCriterion("snapshot_id like", value, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdNotLike(String value) { + addCriterion("snapshot_id not like", value, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdIn(List values) { + addCriterion("snapshot_id in", values, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdNotIn(List values) { + addCriterion("snapshot_id not in", values, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdBetween(String value1, String value2) { + addCriterion("snapshot_id between", value1, value2, "snapshotId"); + return (Criteria) this; + } + + public Criteria andSnapshotIdNotBetween(String value1, String value2) { + addCriterion("snapshot_id not between", value1, value2, "snapshotId"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andCreateByIsNull() { + addCriterion("create_by is null"); + return (Criteria) this; + } + + public Criteria andCreateByIsNotNull() { + addCriterion("create_by is not null"); + return (Criteria) this; + } + + public Criteria andCreateByEqualTo(String value) { + addCriterion("create_by =", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotEqualTo(String value) { + addCriterion("create_by <>", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByGreaterThan(String value) { + addCriterion("create_by >", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByGreaterThanOrEqualTo(String value) { + addCriterion("create_by >=", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByLessThan(String value) { + addCriterion("create_by <", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByLessThanOrEqualTo(String value) { + addCriterion("create_by <=", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByLike(String value) { + addCriterion("create_by like", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotLike(String value) { + addCriterion("create_by not like", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByIn(List values) { + addCriterion("create_by in", values, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotIn(List values) { + addCriterion("create_by not in", values, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByBetween(String value1, String value2) { + addCriterion("create_by between", value1, value2, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotBetween(String value1, String value2) { + addCriterion("create_by not between", value1, value2, "createBy"); + return (Criteria) this; + } + + public Criteria andVersionIsNull() { + addCriterion("version is null"); + return (Criteria) this; + } + + public Criteria andVersionIsNotNull() { + addCriterion("version is not null"); + return (Criteria) this; + } + + public Criteria andVersionEqualTo(Integer value) { + addCriterion("version =", value, "version"); + return (Criteria) this; + } + + public Criteria andVersionNotEqualTo(Integer value) { + addCriterion("version <>", value, "version"); + return (Criteria) this; + } + + public Criteria andVersionGreaterThan(Integer value) { + addCriterion("version >", value, "version"); + return (Criteria) this; + } + + public Criteria andVersionGreaterThanOrEqualTo(Integer value) { + addCriterion("version >=", value, "version"); + return (Criteria) this; + } + + public Criteria andVersionLessThan(Integer value) { + addCriterion("version <", value, "version"); + return (Criteria) this; + } + + public Criteria andVersionLessThanOrEqualTo(Integer value) { + addCriterion("version <=", value, "version"); + return (Criteria) this; + } + + public Criteria andVersionIn(List values) { + addCriterion("version in", values, "version"); + return (Criteria) this; + } + + public Criteria andVersionNotIn(List values) { + addCriterion("version not in", values, "version"); + return (Criteria) this; + } + + public Criteria andVersionBetween(Integer value1, Integer value2) { + addCriterion("version between", value1, value2, "version"); + return (Criteria) this; + } + + public Criteria andVersionNotBetween(Integer value1, Integer value2) { + addCriterion("version not between", value1, value2, "version"); + return (Criteria) this; + } + + public Criteria andMd5IsNull() { + addCriterion("md5 is null"); + return (Criteria) this; + } + + public Criteria andMd5IsNotNull() { + addCriterion("md5 is not null"); + return (Criteria) this; + } + + public Criteria andMd5EqualTo(String value) { + addCriterion("md5 =", value, "md5"); + return (Criteria) this; + } + + public Criteria andMd5NotEqualTo(String value) { + addCriterion("md5 <>", value, "md5"); + return (Criteria) this; + } + + public Criteria andMd5GreaterThan(String value) { + addCriterion("md5 >", value, "md5"); + return (Criteria) this; + } + + public Criteria andMd5GreaterThanOrEqualTo(String value) { + addCriterion("md5 >=", value, "md5"); + return (Criteria) this; + } + + public Criteria andMd5LessThan(String value) { + addCriterion("md5 <", value, "md5"); + return (Criteria) this; + } + + public Criteria andMd5LessThanOrEqualTo(String value) { + addCriterion("md5 <=", value, "md5"); + return (Criteria) this; + } + + public Criteria andMd5Like(String value) { + addCriterion("md5 like", value, "md5"); + return (Criteria) this; + } + + public Criteria andMd5NotLike(String value) { + addCriterion("md5 not like", value, "md5"); + return (Criteria) this; + } + + public Criteria andMd5In(List values) { + addCriterion("md5 in", values, "md5"); + return (Criteria) this; + } + + public Criteria andMd5NotIn(List values) { + addCriterion("md5 not in", values, "md5"); + return (Criteria) this; + } + + public Criteria andMd5Between(String value1, String value2) { + addCriterion("md5 between", value1, value2, "md5"); + return (Criteria) this; + } + + public Criteria andMd5NotBetween(String value1, String value2) { + addCriterion("md5 not between", value1, value2, "md5"); + return (Criteria) this; + } + + public Criteria andTypeIsNull() { + addCriterion("type is null"); + return (Criteria) this; + } + + public Criteria andTypeIsNotNull() { + addCriterion("type is not null"); + return (Criteria) this; + } + + public Criteria andTypeEqualTo(Integer value) { + addCriterion("type =", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotEqualTo(Integer value) { + addCriterion("type <>", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThan(Integer value) { + addCriterion("type >", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("type >=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThan(Integer value) { + addCriterion("type <", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThanOrEqualTo(Integer value) { + addCriterion("type <=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeIn(List values) { + addCriterion("type in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotIn(List values) { + addCriterion("type not in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeBetween(Integer value1, Integer value2) { + addCriterion("type between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotBetween(Integer value1, Integer value2) { + addCriterion("type not between", value1, value2, "type"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SerialLink.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SerialLink.java new file mode 100644 index 000000000..e77bede89 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SerialLink.java @@ -0,0 +1,120 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; + +public class SerialLink { + private Integer id; + + private String name; + + private Integer sceneId; + + private Boolean enable; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name == null ? null : name.trim(); + } + + public Integer getSceneId() { + return sceneId; + } + + public void setSceneId(Integer sceneId) { + this.sceneId = sceneId; + } + + public Boolean getEnable() { + return enable; + } + + public void setEnable(Boolean enable) { + this.enable = enable; + } + + public enum Column { + id("id", "id", "INTEGER", false), + name("name", "name", "VARCHAR", false), + sceneId("scene_id", "sceneId", "INTEGER", false), + enable("enable", "enable", "BIT", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SerialLinkExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SerialLinkExample.java new file mode 100644 index 000000000..51cbd022b --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SerialLinkExample.java @@ -0,0 +1,450 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class SerialLinkExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public SerialLinkExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andNameIsNull() { + addCriterion("name is null"); + return (Criteria) this; + } + + public Criteria andNameIsNotNull() { + addCriterion("name is not null"); + return (Criteria) this; + } + + public Criteria andNameEqualTo(String value) { + addCriterion("name =", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotEqualTo(String value) { + addCriterion("name <>", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThan(String value) { + addCriterion("name >", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThanOrEqualTo(String value) { + addCriterion("name >=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThan(String value) { + addCriterion("name <", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThanOrEqualTo(String value) { + addCriterion("name <=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLike(String value) { + addCriterion("name like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotLike(String value) { + addCriterion("name not like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameIn(List values) { + addCriterion("name in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameNotIn(List values) { + addCriterion("name not in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameBetween(String value1, String value2) { + addCriterion("name between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNameNotBetween(String value1, String value2) { + addCriterion("name not between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNull() { + addCriterion("scene_id is null"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNotNull() { + addCriterion("scene_id is not null"); + return (Criteria) this; + } + + public Criteria andSceneIdEqualTo(Integer value) { + addCriterion("scene_id =", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotEqualTo(Integer value) { + addCriterion("scene_id <>", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThan(Integer value) { + addCriterion("scene_id >", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThanOrEqualTo(Integer value) { + addCriterion("scene_id >=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThan(Integer value) { + addCriterion("scene_id <", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThanOrEqualTo(Integer value) { + addCriterion("scene_id <=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdIn(List values) { + addCriterion("scene_id in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotIn(List values) { + addCriterion("scene_id not in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdBetween(Integer value1, Integer value2) { + addCriterion("scene_id between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotBetween(Integer value1, Integer value2) { + addCriterion("scene_id not between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andEnableIsNull() { + addCriterion("enable is null"); + return (Criteria) this; + } + + public Criteria andEnableIsNotNull() { + addCriterion("enable is not null"); + return (Criteria) this; + } + + public Criteria andEnableEqualTo(Boolean value) { + addCriterion("enable =", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableNotEqualTo(Boolean value) { + addCriterion("enable <>", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableGreaterThan(Boolean value) { + addCriterion("enable >", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableGreaterThanOrEqualTo(Boolean value) { + addCriterion("enable >=", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableLessThan(Boolean value) { + addCriterion("enable <", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableLessThanOrEqualTo(Boolean value) { + addCriterion("enable <=", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableIn(List values) { + addCriterion("enable in", values, "enable"); + return (Criteria) this; + } + + public Criteria andEnableNotIn(List values) { + addCriterion("enable not in", values, "enable"); + return (Criteria) this; + } + + public Criteria andEnableBetween(Boolean value1, Boolean value2) { + addCriterion("enable between", value1, value2, "enable"); + return (Criteria) this; + } + + public Criteria andEnableNotBetween(Boolean value1, Boolean value2) { + addCriterion("enable not between", value1, value2, "enable"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/Sla.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/Sla.java new file mode 100644 index 000000000..4c1a18cc3 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/Sla.java @@ -0,0 +1,164 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; + +public class Sla { + private Integer id; + + private String name; + + private String note; + + private String businessGroup; + + private Long ctime; + + private Long utime; + + private String creator; + + private String updater; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name == null ? null : name.trim(); + } + + public String getNote() { + return note; + } + + public void setNote(String note) { + this.note = note == null ? null : note.trim(); + } + + public String getBusinessGroup() { + return businessGroup; + } + + public void setBusinessGroup(String businessGroup) { + this.businessGroup = businessGroup == null ? null : businessGroup.trim(); + } + + public Long getCtime() { + return ctime; + } + + public void setCtime(Long ctime) { + this.ctime = ctime; + } + + public Long getUtime() { + return utime; + } + + public void setUtime(Long utime) { + this.utime = utime; + } + + public String getCreator() { + return creator; + } + + public void setCreator(String creator) { + this.creator = creator == null ? null : creator.trim(); + } + + public String getUpdater() { + return updater; + } + + public void setUpdater(String updater) { + this.updater = updater == null ? null : updater.trim(); + } + + public enum Column { + id("id", "id", "INTEGER", false), + name("name", "name", "VARCHAR", false), + note("note", "note", "VARCHAR", false), + businessGroup("business_group", "businessGroup", "VARCHAR", false), + ctime("ctime", "ctime", "BIGINT", false), + utime("utime", "utime", "BIGINT", false), + creator("creator", "creator", "VARCHAR", false), + updater("updater", "updater", "VARCHAR", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SlaExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SlaExample.java new file mode 100644 index 000000000..e4c9c2c9c --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SlaExample.java @@ -0,0 +1,730 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class SlaExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public SlaExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andNameIsNull() { + addCriterion("name is null"); + return (Criteria) this; + } + + public Criteria andNameIsNotNull() { + addCriterion("name is not null"); + return (Criteria) this; + } + + public Criteria andNameEqualTo(String value) { + addCriterion("name =", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotEqualTo(String value) { + addCriterion("name <>", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThan(String value) { + addCriterion("name >", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThanOrEqualTo(String value) { + addCriterion("name >=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThan(String value) { + addCriterion("name <", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThanOrEqualTo(String value) { + addCriterion("name <=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLike(String value) { + addCriterion("name like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotLike(String value) { + addCriterion("name not like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameIn(List values) { + addCriterion("name in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameNotIn(List values) { + addCriterion("name not in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameBetween(String value1, String value2) { + addCriterion("name between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNameNotBetween(String value1, String value2) { + addCriterion("name not between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNoteIsNull() { + addCriterion("note is null"); + return (Criteria) this; + } + + public Criteria andNoteIsNotNull() { + addCriterion("note is not null"); + return (Criteria) this; + } + + public Criteria andNoteEqualTo(String value) { + addCriterion("note =", value, "note"); + return (Criteria) this; + } + + public Criteria andNoteNotEqualTo(String value) { + addCriterion("note <>", value, "note"); + return (Criteria) this; + } + + public Criteria andNoteGreaterThan(String value) { + addCriterion("note >", value, "note"); + return (Criteria) this; + } + + public Criteria andNoteGreaterThanOrEqualTo(String value) { + addCriterion("note >=", value, "note"); + return (Criteria) this; + } + + public Criteria andNoteLessThan(String value) { + addCriterion("note <", value, "note"); + return (Criteria) this; + } + + public Criteria andNoteLessThanOrEqualTo(String value) { + addCriterion("note <=", value, "note"); + return (Criteria) this; + } + + public Criteria andNoteLike(String value) { + addCriterion("note like", value, "note"); + return (Criteria) this; + } + + public Criteria andNoteNotLike(String value) { + addCriterion("note not like", value, "note"); + return (Criteria) this; + } + + public Criteria andNoteIn(List values) { + addCriterion("note in", values, "note"); + return (Criteria) this; + } + + public Criteria andNoteNotIn(List values) { + addCriterion("note not in", values, "note"); + return (Criteria) this; + } + + public Criteria andNoteBetween(String value1, String value2) { + addCriterion("note between", value1, value2, "note"); + return (Criteria) this; + } + + public Criteria andNoteNotBetween(String value1, String value2) { + addCriterion("note not between", value1, value2, "note"); + return (Criteria) this; + } + + public Criteria andBusinessGroupIsNull() { + addCriterion("business_group is null"); + return (Criteria) this; + } + + public Criteria andBusinessGroupIsNotNull() { + addCriterion("business_group is not null"); + return (Criteria) this; + } + + public Criteria andBusinessGroupEqualTo(String value) { + addCriterion("business_group =", value, "businessGroup"); + return (Criteria) this; + } + + public Criteria andBusinessGroupNotEqualTo(String value) { + addCriterion("business_group <>", value, "businessGroup"); + return (Criteria) this; + } + + public Criteria andBusinessGroupGreaterThan(String value) { + addCriterion("business_group >", value, "businessGroup"); + return (Criteria) this; + } + + public Criteria andBusinessGroupGreaterThanOrEqualTo(String value) { + addCriterion("business_group >=", value, "businessGroup"); + return (Criteria) this; + } + + public Criteria andBusinessGroupLessThan(String value) { + addCriterion("business_group <", value, "businessGroup"); + return (Criteria) this; + } + + public Criteria andBusinessGroupLessThanOrEqualTo(String value) { + addCriterion("business_group <=", value, "businessGroup"); + return (Criteria) this; + } + + public Criteria andBusinessGroupLike(String value) { + addCriterion("business_group like", value, "businessGroup"); + return (Criteria) this; + } + + public Criteria andBusinessGroupNotLike(String value) { + addCriterion("business_group not like", value, "businessGroup"); + return (Criteria) this; + } + + public Criteria andBusinessGroupIn(List values) { + addCriterion("business_group in", values, "businessGroup"); + return (Criteria) this; + } + + public Criteria andBusinessGroupNotIn(List values) { + addCriterion("business_group not in", values, "businessGroup"); + return (Criteria) this; + } + + public Criteria andBusinessGroupBetween(String value1, String value2) { + addCriterion("business_group between", value1, value2, "businessGroup"); + return (Criteria) this; + } + + public Criteria andBusinessGroupNotBetween(String value1, String value2) { + addCriterion("business_group not between", value1, value2, "businessGroup"); + return (Criteria) this; + } + + public Criteria andCtimeIsNull() { + addCriterion("ctime is null"); + return (Criteria) this; + } + + public Criteria andCtimeIsNotNull() { + addCriterion("ctime is not null"); + return (Criteria) this; + } + + public Criteria andCtimeEqualTo(Long value) { + addCriterion("ctime =", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotEqualTo(Long value) { + addCriterion("ctime <>", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThan(Long value) { + addCriterion("ctime >", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThanOrEqualTo(Long value) { + addCriterion("ctime >=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThan(Long value) { + addCriterion("ctime <", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThanOrEqualTo(Long value) { + addCriterion("ctime <=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeIn(List values) { + addCriterion("ctime in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotIn(List values) { + addCriterion("ctime not in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeBetween(Long value1, Long value2) { + addCriterion("ctime between", value1, value2, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotBetween(Long value1, Long value2) { + addCriterion("ctime not between", value1, value2, "ctime"); + return (Criteria) this; + } + + public Criteria andUtimeIsNull() { + addCriterion("utime is null"); + return (Criteria) this; + } + + public Criteria andUtimeIsNotNull() { + addCriterion("utime is not null"); + return (Criteria) this; + } + + public Criteria andUtimeEqualTo(Long value) { + addCriterion("utime =", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotEqualTo(Long value) { + addCriterion("utime <>", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeGreaterThan(Long value) { + addCriterion("utime >", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeGreaterThanOrEqualTo(Long value) { + addCriterion("utime >=", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeLessThan(Long value) { + addCriterion("utime <", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeLessThanOrEqualTo(Long value) { + addCriterion("utime <=", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeIn(List values) { + addCriterion("utime in", values, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotIn(List values) { + addCriterion("utime not in", values, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeBetween(Long value1, Long value2) { + addCriterion("utime between", value1, value2, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotBetween(Long value1, Long value2) { + addCriterion("utime not between", value1, value2, "utime"); + return (Criteria) this; + } + + public Criteria andCreatorIsNull() { + addCriterion("creator is null"); + return (Criteria) this; + } + + public Criteria andCreatorIsNotNull() { + addCriterion("creator is not null"); + return (Criteria) this; + } + + public Criteria andCreatorEqualTo(String value) { + addCriterion("creator =", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotEqualTo(String value) { + addCriterion("creator <>", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorGreaterThan(String value) { + addCriterion("creator >", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorGreaterThanOrEqualTo(String value) { + addCriterion("creator >=", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorLessThan(String value) { + addCriterion("creator <", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorLessThanOrEqualTo(String value) { + addCriterion("creator <=", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorLike(String value) { + addCriterion("creator like", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotLike(String value) { + addCriterion("creator not like", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorIn(List values) { + addCriterion("creator in", values, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotIn(List values) { + addCriterion("creator not in", values, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorBetween(String value1, String value2) { + addCriterion("creator between", value1, value2, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotBetween(String value1, String value2) { + addCriterion("creator not between", value1, value2, "creator"); + return (Criteria) this; + } + + public Criteria andUpdaterIsNull() { + addCriterion("updater is null"); + return (Criteria) this; + } + + public Criteria andUpdaterIsNotNull() { + addCriterion("updater is not null"); + return (Criteria) this; + } + + public Criteria andUpdaterEqualTo(String value) { + addCriterion("updater =", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterNotEqualTo(String value) { + addCriterion("updater <>", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterGreaterThan(String value) { + addCriterion("updater >", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterGreaterThanOrEqualTo(String value) { + addCriterion("updater >=", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterLessThan(String value) { + addCriterion("updater <", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterLessThanOrEqualTo(String value) { + addCriterion("updater <=", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterLike(String value) { + addCriterion("updater like", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterNotLike(String value) { + addCriterion("updater not like", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterIn(List values) { + addCriterion("updater in", values, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterNotIn(List values) { + addCriterion("updater not in", values, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterBetween(String value1, String value2) { + addCriterion("updater between", value1, value2, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterNotBetween(String value1, String value2) { + addCriterion("updater not between", value1, value2, "updater"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SlaRule.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SlaRule.java new file mode 100644 index 000000000..92502052a --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SlaRule.java @@ -0,0 +1,219 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.Arrays; + +public class SlaRule { + private Integer id; + + private Integer slaId; + + private String name; + + private String ruleItemType; + + private String ruleItem; + + private String compareCondition; + + private Integer compareValue; + + private Integer degree; + + private String actionLevel; + + private Long ctime; + + private Long utime; + + private String creator; + + private String updater; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getSlaId() { + return slaId; + } + + public void setSlaId(Integer slaId) { + this.slaId = slaId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name == null ? null : name.trim(); + } + + public String getRuleItemType() { + return ruleItemType; + } + + public void setRuleItemType(String ruleItemType) { + this.ruleItemType = ruleItemType == null ? null : ruleItemType.trim(); + } + + public String getRuleItem() { + return ruleItem; + } + + public void setRuleItem(String ruleItem) { + this.ruleItem = ruleItem == null ? null : ruleItem.trim(); + } + + public String getCompareCondition() { + return compareCondition; + } + + public void setCompareCondition(String compareCondition) { + this.compareCondition = compareCondition == null ? null : compareCondition.trim(); + } + + public Integer getCompareValue() { + return compareValue; + } + + public void setCompareValue(Integer compareValue) { + this.compareValue = compareValue; + } + + public Integer getDegree() { + return degree; + } + + public void setDegree(Integer degree) { + this.degree = degree; + } + + public String getActionLevel() { + return actionLevel; + } + + public void setActionLevel(String actionLevel) { + this.actionLevel = actionLevel == null ? null : actionLevel.trim(); + } + + public Long getCtime() { + return ctime; + } + + public void setCtime(Long ctime) { + this.ctime = ctime; + } + + public Long getUtime() { + return utime; + } + + public void setUtime(Long utime) { + this.utime = utime; + } + + public String getCreator() { + return creator; + } + + public void setCreator(String creator) { + this.creator = creator == null ? null : creator.trim(); + } + + public String getUpdater() { + return updater; + } + + public void setUpdater(String updater) { + this.updater = updater == null ? null : updater.trim(); + } + + public enum Column { + id("id", "id", "INTEGER", false), + slaId("sla_id", "slaId", "INTEGER", false), + name("name", "name", "VARCHAR", false), + ruleItemType("rule_item_type", "ruleItemType", "VARCHAR", false), + ruleItem("rule_item", "ruleItem", "VARCHAR", false), + compareCondition("compare_condition", "compareCondition", "VARCHAR", false), + compareValue("compare_value", "compareValue", "INTEGER", false), + degree("degree", "degree", "INTEGER", false), + actionLevel("action_level", "actionLevel", "VARCHAR", false), + ctime("ctime", "ctime", "BIGINT", false), + utime("utime", "utime", "BIGINT", false), + creator("creator", "creator", "VARCHAR", false), + updater("updater", "updater", "VARCHAR", false); + + private static final String BEGINNING_DELIMITER = "\""; + + private static final String ENDING_DELIMITER = "\""; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SlaRuleExample.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SlaRuleExample.java new file mode 100644 index 000000000..4b970defd --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/SlaRuleExample.java @@ -0,0 +1,1050 @@ +package run.mone.mimeter.dashboard.pojo; + +import java.util.ArrayList; +import java.util.List; + +public class SlaRuleExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public SlaRuleExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andSlaIdIsNull() { + addCriterion("sla_id is null"); + return (Criteria) this; + } + + public Criteria andSlaIdIsNotNull() { + addCriterion("sla_id is not null"); + return (Criteria) this; + } + + public Criteria andSlaIdEqualTo(Integer value) { + addCriterion("sla_id =", value, "slaId"); + return (Criteria) this; + } + + public Criteria andSlaIdNotEqualTo(Integer value) { + addCriterion("sla_id <>", value, "slaId"); + return (Criteria) this; + } + + public Criteria andSlaIdGreaterThan(Integer value) { + addCriterion("sla_id >", value, "slaId"); + return (Criteria) this; + } + + public Criteria andSlaIdGreaterThanOrEqualTo(Integer value) { + addCriterion("sla_id >=", value, "slaId"); + return (Criteria) this; + } + + public Criteria andSlaIdLessThan(Integer value) { + addCriterion("sla_id <", value, "slaId"); + return (Criteria) this; + } + + public Criteria andSlaIdLessThanOrEqualTo(Integer value) { + addCriterion("sla_id <=", value, "slaId"); + return (Criteria) this; + } + + public Criteria andSlaIdIn(List values) { + addCriterion("sla_id in", values, "slaId"); + return (Criteria) this; + } + + public Criteria andSlaIdNotIn(List values) { + addCriterion("sla_id not in", values, "slaId"); + return (Criteria) this; + } + + public Criteria andSlaIdBetween(Integer value1, Integer value2) { + addCriterion("sla_id between", value1, value2, "slaId"); + return (Criteria) this; + } + + public Criteria andSlaIdNotBetween(Integer value1, Integer value2) { + addCriterion("sla_id not between", value1, value2, "slaId"); + return (Criteria) this; + } + + public Criteria andNameIsNull() { + addCriterion("name is null"); + return (Criteria) this; + } + + public Criteria andNameIsNotNull() { + addCriterion("name is not null"); + return (Criteria) this; + } + + public Criteria andNameEqualTo(String value) { + addCriterion("name =", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotEqualTo(String value) { + addCriterion("name <>", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThan(String value) { + addCriterion("name >", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThanOrEqualTo(String value) { + addCriterion("name >=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThan(String value) { + addCriterion("name <", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThanOrEqualTo(String value) { + addCriterion("name <=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLike(String value) { + addCriterion("name like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotLike(String value) { + addCriterion("name not like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameIn(List values) { + addCriterion("name in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameNotIn(List values) { + addCriterion("name not in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameBetween(String value1, String value2) { + addCriterion("name between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNameNotBetween(String value1, String value2) { + addCriterion("name not between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andRuleItemTypeIsNull() { + addCriterion("rule_item_type is null"); + return (Criteria) this; + } + + public Criteria andRuleItemTypeIsNotNull() { + addCriterion("rule_item_type is not null"); + return (Criteria) this; + } + + public Criteria andRuleItemTypeEqualTo(String value) { + addCriterion("rule_item_type =", value, "ruleItemType"); + return (Criteria) this; + } + + public Criteria andRuleItemTypeNotEqualTo(String value) { + addCriterion("rule_item_type <>", value, "ruleItemType"); + return (Criteria) this; + } + + public Criteria andRuleItemTypeGreaterThan(String value) { + addCriterion("rule_item_type >", value, "ruleItemType"); + return (Criteria) this; + } + + public Criteria andRuleItemTypeGreaterThanOrEqualTo(String value) { + addCriterion("rule_item_type >=", value, "ruleItemType"); + return (Criteria) this; + } + + public Criteria andRuleItemTypeLessThan(String value) { + addCriterion("rule_item_type <", value, "ruleItemType"); + return (Criteria) this; + } + + public Criteria andRuleItemTypeLessThanOrEqualTo(String value) { + addCriterion("rule_item_type <=", value, "ruleItemType"); + return (Criteria) this; + } + + public Criteria andRuleItemTypeLike(String value) { + addCriterion("rule_item_type like", value, "ruleItemType"); + return (Criteria) this; + } + + public Criteria andRuleItemTypeNotLike(String value) { + addCriterion("rule_item_type not like", value, "ruleItemType"); + return (Criteria) this; + } + + public Criteria andRuleItemTypeIn(List values) { + addCriterion("rule_item_type in", values, "ruleItemType"); + return (Criteria) this; + } + + public Criteria andRuleItemTypeNotIn(List values) { + addCriterion("rule_item_type not in", values, "ruleItemType"); + return (Criteria) this; + } + + public Criteria andRuleItemTypeBetween(String value1, String value2) { + addCriterion("rule_item_type between", value1, value2, "ruleItemType"); + return (Criteria) this; + } + + public Criteria andRuleItemTypeNotBetween(String value1, String value2) { + addCriterion("rule_item_type not between", value1, value2, "ruleItemType"); + return (Criteria) this; + } + + public Criteria andRuleItemIsNull() { + addCriterion("rule_item is null"); + return (Criteria) this; + } + + public Criteria andRuleItemIsNotNull() { + addCriterion("rule_item is not null"); + return (Criteria) this; + } + + public Criteria andRuleItemEqualTo(String value) { + addCriterion("rule_item =", value, "ruleItem"); + return (Criteria) this; + } + + public Criteria andRuleItemNotEqualTo(String value) { + addCriterion("rule_item <>", value, "ruleItem"); + return (Criteria) this; + } + + public Criteria andRuleItemGreaterThan(String value) { + addCriterion("rule_item >", value, "ruleItem"); + return (Criteria) this; + } + + public Criteria andRuleItemGreaterThanOrEqualTo(String value) { + addCriterion("rule_item >=", value, "ruleItem"); + return (Criteria) this; + } + + public Criteria andRuleItemLessThan(String value) { + addCriterion("rule_item <", value, "ruleItem"); + return (Criteria) this; + } + + public Criteria andRuleItemLessThanOrEqualTo(String value) { + addCriterion("rule_item <=", value, "ruleItem"); + return (Criteria) this; + } + + public Criteria andRuleItemLike(String value) { + addCriterion("rule_item like", value, "ruleItem"); + return (Criteria) this; + } + + public Criteria andRuleItemNotLike(String value) { + addCriterion("rule_item not like", value, "ruleItem"); + return (Criteria) this; + } + + public Criteria andRuleItemIn(List values) { + addCriterion("rule_item in", values, "ruleItem"); + return (Criteria) this; + } + + public Criteria andRuleItemNotIn(List values) { + addCriterion("rule_item not in", values, "ruleItem"); + return (Criteria) this; + } + + public Criteria andRuleItemBetween(String value1, String value2) { + addCriterion("rule_item between", value1, value2, "ruleItem"); + return (Criteria) this; + } + + public Criteria andRuleItemNotBetween(String value1, String value2) { + addCriterion("rule_item not between", value1, value2, "ruleItem"); + return (Criteria) this; + } + + public Criteria andCompareConditionIsNull() { + addCriterion("compare_condition is null"); + return (Criteria) this; + } + + public Criteria andCompareConditionIsNotNull() { + addCriterion("compare_condition is not null"); + return (Criteria) this; + } + + public Criteria andCompareConditionEqualTo(String value) { + addCriterion("compare_condition =", value, "compareCondition"); + return (Criteria) this; + } + + public Criteria andCompareConditionNotEqualTo(String value) { + addCriterion("compare_condition <>", value, "compareCondition"); + return (Criteria) this; + } + + public Criteria andCompareConditionGreaterThan(String value) { + addCriterion("compare_condition >", value, "compareCondition"); + return (Criteria) this; + } + + public Criteria andCompareConditionGreaterThanOrEqualTo(String value) { + addCriterion("compare_condition >=", value, "compareCondition"); + return (Criteria) this; + } + + public Criteria andCompareConditionLessThan(String value) { + addCriterion("compare_condition <", value, "compareCondition"); + return (Criteria) this; + } + + public Criteria andCompareConditionLessThanOrEqualTo(String value) { + addCriterion("compare_condition <=", value, "compareCondition"); + return (Criteria) this; + } + + public Criteria andCompareConditionLike(String value) { + addCriterion("compare_condition like", value, "compareCondition"); + return (Criteria) this; + } + + public Criteria andCompareConditionNotLike(String value) { + addCriterion("compare_condition not like", value, "compareCondition"); + return (Criteria) this; + } + + public Criteria andCompareConditionIn(List values) { + addCriterion("compare_condition in", values, "compareCondition"); + return (Criteria) this; + } + + public Criteria andCompareConditionNotIn(List values) { + addCriterion("compare_condition not in", values, "compareCondition"); + return (Criteria) this; + } + + public Criteria andCompareConditionBetween(String value1, String value2) { + addCriterion("compare_condition between", value1, value2, "compareCondition"); + return (Criteria) this; + } + + public Criteria andCompareConditionNotBetween(String value1, String value2) { + addCriterion("compare_condition not between", value1, value2, "compareCondition"); + return (Criteria) this; + } + + public Criteria andCompareValueIsNull() { + addCriterion("compare_value is null"); + return (Criteria) this; + } + + public Criteria andCompareValueIsNotNull() { + addCriterion("compare_value is not null"); + return (Criteria) this; + } + + public Criteria andCompareValueEqualTo(Integer value) { + addCriterion("compare_value =", value, "compareValue"); + return (Criteria) this; + } + + public Criteria andCompareValueNotEqualTo(Integer value) { + addCriterion("compare_value <>", value, "compareValue"); + return (Criteria) this; + } + + public Criteria andCompareValueGreaterThan(Integer value) { + addCriterion("compare_value >", value, "compareValue"); + return (Criteria) this; + } + + public Criteria andCompareValueGreaterThanOrEqualTo(Integer value) { + addCriterion("compare_value >=", value, "compareValue"); + return (Criteria) this; + } + + public Criteria andCompareValueLessThan(Integer value) { + addCriterion("compare_value <", value, "compareValue"); + return (Criteria) this; + } + + public Criteria andCompareValueLessThanOrEqualTo(Integer value) { + addCriterion("compare_value <=", value, "compareValue"); + return (Criteria) this; + } + + public Criteria andCompareValueIn(List values) { + addCriterion("compare_value in", values, "compareValue"); + return (Criteria) this; + } + + public Criteria andCompareValueNotIn(List values) { + addCriterion("compare_value not in", values, "compareValue"); + return (Criteria) this; + } + + public Criteria andCompareValueBetween(Integer value1, Integer value2) { + addCriterion("compare_value between", value1, value2, "compareValue"); + return (Criteria) this; + } + + public Criteria andCompareValueNotBetween(Integer value1, Integer value2) { + addCriterion("compare_value not between", value1, value2, "compareValue"); + return (Criteria) this; + } + + public Criteria andDegreeIsNull() { + addCriterion("degree is null"); + return (Criteria) this; + } + + public Criteria andDegreeIsNotNull() { + addCriterion("degree is not null"); + return (Criteria) this; + } + + public Criteria andDegreeEqualTo(Integer value) { + addCriterion("degree =", value, "degree"); + return (Criteria) this; + } + + public Criteria andDegreeNotEqualTo(Integer value) { + addCriterion("degree <>", value, "degree"); + return (Criteria) this; + } + + public Criteria andDegreeGreaterThan(Integer value) { + addCriterion("degree >", value, "degree"); + return (Criteria) this; + } + + public Criteria andDegreeGreaterThanOrEqualTo(Integer value) { + addCriterion("degree >=", value, "degree"); + return (Criteria) this; + } + + public Criteria andDegreeLessThan(Integer value) { + addCriterion("degree <", value, "degree"); + return (Criteria) this; + } + + public Criteria andDegreeLessThanOrEqualTo(Integer value) { + addCriterion("degree <=", value, "degree"); + return (Criteria) this; + } + + public Criteria andDegreeIn(List values) { + addCriterion("degree in", values, "degree"); + return (Criteria) this; + } + + public Criteria andDegreeNotIn(List values) { + addCriterion("degree not in", values, "degree"); + return (Criteria) this; + } + + public Criteria andDegreeBetween(Integer value1, Integer value2) { + addCriterion("degree between", value1, value2, "degree"); + return (Criteria) this; + } + + public Criteria andDegreeNotBetween(Integer value1, Integer value2) { + addCriterion("degree not between", value1, value2, "degree"); + return (Criteria) this; + } + + public Criteria andActionLevelIsNull() { + addCriterion("action_level is null"); + return (Criteria) this; + } + + public Criteria andActionLevelIsNotNull() { + addCriterion("action_level is not null"); + return (Criteria) this; + } + + public Criteria andActionLevelEqualTo(String value) { + addCriterion("action_level =", value, "actionLevel"); + return (Criteria) this; + } + + public Criteria andActionLevelNotEqualTo(String value) { + addCriterion("action_level <>", value, "actionLevel"); + return (Criteria) this; + } + + public Criteria andActionLevelGreaterThan(String value) { + addCriterion("action_level >", value, "actionLevel"); + return (Criteria) this; + } + + public Criteria andActionLevelGreaterThanOrEqualTo(String value) { + addCriterion("action_level >=", value, "actionLevel"); + return (Criteria) this; + } + + public Criteria andActionLevelLessThan(String value) { + addCriterion("action_level <", value, "actionLevel"); + return (Criteria) this; + } + + public Criteria andActionLevelLessThanOrEqualTo(String value) { + addCriterion("action_level <=", value, "actionLevel"); + return (Criteria) this; + } + + public Criteria andActionLevelLike(String value) { + addCriterion("action_level like", value, "actionLevel"); + return (Criteria) this; + } + + public Criteria andActionLevelNotLike(String value) { + addCriterion("action_level not like", value, "actionLevel"); + return (Criteria) this; + } + + public Criteria andActionLevelIn(List values) { + addCriterion("action_level in", values, "actionLevel"); + return (Criteria) this; + } + + public Criteria andActionLevelNotIn(List values) { + addCriterion("action_level not in", values, "actionLevel"); + return (Criteria) this; + } + + public Criteria andActionLevelBetween(String value1, String value2) { + addCriterion("action_level between", value1, value2, "actionLevel"); + return (Criteria) this; + } + + public Criteria andActionLevelNotBetween(String value1, String value2) { + addCriterion("action_level not between", value1, value2, "actionLevel"); + return (Criteria) this; + } + + public Criteria andCtimeIsNull() { + addCriterion("ctime is null"); + return (Criteria) this; + } + + public Criteria andCtimeIsNotNull() { + addCriterion("ctime is not null"); + return (Criteria) this; + } + + public Criteria andCtimeEqualTo(Long value) { + addCriterion("ctime =", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotEqualTo(Long value) { + addCriterion("ctime <>", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThan(Long value) { + addCriterion("ctime >", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeGreaterThanOrEqualTo(Long value) { + addCriterion("ctime >=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThan(Long value) { + addCriterion("ctime <", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeLessThanOrEqualTo(Long value) { + addCriterion("ctime <=", value, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeIn(List values) { + addCriterion("ctime in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotIn(List values) { + addCriterion("ctime not in", values, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeBetween(Long value1, Long value2) { + addCriterion("ctime between", value1, value2, "ctime"); + return (Criteria) this; + } + + public Criteria andCtimeNotBetween(Long value1, Long value2) { + addCriterion("ctime not between", value1, value2, "ctime"); + return (Criteria) this; + } + + public Criteria andUtimeIsNull() { + addCriterion("utime is null"); + return (Criteria) this; + } + + public Criteria andUtimeIsNotNull() { + addCriterion("utime is not null"); + return (Criteria) this; + } + + public Criteria andUtimeEqualTo(Long value) { + addCriterion("utime =", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotEqualTo(Long value) { + addCriterion("utime <>", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeGreaterThan(Long value) { + addCriterion("utime >", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeGreaterThanOrEqualTo(Long value) { + addCriterion("utime >=", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeLessThan(Long value) { + addCriterion("utime <", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeLessThanOrEqualTo(Long value) { + addCriterion("utime <=", value, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeIn(List values) { + addCriterion("utime in", values, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotIn(List values) { + addCriterion("utime not in", values, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeBetween(Long value1, Long value2) { + addCriterion("utime between", value1, value2, "utime"); + return (Criteria) this; + } + + public Criteria andUtimeNotBetween(Long value1, Long value2) { + addCriterion("utime not between", value1, value2, "utime"); + return (Criteria) this; + } + + public Criteria andCreatorIsNull() { + addCriterion("creator is null"); + return (Criteria) this; + } + + public Criteria andCreatorIsNotNull() { + addCriterion("creator is not null"); + return (Criteria) this; + } + + public Criteria andCreatorEqualTo(String value) { + addCriterion("creator =", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotEqualTo(String value) { + addCriterion("creator <>", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorGreaterThan(String value) { + addCriterion("creator >", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorGreaterThanOrEqualTo(String value) { + addCriterion("creator >=", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorLessThan(String value) { + addCriterion("creator <", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorLessThanOrEqualTo(String value) { + addCriterion("creator <=", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorLike(String value) { + addCriterion("creator like", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotLike(String value) { + addCriterion("creator not like", value, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorIn(List values) { + addCriterion("creator in", values, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotIn(List values) { + addCriterion("creator not in", values, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorBetween(String value1, String value2) { + addCriterion("creator between", value1, value2, "creator"); + return (Criteria) this; + } + + public Criteria andCreatorNotBetween(String value1, String value2) { + addCriterion("creator not between", value1, value2, "creator"); + return (Criteria) this; + } + + public Criteria andUpdaterIsNull() { + addCriterion("updater is null"); + return (Criteria) this; + } + + public Criteria andUpdaterIsNotNull() { + addCriterion("updater is not null"); + return (Criteria) this; + } + + public Criteria andUpdaterEqualTo(String value) { + addCriterion("updater =", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterNotEqualTo(String value) { + addCriterion("updater <>", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterGreaterThan(String value) { + addCriterion("updater >", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterGreaterThanOrEqualTo(String value) { + addCriterion("updater >=", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterLessThan(String value) { + addCriterion("updater <", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterLessThanOrEqualTo(String value) { + addCriterion("updater <=", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterLike(String value) { + addCriterion("updater like", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterNotLike(String value) { + addCriterion("updater not like", value, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterIn(List values) { + addCriterion("updater in", values, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterNotIn(List values) { + addCriterion("updater not in", values, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterBetween(String value1, String value2) { + addCriterion("updater between", value1, value2, "updater"); + return (Criteria) this; + } + + public Criteria andUpdaterNotBetween(String value1, String value2) { + addCriterion("updater not between", value1, value2, "updater"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/common/Pageable.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/common/Pageable.java new file mode 100644 index 000000000..2963666ae --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/pojo/common/Pageable.java @@ -0,0 +1,13 @@ +package run.mone.mimeter.dashboard.pojo.common; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/6/22 + */ +public interface Pageable { + + void setLimit(Integer limit); + + void setOffset(Long offset); +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/AgentService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/AgentService.java new file mode 100644 index 000000000..1a2d2599a --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/AgentService.java @@ -0,0 +1,46 @@ +package run.mone.mimeter.dashboard.service; + +import com.xiaomi.mone.tpc.common.vo.OrgInfoVo; +import run.mone.mimeter.dashboard.bo.agent.*; +import run.mone.mimeter.dashboard.bo.common.Result; + +import java.util.List; + +public interface AgentService { + Result> getAgentListByTenant(String tenant); + + Result getAllAgentList(GetAgentListReq req); + + Result getApplyList(GetApplyListReq req); + + Result> getOrgList(String keyword); + + Result> getAllAvailableAgentList(); + + Result applyAgent(AgentApplyReq req); + + Result refuseApply(Integer applyID); + + Result approveApply(Integer applyID); + + Result tenantForAgent(TenantForAgentReq req); + + Result applyAgentDomain(List req); + + Result applyAgentDomainByRate(DomainApplyByRateReq req); + + Result getDomainApplyList(GetApplyListReq req); + + Result approveDomainApply(Integer applyID); + + Result refuseDomainApply(Integer applyID); + + Result hostForAgent(HostForAgentReq req); + + Result delHostForAgents(DelHostForAgentsReq req); + + Result getAgentHostsFile(LoadHostsFileReq req); + + Result syncDomainConf(); + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/BenchMonitorService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/BenchMonitorService.java new file mode 100644 index 000000000..16533b445 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/BenchMonitorService.java @@ -0,0 +1,12 @@ +package run.mone.mimeter.dashboard.service; + +import run.mone.mimeter.dashboard.bo.scene.SceneTaskAppsBo; +import run.mone.mimeter.dashboard.bo.agent.AgentMonitorBo; +import run.mone.mimeter.dashboard.bo.common.Result; + +public interface BenchMonitorService { + Result getAppListByReportID(Integer sceneId,String reportId,Boolean realTime); + + Result getAgentInfosByReport(String reportId, Boolean realTime); + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/DatasetService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/DatasetService.java new file mode 100644 index 000000000..7b33305f5 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/DatasetService.java @@ -0,0 +1,54 @@ +package run.mone.mimeter.dashboard.service; + +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.dataset.*; +import run.mone.mimeter.dashboard.pojo.Dataset; + +import java.util.List; +import java.util.Set; +import java.util.TreeMap; + +public interface DatasetService { + + /** + * sla + */ + Result newDataset(DatasetDto param); + + Result> multiNewDataset(List param); + + Result updateDataset(DatasetDto param); + + Result multiUpdateDataset(List param); + + Result getDatasetList(GetDatasetListReq req); + + Result> getDatasetListByIds(List datasetIds); + + Result getDatasetById(int id); + + Result delDataset(int id); + + Result multiDelDataset(List ids); + + Result bindScene(int datasetId, int sceneId); + + Result bindDataSetsByScene(List datasetIds, Set refDatasetIds, int sceneId); + + Result unbindScene(int datasetId, int sceneId); + + Result filePreview(int id); + + Result> getParamDataByIds(List ids); + + Result> getParamDataBySceneId(Integer sceneId); + + List getDatasetIdsBySceneId(Integer sceneId); + + Result sceneFileDetail(Integer sceneId); + + TreeMap> getParamDataMap(List reqList); + + boolean syncTenant(); + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/EsLogService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/EsLogService.java new file mode 100644 index 000000000..3ebd32e0e --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/EsLogService.java @@ -0,0 +1,18 @@ +package run.mone.mimeter.dashboard.service; + +import run.mone.mimeter.dashboard.bo.common.PagedResp; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.report.ReqRespLogRecord; +import run.mone.mimeter.dashboard.bo.report.SearchApiLogReq; + +import java.util.List; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/7/6 + */ +public interface EsLogService { + + Result>> searchApiLogs(SearchApiLogReq req); +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/OperationLogService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/OperationLogService.java new file mode 100644 index 000000000..d47b7c99f --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/OperationLogService.java @@ -0,0 +1,22 @@ +package run.mone.mimeter.dashboard.service; + +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.operationlog.GetOperationLogListReq; +import run.mone.mimeter.dashboard.bo.operationlog.OperationLogDto; +import run.mone.mimeter.dashboard.bo.operationlog.OperationLogList; +import run.mone.mimeter.dashboard.bo.sla.GetSlaListReq; +import run.mone.mimeter.dashboard.bo.sla.SlaDto; +import run.mone.mimeter.dashboard.bo.sla.SlaList; + +import java.util.List; + +public interface OperationLogService { + + /** + * sla + */ + void newOperationLog(OperationLogDto param); + + Result getOperationLogList(GetOperationLogListReq req); + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/ReportInfoService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/ReportInfoService.java new file mode 100644 index 000000000..00dde1c47 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/ReportInfoService.java @@ -0,0 +1,26 @@ +package run.mone.mimeter.dashboard.service; + +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.report.ReportInfoBo; + +import java.util.List; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/6/22 + */ +public interface ReportInfoService { + + Result> listReports(String tenant, String keyword, Integer pageNo, Integer pageSize); + + Result countReports(String tenant, String keyword, Integer pageNo, Integer pageSize); + + Result getReportDetails(Long sceneId, String reportId); + + Result createReport(ReportInfoBo bo); + + Result removeReports(List reportIds); + + Result updateReport(ReportInfoBo bo); +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/SceneApiService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/SceneApiService.java new file mode 100644 index 000000000..ad1feb3da --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/SceneApiService.java @@ -0,0 +1,41 @@ +package run.mone.mimeter.dashboard.service; + +import com.alibaba.nacos.api.exception.NacosException; +import run.mone.mimeter.dashboard.bo.DubboService; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.scene.DefaultSceneInfo; +import run.mone.mimeter.dashboard.bo.scene.DubboApiInfoDTO; +import run.mone.mimeter.dashboard.bo.scene.HttpApiInfoDTO; +import run.mone.mimeter.dashboard.bo.sceneapi.GetApiDetailReq; +import run.mone.mimeter.dashboard.bo.sceneapi.SceneApiInfoItemBasic; + +import java.util.List; + +public interface SceneApiService { + Result searchApiFromMiApi(String keyword, Integer apiProtocol); + + Result getApiDetailFromMiApi(GetApiDetailReq getApiDetailReq); + + Result getSceneBasicInfoFromApiID(GetApiDetailReq req); + + boolean newHttpSceneApis(List httpApiInfoDTOS, int sceneId,int serialLinkId); + + boolean updateHttpSceneApi(HttpApiInfoDTO httpApiInfoDTO); + + boolean updateDubboSceneApi(DubboApiInfoDTO dubboApiInfoDTO); + + boolean newDubboSceneApis(List dubboApiInfoDTOS, int sceneId,int serialLinkId); + + boolean deleteSceneApisBySceneId(int sceneId); + + boolean deleteSceneApisBySerialLinkId(int serialLinkId); + + Result> loadDubboApiServices(String keyword, String env); + + Result> getServiceMethod(String serviceName, String env) throws NacosException; + + List getBasicInfosByIds(List apiIdList); + + Result getApiUrlById(Integer apiId); + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/SceneGroupService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/SceneGroupService.java new file mode 100644 index 000000000..7697a9fd2 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/SceneGroupService.java @@ -0,0 +1,14 @@ +package run.mone.mimeter.dashboard.service; + +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.scene.CreateSceneDTO; +import run.mone.mimeter.dashboard.bo.scene.EditSceneDTO; +import run.mone.mimeter.dashboard.bo.scenegroup.SceneGroupDTO; + +public interface SceneGroupService { + Result newSceneGroup(SceneGroupDTO sceneGroupDTO, String opUser); + + Result delSceneGroup(SceneGroupDTO sceneGroupDTO, String opUser); + + Result editSceneGroup(SceneGroupDTO sceneGroupDTO, String opUser); +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/SceneService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/SceneService.java new file mode 100644 index 000000000..79b0a39ad --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/SceneService.java @@ -0,0 +1,34 @@ +package run.mone.mimeter.dashboard.service; + +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.dataset.SceneParamData; +import run.mone.mimeter.dashboard.bo.scene.*; +import run.mone.mimeter.dashboard.bo.scenegroup.GetSceneGroupListReq; +import run.mone.mimeter.dashboard.bo.scenegroup.SceneGroupList; +import run.mone.mimeter.dashboard.pojo.SceneInfo; + +import java.util.List; + +public interface SceneService { + Result newScene(CreateSceneDTO createSceneReq, String opUser); + + Result delScene(Integer sceneID, String opUser); + + Result editScene(EditSceneDTO editSceneReq, String opUser); + + Result getSceneByID(Integer sceneID,boolean engine); + + Result getSceneList(GetSceneListReq req); + + Result> getSceneListByIds(GetSceneListByIdsReq req); + + Result getSceneListByGroup(GetSceneGroupListReq req); + + Result> getSceneInfoByIds(List sceneIds); + + Result getSceneParamData(Integer sceneId); + + Result getSceneListByKeyword(GetSceneListReq req); + + List getSerialLinksByIds(List serialIds); +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/SceneSnapshotService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/SceneSnapshotService.java new file mode 100644 index 000000000..5a92d418e --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/SceneSnapshotService.java @@ -0,0 +1,31 @@ +package run.mone.mimeter.dashboard.service; + +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.scene.SceneSnapshotBo; + +import java.util.List; +import java.util.Map; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/6/23 + */ +public interface SceneSnapshotService { + + Result getSceneSnapshotById(String snapshotId); + + /** + * only return meta data; does not contain scene data + */ + Result getSceneSnapshotByScene(Long sceneId); + + /** + * return scene data as well + */ + Result getSceneSnapshotDetailByScene(Long sceneId); + + Result createSnapshot(SceneSnapshotBo bo); + + Map sceneNameMapFromIds(List snapshotIds); +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/SlaService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/SlaService.java new file mode 100644 index 000000000..0e94eadae --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/SlaService.java @@ -0,0 +1,27 @@ +package run.mone.mimeter.dashboard.service; + +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.sla.GetSlaListReq; +import run.mone.mimeter.dashboard.bo.sla.SlaDto; +import run.mone.mimeter.dashboard.bo.sla.SlaList; + +import java.util.List; + +public interface SlaService { + + /** + * sla + */ + Result newSla(SlaDto param); + + Result updateSla(SlaDto param); + + Result getSlaList(GetSlaListReq req); + + Result getSlaById(int id); + + Result delSla(int id); + + Result multiDelSla(List ids); + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/TaskService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/TaskService.java new file mode 100644 index 000000000..3baa182da --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/TaskService.java @@ -0,0 +1,30 @@ +package run.mone.mimeter.dashboard.service; + +import run.mone.mimeter.dashboard.bo.ChangeQpsReq; +import run.mone.mimeter.dashboard.bo.DubboSceneDebugResult; +import run.mone.mimeter.dashboard.bo.HttpSceneDebugResult; +import run.mone.mimeter.dashboard.bo.SubmitTaskRes; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.task.SceneRpsRateReq; +import run.mone.mimeter.dashboard.bo.task.TaskDTO; +import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; + +import java.util.List; +import java.util.TreeMap; + +public interface TaskService { + + Result submitTask(TaskDTO taskDTO, String opUser); + + Result stopTask(Integer type,TaskDTO taskDTO,String opUser); + + Result manualUpdateRps(ChangeQpsReq req); + + Result manualUpdateSceneRpsRate(SceneRpsRateReq req); + + Result>> getHttpSceneDebugResultByTaskId(String reportId, String opUser); + + Result>> getDubboSceneDebugResultByTaskId(String reportId, String opUser); + + SseEmitter stream(String reportId, String username); +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/AgentServiceImpl.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/AgentServiceImpl.java new file mode 100644 index 000000000..48c2ff2ba --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/AgentServiceImpl.java @@ -0,0 +1,680 @@ +package run.mone.mimeter.dashboard.service.impl; + +import com.alibaba.nacos.api.config.annotation.NacosValue; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.xiaomi.mone.tpc.api.service.NodeFacade; +import com.xiaomi.mone.tpc.api.service.UserOrgFacade; +import com.xiaomi.mone.tpc.common.param.NodeOrgQryParam; +import com.xiaomi.mone.tpc.common.param.NullParam; +import com.xiaomi.mone.tpc.common.vo.OrgInfoVo; +import com.xiaomi.mone.tpc.common.vo.PageDataVo; +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import run.mone.mimeter.dashboard.bo.agent.*; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.common.HttpDao; +import run.mone.mimeter.dashboard.common.HttpResult; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.mapper.AgentApplyInfoMapper; +import run.mone.mimeter.dashboard.mapper.AgentInfoMapper; +import run.mone.mimeter.dashboard.mapper.DomainApplyInfoMapper; +import run.mone.mimeter.dashboard.service.AgentService; +import run.mone.mimeter.dashboard.pojo.*; + +import javax.annotation.PostConstruct; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Collectors; + +import static run.mone.mimeter.dashboard.bo.common.Constants.DEFAULT_PAGE_SIZE; + +@Service +@Slf4j +public class AgentServiceImpl implements AgentService { + + private final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); + + private final ExecutorService pool = Executors.newSingleThreadExecutor(); + + @Autowired + private AgentInfoMapper agentInfoMapper; + + @Autowired + private AgentApplyInfoMapper agentApplyInfoMapper; + + @Autowired + private DomainApplyInfoMapper domainApplyInfoMapper; + @DubboReference(registry = "stRegistry", check = false, group = "staging-open", version = "1.0") + private UserOrgFacade userOrgFacade; + + @DubboReference(registry = "stRegistry", check = false, group = "staging-open", version = "1.0") + private NodeFacade nodeFacade; + + /** + * 心跳超时 15s + */ + private static final int timeout_period = 15 * 1000; + + private static final Gson gson = new Gson(); + + /** + * 公用租户 + */ + private static final String PUB_TENANT = "MI"; + + + /** + * bench manager addr + */ + @NacosValue(autoRefreshed = true, value = "${bench.api_manager_url}") + private String apiSvrUrl; + + @Autowired + private HttpDao httpDao; + + /** + * 每 10s 检查agent机器状态 + */ + @PostConstruct + public void init() { + executorService.scheduleAtFixedRate(this::checkAgentStatus, 0, 30, TimeUnit.SECONDS); + } + + public void checkAgentStatus() { + try { + long now = System.currentTimeMillis(); + AgentInfoExample example = new AgentInfoExample(); + example.createCriteria().andIpIsNotNull(); + List agentInfos = agentInfoMapper.selectByExample(example); + agentInfos.forEach(agentInfo -> { + long lastBeatTime = agentInfo.getUtime(); + if ((now - lastBeatTime) >= timeout_period) { + agentInfo.setEnable(false); + agentInfoMapper.updateByPrimaryKey(agentInfo); + } + }); + } catch (Throwable ex) { + log.error(ex.getMessage()); + } + } + + @Override + public Result> getAgentListByTenant(String tenant) { + AgentInfoExample example = new AgentInfoExample(); + example.createCriteria().andTenantEqualTo(tenant).andIpIsNotNull().andEnableEqualTo(true); + example.or(example.createCriteria().andTenantEqualTo(PUB_TENANT).andIpIsNotNull().andEnableEqualTo(true)); + List agentInfos = agentInfoMapper.selectByExampleWithBLOBs(example); + + return Result.success(agentInfos.stream().map(agentInfo -> { + AgentDTO agentDTO = new AgentDTO(); + BeanUtils.copyProperties(agentInfo, agentDTO); + if (agentInfo.getDomainConf() != null) { + agentDTO.setDomainConfs(gson.fromJson(agentInfo.getDomainConf(), new TypeToken>() { + }.getType())); + } else { + agentDTO.setDomainConfs(new ArrayList<>()); + } + return agentDTO; + }).collect(Collectors.toList())); + } + + @Override + public Result getAllAgentList(GetAgentListReq req) { + if (req.getPage() <= 0) { + req.setPage(1); + } + if (req.getPageSize() <= 0) { + req.setPageSize(DEFAULT_PAGE_SIZE); + } + int offset = (req.getPage() - 1) * req.getPageSize(); + + AgentInfoExample totalExp = new AgentInfoExample(); + totalExp.createCriteria().andIpIsNotNull().andNodeIpIsNotNull().andEnableEqualTo(true); + + AgentInfoExample example = new AgentInfoExample(); + example.createCriteria().andIpIsNotNull().andNodeIpIsNotNull().andEnableEqualTo(true); + example.setOrderByClause("id desc limit " + req.getPageSize() + " offset " + offset); + + List agentInfos = agentInfoMapper.selectByExampleWithBLOBs(example); + + AgentDTOList agentDTOList = new AgentDTOList(); + agentDTOList.setPage(req.getPage()); + agentDTOList.setPageSize(req.getPageSize()); + + List list = agentInfos.stream().map(agentInfo -> { + AgentDTO agentDTO = new AgentDTO(); + BeanUtils.copyProperties(agentInfo, agentDTO); + if (agentInfo.getDomainConf() != null) { + agentDTO.setDomainConfs(gson.fromJson(agentInfo.getDomainConf(), new TypeToken>() { + }.getType())); + } else { + agentDTO.setDomainConfs(new ArrayList<>()); + } + return agentDTO; + }).collect(Collectors.toList()); + + agentDTOList.setList(list); + agentDTOList.setTotal(agentInfoMapper.countByExample(totalExp)); + + return Result.success(agentDTOList); + } + + @Override + public Result getApplyList(GetApplyListReq req) { + if (req.getPage() <= 0) { + req.setPage(1); + } + if (req.getPageSize() <= 0) { + req.setPageSize(DEFAULT_PAGE_SIZE); + } + int offset = (req.getPage() - 1) * req.getPageSize(); + + AgentApplyInfoExample totalExp = new AgentApplyInfoExample(); + AgentApplyInfoExample.Criteria totalCriteria = totalExp.createCriteria(); + + AgentApplyInfoExample applyInfoExample = new AgentApplyInfoExample(); + AgentApplyInfoExample.Criteria exampleCriteria = applyInfoExample.createCriteria(); + + if (req.getApplyUser() != null && !req.getApplyUser().equals("")) { + exampleCriteria.andApplyUserEqualTo(req.getApplyUser()); + totalCriteria.andApplyUserEqualTo(req.getApplyUser()); + } + + if (req.getApplyStatus() != null) { + exampleCriteria.andApplyStatusEqualTo(req.getApplyStatus()); + totalCriteria.andApplyStatusEqualTo(req.getApplyStatus()); + } + applyInfoExample.setOrderByClause("id desc limit " + req.getPageSize() + " offset " + offset); + + AgentApplyList agentApplyList = new AgentApplyList(); + agentApplyList.setPage(req.getPage()); + agentApplyList.setPageSize(req.getPageSize()); + + List applyInfoList = agentApplyInfoMapper.selectByExample(applyInfoExample); + if (applyInfoList == null || applyInfoList.size() == 0) { + return Result.success(agentApplyList); + } + List applyDTOS = new ArrayList<>(applyInfoList.size()); + + applyInfoList.forEach(agentApplyInfo -> { + AgentApplyDTO dto = new AgentApplyDTO(); + BeanUtils.copyProperties(agentApplyInfo, dto); + applyDTOS.add(dto); + }); + agentApplyList.setList(applyDTOS); + agentApplyList.setTotal(agentApplyInfoMapper.countByExample(totalExp)); + return Result.success(agentApplyList); + } + + @Override + public Result> getOrgList(String keyword) { + NodeOrgQryParam param = new NodeOrgQryParam(); + param.setAccount("system"); + param.setUserType(0); + param.setOrgName(keyword); + PageDataVo vo = nodeFacade.orgList(param).getData(); + return Result.success(vo.getList()); + } + + @Override + public Result> getAllAvailableAgentList() { + AgentInfoExample example = new AgentInfoExample(); + example.createCriteria().andIpIsNotNull().andNodeIpIsNotNull().andEnableEqualTo(true).andTenantIsNull(); + example.or(example.createCriteria().andIpIsNotNull().andNodeIpIsNotNull().andEnableEqualTo(true).andTenantEqualTo("")); + List agentInfos = agentInfoMapper.selectByExample(example); + + return Result.success(agentInfos.stream().map(agentInfo -> { + AgentDTO agentDTO = new AgentDTO(); + BeanUtils.copyProperties(agentInfo, agentDTO); + return agentDTO; + }).collect(Collectors.toList())); + } + + @Override + public Result applyAgent(AgentApplyReq req) { + req.getAgentIDs().forEach(agentId -> { + AgentInfo agentInfo = agentInfoMapper.selectByPrimaryKey(agentId); + if (agentInfo == null) { + return; + } + NullParam param = new NullParam(); + param.setAccount(req.getApplier()); + param.setUserType(0); + OrgInfoVo orgInfoVo = userOrgFacade.getOrgByAccount(param).getData(); + if (orgInfoVo == null) { + return; + } + AgentApplyInfoExample example = new AgentApplyInfoExample(); + //该组织已申请过该机器,待审核 + example.createCriteria().andAgentIpEqualTo(agentInfo.getNodeIp()).andApplyOrgIdEqualTo(orgInfoVo.getIdPath()).andApplyStatusEqualTo(ApplyStatusEnum.UnAuditing.statusCode); + List applyInfos = agentApplyInfoMapper.selectByExample(example); + if (applyInfos != null && applyInfos.size() != 0) { + return; + } + AgentApplyInfo apply = new AgentApplyInfo(); + apply.setApplyUser(req.getApplier()); + apply.setApplyOrgId(orgInfoVo.getIdPath()); + apply.setApplyOrgName(orgInfoVo.getNamePath()); + apply.setAgentIp(agentInfo.getNodeIp()); + apply.setAgentHostname(agentInfo.getHostname()); + apply.setApplyStatus(ApplyStatusEnum.UnAuditing.statusCode); + apply.setCtime(System.currentTimeMillis()); + + agentApplyInfoMapper.insert(apply); + }); + + return Result.success(true); + } + + @Override + public Result refuseApply(Integer applyID) { + AgentApplyInfo applyInfo = agentApplyInfoMapper.selectByPrimaryKey(applyID); + if (applyInfo == null) { + return Result.fail(CommonError.InvalidParamError); + } + applyInfo.setApplyStatus(ApplyStatusEnum.ApplyRefuse.statusCode); + agentApplyInfoMapper.updateByPrimaryKey(applyInfo); + + return Result.success(true); + } + + @Override + @Transactional + public Result approveApply(Integer applyID) { + AgentApplyInfo applyInfo = agentApplyInfoMapper.selectByPrimaryKey(applyID); + if (applyInfo == null) { + return Result.fail(CommonError.InvalidParamError); + } + AgentInfoExample example = new AgentInfoExample(); + example.createCriteria().andNodeIpEqualTo(applyInfo.getAgentIp()); + List agentInfo = agentInfoMapper.selectByExample(example); + if (agentInfo == null || agentInfo.size() != 1) { + return Result.fail(CommonError.InvalidParamError); + } + AgentInfo agent = agentInfo.get(0); + if (agent.getTenant() != null && !agent.getTenant().equals("")) { + return Result.fail(CommonError.AgentAlreadyGetTenant); + } + agent.setTenant(applyInfo.getApplyOrgId()); + agent.setTenantCn(applyInfo.getApplyOrgName()); + agentInfoMapper.updateByPrimaryKey(agent); + + //更新工单 + applyInfo.setApplyStatus(ApplyStatusEnum.ApplyPass.statusCode); + agentApplyInfoMapper.updateByPrimaryKey(applyInfo); + return Result.success(true); + } + + @Override + public Result tenantForAgent(TenantForAgentReq req) { + AgentInfo agentInfo = agentInfoMapper.selectByPrimaryKey(req.getAgentID()); + if (agentInfo == null) { + return Result.fail(CommonError.InvalidParamError); + } + agentInfo.setTenant(req.getTenant()); + agentInfo.setTenantCn(req.getTenantCn()); + + agentInfoMapper.updateByPrimaryKey(agentInfo); + return Result.success(true); + } + + @Override + public Result applyAgentDomain(List req) { + List domainApplyInfoList = new ArrayList<>(); + AtomicBoolean errorIp = new AtomicBoolean(false); + req.forEach(domainApplyReq -> { + domainApplyReq.getAgentIPs().forEach(agentIp -> { + AgentInfoExample example = new AgentInfoExample(); + example.createCriteria().andIpEqualTo(agentIp); + List agentInfos = agentInfoMapper.selectByExample(example); + if (agentInfos == null || agentInfos.size() == 0) { + errorIp.set(true); + } + }); + + if (errorIp.get()) { + return; + } + DomainApplyInfo apply = new DomainApplyInfo(); + apply.setApplyStatus(ApplyStatusEnum.UnAuditing.statusCode); + apply.setApplyUser(domainApplyReq.getApplier()); + apply.setCtime(System.currentTimeMillis()); + apply.setDomain(domainApplyReq.getDomain()); + apply.setIp(domainApplyReq.getIp()); + + apply.setAgentIpList(gson.toJson(domainApplyReq.getAgentIPs())); + domainApplyInfoList.add(apply); + }); + if (errorIp.get()) { + return Result.fail(CommonError.InvalidParamError); + } + domainApplyInfoMapper.batchInsert(domainApplyInfoList); + + return Result.success(true); + } + + @Override + public Result applyAgentDomainByRate(DomainApplyByRateReq req) { + List domainApplyReqList = new ArrayList<>(req.getDomainIpAndRates().size()); + //申请的全部机器 + List agentIps = req.getAgentIPs(); + if (agentIps.size() == 0 || agentIps.size() == 1) { + return Result.fail(CommonError.InvalidAgentNumError); + } + //总机器数 + int totalAgent = agentIps.size(); + List flagList = new ArrayList<>(); + int tmpSumRate = 0; + for (DomainIpAndRate ipRate : + req.getDomainIpAndRates()) { + //比例分隔标记 + tmpSumRate += ipRate.getRate(); + double rate = tmpSumRate / 100d; + int index = (int) (totalAgent * rate) - 1; + flagList.add(index); + } + + int pointer = -1; + for (int i = 0; i < req.getDomainIpAndRates().size(); i++) { + DomainApplyReq domainApplyReq = new DomainApplyReq(); + domainApplyReq.setApplier(req.getApplier()); + domainApplyReq.setDomain(req.getDomain()); + domainApplyReq.setIp(req.getDomainIpAndRates().get(i).getIp()); + domainApplyReq.setAgentIPs(agentIps.subList(pointer + 1, flagList.get(i))); + pointer = flagList.get(i); + domainApplyReqList.add(domainApplyReq); + } + return this.applyAgentDomain(domainApplyReqList); + } + + @Override + public Result getDomainApplyList(GetApplyListReq req) { + if (req.getPage() <= 0) { + req.setPage(1); + } + if (req.getPageSize() <= 0) { + req.setPageSize(DEFAULT_PAGE_SIZE); + } + int offset = (req.getPage() - 1) * req.getPageSize(); + + DomainApplyInfoExample totalExp = new DomainApplyInfoExample(); + DomainApplyInfoExample.Criteria totalCriteria = totalExp.createCriteria(); + + DomainApplyInfoExample applyInfoExample = new DomainApplyInfoExample(); + DomainApplyInfoExample.Criteria exampleCriteria = applyInfoExample.createCriteria(); + + if (req.getApplyUser() != null && !req.getApplyUser().equals("")) { + exampleCriteria.andApplyUserEqualTo(req.getApplyUser()); + totalCriteria.andApplyUserEqualTo(req.getApplyUser()); + } + + if (req.getApplyStatus() != null) { + exampleCriteria.andApplyStatusEqualTo(req.getApplyStatus()); + totalCriteria.andApplyStatusEqualTo(req.getApplyStatus()); + } + applyInfoExample.setOrderByClause("id desc limit " + req.getPageSize() + " offset " + offset); + + DomainApplyList agentApplyList = new DomainApplyList(); + agentApplyList.setPage(req.getPage()); + agentApplyList.setPageSize(req.getPageSize()); + + List applyInfoList = domainApplyInfoMapper.selectByExampleWithBLOBs(applyInfoExample); + if (applyInfoList == null || applyInfoList.size() == 0) { + return Result.success(agentApplyList); + } + List applyDTOS = new ArrayList<>(applyInfoList.size()); + + applyInfoList.forEach(agentApplyInfo -> { + DomainApplyDTO dto = new DomainApplyDTO(); + BeanUtils.copyProperties(agentApplyInfo, dto); + dto.setAgentIpList(gson.fromJson(agentApplyInfo.getAgentIpList(), new TypeToken>() { + }.getType())); + applyDTOS.add(dto); + }); + agentApplyList.setList(applyDTOS); + agentApplyList.setTotal(domainApplyInfoMapper.countByExample(totalExp)); + return Result.success(agentApplyList); + } + + @Override + @Transactional + public Result approveDomainApply(Integer applyID) { + DomainApplyInfo applyInfo = domainApplyInfoMapper.selectByPrimaryKey(applyID); + if (applyInfo == null) { + return Result.fail(CommonError.InvalidParamError); + } + DomainApplyReq agentReq = new DomainApplyReq(); + agentReq.setDomain(applyInfo.getDomain()); + agentReq.setIp(applyInfo.getIp()); + agentReq.setAgentIPs(gson.fromJson(applyInfo.getAgentIpList(), new TypeToken>() { + }.getType())); + + HttpResult result; + try { + result = httpDao.post(apiSvrUrl + "/edit/hosts", gson.toJson(agentReq)); + } catch (Exception e) { + log.error("[TaskService.submitTask] failed to submit task, msg: {}", e.getMessage(), e); + return Result.fail(CommonError.APIServerError); + } + + if (result.getCode() == 200) { + //更新工单 + applyInfo.setApplyStatus(ApplyStatusEnum.ApplyPass.statusCode); + domainApplyInfoMapper.updateByPrimaryKey(applyInfo); + + //更新机器domain字段 + CompletableFuture.runAsync(() -> callbackUpdateAgentHosts(agentReq), pool); + + return Result.success(true); + } + return Result.fail(CommonError.InvalidParamError); + } + + /** + * 发压机host更新成功后,回调保存各个机器域名绑定记录(新增或修改) + */ + private void callbackUpdateAgentHosts(DomainApplyReq agentReq) { + List agentIpList = agentReq.getAgentIPs(); + if (agentIpList != null) { + agentIpList.forEach(agentIp -> { + AgentInfoExample example = new AgentInfoExample(); + example.createCriteria().andIpEqualTo(agentIp); + List agentInfoList = agentInfoMapper.selectByExampleWithBLOBs(example); + //机器存在 + if (agentInfoList != null && agentInfoList.size() != 0) { + AgentInfo agentInfo = agentInfoList.get(0); + if (agentInfo.getEnable()) { + List domainConfs; + if (agentInfo.getDomainConf() == null) { + //暂无域名配置 + domainConfs = new ArrayList<>(); + DomainConf domainConf = new DomainConf(); + domainConf.setDomain(agentReq.getDomain()); + domainConf.setIp(agentReq.getIp()); + domainConfs.add(domainConf); + agentInfo.setDomainConf(gson.toJson(domainConfs)); + } else { + //已有域名绑定配置 + domainConfs = gson.fromJson(agentInfo.getDomainConf(), new TypeToken>() { + }.getType()); + boolean find = false; + for (DomainConf domainConf : + domainConfs) { + if (agentReq.getDomain().equals(domainConf.getDomain())) { + find = true; + //更新该域名绑定的ip + domainConf.setIp(agentReq.getIp()); + break; + } + } + if (!find) { + //无相同域名,追加 + DomainConf domainConf = new DomainConf(); + domainConf.setDomain(agentReq.getDomain()); + domainConf.setIp(agentReq.getIp()); + domainConfs.add(domainConf); + } + agentInfo.setDomainConf(gson.toJson(domainConfs)); + } + //更新 + agentInfoMapper.updateByPrimaryKeyWithBLOBs(agentInfo); + } + } + }); + } + } + + /** + * 发压机host更新成功后,回调保存各个机器域名绑定记录(新增或修改) + */ + private void callbackDelAgentHosts(DelHostForAgentsReq agentReq) { + List agentIpList = agentReq.getAgentIps(); + if (agentIpList != null) { + agentIpList.forEach(agentIp -> { + AgentInfoExample example = new AgentInfoExample(); + example.createCriteria().andIpEqualTo(agentIp); + List agentInfoList = agentInfoMapper.selectByExampleWithBLOBs(example); + //机器存在 + if (agentInfoList != null && agentInfoList.size() != 0) { + AgentInfo agentInfo = agentInfoList.get(0); + if (agentInfo.getEnable()) { + List domainConfs; + if (agentInfo.getDomainConf() == null) { + //暂无域名配置 + } else { + //已有域名绑定配置 + domainConfs = gson.fromJson(agentInfo.getDomainConf(), new TypeToken>() { + }.getType()); + //过滤删除的域名配置 + domainConfs = domainConfs.stream().filter(domainConf -> !agentReq.getDomain().equals(domainConf.getDomain().trim())).collect(Collectors.toList()); + agentInfo.setDomainConf(gson.toJson(domainConfs)); + } + //更新 + agentInfoMapper.updateByPrimaryKeyWithBLOBs(agentInfo); + } + } + }); + } + } + + @Override + public Result refuseDomainApply(Integer applyID) { + DomainApplyInfo applyInfo = domainApplyInfoMapper.selectByPrimaryKey(applyID); + if (applyInfo == null) { + return Result.fail(CommonError.InvalidParamError); + } + //更新工单 + applyInfo.setApplyStatus(ApplyStatusEnum.ApplyRefuse.statusCode); + domainApplyInfoMapper.updateByPrimaryKey(applyInfo); + return Result.success(true); + } + + @Override + public Result hostForAgent(HostForAgentReq req) { + HttpResult result; + try { + result = httpDao.post(apiSvrUrl + "/manual/edit/hosts", gson.toJson(req)); + } catch (Exception e) { + log.error("[TaskService.hostForAgent] failed to submit task, msg: {}", e.getMessage(), e); + return Result.fail(CommonError.APIServerError); + } + if (result.getCode() == 200) { + + DomainApplyReq agentReq = new DomainApplyReq(); + agentReq.setDomain(req.getDomain()); + agentReq.setIp(req.getIp()); + agentReq.setAgentIPs(Collections.singletonList(req.getAgentIp())); + + CompletableFuture.runAsync(() -> callbackUpdateAgentHosts(agentReq), pool); + + return Result.success(true); + } + return Result.fail(CommonError.UnknownError); + } + + @Override + public Result delHostForAgents(DelHostForAgentsReq req) { + + HttpResult result; + try { + result = httpDao.post(apiSvrUrl + "/del/hosts", gson.toJson(req)); + } catch (Exception e) { + log.error("[TaskService.delHostForAgents] failed to del host from agent, msg: {}", e.getMessage(), e); + return Result.fail(CommonError.APIServerError); + } + if (result.getCode() == 200) { + //异步更新删除域名绑定配置 + CompletableFuture.runAsync(() -> callbackDelAgentHosts(req), pool); + return Result.success(true); + } + return Result.fail(CommonError.UnknownError); + } + + @Override + public Result getAgentHostsFile(LoadHostsFileReq req) { + HttpResult result; + try { + result = httpDao.post(apiSvrUrl + "/load/hosts", gson.toJson(req)); + } catch (Exception e) { + log.error("[TaskService.getAgentHostsFile] failed to del host from agent, msg: {}", e.getMessage(), e); + return Result.fail(CommonError.APIServerError); + } + if (result.getCode() == 200) { + return Result.success(result.getData()); + } + return Result.fail(CommonError.UnknownError); + } + + /** + * 同步域名绑定配置到压测机 + */ + @Override + public Result syncDomainConf() { + AgentInfoExample example = new AgentInfoExample(); + + example.createCriteria().andEnableEqualTo(true); + List agentInfoList = agentInfoMapper.selectByExampleWithBLOBs(example); + if (agentInfoList == null || agentInfoList.size() == 0) { + return Result.success(true); + } + SyncHostsReq syncHostsReq = new SyncHostsReq(); + List agentHostsConfList = new ArrayList<>(); + List domainConfList; + + for (AgentInfo agentInfo : + agentInfoList) { + if (agentInfo.getDomainConf() != null) { + //存在绑定域名配置,需要同步到压测机 + AgentHostsConf hostsConf = new AgentHostsConf(); + hostsConf.setAgentIp(agentInfo.getIp()); + domainConfList = gson.fromJson(agentInfo.getDomainConf(), new TypeToken>() { + }.getType()); + hostsConf.setDomainConfs(domainConfList); + agentHostsConfList.add(hostsConf); + } + } + //调用manager的请求数据 + //{"agentHostsConfList":[{"agentIp":"127.0.0.1","domainConfs":[{}]}]} + syncHostsReq.setAgentHostsConfList(agentHostsConfList); + + HttpResult result; + try { + result = httpDao.post(apiSvrUrl + "/sync/hosts", gson.toJson(syncHostsReq)); + } catch (Exception e) { + log.error("[TaskService.getAgentHostsFile] failed to del host from agent, msg: {}", e.getMessage(), e); + return Result.fail(CommonError.UnknownError); + } + if (result.getCode() == 200) { + return Result.success(true); + } + return Result.fail(CommonError.APIServerError); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/BenchBroadcastServiceImpl.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/BenchBroadcastServiceImpl.java new file mode 100644 index 000000000..0626a4a73 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/BenchBroadcastServiceImpl.java @@ -0,0 +1,289 @@ +package run.mone.mimeter.dashboard.service.impl; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.dubbo.config.annotation.DubboService; +import org.springframework.beans.factory.annotation.Autowired; +import run.mone.mimeter.dashboard.bo.common.Constants; +import run.mone.mimeter.dashboard.bo.common.EmitterTypeEnum; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.report.ReportInfoBo; +import run.mone.mimeter.dashboard.bo.sla.SlaRuleItemTypeEnum; +import run.mone.mimeter.dashboard.bo.statistics.TotalStatAnalysisEvent; +import run.mone.mimeter.dashboard.bo.sla.BenchEvent; +import run.mone.mimeter.dashboard.bo.sla.SlaEvent; +import run.mone.mimeter.dashboard.common.util.Util; +import run.mone.mimeter.dashboard.mapper.CheckPointInfoMapper; +import run.mone.mimeter.dashboard.mapper.ReportInfoMapper; +import run.mone.mimeter.dashboard.mapper.SceneApiInfoMapper; +import run.mone.mimeter.dashboard.pojo.CheckPointInfo; +import run.mone.mimeter.dashboard.pojo.ReportInfo; +import run.mone.mimeter.dashboard.pojo.ReportInfoExample; +import run.mone.mimeter.dashboard.pojo.SceneApiInfo; +import run.mone.mimeter.dashboard.service.BenchBroadcastService; +import run.mone.mimeter.dashboard.service.ReportInfoService; +import run.mone.mimeter.dashboard.service.SceneApiService; +import run.mone.mimeter.dashboard.service.SceneService; + +import java.util.*; + +import static com.google.common.base.Preconditions.checkArgument; +import static run.mone.mimeter.dashboard.bo.common.Constants.REPORT_STATUS_INACTIVE; + +/** + * @author dongzhenxing + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/7/21 + */ +@Slf4j +@DubboService(interfaceClass = BenchBroadcastService.class, group = "${dubbo.group}",version = "${dubbo.version}",timeout = 20000) +public class BenchBroadcastServiceImpl implements BenchBroadcastService { + + private final String logPrefix = "[BenchBroadcastService]"; + + @Autowired + private ReportEmitterService reportEmitterService; + + @Autowired + private SceneApiService sceneApiService; + + @Autowired + private SceneService sceneService; + + @Autowired + private ReportInfoService reportInfoService; + + @Autowired + private SceneApiInfoMapper sceneApiInfoMapper; + + @Autowired + private CheckPointInfoMapper checkPointInfoMapper; + + @Autowired + private ReportInfoMapper reportInfoMapper; + + private static final Gson gson = Util.getGson(); + + @Override + public Result notifyEvent(EmitterTypeEnum emitEventType, String reportId, SlaEvent slaEvent) { + notifySlaEventSync(emitEventType, reportId, slaEvent); + return Result.success(true); + } + + @Override + public Result notifyEvent(EmitterTypeEnum emitEventType, String reportId, TotalStatAnalysisEvent analysisEvent) { + notifyTotalAnalysisEvent(emitEventType, reportId, analysisEvent); + return Result.success(true); + } + + public Result notifyEvent(EmitterTypeEnum emitEventType, String reportId, ReportInfoBo reportInfoBo) { + notifyFinishSync(emitEventType, reportId, reportInfoBo); + return Result.success(true); + } + + private void notifyFinishSync(EmitterTypeEnum emitEventType, String reportId, ReportInfoBo reportInfoBo){ + checkArgument(StringUtils.isNotBlank(reportId), this.logPrefix + "notifyEvent empty report id"); + String logMsg = this.logPrefix + "notifyEvent report id " + reportId + ", emit type " + emitEventType + "; "; + + if (EmitterTypeEnum.FINISH.getValue().equals(emitEventType.getValue())) { + reportInfoBo.setStatus(REPORT_STATUS_INACTIVE); + this.reportInfoService.updateReport(reportInfoBo); + try { + int sessionCnt = this.reportEmitterService.countSessions(reportId); + if (0 == sessionCnt) { + log.warn(logMsg + "session is zero"); + return; + } + log.info(logMsg + "session cnt is {}", sessionCnt); + this.reportEmitterService.complete(reportId); + } catch (Exception e) { + log.warn("complete failed,e:{}",e.getMessage()); + } + } else { + log.error(logMsg + "invalid event type"); + } + } + private void notifySlaEventSync(EmitterTypeEnum emitEventType, String reportId, SlaEvent slaEvent) { + checkArgument(StringUtils.isNotBlank(reportId), this.logPrefix + "notifyEvent empty report id"); + String logMsg = this.logPrefix + "notifyEvent report id " + reportId + ", emit type " + emitEventType + "; "; + int sessionCnt = this.reportEmitterService.countSessions(reportId); + + if (0 == sessionCnt) { + log.warn(logMsg + "session is zero"); + return; + } + log.info(logMsg + "session cnt is {}", sessionCnt); + + //sla 事件消息 + try { + this.reportEmitterService.sendSlaMsg(reportId, slaEvent); + } catch (Exception e) { + log.warn("reportEmitterService.sendSlaMsg error"); + } finally { + //补充接口信息 + processSlaEventApiInfo(slaEvent); + //更新,追加报告中的事件列表 + updateSlaEventByReport(reportId, slaEvent); + } + + } + + private void notifyTotalAnalysisEvent(EmitterTypeEnum emitEventType, String reportId, TotalStatAnalysisEvent analysisEvent) { + checkArgument(StringUtils.isNotBlank(reportId), this.logPrefix + "notifyEvent empty report id"); + String logMsg = this.logPrefix + "notifyEvent report id " + reportId + ", emit type " + emitEventType + "; "; + int sessionCnt = this.reportEmitterService.countSessions(reportId); + + if (0 == sessionCnt) { + //已经结束,直接更新报告数据 + //更新错误分析事件列表 + //补充事件信息 + if (analysisEvent.isFinish()){ + log.info("total!! "+analysisEvent.getTotalReq()+"_____err:"+analysisEvent.getTotalErrReq()); + processTotalStatisticEvent(analysisEvent); + updateTotalStatEventByReport(reportId, analysisEvent,true); + + ReportInfoExample example = new ReportInfoExample(); + example.createCriteria().andReportIdEqualTo(reportId); + List reportInfoList = reportInfoMapper.selectByExample(example); + if (reportInfoList != null && reportInfoList.size() !=0){ + ReportInfo reportInfo = reportInfoList.get(0); + reportInfo.setStatus(REPORT_STATUS_INACTIVE); + long now = System.currentTimeMillis(); + if (reportInfo.getFinishTime() == null){ + reportInfo.setFinishTime(now +300000); + } + if (reportInfo.getDuration() == null){ + int duration = (int) ((now -reportInfo.getCreateTime().getTime())/1000); + reportInfo.setDuration(duration); + } + reportInfoMapper.updateByPrimaryKey(reportInfo); + } + } + log.warn(logMsg + "session is zero"); + return; + } + log.debug(logMsg + "session cnt is {}", sessionCnt); + + try { + //补充事件信息 + processTotalStatisticEvent(analysisEvent); + // 推送统计事件 + this.reportEmitterService.sendTotalStatisticMsg(reportId, analysisEvent); + } catch (Exception e) { + log.warn("reportEmitterService.sendErrStatisticMsg error"); + } finally { + //更新数据分析事件列表 + updateTotalStatEventByReport(reportId, analysisEvent,false); + } + } + + private void processSlaEventApiInfo(SlaEvent slaEvent){ + try { + if (slaEvent.getRuleItemType().equals(SlaRuleItemTypeEnum.BusinessMetrics.ruleItemTypeName)){ + //业务指标报警 + if (slaEvent.getTriggerApiId() != 0){ + SceneApiInfo apiInfo = sceneApiInfoMapper.selectByPrimaryKey(slaEvent.getTriggerApiId()); + slaEvent.setApiName(apiInfo.getApiName()); + if (apiInfo.getApiType() == Constants.CASE_TYPE_HTTP){ + slaEvent.setApiUrlOrServiceName(apiInfo.getApiUrl()); + }else if (apiInfo.getApiType() == Constants.CASE_TYPE_RPCX){ + slaEvent.setApiUrlOrServiceName(apiInfo.getServiceName()+":"+apiInfo.getMethodName()); + } + } + } + } catch (Exception e) { + log.warn("get api info err:{}",e.getMessage()); + } + } + + private void processTotalStatisticEvent(TotalStatAnalysisEvent totalAnalysisEvent) { + totalAnalysisEvent.getErrorTypeAnalyses().forEach(errorTypeAnalysis -> { + //各个错误总计类 + Integer apiId = errorTypeAnalysis.getMostErrApi(); + if (apiId != null) { + //次数最多的api + SceneApiInfo sceneApiInfo = sceneApiInfoMapper.selectByPrimaryKey(apiId); + errorTypeAnalysis.setMostErrApiName(sceneApiInfo.getApiName()); + + if (errorTypeAnalysis.getErrorType() == 1) { + //检查点错误 + int checkPointId = errorTypeAnalysis.getCheckPointId(); + CheckPointInfo checkPointInfo = checkPointInfoMapper.selectByPrimaryKey(checkPointId); + errorTypeAnalysis.setCheckPointDesc(gson.toJson(checkPointInfo)); + } + } + }); + + //接口信息补充 + totalAnalysisEvent.getApiStatisticsList().forEach(apiStatistics -> { + SceneApiInfo apiInfo = sceneApiInfoMapper.selectByPrimaryKey(apiStatistics.getApiId()); + if (apiInfo != null){ + apiStatistics.setApiName(apiInfo.getApiName()); + apiStatistics.setApiType(apiInfo.getApiType()); + if (apiInfo.getApiType() == Constants.CASE_TYPE_HTTP){ + apiStatistics.setUri(apiInfo.getApiUrl()); + if (apiInfo.getRequestMethod() == Constants.HTTP_REQ_GET){ + apiStatistics.setMethod("get"); + }else { + apiStatistics.setMethod("post"); + } + }else if (apiInfo.getApiType() == Constants.CASE_TYPE_RPCX){ + apiStatistics.setDubboServiceName(apiInfo.getServiceName()); + apiStatistics.setDubboMethodName(apiInfo.getMethodName()); + apiStatistics.setDubboGroup(apiInfo.getDubboGroup()); + apiStatistics.setDubboVersion(apiInfo.getDubboVersion()); + } + apiStatistics.setSerialId(apiInfo.getSerialLinkId()); + } + }); + } + + private void updateTotalStatEventByReport(String reportId, TotalStatAnalysisEvent analysisEvent,boolean lastTime) { + //更新报告中的数据分析事件 + ReportInfoExample example = new ReportInfoExample(); + example.createCriteria().andReportIdEqualTo(reportId); + + List reportInfos = reportInfoMapper.selectByExampleWithBLOBs(example); + if (reportInfos == null || reportInfos.size() != 1) { + return; + } + ReportInfo reportInfo = reportInfos.get(0); + reportInfo.setConcurrency(analysisEvent.getAvgTps()); + reportInfo.setConcurrencyMax(analysisEvent.getMaxTps()); + reportInfo.setTotalStatAnalysisEventList(gson.toJson(analysisEvent)); + if (lastTime){ + reportInfo.setFinishTime(System.currentTimeMillis()); + } + //更新链路 rps 数据 + if (analysisEvent.getLinkToDagTaskRpsMap() != null && !analysisEvent.getLinkToDagTaskRpsMap().isEmpty()){ + reportInfo.setLinkToDagId(gson.toJson(analysisEvent.getLinkToDagTaskRpsMap())); + } + reportInfoMapper.updateByPrimaryKeyWithBLOBs(reportInfo); + } + + private void updateSlaEventByReport(String reportId, BenchEvent benchEvent) { + //更新报告中的事件列表 + ReportInfoExample example = new ReportInfoExample(); + example.createCriteria().andReportIdEqualTo(reportId); + + List reportInfos = reportInfoMapper.selectByExampleWithBLOBs(example); + if (reportInfos == null || reportInfos.size() != 1) { + return; + } + ReportInfo reportInfo = reportInfos.get(0); + List benchEvents = gson.fromJson(reportInfo.getSlaEventList(), new TypeToken>() { + }.getType()); + if (benchEvents != null) { + benchEvents.add(benchEvent); + } else { + benchEvents = new ArrayList<>(); + benchEvents.add(benchEvent); + } + reportInfo.setSlaEventList(gson.toJson(benchEvents)); + reportInfoMapper.updateByPrimaryKeyWithBLOBs(reportInfo); + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/BenchMonitorServiceImpl.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/BenchMonitorServiceImpl.java new file mode 100644 index 000000000..15ebf225b --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/BenchMonitorServiceImpl.java @@ -0,0 +1,184 @@ +package run.mone.mimeter.dashboard.service.impl; + +import com.google.gson.Gson; +import com.google.gson.JsonSyntaxException; +import com.google.gson.reflect.TypeToken; +import com.xiami.mione.tesla.k8s.service.K8sProxyService; +import com.xiaomi.faas.func.api.MimeterService; +import com.xiaomi.mione.tesla.k8s.bo.PodNode; +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import run.mone.mimeter.dashboard.bo.common.Constants; +import run.mone.mimeter.dashboard.bo.scene.SceneTaskAppsBo; +import run.mone.mimeter.dashboard.bo.agent.AgentMonitorBo; +import run.mone.mimeter.dashboard.bo.agent.AgentMonitorInfo; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.common.HttpDao; +import run.mone.mimeter.dashboard.common.util.Util; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.mapper.ReportInfoMapper; +import run.mone.mimeter.dashboard.mapper.SceneApiInfoMapper; +import run.mone.mimeter.dashboard.mapper.SceneInfoMapper; +import run.mone.mimeter.dashboard.mapper.SerialLinkMapper; +import run.mone.mimeter.dashboard.service.BenchMonitorService; +import run.mone.mimeter.dashboard.pojo.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@Service +@Slf4j +public class BenchMonitorServiceImpl implements BenchMonitorService { + + @Autowired + private HttpDao httpDao; + + + /** + * 前后拓宽时间 + */ + private static final Long expendTime = (long) (5 * 1000); + + @Autowired + private ReportInfoMapper reportInfoMapper; + + @Autowired + private SerialLinkMapper serialLinkMapper; + + @Autowired + private SceneApiInfoMapper apiInfoMapper; + + private static final Gson gson = Util.getGson(); + + @DubboReference(registry = "stRegistry",check = false,group = "staging",timeout = 3000) + private MimeterService mimeterServiceSt; + + @DubboReference(registry = "olRegistry",check = false,group = "online",timeout = 3000) + private MimeterService mimeterServiceStOl; + + @DubboReference(check = false,group = "${ref.k8s.service.group}",timeout = 3000) + private K8sProxyService k8sProxyService; + + @Autowired + private SceneInfoMapper sceneInfoMapper; + + @Override + public Result getAppListByReportID(Integer sceneId, String reportId, Boolean realTime) { + + SceneInfo sceneInfo = sceneInfoMapper.selectByPrimaryKey(sceneId); + if (sceneInfo == null){ + return Result.success(new SceneTaskAppsBo()); + } + + String flag = sceneId + "_" + reportId; + com.xiaomi.youpin.infra.rpc.Result res; + try { + if (sceneInfo.getSceneEnv() == Constants.SCENE_ENV_ST){ + res = mimeterServiceSt.getApps(flag); + }else if (sceneInfo.getSceneEnv() == Constants.SCENE_ENV_OL){ + res = mimeterServiceStOl.getApps(flag); + }else { + return Result.success(new SceneTaskAppsBo()); + } + } catch (Exception e) { + return Result.fail(CommonError.UnknownError); + } + if (res.getCode() == 0) { + if (res.getData() == null){ + return Result.success(new SceneTaskAppsBo()); + } + SceneTaskAppsBo sceneTaskAppsBo = null; + try { + sceneTaskAppsBo = gson.fromJson(res.getData().toString(), new TypeToken() { + }.getType()); + } catch (JsonSyntaxException e) { + log.error("getAppListByReportID failed,e:{}",e.getMessage()); + return Result.success(new SceneTaskAppsBo()); + } + ReportInfoExample example = new ReportInfoExample(); + example.createCriteria().andReportIdEqualTo(reportId); + List reportInfoList = reportInfoMapper.selectByExample(example); + + if (reportInfoList == null || reportInfoList.size() == 0) { + return Result.fail(CommonError.InvalidParamError); + } + ReportInfo reportInfo = reportInfoList.get(0); + + sceneTaskAppsBo.setFromTime(reportInfo.getCreateTime().getTime() - expendTime); + if (realTime) { + //实时 + sceneTaskAppsBo.setToTime(null); + } else { + if (reportInfo.getFinishTime() != null){ + sceneTaskAppsBo.setToTime(reportInfo.getFinishTime() + expendTime); + } + } + sceneTaskAppsBo.getSerialLinks().forEach(linkTaskAppsBo -> { + SerialLink serialLink = serialLinkMapper.selectByPrimaryKey(Integer.parseInt(linkTaskAppsBo.getSerialLinkId())); + linkTaskAppsBo.setSerialLinkName(serialLink.getName()); + linkTaskAppsBo.getApis().forEach(apiTaskAppsBo -> { + SceneApiInfo apiInfo = apiInfoMapper.selectByPrimaryKey(Integer.parseInt(apiTaskAppsBo.getApiId())); + apiTaskAppsBo.setApiName(apiInfo.getApiName()); + }); + }); + sceneTaskAppsBo.setSceneTask(flag); + return Result.success(sceneTaskAppsBo); + } + return Result.fail(CommonError.UnknownError); + } + + @Override + public Result getAgentInfosByReport(String reportId, Boolean realTime) { + AgentMonitorBo agentMonitorBo = new AgentMonitorBo(); + + List agentInfos = new ArrayList<>(); + ReportInfoExample example = new ReportInfoExample(); + example.createCriteria().andReportIdEqualTo(reportId); + List reportInfoList = reportInfoMapper.selectByExampleWithBLOBs(example); + + if (reportInfoList == null || reportInfoList.size() == 0) { + return Result.fail(CommonError.InvalidParamError); + } + ReportInfo reportInfo = reportInfoList.get(0); + + String agentJson = reportInfo.getAgents(); + List agentAddrs = gson.fromJson(agentJson, new TypeToken>() { + }.getType()); + + log.info("!!! agent info 1:{}",agentJson); + if (agentAddrs == null){ + return Result.success(agentMonitorBo); + } + + agentMonitorBo.setFromTime(reportInfo.getCreateTime().getTime()); + if (realTime) { + agentMonitorBo.setToTime(null); + } else { + if (reportInfo.getFinishTime() != null){ + agentMonitorBo.setToTime(reportInfo.getFinishTime() + expendTime); + }else { + agentMonitorBo.setToTime(System.currentTimeMillis()); + } + } + + List podIps = agentAddrs.stream().map(addr -> addr.substring(0,addr.indexOf(":"))).collect(Collectors.toList()); + + log.info("!!! agent info 1:{}",gson.toJson(podIps)); + + List agents = k8sProxyService.getNodeIP(podIps).getData(); + + if (agents.size() != 0){ + agents.forEach(agent ->{ + AgentMonitorInfo agentMonitorInfo = new AgentMonitorInfo(); + agentMonitorInfo.setNodeIp(agent.getNodeIP()); + agentMonitorInfo.setPodIp(agent.getPodIP()); + agentInfos.add(agentMonitorInfo); + }); + } + agentMonitorBo.setAgentMonitorInfos(agentInfos); + return Result.success(agentMonitorBo); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/DatasetServiceImpl.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/DatasetServiceImpl.java new file mode 100644 index 000000000..e2d56e93f --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/DatasetServiceImpl.java @@ -0,0 +1,554 @@ +package run.mone.mimeter.dashboard.service.impl; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.xiaomi.mone.tpc.api.service.UserOrgFacade; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.dataset.*; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.mapper.DatasetMapper; +import run.mone.mimeter.dashboard.mapper.DatasetSceneRelationMapper; +import run.mone.mimeter.dashboard.pojo.*; +import run.mone.mimeter.dashboard.service.DatasetService; +import run.mone.mimeter.dashboard.service.SceneService; + +import java.util.*; +import java.util.stream.Collectors; + +import static run.mone.mimeter.dashboard.bo.common.Constants.DEFAULT_PAGE_SIZE; +import static run.mone.mimeter.dashboard.service.impl.UploadService.PreviewFileRowNum; + +@Service +@Slf4j +public class DatasetServiceImpl implements DatasetService { + + private static final Gson gson = new Gson(); + + @Autowired + DatasetMapper datasetMapper; + + @Autowired + DatasetSceneRelationMapper datasetSceneRelationMapper; + + @Autowired + private UploadService uploadService; + + @Autowired + private SceneService sceneService; + + @DubboReference(registry = "stRegistry",check = false,group = "staging-open",version = "1.0") + private UserOrgFacade userOrgFacade; + + @Override + public Result newDataset(DatasetDto param) { + Pair checkRes = checkParam(param); + if (checkRes.getKey() != 0) { + return Result.fail(CommonError.InvalidParamError.code, checkRes.getValue()); + } + + Dataset dataset = toDataset(param); + //添加租户信息 + if (param.getTenant() != null) { + dataset.setTenant(param.getTenant()); + } + datasetMapper.insert(dataset); + return Result.success(dataset.getId()); + } + + @Override + public Result> multiNewDataset(List param) { + for (DatasetDto perParam : param) { + Pair checkRes = checkParam(perParam); + if (checkRes.getKey() != 0) { + return Result.fail(CommonError.InvalidParamError.code, checkRes.getValue()); + } + } + List datasets = param.stream().map(it -> { + Dataset dataset = toDataset(it); + //添加租户信息 + if (it.getTenant() != null) { + dataset.setTenant(it.getTenant()); + } + return dataset; + }).collect(Collectors.toList()); + datasetMapper.batchInsert(datasets); + return Result.success(datasets.stream().map(Dataset::getId).collect(Collectors.toList())); + } + + @Override + public Result updateDataset(DatasetDto param) { + Pair checkRes = checkParam(param); + if (checkRes.getKey() != 0) { + return Result.fail(CommonError.InvalidParamError.code, checkRes.getValue()); + } + + Dataset dataset = toDataset(param); + //兼容,早期的数据源没有租户信息,这里在更新的时候补充进去 +// if (param.getTenant() != null && dataset.getTenant() == null) { +// dataset.setTenant(param.getTenant()); +// } + datasetMapper.updateByPrimaryKeyWithBLOBs(dataset); + return Result.success(true); + } + + @Override + public Result multiUpdateDataset(List param) { + for (DatasetDto perParam : param) { + Pair checkRes = checkParam(perParam); + if (checkRes.getKey() != 0) { + return Result.fail(CommonError.InvalidParamError.code, checkRes.getValue()); + } + } + + param.forEach(it -> { + Dataset dataset = toDataset(it); + //兼容,早期的数据源没有租户信息,这里在更新的时候补充进去 + if (it.getTenant() != null && dataset.getTenant() == null) { + dataset.setTenant(it.getTenant()); + } + datasetMapper.updateByPrimaryKeyWithBLOBs(dataset); + }); + return Result.success(true); + } + + @Override + public Result getDatasetList(GetDatasetListReq req) { + + if (req.getPage() <= 0) { + req.setPage(1); + } + if (req.getPageSize() <= 0) { + req.setPageSize(DEFAULT_PAGE_SIZE); + } + int offset = (req.getPage() - 1) * req.getPageSize(); + + DatasetExample totalDatasetExample = new DatasetExample(); + DatasetExample.Criteria totalCriteria = totalDatasetExample.createCriteria(); + DatasetExample datasetExample = new DatasetExample(); + + DatasetExample.Criteria criteria = datasetExample.createCriteria(); + + if (StringUtils.isNotEmpty(req.getDatasetName())) { + totalCriteria.andNameLike("%" + req.getDatasetName() + "%"); + criteria.andNameLike("%" + req.getDatasetName() + "%"); + } + if (StringUtils.isNotEmpty(req.getCreator())) { + totalCriteria.andCreatorLike("%" + req.getCreator() + "%"); + criteria.andCreatorLike("%" + req.getCreator() + "%"); + } + if (req.getType() != null && req.getType() > 0) { + totalCriteria.andTypeEqualTo(req.getType()); + criteria.andTypeEqualTo(req.getType()); + } + + datasetExample.setOrderByClause("id desc limit " + req.getPageSize() + " offset " + offset); + + DatasetList datasetList = new DatasetList(); + datasetList.setPage(req.getPage()); + datasetList.setPageSize(req.getPageSize()); + List datasets = datasetMapper.selectByExampleWithBLOBs(datasetExample); + if (datasets == null || datasets.size() == 0) { + return Result.success(datasetList); + } + List datasetDtos = datasets.stream().map(this::toDatasetDto).collect(Collectors.toList()); + + //添加引用场景字段 + List datasetIds = datasetDtos.stream().map(DatasetDto::getId).collect(Collectors.toList()); + Map> datasetIdToSceneIds = getSceneIdsByDatasetIds(datasetIds); + Set sceneIdSet = new HashSet<>(); + datasetIdToSceneIds.forEach((key, value) -> sceneIdSet.addAll(value)); + if (sceneIdSet.size() > 0) { + List scenes = sceneService.getSceneInfoByIds(new ArrayList<>(sceneIdSet)).getData(); + Map sceneIdName = scenes.stream().collect(Collectors.toMap(SceneInfo::getId, SceneInfo::getName)); + datasetDtos.forEach(it -> { + Integer datasetId = it.getId(); + List sceneIds = datasetIdToSceneIds.get(datasetId); + if (sceneIds != null && sceneIds.size() > 0) { + Map perSceneIdName = sceneIds.stream().filter(it1 -> sceneIdName.get(it1) != null) + .collect(Collectors.toMap(it1 -> it1, sceneIdName::get)); + + it.setBindScenes(perSceneIdName); + } + }); + } + + datasetList.setList(datasetDtos); + datasetList.setTotal(datasetMapper.countByExample(totalDatasetExample)); + + return Result.success(datasetList); + } + + @Override + public Result> getDatasetListByIds(List datasetIds) { + List datasetList = new ArrayList<>(); + if (datasetIds != null && datasetIds.size() != 0) { + DatasetExample example = new DatasetExample(); + example.createCriteria().andIdIn(datasetIds); + datasetList = datasetMapper.selectByExampleWithBLOBs(example); + } + return Result.success(datasetList); + } + + @Override + public Result getDatasetById(int id) { + Dataset dataset = datasetMapper.selectByPrimaryKey(id); + DatasetDto datasetDto = toDatasetDto(dataset); + return Result.success(datasetDto); + } + + @Override + public Result delDataset(int id) { + DatasetSceneRelationExample relationExample = new DatasetSceneRelationExample(); + DatasetSceneRelationExample.Criteria criteria = relationExample.createCriteria(); + criteria.andDatasetIdEqualTo(id); + List relations = datasetSceneRelationMapper.selectByExample(relationExample); + if (relations != null && relations.size() > 0) { + //多校验一步,看一下关联的场景到底还存不存在 + List scenes = sceneService.getSceneInfoByIds(relations.stream().map(DatasetSceneRelation::getSceneId).collect(Collectors.toList())).getData(); + if (scenes != null && scenes.size() > 0) { + return Result.fail(CommonError.DeleteFileBindingSceneError); + } + } + + datasetMapper.deleteByPrimaryKey(id); + datasetSceneRelationMapper.deleteByExample(relationExample); + + return Result.success(true); + } + + @Override + public Result multiDelDataset(List ids) { + DatasetSceneRelationExample relationExample = new DatasetSceneRelationExample(); + DatasetSceneRelationExample.Criteria criteria = relationExample.createCriteria(); + criteria.andDatasetIdIn(ids); + List relations = datasetSceneRelationMapper.selectByExample(relationExample); + if (relations != null && relations.size() > 0) { + //多校验一步,看一下关联的场景到底还存不存在 + List scenes = sceneService.getSceneInfoByIds(relations.stream().map(DatasetSceneRelation::getSceneId).collect(Collectors.toList())).getData(); + if (scenes != null && scenes.size() > 0) { + return Result.fail(CommonError.DeleteFileBindingSceneError); + } + } + + DatasetExample example = new DatasetExample(); + example.createCriteria().andIdIn(ids); + datasetMapper.deleteByExample(example); + datasetSceneRelationMapper.deleteByExample(relationExample); + + return Result.success(true); + } + + @Override + public Result bindScene(int datasetId, int sceneId) { + long now = System.currentTimeMillis(); + DatasetSceneRelation datasetSceneRelation = new DatasetSceneRelation(); + datasetSceneRelation.setDatasetId(datasetId); + datasetSceneRelation.setSceneId(sceneId); + datasetSceneRelation.setCtime(now); + datasetSceneRelation.setUtime(now); + datasetSceneRelation.setEnable(false); + datasetSceneRelationMapper.insert(datasetSceneRelation); + return Result.success(datasetSceneRelation.getId()); + } + + @Override + public Result bindDataSetsByScene(List datasetIds, Set refDatasetIds, int sceneId) { + List toBeAdded = new ArrayList<>(); + List toBeRemoved = new ArrayList<>(); + List toBeUpdated = new ArrayList<>(); + + DatasetSceneRelationExample example = new DatasetSceneRelationExample(); + example.createCriteria().andSceneIdEqualTo(sceneId); + List relations = datasetSceneRelationMapper.selectByExample(example); + List olds = relations.stream().map(DatasetSceneRelation::getDatasetId).collect(Collectors.toList()); + + + datasetIds.forEach(newId -> { + if (!olds.contains(newId)) { + toBeAdded.add(newId); + } + }); + olds.forEach(oldId -> { + if (!datasetIds.contains(oldId)) { + toBeRemoved.add(oldId); + } else { + toBeUpdated.add(oldId); + } + }); + + if (toBeUpdated.size() != 0) { + toBeUpdated.forEach(uId -> { + DatasetSceneRelationExample relationExample = new DatasetSceneRelationExample(); + relationExample.createCriteria().andSceneIdEqualTo(sceneId).andDatasetIdEqualTo(uId); + List relationList = datasetSceneRelationMapper.selectByExample(relationExample); + if (relationList != null && relationList.size() != 0) { + DatasetSceneRelation relation = relationList.get(0); + if (refDatasetIds != null) { + relation.setEnable(refDatasetIds.contains(uId)); + } else { + relation.setEnable(false); + } + datasetSceneRelationMapper.updateByPrimaryKey(relation); + } + }); + } + + if (toBeRemoved.size() != 0) { + DatasetSceneRelationExample rmExp = new DatasetSceneRelationExample(); + rmExp.createCriteria().andDatasetIdIn(toBeRemoved).andSceneIdEqualTo(sceneId); + datasetSceneRelationMapper.deleteByExample(rmExp); + } + + long now = System.currentTimeMillis(); + if (toBeAdded.size() != 0) { + List relationList = toBeAdded.stream().map(it -> { + DatasetSceneRelation datasetSceneRelation = new DatasetSceneRelation(); + datasetSceneRelation.setDatasetId(it); + datasetSceneRelation.setSceneId(sceneId); + datasetSceneRelation.setCtime(now); + datasetSceneRelation.setUtime(now); + if (refDatasetIds != null) { + datasetSceneRelation.setEnable(refDatasetIds.contains(it)); + } else { + datasetSceneRelation.setEnable(false); + } + return datasetSceneRelation; + }).collect(Collectors.toList()); + datasetSceneRelationMapper.batchInsert(relationList); + } + + + return Result.success(true); + } + + @Override + public Result unbindScene(int datasetId, int sceneId) { + DatasetSceneRelationExample relationExample = new DatasetSceneRelationExample(); + DatasetSceneRelationExample.Criteria criteria = relationExample.createCriteria(); + criteria.andDatasetIdEqualTo(datasetId).andSceneIdEqualTo(sceneId); + List relationList = datasetSceneRelationMapper.selectByExample(relationExample); + if (relationList != null && relationList.size() != 0) { + if (relationList.get(0).getEnable()) { + return Result.fail(CommonError.UnbindRefDataset); + } + int res = datasetSceneRelationMapper.deleteByPrimaryKey(relationList.get(0).getId()); + return Result.success(res); + } + return Result.fail(CommonError.InvalidParamError); + } + + @Override + public Result filePreview(int id) { + Dataset dataset = datasetMapper.selectByPrimaryKey(id); + List lines = uploadService.loadFileByRange(dataset, 0, PreviewFileRowNum).getData(); + + PreviewFileRes previewFileRes = new PreviewFileRes(); + previewFileRes.setPreviewFileRows(lines); + previewFileRes.setFileRows(dataset.getFileRows()); + previewFileRes.setFileName(dataset.getFileName()); + + return Result.success(previewFileRes); + } + + @Override + public Result> getParamDataByIds(List ids) { + List paramDatas = new ArrayList<>(); + if (ids == null || ids.size() == 0) { + return Result.success(paramDatas); + } + + DatasetExample datasetExample = new DatasetExample(); + DatasetExample.Criteria criteria = datasetExample.createCriteria(); + criteria.andIdIn(ids); + List list = datasetMapper.selectByExampleWithBLOBs(datasetExample); + + if (list == null || list.size() == 0) { + return Result.success(paramDatas); + } + + list.stream().filter(it -> StringUtils.isNotEmpty(it.getDefaultParamName())).forEach(it -> { + List params = Arrays.asList(it.getDefaultParamName().split(",")); + for (int i = 0; i < params.size(); i++) { + + ParamData paramData = new ParamData(); + paramData.setColumnIndex(i + 1); + paramData.setDatasetId(it.getId()); + paramData.setDatasetName(it.getName()); + paramData.setParamName(params.get(i)); + paramDatas.add(paramData); + } + }); + + return Result.success(paramDatas); + } + + @Override + public Result> getParamDataBySceneId(Integer sceneId) { + List datasetsIds = getDatasetIdsBySceneId(sceneId); + return getParamDataByIds(datasetsIds); + } + + @Override + public List getDatasetIdsBySceneId(Integer sceneId) { + DatasetSceneRelationExample relationExample = new DatasetSceneRelationExample(); + DatasetSceneRelationExample.Criteria criteria = relationExample.createCriteria(); + criteria.andSceneIdEqualTo(sceneId); + List relations = datasetSceneRelationMapper.selectByExample(relationExample); + + return relations.stream().map(DatasetSceneRelation::getDatasetId).collect(Collectors.toList()); + } + + @Override + public Result sceneFileDetail(Integer sceneId) { + SceneFileDetailRes sceneFileDetailRes = new SceneFileDetailRes(); + + List datasetIds = getDatasetIdsBySceneId(sceneId); + if (datasetIds == null || datasetIds.size() == 0) { + return Result.success(sceneFileDetailRes); + } + + List datasets = getDatasetListByIds(datasetIds).getData(); + List datasetDtos = datasets.stream().map(this::toDatasetDto).collect(Collectors.toList()); + List paramDatas = getParamDataByIds(datasetIds).getData(); + + sceneFileDetailRes.setDatasetLists(datasetDtos); + sceneFileDetailRes.setParamDataList(paramDatas); + + return Result.success(sceneFileDetailRes); + } + + @Override + public TreeMap> getParamDataMap(List reqList) { + TreeMap> dataRes = new TreeMap<>(); + List datasetIds = reqList.stream().map(DatasetLinesReq::getDatasetId).collect(Collectors.toList()); + List datasets = getDatasetListByIds(datasetIds).getData(); + Map datasetMap = datasets.stream().collect(Collectors.toMap(Dataset::getId, it -> it)); + reqList.forEach(req -> { + List paramNames = Arrays.asList(req.getDefaultParamName().split(",")); + Dataset dataset = datasetMap.get(req.getDatasetId()); + List lines = null; + try { + lines = uploadService.loadStringArrByRange(dataset, req.getFrom(), req.getTo()).getData(); + } catch (Exception e) { + log.error("loadStringArrByRange error,datasetId:{},fileUrl:{},ksKey:{},paramNames:{},from:{},to:{},error:{}",req.getDatasetId(),req.getFileUrl(),req.getFileKsKey(),req.getDefaultParamName(),req.getFrom(),req.getTo(),e.getMessage()); + } + paramNames.forEach(paramName -> dataRes.put(paramName, new ArrayList<>())); + lines.forEach(line -> { + for (int i = 0; i < paramNames.size(); i++) { + dataRes.get(paramNames.get(i)).add(line[i]); + } + }); + }); + log.info("get getParamDataMap dataRes size:{}",dataRes.size()); + return dataRes; + } + + private Pair checkParam(DatasetDto datasetDto) { + List datasetTypes = DatasetTypeEnum.getDatasetTypes(); + if (datasetDto.getType() == null) { + return Pair.of(-1, "数据源类型必填"); + } + if (datasetDto.getIgnoreFirstRow() == null) { + datasetDto.setIgnoreFirstRow(0); + } + + int type = datasetDto.getType(); + if (!datasetTypes.contains(type)) { + return Pair.of(-1, "不存在的数据源类型"); + } + if (datasetDto.getType() == DatasetTypeEnum.FileUpload.typeCode) { + if (StringUtils.isEmpty(datasetDto.getDefaultParamName())) { + return Pair.of(-1, "文件类型数据源参数名必填"); + } + if (StringUtils.isEmpty(datasetDto.getDefaultParamName())) { + return Pair.of(-1, "文件参数名不允许为空"); + } else { + String[] paramNameArr = datasetDto.getDefaultParamName().split(","); + if (Arrays.asList(paramNameArr).stream().anyMatch(it -> StringUtils.isEmpty(it))) { + return Pair.of(-1, "文件参数名不允许为空"); + } + } + } + + return Pair.of(0, "success"); + } + + private List getSceneIdsByDatasetId(Integer datasetId) { + DatasetSceneRelationExample relationExample = new DatasetSceneRelationExample(); + DatasetSceneRelationExample.Criteria criteria = relationExample.createCriteria(); + criteria.andDatasetIdEqualTo(datasetId); + List relations = datasetSceneRelationMapper.selectByExample(relationExample); + + return relations.stream().map(DatasetSceneRelation::getSceneId).collect(Collectors.toList()); + } + + private Map> getSceneIdsByDatasetIds(List ids) { + DatasetSceneRelationExample relationExample = new DatasetSceneRelationExample(); + DatasetSceneRelationExample.Criteria criteria = relationExample.createCriteria(); + criteria.andDatasetIdIn(ids); + List relations = datasetSceneRelationMapper.selectByExample(relationExample); + + Map> map = new HashMap<>(); + ids.stream().forEach(it -> map.put(it, new ArrayList<>())); + relations.stream().forEach(it -> { + map.get(it.getDatasetId()).add(it.getSceneId()); + }); + + return map; + } + + private Dataset toDataset(DatasetDto param) { + Dataset dataset = new Dataset(); + BeanUtils.copyProperties(param, dataset); + if (param.getPreviewFileRows() != null && param.getPreviewFileRows().size() != 0) { + dataset.setPreviewFileRows(gson.toJson(param.getPreviewFileRows())); + } + if (param.getHeader() != null && param.getHeader().size() != 0) { + dataset.setHeader(gson.toJson(param.getHeader())); + } + long now = System.currentTimeMillis(); + if (dataset.getCtime() == null || dataset.getCtime() == 0) { + dataset.setCtime(now); + } + dataset.setUtime(now); + + return dataset; + } + + private DatasetDto toDatasetDto(Dataset dataset) { + DatasetDto datasetDto = new DatasetDto(); + BeanUtils.copyProperties(dataset, datasetDto); + if (StringUtils.isNotEmpty(dataset.getPreviewFileRows())) { + datasetDto.setPreviewFileRows(gson.fromJson(dataset.getPreviewFileRows(), new TypeToken>() { + }.getType())); + } + if (StringUtils.isNotEmpty(dataset.getHeader())) { + datasetDto.setHeader(gson.fromJson(dataset.getHeader(), new TypeToken>() { + }.getType())); + } + return datasetDto; + } + + @Override + public boolean syncTenant() { +// DatasetExample datasetExample = new DatasetExample(); +// datasetExample.createCriteria().andIdIsNotNull(); +// List datasetList = datasetMapper.selectByExample(datasetExample); +// datasetList.forEach(dataset -> { +// NullParam param = new NullParam(); +// param.setAccount(dataset.getUpdater()); +// param.setUserType(0); +// OrgInfoVo orgInfoVo = userOrgFacade.getOrgByAccount(param).getData(); +// dataset.setTenant(orgInfoVo.getIdPath()); +// datasetMapper.updateByPrimaryKey(dataset); +// }); + return true; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/DubboHealthServiceImpl.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/DubboHealthServiceImpl.java new file mode 100644 index 000000000..1fcf6e51e --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/DubboHealthServiceImpl.java @@ -0,0 +1,25 @@ +package run.mone.mimeter.dashboard.service.impl; + +import com.xiaomi.mone.dubbo.docs.annotations.ApiDoc; +import com.xiaomi.mone.dubbo.docs.annotations.ApiModule; +import org.apache.dubbo.config.annotation.DubboService; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.common.TestReq; +import run.mone.mimeter.dashboard.service.DubboHealthService; + +@DubboService(group = "${dubbo.group}",version = "${dubbo.version}") +@ApiModule(value = "mimeter的健康检测服务", apiInterface = DubboHealthService.class) +public class DubboHealthServiceImpl implements DubboHealthService { + @Override + @ApiDoc(value = "health方法") + public String health(TestReq testReq) { + return testReq.getUid(); + } + + @Override + public Result getUid() { + TestReq req = new TestReq(); + req.setUid("dzx"); + return Result.success(req); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/EsLogServiceImpl.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/EsLogServiceImpl.java new file mode 100644 index 000000000..f3ed2cc5c --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/EsLogServiceImpl.java @@ -0,0 +1,137 @@ +package run.mone.mimeter.dashboard.service.impl; + +import com.google.gson.Gson; +import com.xiaomi.mone.es.EsClient; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.elasticsearch.action.search.SearchRequest; +import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.common.unit.TimeValue; +import org.elasticsearch.index.query.BoolQueryBuilder; +import org.elasticsearch.index.query.QueryBuilders; +import org.elasticsearch.index.query.RangeQueryBuilder; +import org.elasticsearch.index.query.TermQueryBuilder; +import org.elasticsearch.search.SearchHits; +import org.elasticsearch.search.builder.SearchSourceBuilder; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import run.mone.mimeter.dashboard.bo.common.PagedResp; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.report.ReqRespLogRecord; +import run.mone.mimeter.dashboard.bo.report.SearchApiLogReq; +import run.mone.mimeter.dashboard.service.EsLogService; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import static org.elasticsearch.search.sort.SortOrder.ASC; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/7/6 + */ +@Slf4j +@Service +public class EsLogServiceImpl implements EsLogService { + + @Autowired + private EsClient esClient; + + @Value("${es.index.apilog}") + private String esIndexApilog; + + @Override + public Result>> searchApiLogs(SearchApiLogReq req) { + try { + SearchRequest searchRequest = new SearchRequest(esIndexApilog); + SearchSourceBuilder qb = new SearchSourceBuilder(); + BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery(); + + if (req.getStartTs() != null && req.getStartTs() > 0) { + RangeQueryBuilder rangeQueryBuilder = QueryBuilders.rangeQuery("timestamp").from(req.getStartTs()); + boolQueryBuilder = boolQueryBuilder.must(rangeQueryBuilder); + } + if (req.getEndTs() != null && req.getEndTs() > 0) { + RangeQueryBuilder rangeQueryBuilder1 = QueryBuilders.rangeQuery("timestamp").to(req.getEndTs()); + boolQueryBuilder = boolQueryBuilder.must(rangeQueryBuilder1); + } + if (StringUtils.isNotEmpty(req.getApiUri())) { + TermQueryBuilder termQueryBuilder2 = QueryBuilders.termQuery("uri", StringUtils.trim(req.getApiUri())); + boolQueryBuilder = boolQueryBuilder.must(termQueryBuilder2); + } + + if (req.getSceneId() != null && req.getSceneId() > 0) { + TermQueryBuilder termQueryBuilder3 = QueryBuilders.termQuery("sceneId", req.getSceneId()); + boolQueryBuilder = boolQueryBuilder.must(termQueryBuilder3); + } + if (req.getRtMin() != null && req.getRtMin() > 0) { + RangeQueryBuilder rangeQueryBuilder4 = QueryBuilders.rangeQuery("rt").from(req.getRtMin()); + boolQueryBuilder = boolQueryBuilder.must(rangeQueryBuilder4); + } + if (req.getRtMax() != null && req.getRtMax() > 0) { + RangeQueryBuilder rangeQueryBuilder5 = QueryBuilders.rangeQuery("rt").to(req.getRtMax()); + boolQueryBuilder = boolQueryBuilder.must(rangeQueryBuilder5); + } + if (req.getRespCode() != null && req.getRespCode() > 0) { + TermQueryBuilder termQueryBuilder6 = QueryBuilders.termQuery("code", req.getRespCode()); + boolQueryBuilder = boolQueryBuilder.must(termQueryBuilder6); + } + if (req.getFailed() != null) { + TermQueryBuilder termQueryBuilder7 = QueryBuilders.termQuery("failed", req.getFailed()); + boolQueryBuilder = boolQueryBuilder.must(termQueryBuilder7); + } + if (StringUtils.isNotBlank(req.getReportId())) { + TermQueryBuilder termQueryBuilder8 = QueryBuilders.termQuery("reportId", req.getReportId()); + boolQueryBuilder = boolQueryBuilder.must(termQueryBuilder8); + } + if (req.getApiId() != null && req.getApiId() > 0) { + TermQueryBuilder termQueryBuilder9 = QueryBuilders.termQuery("apiId", req.getApiId()); + boolQueryBuilder = boolQueryBuilder.must(termQueryBuilder9); + } + if (StringUtils.isNotEmpty(req.getApiMethod())) { + TermQueryBuilder termQueryBuilder10 = QueryBuilders.termQuery("method", StringUtils.trim(req.getApiMethod())); + boolQueryBuilder = boolQueryBuilder.must(termQueryBuilder10); + } + if (req.getSerialId() != null && req.getSerialId() > 0) { + TermQueryBuilder termQueryBuilder11 = QueryBuilders.termQuery("serialId", req.getSerialId()); + boolQueryBuilder = boolQueryBuilder.must(termQueryBuilder11); + } + if (StringUtils.isNotEmpty(req.getTraceId())) { + TermQueryBuilder termQueryBuilder12 = QueryBuilders.termQuery("traceId", StringUtils.trim(req.getTraceId())); + boolQueryBuilder = boolQueryBuilder.must(termQueryBuilder12); + } + + qb.query(boolQueryBuilder); + qb.from((req.getPageNo() - 1) * req.getPageSize()) + .size(req.getPageSize()) + .timeout(new TimeValue(3000)); + + qb = qb.sort("timestamp", ASC); + searchRequest.source(qb); + SearchResponse res = esClient.search(searchRequest); + SearchHits searchHits = res.getHits(); + long count = searchHits.getTotalHits().value; + + List records = new ArrayList<>(); + Gson gson = new Gson(); + Arrays.stream(searchHits.getHits()).forEach(it -> { + String jsonSource = it.getSourceAsString(); + ReqRespLogRecord reqRespLogRecord = gson.fromJson(jsonSource, ReqRespLogRecord.class); + records.add(reqRespLogRecord); + }); + + PagedResp> apilogRes = new PagedResp(); + apilogRes.setTotal(count); + apilogRes.setData(records); + + return Result.success(apilogRes); + + } catch (Exception e) { + log.error("ApiStatServiceImpl.searchApiLogs error, ", e); + return null; + } + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/FeiShuService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/FeiShuService.java new file mode 100644 index 000000000..5eb10d804 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/FeiShuService.java @@ -0,0 +1,75 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.service.impl; + +import com.alibaba.nacos.api.config.annotation.NacosValue; +import com.xiaomi.youpin.feishu.FeiShu; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.PostConstruct; +import java.util.List; + +@Service +@Slf4j +public class FeiShuService { + + private FeiShu feiShu; + + @NacosValue("${feishu.appId}") + private String appId = ""; + + @NacosValue("${feishu.appSecret}") + private String appSecret = ""; + + @PostConstruct + private void init() { + feiShu = new FeiShu(appId, appSecret); + } + + public void sendMsg2Person(String username, String msg) { + if (StringUtils.isEmpty(username)) { + log.error("username is null"); + return; + } + try { + log.info("FeiShuService#sendMsg personal msg: {}", msg); + feiShu.sendMsgByEmail(username + "@xiaomi.com", msg); + } catch (Exception e) { + log.error("FeiShuService#send personal msg Throwable" + e.getMessage(), e); + } + } + + public void sendCard2Person(List usernames, String card) { + if (usernames == null) { + log.error("username is null"); + return; + } + try { + log.info("FeiShuService#sendCard2Person personal msg: {}", card); + usernames.forEach(username ->{ + if (username.contains("@")){ + username = username.substring(0,username.indexOf("@")); + } + feiShu.sendCardByEmail(username + "@xiaomi.com", card); + }); + } catch (Exception e) { + log.error("FeiShuService#send personal msg Throwable" + e.getMessage(), e); + } + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/GatewayService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/GatewayService.java new file mode 100644 index 000000000..20856f815 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/GatewayService.java @@ -0,0 +1,62 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.service.impl; + +import com.xiaomi.youpin.gateway.manager.bo.openApi.GatewayApiInfoList; +import com.xiaomi.youpin.gateway.manager.bo.openApi.GetGatewayApiInfoListReq; +import com.xiaomi.youpin.gateway.manager.service.IGatewayOpenApi; +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.stereotype.Service; +import run.mone.mimeter.dashboard.bo.common.Result; + +import static com.xiaomi.youpin.tesla.traffic.recording.api.bo.enums.GatewayEnvTypeEnum.*; +import static run.mone.mimeter.dashboard.exception.CommonError.WrongGatewayEnvError; + +@Service +@Slf4j +public class GatewayService { + + @DubboReference(check = false, interfaceClass = IGatewayOpenApi.class, group = "${ref.gateway.service.group.staging}", timeout = 4000) + private IGatewayOpenApi iGatewayOpenApiStaging; + + @DubboReference(check = false, interfaceClass = IGatewayOpenApi.class, group = "${ref.gateway.service.group.online}", timeout = 4000) + private IGatewayOpenApi iGatewayOpenApiOnline; + + @DubboReference(check = false, interfaceClass = IGatewayOpenApi.class, group = "${ref.gateway.service.group.intranet}", timeout = 4000) + private IGatewayOpenApi iGatewayOpenApiIntranet; + + public Result getGatewayApiInfoList(GetGatewayApiInfoListReq req, String user, int env) { + switch (env) { + case ONLINE_CODE: { + return Result.success(iGatewayOpenApiOnline.getGatewayApiInfoList(req, user).getData()); + } + case INTRANET_CODE: { + return Result.success(iGatewayOpenApiIntranet.getGatewayApiInfoList(req, user).getData()); + } + case STAGING_CODE: { + return Result.success(iGatewayOpenApiStaging.getGatewayApiInfoList(req, user).getData()); + } + default: { + log.error("GatewayService.getGatewayApiInfoList error, env is wrong: {} ", env); + return Result.fail(WrongGatewayEnvError.code, WrongGatewayEnvError.message); + } + + } + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/LoginService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/LoginService.java new file mode 100644 index 000000000..a773238dc --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/LoginService.java @@ -0,0 +1,78 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.dashboard.service.impl; + +import com.xiaomi.mone.tpc.api.service.UserOrgFacade; +import com.xiaomi.mone.tpc.common.param.NullParam; +import com.xiaomi.mone.tpc.common.vo.OrgInfoVo; +import org.apache.dubbo.config.annotation.DubboReference; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import run.mone.mimeter.dashboard.bo.UserInfo; +import run.mone.mimeter.dashboard.common.SessionAccount; + +import javax.servlet.http.HttpServletRequest; + +import static run.mone.mimeter.dashboard.bo.common.Constants.SKIP_MI_DUN_USER_NAME; + +@Service +public class LoginService { + + private static final Logger LOGGER = LoggerFactory.getLogger(LoginService.class); + + @Value("${is_local:false}") + private String isLocal; + + @Autowired + private UserV1Service userService; + + @DubboReference(registry = "stRegistry", check = false, group = "staging-open", version = "1.0") + private UserOrgFacade userOrgFacade; + + public SessionAccount getAccountFromSession(HttpServletRequest request) { + if (null == request) { + return null; + } + if (isLocal.equals("true")) { + NullParam param = new NullParam(); + param.setAccount("dongzhenxing"); + param.setUserType(0); + return new SessionAccount("dongzhenxing", "dongzhenxing", true, "default"); + } + UserInfo userInfo = userService.getUserInfo(); + String username = userInfo != null ? userInfo.getFullAccount() : request.getHeader(SKIP_MI_DUN_USER_NAME); + + NullParam param = new NullParam(); + param.setAccount(username); + param.setUserType(0); + String idPath = ""; + try { + OrgInfoVo orgInfoVo = userOrgFacade.getOrgByAccount(param).getData(); + if (orgInfoVo != null) { + idPath = orgInfoVo.getIdPath(); + } + } catch (Exception e) { + LOGGER.warn("[LoginService.getAccountFromSession], failed to getOrgByAccount, msg: {} ", e.getMessage()); + } + + return new SessionAccount(username, userInfo.getName(), userInfo.isAdmin(), idPath); + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/OperationLogServiceImpl.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/OperationLogServiceImpl.java new file mode 100644 index 000000000..dbb20db5c --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/OperationLogServiceImpl.java @@ -0,0 +1,118 @@ +package run.mone.mimeter.dashboard.service.impl; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import org.apache.dubbo.common.utils.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.operationlog.GetOperationLogListReq; +import run.mone.mimeter.dashboard.bo.operationlog.OperationLogDto; +import run.mone.mimeter.dashboard.bo.operationlog.OperationLogList; +import run.mone.mimeter.dashboard.bo.operationlog.PerOperation; +import run.mone.mimeter.dashboard.mapper.OperationLogMapper; +import run.mone.mimeter.dashboard.pojo.OperationLog; +import run.mone.mimeter.dashboard.pojo.OperationLogExample; +import run.mone.mimeter.dashboard.service.OperationLogService; + +import java.util.List; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +import static run.mone.mimeter.dashboard.bo.common.Constants.DEFAULT_PAGE_SIZE; + +@Service +public class OperationLogServiceImpl implements OperationLogService { + + @Autowired + OperationLogMapper operationLogMapper; + + private static Gson gson = new Gson(); + + private static ThreadPoolExecutor executor = new ThreadPoolExecutor(4, 30,TimeUnit.SECONDS.toMillis(30), TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(30)); + + + @Override + public void newOperationLog(OperationLogDto param) { + executor.execute(() -> { + OperationLog operationLog = toOperationLog(param); + operationLogMapper.insert(operationLog);}); + } + + @Override + public Result getOperationLogList(GetOperationLogListReq req) { + + if (req.getPage() <= 0) { + req.setPage(1); + } + if (req.getPageSize() <= 0) { + req.setPageSize(DEFAULT_PAGE_SIZE); + } + int offset = (req.getPage() - 1) * req.getPageSize(); + + OperationLogExample totalOperationLogExample = new OperationLogExample(); + OperationLogExample.Criteria totalCriteria = totalOperationLogExample.createCriteria(); + OperationLogExample operationLogExample = new OperationLogExample(); + OperationLogExample.Criteria criteria = operationLogExample.createCriteria(); + + if (req.getEndTime() != 0) { + totalCriteria.andCreateTimeLessThanOrEqualTo(req.getEndTime()); + criteria.andCreateTimeLessThanOrEqualTo(req.getEndTime()); + } + if (req.getStartTime() != 0) { + totalCriteria.andCreateTimeGreaterThanOrEqualTo(req.getStartTime()); + criteria.andCreateTimeGreaterThanOrEqualTo(req.getStartTime()); + } + if (req.getSceneId() != 0) { + totalCriteria.andSceneIdEqualTo(req.getSceneId()); + criteria.andSceneIdEqualTo(req.getSceneId()); + } + + operationLogExample.setOrderByClause("id desc limit " + req.getPageSize() + " offset " + offset); + + OperationLogList operationLogList = new OperationLogList(); + operationLogList.setPage(req.getPage()); + operationLogList.setPageSize(req.getPageSize()); + List operationLogs = operationLogMapper.selectByExampleWithBLOBs(operationLogExample); + if (operationLogs == null || operationLogs.size() == 0) { + return Result.success(operationLogList); + } + List operationLogDtos = operationLogs.stream().map(it -> { + return toOperationLogDto(it); + }).collect(Collectors.toList()); + operationLogList.setList(operationLogDtos); + operationLogList.setTotal(operationLogMapper.countByExample(totalOperationLogExample)); + + return Result.success(operationLogList); + } + + + private OperationLog toOperationLog(OperationLogDto param) { + OperationLog operationLog = new OperationLog(); + BeanUtils.copyProperties(param, operationLog); + if (param.getSupportOperation() != null && param.getSupportOperation().size() > 0) { + operationLog.setSupportOperation(gson.toJson(param.getSupportOperation())); + } + long now = System.currentTimeMillis(); + if (operationLog.getCreateTime() == null || operationLog.getCreateTime() == 0) { + operationLog.setCreateTime(now); + } + operationLog.setUpdateTime(now); + return operationLog; + } + + private OperationLogDto toOperationLogDto(OperationLog operationLog) { + OperationLogDto operationLogDto = new OperationLogDto(); + BeanUtils.copyProperties(operationLog, operationLogDto); + if (StringUtils.isNotEmpty(operationLog.getSupportOperation())) { + operationLogDto.setSupportOperation(gson.fromJson(operationLog.getSupportOperation(), new TypeToken>() { + }.getType())); + } + return operationLogDto; + } + + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/ReportEmitterService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/ReportEmitterService.java new file mode 100644 index 000000000..037bd44b5 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/ReportEmitterService.java @@ -0,0 +1,115 @@ +package run.mone.mimeter.dashboard.service.impl; + +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Service; +import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter; +import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; +import run.mone.mimeter.dashboard.bo.common.EmitterTypeEnum; +import run.mone.mimeter.dashboard.bo.statistics.TotalStatAnalysisEvent; +import run.mone.mimeter.dashboard.bo.sla.SlaEvent; + +import java.io.IOException; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.TimeUnit; + +import static com.google.common.base.Preconditions.checkArgument; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/6/30 + */ +@Service +@Slf4j +public class ReportEmitterService { + + private final ConcurrentMap> reportEmitterMap = new ConcurrentHashMap<>(); + + private final String logPrefix = "[ReportEmitterService]"; + + public int countSessions(String reportId) { + if (!this.reportEmitterMap.containsKey(reportId)) { + return 0; + } + return this.reportEmitterMap.get(reportId).size(); + } + + public SseEmitter connect(String reportId, String username) { + checkArgument(StringUtils.isNotBlank(reportId) && StringUtils.isNotBlank(username), + this.logPrefix + "connect empty input"); + SseEmitter emitter = new SseEmitter(3600_000L); + ConcurrentHashMap map = Optional.ofNullable(this.reportEmitterMap.get(reportId)).orElse(new ConcurrentHashMap<>()); + map.put(username, emitter); + this.reportEmitterMap.put(reportId, map); + log.info(this.logPrefix + "connected with {}, report id:{}", username, reportId); + + return emitter; + } + + public void sendSlaMsg(String reportId, SlaEvent slaEvent) { + if (!this.reportEmitterMap.containsKey(reportId)) { + log.warn(this.logPrefix + "sendSlaMsg client connection is not established, report id:" + reportId); + return; + } + this.doSendMessage("sla_event", reportId, slaEvent); + } + + public void sendTotalStatisticMsg(String reportId, TotalStatAnalysisEvent analysisEvent) { + if (!this.reportEmitterMap.containsKey(reportId)) { + log.warn(this.logPrefix + "sendErrStatisticMsg client connection is not established, report id:" + reportId); + return; + } + try { + this.doSendMessage("total_analysis_event", reportId, analysisEvent); + } catch (Exception e) { + log.warn("send sendErrStatisticMsg error_analysis_event:{}",e.getMessage()); + } + } + + private void doSendMessage(String eventName, String reportId, Object data) { + List removeUsers = new ArrayList<>(); + + this.reportEmitterMap.get(reportId).forEach((username, emitter) -> { + try { + emitter.send(SseEmitter.event().name(eventName).data(data, MediaType.APPLICATION_JSON)); + } catch (IllegalStateException illegalStateException) { + Optional.of(emitter).ifPresent(ResponseBodyEmitter::complete); + removeUsers.add(username); + log.error(this.logPrefix + "doSendMessage id " + reportId + ", username:" + username + " is complete; " + + illegalStateException.getMessage()); + } catch (Exception e) { + log.error(this.logPrefix + "doSendMessage id:" + reportId + ", username " + username, e); + } + }); + removeUsers.forEach(username -> this.reportEmitterMap.get(reportId).remove(username)); + } + + public boolean complete(String reportId) { + if (StringUtils.isBlank(reportId) || !this.reportEmitterMap.containsKey(reportId)) { + log.warn(this.logPrefix + "complete report id is empty or could not be found"); + return true; + } + log.info(logPrefix + "complete invoked report id: {}, list size: {}", reportId, this.reportEmitterMap.get(reportId).size()); + + this.reportEmitterMap.get(reportId).forEach((username, emitter) -> { + try { + emitter.send(SseEmitter.event().name(EmitterTypeEnum.FINISH.getValue()).data("finish",MediaType.APPLICATION_JSON)); + } catch (Exception e) { + log.error(this.logPrefix + "complete id:" + reportId + " username:" + username, e); + } + }); + // wait some time to close after sending FIN, so it's in another for loop + this.reportEmitterMap.get(reportId).forEach((username, emitter) -> { + try { + emitter.complete(); + } catch (Exception e) { + log.error(this.logPrefix + "complete id:" + reportId + " username:" + username, e); + } + }); + return this.reportEmitterMap.remove(reportId) != null; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/ReportInfoServiceImpl.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/ReportInfoServiceImpl.java new file mode 100644 index 000000000..137338d3f --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/ReportInfoServiceImpl.java @@ -0,0 +1,188 @@ +package run.mone.mimeter.dashboard.service.impl; + +import com.google.gson.Gson; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.report.ErrRateBo; +import run.mone.mimeter.dashboard.bo.report.ReportInfoBo; +import run.mone.mimeter.dashboard.bo.scene.SceneSnapshotBo; +import run.mone.mimeter.dashboard.mapper.ReportInfoMapper; +import run.mone.mimeter.dashboard.pojo.ReportInfo; +import run.mone.mimeter.dashboard.pojo.ReportInfoExample; +import run.mone.mimeter.dashboard.service.ReportInfoService; +import run.mone.mimeter.dashboard.service.SceneSnapshotService; +import run.mone.mimeter.dashboard.common.util.Utility; + +import java.util.*; +import java.util.function.Consumer; + +import static com.google.common.base.Preconditions.checkArgument; +import static run.mone.mimeter.dashboard.bo.common.Constants.*; + +/** + * @author dongzhenxing + * @version 1.0 + * @since 2022/6/22 + */ +@Slf4j +@Service +public class ReportInfoServiceImpl implements ReportInfoService { + + private final String logPrefix = "[ReportInfoService]"; + + @Autowired + private ReportInfoMapper reportInfoMapper; + + private static final Gson gson = new Gson(); + + @Autowired + private SceneSnapshotService sceneSnapshotService; + + private ReportInfoExample buildListReportExample(String tenant, String keyword, Integer pageNo, Integer pageSize) { + ReportInfoExample example = new ReportInfoExample(); + ReportInfoExample.Criteria criteria = example.createCriteria(); + if (StringUtils.isNotBlank(keyword)) { + if (StringUtils.isNumeric(keyword)) { + criteria.andSceneIdEqualTo(Long.parseLong(keyword)); + } else { + criteria.andCreateByLike("%"+keyword+"%"); + example.or(example.createCriteria().andReportNameLike("%"+keyword+"%")); + } + } + criteria.andFinishTimeIsNotNull(); + Utility.handlePagination(example, pageSize, pageNo); + example.setOrderByClause("id desc"); + return example; + } + + private static Consumer writeBoConsumer(List resp) { + return (po) -> { + ReportInfoBo bo = new ReportInfoBo(); + BeanUtils.copyProperties(po, bo); + ErrRateBo errRate = gson.fromJson(po.getTotalStatAnalysisEventList(), ErrRateBo.class); + if (errRate != null){ + double successRate = 100.00 - Double.parseDouble(errRate.getTotalErrRate()); + + bo.setSuccessRate(format2(successRate)); + } + resp.add(bo); + }; + } + + @Override + public Result> listReports(String tenant, String keyword, Integer pageNo, Integer pageSize) { + return this.reportInfosFromExample(this.buildListReportExample(tenant, keyword, pageNo, pageSize)); + } + + private Result> reportInfosFromExample(ReportInfoExample example) { + List list = new ArrayList<>(); + this.reportInfoMapper.selectByExampleWithBLOBs(example).forEach(writeBoConsumer(list)); + return Result.success(list); + } + + @Override + public Result countReports(String tenant, String keyword, Integer pageNo, Integer pageSize) { + return Result.success(this.reportInfoMapper.countByExample(this.buildListReportExample(tenant, keyword, pageNo, pageSize))); + } + + @Override + public Result getReportDetails(Long sceneId, String reportId) { + ReportInfoExample example = new ReportInfoExample(); + ReportInfoExample.Criteria criteria = example.createCriteria(); + criteria.andReportIdEqualTo(reportId); + + if (sceneId != null && sceneId > 0) { + criteria.andSceneIdEqualTo(sceneId); + } + List list = this.reportInfoMapper.selectByExampleWithBLOBs(example); + + if (list.isEmpty()) { + return Result.success(null); + } + ReportInfoBo bo = new ReportInfoBo(); + BeanUtils.copyProperties(list.get(0), bo); + if (bo.getFinishTime() == null || bo.getDuration() == null || bo.getDuration() == 0) { + long tmpFinishTime; + if (bo.getDuration() == null || bo.getDuration() == 0) { + tmpFinishTime = bo.getCreateTime().getTime() + 600000; + } else { + tmpFinishTime = bo.getCreateTime().getTime() + bo.getDuration() + 1000; + } + bo.setFinishTime(tmpFinishTime); + + list.get(0).setStatus(REPORT_STATUS_INACTIVE); + try { + reportInfoMapper.updateByPrimaryKey(list.get(0)); + } catch (Exception e) { + log.error("error:{}",e.getMessage()); + } + } + bo.setTotalStatAnalysis(list.get(0).getTotalStatAnalysisEventList()); + return Result.success(bo); + } + + @Override + public Result createReport(ReportInfoBo bo) { + checkArgument(bo != null && bo.checkCreate(), this.logPrefix + "createReport invalid input"); + + if (StringUtils.isBlank(bo.getSnapshotId())) { + Result result = this.sceneSnapshotService.getSceneSnapshotByScene(bo.getSceneId()); + String snapshotId = bo.getSnapshotId(); + SceneSnapshotBo snapshotData = result.getData(); + + if (result.getData() != null) { + snapshotId = snapshotData.getSnapshotId(); + } + checkArgument(StringUtils.isNotBlank(snapshotId), this.logPrefix + "createReport empty snapshot id"); + bo.setSnapshotId(snapshotId); + } + // passed from task service submit task + String reportId = bo.getReportId(); + bo.setReportId(reportId); + ReportInfo po = new ReportInfo(); + BeanUtils.copyProperties(bo, po); + if (this.reportInfoMapper.insertSelective(po) <= 0) { + return Result.success(""); + } + return Result.success(reportId); + } + + @Override + public Result updateReport(ReportInfoBo bo) { + checkArgument(bo != null && bo.checkUpdate(), this.logPrefix + "updateReport invalid input"); + ReportInfo po = new ReportInfo(); + BeanUtils.copyProperties(bo, po); + + ReportInfoExample example = new ReportInfoExample(); + ReportInfoExample.Criteria criteria = example.createCriteria(); + criteria.andReportIdEqualTo(bo.getReportId()); + + if (bo.getSceneId() != null && bo.getSceneId() > 0) { + criteria.andSceneIdEqualTo(bo.getSceneId()); + } + return Result.success(this.reportInfoMapper.updateByExampleSelective(po, example) > 0); + } + + @Override + public Result removeReports(List reportIds) { + checkArgument(reportIds != null && !reportIds.isEmpty(), + this.logPrefix + "empty or inconsistent input"); + + ReportInfoExample example = new ReportInfoExample(); + ReportInfoExample.Criteria criteria = example.createCriteria(); + criteria.andIdIn(reportIds); + reportInfoMapper.deleteByExample(example); + return Result.success(1); + } + + public static String format2(double value) { + /* + * %.2f % 表示 小数点前任意位数 2 表示两位小数 格式后的结果为 f 表示浮点型 + */ + return new Formatter().format("%.2f", value).toString(); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/SceneApiServiceImpl.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/SceneApiServiceImpl.java new file mode 100644 index 000000000..58d039fb1 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/SceneApiServiceImpl.java @@ -0,0 +1,705 @@ +package run.mone.mimeter.dashboard.service.impl; + +import com.alibaba.nacos.api.exception.NacosException; +import com.alibaba.nacos.api.naming.pojo.Instance; +import com.google.gson.Gson; +import com.google.gson.JsonSyntaxException; +import com.google.gson.reflect.TypeToken; +import com.xiaomi.data.push.nacos.NacosNaming; +import com.xiaomi.miapi.api.service.MiApiDataService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.dubbo.common.utils.StringUtils; +import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import run.mone.mimeter.dashboard.bo.DubboService; +import run.mone.mimeter.dashboard.bo.DubboServiceList; +import run.mone.mimeter.dashboard.bo.NacosInfo; +import run.mone.mimeter.dashboard.bo.NacosLoginInfo; +import run.mone.mimeter.dashboard.bo.common.Constants; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.scene.DefaultSceneInfo; +import run.mone.mimeter.dashboard.bo.scene.DubboApiInfoDTO; +import run.mone.mimeter.dashboard.bo.scene.HttpApiInfoDTO; +import run.mone.mimeter.dashboard.bo.scene.TspAuthInfo; +import run.mone.mimeter.dashboard.bo.sceneapi.*; +import run.mone.mimeter.dashboard.common.DubboParamItem; +import run.mone.mimeter.dashboard.common.TaskType; +import run.mone.mimeter.dashboard.common.util.BizUtils; +import run.mone.mimeter.dashboard.common.util.Util; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.exception.CommonException; +import run.mone.mimeter.dashboard.mapper.CheckPointInfoMapper; +import run.mone.mimeter.dashboard.mapper.SceneApiInfoMapper; +import run.mone.mimeter.dashboard.pojo.CheckPointInfo; +import run.mone.mimeter.dashboard.pojo.SceneApiInfo; +import run.mone.mimeter.dashboard.pojo.SceneApiInfoExample; +import run.mone.mimeter.dashboard.service.SceneApiService; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import java.util.*; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +import static run.mone.mimeter.dashboard.bo.common.Constants.*; + +@Service +@Slf4j +public class SceneApiServiceImpl implements SceneApiService { + + //mimeter只会有一个环境,调用mi-api线上即可 + @DubboReference(check = false, group = "${ref.miapi.service.group}", version = "${ref.miapi.service.version}") + private MiApiDataService miApiDataService; + + @Autowired + private SceneApiInfoMapper sceneApiInfoMapper; + + @Resource(name = "nacosNamingSt") + private NacosNaming nacosNamingSt; + + @Resource(name = "nacosNamingOl") + private NacosNaming nacosNamingOl; + private static final Gson gson = Util.getGson(); + ; + public static String stNacosAccessToken = ""; + + public static String olNacosAccessToken = ""; + + + @Autowired + private CheckPointInfoMapper checkPointInfoMapper; + + @Autowired + NacosInfo nacosInfo; + + private final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); + + /** + * 每5分钟更新nacos的accessToken + */ + @PostConstruct + public void init() { + executorService.scheduleAtFixedRate(this::refreshStNacosToken, 0, 5, TimeUnit.MINUTES); + + executorService.scheduleAtFixedRate(this::refreshOlNacosToken, 0, 5, TimeUnit.MINUTES); + } + + @Override + public Result searchApiFromMiApi(String keyword, Integer apiProtocol) { + try { + List> apiDatas = miApiDataService.searchAllApiByKeyword(keyword, apiProtocol); + + if (apiProtocol == Constants.HTTP_API_TYPE || apiProtocol == Constants.GATEWAY_API_TYPE) { + List items = new ArrayList<>(); + //http、mione网关接口集 + apiDatas.forEach(apiData -> { + SceneHttpApiInfoItemBasic httpItem = new SceneHttpApiInfoItemBasic(); + httpItem.setApiName((String) apiData.getOrDefault("apiName", "")); + httpItem.setApiRequestType((Integer) apiData.getOrDefault("apiRequestType", 0)); + httpItem.setApiUrl((String) apiData.getOrDefault("apiURI", "")); + httpItem.setApiProtocol((Integer) apiData.getOrDefault("apiProtocol", HTTP_API_TYPE)); + Long apiID = (Long) apiData.getOrDefault("apiID", 0); + httpItem.setApiID(apiID.intValue()); + + Long projectID = (Long) apiData.getOrDefault("projectID", 0); + httpItem.setProjectID(projectID.intValue()); + items.add(httpItem); + }); + return Result.success(items); + } else if (apiProtocol == Constants.DUBBO_API_TYPE) { + List items = new ArrayList<>(); + //dubbo接口集 + apiDatas.forEach(apiData -> { + SceneDubboApiInfoItemBasic dubboItem = new SceneDubboApiInfoItemBasic(); + dubboItem.setApiName((String) apiData.getOrDefault("apiName", "")); + + Long apiID = (Long) apiData.getOrDefault("apiID", 0); + + dubboItem.setApiID(apiID.intValue()); + + Long projectID = (Long) apiData.getOrDefault("projectID", 0); + dubboItem.setProjectID(projectID.intValue()); + dubboItem.setApiProtocol((Integer) apiData.getOrDefault("apiProtocol", DUBBO_API_TYPE)); + String dubboPath = (String) apiData.getOrDefault("apiURI", ""); + String[] dubboInfo = dubboPath.split(":", 4); + if (dubboInfo.length != 4) { + return; + } + dubboItem.setServiceName(dubboInfo[0]); + dubboItem.setGroup(dubboInfo[1]); + dubboItem.setVersion(dubboInfo[2]); + dubboItem.setMethodName(dubboInfo[3]); + dubboItem.setPath(dubboPath); + items.add(dubboItem); + }); + return Result.success(items); + } + } catch (Exception e) { + return Result.fail(CommonError.LoadMiApiDataFail); + } + return Result.success(new ArrayList<>()); + } + + @Override + public Result getApiDetailFromMiApi(GetApiDetailReq req) { + try { + String apiDetailStr = miApiDataService.getApiDetailById(req.getProjectID(), req.getApiID(), req.getApiProtocol()); + Map apiDetail = gson.fromJson(apiDetailStr, new TypeToken>() { + }.getType()); + //http或网关类型的接口 + if (req.getApiProtocol() == Constants.HTTP_API_TYPE || req.getApiProtocol() == Constants.GATEWAY_API_TYPE) { + SceneHttpApiInfoItemDetail httpDetail = new SceneHttpApiInfoItemDetail(); + httpDetail.setHeaderInfo(gson.toJson(apiDetail.getOrDefault("headerInfo", ""))); + Map baseInfo = null; + String baseUrl = ""; + if (req.getApiProtocol() == Constants.HTTP_API_TYPE) { + baseInfo = (Map) apiDetail.get("baseInfo"); + if (Objects.nonNull(baseInfo)) { + httpDetail.setApiName((String) baseInfo.get("apiName")); + httpDetail.setApiID((Integer) baseInfo.get("apiID")); + int requestMethod = (int) baseInfo.get("apiRequestType"); + httpDetail.setApiRequestType(requestMethod); + baseUrl = (String) baseInfo.get("apiURI"); + httpDetail.setApiRequestParamType((Integer) baseInfo.get("apiRequestParamType")); + httpDetail.setRequestInfoRaw((String) baseInfo.get("apiRequestRaw")); + } + } else if (req.getApiProtocol() == Constants.GATEWAY_API_TYPE) { + baseInfo = (Map) apiDetail.get("gatewayApiBaseInfo"); + if (Objects.nonNull(baseInfo)) { + httpDetail.setApiName((String) baseInfo.get("name")); + httpDetail.setApiID((Integer) baseInfo.get("id")); + String requestMethod = (String) baseInfo.get("httpMethod"); + if (requestMethod.equalsIgnoreCase("get")) { + httpDetail.setApiRequestType(MI_API_HTTP_REQ_GET); + } else { + httpDetail.setApiRequestType(MI_API_HTTP_REQ_POST); + } + httpDetail.setApiRequestParamType(2); + baseUrl = (String) baseInfo.get("url"); + httpDetail.setRequestInfoRaw((String) apiDetail.getOrDefault("apiRequestRaw", "{}")); + + } + } + //http或网关类型接口 + httpDetail.setApiProtocol(req.getApiProtocol()); + StringBuilder url = new StringBuilder("127.0.0.1:8080"); + url.append(baseUrl); + if (httpDetail.getApiRequestType() == MI_API_HTTP_REQ_GET) { + List reqParamList = (List) apiDetail.getOrDefault("requestInfo", ""); + if (reqParamList != null && reqParamList.size() != 0) { + url.append("?"); + } + for (int i = 0; i < Objects.requireNonNull(reqParamList).size(); i++) { + Map pair = (Map) reqParamList.get(i); + url.append(pair.get("paramKey")); + url.append("="); + url.append(pair.get("paramValue")); + if (i != reqParamList.size() - 1) { + url.append("&"); + } + } + } else { + httpDetail.setRequestInfo(gson.toJson(apiDetail.getOrDefault("requestInfo", ""))); + } + httpDetail.setApiUrl(url.toString()); + return Result.success(httpDetail); + } else if (req.getApiProtocol() == Constants.DUBBO_API_TYPE) { + //dubbo类型接口 + SceneDubboApiInfoItemDetail dubboDetail = new SceneDubboApiInfoItemDetail(); + dubboDetail.setApiName((String) apiDetail.getOrDefault("name", "")); + dubboDetail.setDubboEnv((String) apiDetail.getOrDefault("apiEnv", "staging")); + dubboDetail.setProjectID((Integer) apiDetail.getOrDefault("projectID", "")); + dubboDetail.setApiProtocol(Constants.DUBBO_API_TYPE); + + Map dubboApiBaseInfo = (Map) apiDetail.get("dubboApiBaseInfo"); + if (Objects.nonNull(dubboApiBaseInfo)) { + dubboDetail.setServiceName((String) dubboApiBaseInfo.get("apimodelclass")); + dubboDetail.setGroup((String) dubboApiBaseInfo.get("apigroup")); + dubboDetail.setVersion((String) dubboApiBaseInfo.get("apiversion")); + dubboDetail.setMethodName((String) dubboApiBaseInfo.get("apiname")); + dubboDetail.setApiID((Integer) dubboApiBaseInfo.get("id")); + + if (Objects.nonNull(dubboApiBaseInfo.get("methodparaminfo"))) { + String paramsJson = (String) dubboApiBaseInfo.get("methodparaminfo"); + List itemList = gson.fromJson(paramsJson, new TypeToken>() { + }.getType()); + if (Objects.nonNull(itemList)) { + dubboDetail.setRequestParamTypeList(itemList.stream().map(DubboParamItem::getItemClassStr).collect(Collectors.toList())); + } + } else { + dubboDetail.setRequestParamTypeList(new ArrayList<>()); + } + + //请求体,需要mi-api中对应项目使用较高版本依赖才能自动生成请求体 + if (Objects.nonNull(dubboApiBaseInfo.get("request"))) { + dubboDetail.setRequestBody((String) dubboApiBaseInfo.get("request")); + } + } + return Result.success(dubboDetail); + } + return Result.fail(CommonError.InvalidParamError); + } catch (Exception e) { + return Result.fail(CommonError.LoadMiApiDataFail); + } + } + + @Override + public Result getSceneBasicInfoFromApiID(GetApiDetailReq req) { + DefaultSceneInfo defaultSceneInfo = new DefaultSceneInfo(); + Object apiInfo; + try { + apiInfo = this.getApiDetailFromMiApi(req).getData(); + + defaultSceneInfo.setDefaultSceneName("默认场景(请修改)"); + if (req.getApiProtocol() == Constants.HTTP_API_TYPE || req.getApiProtocol() == Constants.GATEWAY_API_TYPE) { + defaultSceneInfo.setSceneType(TaskType.http.name()); + SceneHttpApiInfoItemDetail httpApi = (SceneHttpApiInfoItemDetail) apiInfo; + if (httpApi != null) { + defaultSceneInfo.setDefaultSceneName(httpApi.getApiName()); + } + } else if (req.getApiProtocol() == Constants.DUBBO_API_TYPE) { + defaultSceneInfo.setSceneType(TaskType.dubbo.name()); + SceneDubboApiInfoItemDetail dubboApi = (SceneDubboApiInfoItemDetail) apiInfo; + if (dubboApi != null) { + defaultSceneInfo.setDefaultSceneName(dubboApi.getApiName()); + } + } + defaultSceneInfo.setApiInfo(apiInfo); + } catch (Exception e) { + log.error("get api error:{}", e.getMessage()); + } + return Result.success(defaultSceneInfo); + } + + @Override + public boolean newHttpSceneApis(List httpApiInfoDTOS, int sceneId, int serialLinkId) { + httpApiInfoDTOS.forEach(httpApiInfoDTO -> { + Pair checkRes = checkHttpSceneApiParam(httpApiInfoDTO); + if (checkRes.getKey() != 0) { + throw new CommonException(CommonError.InvalidParamError.code, checkRes.getValue()); + } + SceneApiInfo info = new SceneApiInfo(); + BeanUtils.copyProperties(httpApiInfoDTO, info); + info.setApiType(Constants.CASE_TYPE_HTTP); + info.setSerialLinkId(serialLinkId); + info.setSceneId(sceneId); + //raw数据,post请求使用raw格式 + if (httpApiInfoDTO.getRequestInfoRaw() == null || httpApiInfoDTO.getRequestInfoRaw().isEmpty()) { + info.setRequestBody("[{}]"); + } else { + info.setRequestBody(httpApiInfoDTO.getRequestInfoRaw()); + } + //带格式参数数据 + info.setRequestMethod(httpApiInfoDTO.getApiRequestType()); + info.setRequestParamInfo(httpApiInfoDTO.getRequestInfo()); + if (httpApiInfoDTO.getApiRequestType() == Constants.HTTP_REQ_GET) { + Pair> res = parseGetUrl(httpApiInfoDTO.getApiUrl()); + if (res.getLeft() == -1) { + return; + } else { + info.setRequestParamInfo(gson.toJson(res.getRight())); + } + } + info.setApiHeader(httpApiInfoDTO.getHeaderInfo()); + + //汽车部tsp接口鉴权 + if (httpApiInfoDTO.getApiTspAuth() != null){ + info.setApiTspAuth(gson.toJson(httpApiInfoDTO.getApiTspAuth())); + }else { + info.setApiTspAuth(gson.toJson(new TspAuthInfo(false))); + } + //该接口是否使用录制的流量 + if (httpApiInfoDTO.getApiTrafficInfo() != null){ + info.setApiTrafficInfo(gson.toJson(httpApiInfoDTO.getApiTrafficInfo())); + }else { + info.setApiTrafficInfo(gson.toJson(new ApiTrafficInfo(false))); + } + + //该接口是否使用x5 + if (httpApiInfoDTO.getApiX5Info() != null){ + info.setApiX5Info(gson.toJson(httpApiInfoDTO.getApiX5Info())); + }else { + info.setApiX5Info(gson.toJson(new ApiX5Info(false))); + } + + //转换解析表达式 + BizUtils.processOutputParamExpr(httpApiInfoDTO.getOutputParamInfos()); + info.setOutputParamInfo(gson.toJson(httpApiInfoDTO.getOutputParamInfos())); + + //处理检查点数据 + processCheckPoints(null, httpApiInfoDTO, info); + + //过滤条件 + info.setFilterCondition(gson.toJson(httpApiInfoDTO.getFilterCondition())); + sceneApiInfoMapper.insert(info); + httpApiInfoDTO.setApiID(info.getId()); + }); + return true; + } + + @Override + public boolean updateHttpSceneApi(HttpApiInfoDTO httpApiInfoDTO) { + Pair checkRes = checkHttpSceneApiParam(httpApiInfoDTO); + if (checkRes.getKey() != 0) { + return false; + } + SceneApiInfo info = sceneApiInfoMapper.selectByPrimaryKey(httpApiInfoDTO.getApiID()); + + BeanUtils.copyProperties(httpApiInfoDTO, info); + info.setApiType(Constants.CASE_TYPE_HTTP); + //raw数据,post请求使用raw格式 + info.setRequestBody(httpApiInfoDTO.getRequestInfoRaw()); + //带格式参数数据 + info.setRequestMethod(httpApiInfoDTO.getApiRequestType()); + info.setRequestParamInfo(httpApiInfoDTO.getRequestInfo()); + if (httpApiInfoDTO.getApiRequestType() == Constants.HTTP_REQ_GET) { + Pair> res = parseGetUrl(httpApiInfoDTO.getApiUrl()); + if (res.getLeft() == -1) { + return false; + } else { + info.setRequestParamInfo(gson.toJson(res.getRight())); + } + } + info.setApiHeader(httpApiInfoDTO.getHeaderInfo()); + + //汽车部tsp接口鉴权 + if (httpApiInfoDTO.getApiTspAuth() != null){ + info.setApiTspAuth(gson.toJson(httpApiInfoDTO.getApiTspAuth())); + }else { + info.setApiTspAuth(gson.toJson(new TspAuthInfo(false))); + } + //该接口是否使用录制的流量 + if (httpApiInfoDTO.getApiTrafficInfo() != null){ + info.setApiTrafficInfo(gson.toJson(httpApiInfoDTO.getApiTrafficInfo())); + }else { + info.setApiTrafficInfo(gson.toJson(new ApiTrafficInfo(false))); + } + //该接口是否使用x5 + if (httpApiInfoDTO.getApiX5Info() != null){ + info.setApiX5Info(gson.toJson(httpApiInfoDTO.getApiX5Info())); + }else { + info.setApiX5Info(gson.toJson(new ApiX5Info(false))); + } + //转换解析表达式 + BizUtils.processOutputParamExpr(httpApiInfoDTO.getOutputParamInfos()); + info.setOutputParamInfo(gson.toJson(httpApiInfoDTO.getOutputParamInfos())); + + //处理检查点数据 + processCheckPoints(null, httpApiInfoDTO, info); + + //过滤条件 + info.setFilterCondition(gson.toJson(httpApiInfoDTO.getFilterCondition())); + + sceneApiInfoMapper.updateByPrimaryKeyWithBLOBs(info); + return true; + } + + @Override + public boolean updateDubboSceneApi(DubboApiInfoDTO dubboApiInfoDTO) { + Pair checkRes = checkDubboSceneApiParam(dubboApiInfoDTO); + if (checkRes.getKey() != 0) { + throw new CommonException(CommonError.InvalidParamError.code, checkRes.getValue()); + } + SceneApiInfo info = sceneApiInfoMapper.selectByPrimaryKey(dubboApiInfoDTO.getApiID()); + BeanUtils.copyProperties(dubboApiInfoDTO, info); + info.setApiType(Constants.CASE_TYPE_RPCX); + info.setDubboGroup(dubboApiInfoDTO.getGroup()); + info.setDubboVersion(dubboApiInfoDTO.getVersion()); + //nacos环境 + if ("staging".equals(dubboApiInfoDTO.getDubboEnv())) { + info.setNacosType(Constants.NACOS_TYPE_ST); + } else if ("online".equals(dubboApiInfoDTO.getDubboEnv())) { + info.setNacosType(Constants.NACOS_TYPE_OL); + } + //参数类型列表 + info.setParamTypeList(gson.toJson(dubboApiInfoDTO.getRequestParamTypeList())); + //参数体 json + info.setDubboParamJson(dubboApiInfoDTO.getRequestBody()); + + //更新attachment + info.setApiHeader(dubboApiInfoDTO.getAttachments()); + + //转换解析表达式 + BizUtils.processOutputParamExpr(dubboApiInfoDTO.getOutputParamInfos()); + info.setOutputParamInfo(gson.toJson(dubboApiInfoDTO.getOutputParamInfos())); + + //处理检查点数据 + processCheckPoints(dubboApiInfoDTO, null, info); + + //过滤条件 + info.setFilterCondition(gson.toJson(dubboApiInfoDTO.getFilterCondition())); + sceneApiInfoMapper.updateByPrimaryKeyWithBLOBs(info); + return true; + } + + @Override + public boolean newDubboSceneApis(List dubboApiInfoDTOS, int sceneId, int serialLinkId) { + dubboApiInfoDTOS.forEach(dubboApiInfoDTO -> { + Pair checkRes = checkDubboSceneApiParam(dubboApiInfoDTO); + if (checkRes.getKey() != 0) { + throw new CommonException(CommonError.InvalidParamError.code, checkRes.getValue()); + } + SceneApiInfo info = new SceneApiInfo(); + BeanUtils.copyProperties(dubboApiInfoDTO, info); + info.setDubboGroup(dubboApiInfoDTO.getGroup()); + info.setDubboVersion(dubboApiInfoDTO.getVersion()); + + info.setRequestMethod(0); + info.setNeedLogin(false); + + info.setApiType(Constants.CASE_TYPE_RPCX); + info.setSceneId(sceneId); + info.setSerialLinkId(serialLinkId); + //nacos环境 + if ("staging".equals(dubboApiInfoDTO.getDubboEnv())) { + info.setNacosType(Constants.NACOS_TYPE_ST); + } else if ("online".equals(dubboApiInfoDTO.getDubboEnv())) { + info.setNacosType(Constants.NACOS_TYPE_OL); + } + //参数类型列表 + info.setParamTypeList(gson.toJson(dubboApiInfoDTO.getRequestParamTypeList())); + //参数体 json + info.setDubboParamJson(dubboApiInfoDTO.getRequestBody()); + //dubbo请求携带的attachment + info.setApiHeader(dubboApiInfoDTO.getAttachments()); + + //转换解析表达式 + BizUtils.processOutputParamExpr(dubboApiInfoDTO.getOutputParamInfos()); + info.setOutputParamInfo(gson.toJson(dubboApiInfoDTO.getOutputParamInfos())); + + //处理检查点数据 + processCheckPoints(dubboApiInfoDTO, null, info); + + //过滤条件 + info.setFilterCondition(gson.toJson(dubboApiInfoDTO.getFilterCondition())); + sceneApiInfoMapper.insert(info); + dubboApiInfoDTO.setApiID(info.getId()); + }); + return true; + } + + @Override + public boolean deleteSceneApisBySceneId(int sceneId) { + SceneApiInfoExample example = new SceneApiInfoExample(); + example.createCriteria().andSceneIdEqualTo(sceneId); + return sceneApiInfoMapper.deleteByExample(example) >= 0; + } + + @Override + public boolean deleteSceneApisBySerialLinkId(int serialLinkId) { + SceneApiInfoExample example = new SceneApiInfoExample(); + example.createCriteria().andSerialLinkIdEqualTo(serialLinkId); + return sceneApiInfoMapper.deleteByExample(example) >= 0; + } + + private void processCheckPoints(DubboApiInfoDTO dubboApiInfoDTO, HttpApiInfoDTO httpApiInfoDTO, SceneApiInfo info) { + List checkPointInfoDTOList = new ArrayList<>(); + //检查点信息 + if (info.getApiType() == Constants.CASE_TYPE_HTTP) { + checkPointInfoDTOList = httpApiInfoDTO.getCheckPointInfoList(); + } else if (info.getApiType() == Constants.CASE_TYPE_RPCX) { + checkPointInfoDTOList = dubboApiInfoDTO.getCheckPointInfoList(); + } + List checkPointInfos = new ArrayList<>(checkPointInfoDTOList.size()); + checkPointInfoDTOList.forEach(checkPointInfoDTO -> { + CheckPointInfo checkPointInfo = new CheckPointInfo(); + checkPointInfo.setCheckType(checkPointInfoDTO.getCheckType()); + checkPointInfo.setCheckObj(checkPointInfoDTO.getCheckObj()); + checkPointInfo.setCheckCondition(checkPointInfoDTO.getCheckCondition()); + checkPointInfo.setCheckContent(checkPointInfoDTO.getCheckContent()); + checkPointInfos.add(checkPointInfo); + }); + + //插入检查点数据 + if (checkPointInfos.size() != 0) { + checkPointInfoMapper.batchInsert(checkPointInfos); + } + info.setCheckPoint(gson.toJson(checkPointInfos)); + } + + private Pair checkHttpSceneApiParam(HttpApiInfoDTO apiInfoDTO) { + if (apiInfoDTO.getApiUrl() == null) { + return Pair.of(-1, "接口url"); + } + if (apiInfoDTO.getApiRequestType() == null) { + return Pair.of(-1, "接口请求方式必传"); + } + if (apiInfoDTO.getApiOrder() == null) { + return Pair.of(-1, "接口顺序必传"); + } + if (apiInfoDTO.getApiRequestType() == Constants.HTTP_REQ_POST && apiInfoDTO.getContentType() == null) { + return Pair.of(-1, "参数类型必传"); + } + if (apiInfoDTO.getRequestTimeout() == null) { + return Pair.of(-1, "接口超时时间必传"); + } + if (apiInfoDTO.getNeedLogin() == null) { + apiInfoDTO.setNeedLogin(false); + } + + return Pair.of(0, "success"); + } + + private Pair checkDubboSceneApiParam(DubboApiInfoDTO apiInfoDTO) { + if (apiInfoDTO.getServiceName() == null) { + return Pair.of(-1, "dubbo 服务名必传"); + } + if (apiInfoDTO.getMethodName() == null) { + return Pair.of(-1, "dubbo 方法名必传"); + } + if (apiInfoDTO.getGroup() == null) { + apiInfoDTO.setGroup(""); + } + if (apiInfoDTO.getVersion() == null) { + apiInfoDTO.setVersion(""); + } + if (apiInfoDTO.getApiOrder() == null) { + return Pair.of(-1, "接口顺序必传"); + } + if (apiInfoDTO.getRequestTimeout() == null) { + return Pair.of(-1, "接口超时时间必传"); + } + return Pair.of(0, "success"); + } + + @Override + public Result> loadDubboApiServices(String keyword, String env) { + DubboServiceList serviceList = new DubboServiceList(); + String serviceListStr = ""; + + String DEFAULT_NAMESPACE = ""; + if (NACOS_CN_ONLINE.equals(env)) { + serviceListStr = nacosNamingOl.serviceList2(DEFAULT_NAMESPACE, 1, 50, keyword, olNacosAccessToken); + }else if (NACOS_ST.equals(env)){ + serviceListStr = nacosNamingSt.serviceList2(DEFAULT_NAMESPACE, 1, 50, keyword, stNacosAccessToken); + } + if (Objects.nonNull(serviceListStr) && StringUtils.isNotEmpty(serviceListStr)) { + try { + serviceList = gson.fromJson(serviceListStr, new TypeToken() { + }.getType()); + } catch (JsonSyntaxException e) { + log.error("获取nacos服务列表失败,serviceList:{}", serviceListStr); + this.refreshOlNacosToken(); + this.refreshStNacosToken(); + try { + if (NACOS_CN_ONLINE.equals(env)) { + serviceListStr = nacosNamingOl.serviceList2(DEFAULT_NAMESPACE, 1, 50, keyword, olNacosAccessToken); + }else if (NACOS_ST.equals(env)){ + serviceListStr = nacosNamingSt.serviceList2(DEFAULT_NAMESPACE, 1, 50, keyword, stNacosAccessToken); + } + serviceList = gson.fromJson(serviceListStr, new TypeToken() { + }.getType()); + } catch (Exception ex) { + return Result.fail(500, "获取nacos服务列表失败"); + } + } + } + + if (Objects.nonNull(serviceList)) { + return Result.success(serviceList.getServiceList().stream().filter(service -> (service.getHealthyInstanceCount() > 0 && service.getName().startsWith("providers:"))).collect(Collectors.toList())); + } else { + return Result.success(new ArrayList<>()); + } + } + + @Override + public Result> getServiceMethod(String serviceName, String env) throws NacosException { + List methodNames; + List instanceList; + + switch (env) { + case Constants.NACOS_ST: + instanceList = nacosNamingSt.getAllInstances(serviceName); + break; + case Constants.NACOS_CN_ONLINE: + instanceList = nacosNamingOl.getAllInstances(serviceName); + break; + default: + instanceList = new ArrayList<>(); + } + + if (Objects.nonNull(instanceList) && !instanceList.isEmpty()) { + Instance instance = instanceList.get(0); + String[] methodsArr = instance.getMetadata().getOrDefault("methods", "").split(","); + methodNames = Arrays.stream(methodsArr).collect(Collectors.toList()); + return Result.success(methodNames); + } + return Result.success(new ArrayList<>()); + } + + public List getBasicInfosByIds(List apiIdList) { + if (apiIdList == null || apiIdList.isEmpty()) { + return new ArrayList<>(); + } + SceneApiInfoExample example = new SceneApiInfoExample(); + example.createCriteria().andIdIn(apiIdList); + List poList = this.sceneApiInfoMapper.selectByExample(example); + + return poList.stream().map((po) -> SceneApiInfoItemBasic.builder() + .apiID(po.getId()) + .apiName(po.getApiName()) + .build()).collect(Collectors.toList()); + } + + @Override + public Result getApiUrlById(Integer apiId) { + SceneApiInfo apiInfo = sceneApiInfoMapper.selectByPrimaryKey(apiId); + if (apiInfo == null) { + return Result.success(""); + } + if (apiInfo.getApiType() == CASE_TYPE_HTTP) { + return Result.success(apiInfo.getApiUrl()); + } else if (apiInfo.getApiType() == CASE_TYPE_RPCX) { + return Result.success(apiInfo.getServiceName() + "|" + apiInfo.getMethodName()); + } + return Result.success(""); + } + + private Pair> parseGetUrl(String url) { + //url 例: http://www.baidu.com?a=b&b=2 + List kvPairs = new ArrayList<>(); + if (url.contains("?")) { + String[] urlArr = url.split("\\?", 2); + if (urlArr.length != 2) { + return Pair.of(-1, null); + } + //[a=b,b=2] + String[] kvStrPair = urlArr[1].split("&"); + for (String s : kvStrPair) { + String[] kAndV = s.split("=", 2); + kvPairs.add(new FormParamValue(kAndV[0], kAndV[1])); + } + } + return Pair.of(0, kvPairs); + } + + public void refreshStNacosToken() { + //测试环境nacos + try { + NacosLoginInfo stNacosLoginInfo = new Gson().fromJson(nacosNamingSt.login(nacosInfo.getUsernameSt(), nacosInfo.getPasswordSt()), NacosLoginInfo.class); + if (null != stNacosLoginInfo && StringUtils.isNotEmpty(stNacosLoginInfo.getAccessToken())) { + stNacosAccessToken = stNacosLoginInfo.getAccessToken(); + } + } catch (Throwable ex) { + log.error(ex.getMessage()); + } + } + + private void refreshOlNacosToken() { + //中国区线上环境nacos + try { + NacosLoginInfo olNacosLoginInfo = new Gson().fromJson(nacosNamingOl.login(nacosInfo.getUsernameOl(), nacosInfo.getPasswordOl()), NacosLoginInfo.class); + if (null != olNacosLoginInfo && StringUtils.isNotEmpty(olNacosLoginInfo.getAccessToken())) { + olNacosAccessToken = olNacosLoginInfo.getAccessToken(); + } + } catch (Throwable ex) { + log.error(ex.getMessage()); + } + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/SceneGroupServiceImpl.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/SceneGroupServiceImpl.java new file mode 100644 index 000000000..540820272 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/SceneGroupServiceImpl.java @@ -0,0 +1,63 @@ +package run.mone.mimeter.dashboard.service.impl; + +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.scenegroup.SceneGroupDTO; +import run.mone.mimeter.dashboard.mapper.SceneGroupMapper; +import run.mone.mimeter.dashboard.mapper.SceneInfoMapper; +import run.mone.mimeter.dashboard.pojo.SceneGroup; +import run.mone.mimeter.dashboard.pojo.SceneInfo; +import run.mone.mimeter.dashboard.pojo.SceneInfoExample; +import run.mone.mimeter.dashboard.service.SceneGroupService; +import run.mone.mimeter.dashboard.service.SceneService; + +import java.util.List; + +@Service +public class SceneGroupServiceImpl implements SceneGroupService { + + @Autowired + private SceneGroupMapper sceneGroupMapper; + + @Autowired + private SceneInfoMapper sceneInfoMapper; + + @Autowired + private SceneService sceneService; + + @Override + public Result newSceneGroup(SceneGroupDTO sceneGroupDTO, String opUser) { + SceneGroup sceneGroup = new SceneGroup(); + BeanUtils.copyProperties(sceneGroupDTO,sceneGroup); + sceneGroup.setCreator(opUser); + sceneGroup.setCtime(System.currentTimeMillis()); + sceneGroup.setTenant(sceneGroupDTO.getTenant()); + sceneGroupMapper.insert(sceneGroup); + return Result.success(sceneGroup.getId()); + } + + @Override + public Result editSceneGroup(SceneGroupDTO sceneGroupDTO, String opUser) { + SceneGroup sceneGroup = sceneGroupMapper.selectByPrimaryKey(sceneGroupDTO.getId()); + sceneGroup.setGroupName(sceneGroupDTO.getGroupName()); + sceneGroup.setGroupDesc(sceneGroupDTO.getGroupDesc()); + if (sceneGroup.getTenant() == null){ + sceneGroup.setTenant(sceneGroupDTO.getTenant()); + } + sceneGroupMapper.updateByPrimaryKey(sceneGroup); + return Result.success(true); + } + + @Override + public Result delSceneGroup(SceneGroupDTO sceneGroupDTO, String opUser) { + SceneInfoExample example = new SceneInfoExample(); + example.createCriteria().andSceneGroupIdEqualTo(sceneGroupDTO.getId()); + List sceneInfoList = sceneInfoMapper.selectByExample(example); + sceneInfoList.forEach(sceneInfo -> sceneService.delScene(sceneInfo.getId(),opUser)); + sceneGroupMapper.deleteByPrimaryKey(sceneGroupDTO.getId()); + return Result.success(true); + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/SceneServiceImpl.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/SceneServiceImpl.java new file mode 100644 index 000000000..d38a6ce64 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/SceneServiceImpl.java @@ -0,0 +1,1096 @@ +package run.mone.mimeter.dashboard.service.impl; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.tuple.Pair; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import run.mone.mimeter.dashboard.bo.agent.AgentDTO; +import run.mone.mimeter.dashboard.bo.common.Constants; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.dataset.SceneParamData; +import run.mone.mimeter.dashboard.bo.operationlog.OperationLogDto; +import run.mone.mimeter.dashboard.bo.operationlog.PerOperation; +import run.mone.mimeter.dashboard.bo.scene.*; +import org.springframework.stereotype.Service; +import run.mone.mimeter.dashboard.bo.sceneapi.ApiTrafficInfo; +import run.mone.mimeter.dashboard.bo.sceneapi.ApiX5Info; +import run.mone.mimeter.dashboard.bo.sceneapi.CheckPointInfoDTO; +import run.mone.mimeter.dashboard.bo.sceneapi.SceneApiOutputParam; +import run.mone.mimeter.dashboard.bo.scenegroup.GetSceneGroupListReq; +import run.mone.mimeter.dashboard.bo.scenegroup.GroupSceneDTO; +import run.mone.mimeter.dashboard.bo.scenegroup.SceneGroupList; +import run.mone.mimeter.dashboard.bo.sla.SlaDto; +import run.mone.mimeter.dashboard.common.TaskStatus; +import run.mone.mimeter.dashboard.common.util.Util; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.exception.CommonException; +import run.mone.mimeter.dashboard.mapper.*; +import run.mone.mimeter.dashboard.pojo.*; +import run.mone.mimeter.dashboard.service.*; + +import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +import static com.google.common.base.Preconditions.checkArgument; +import static run.mone.mimeter.dashboard.bo.common.Constants.*; +import static run.mone.mimeter.dashboard.bo.operationlog.OperationLogTypeEnum.NEW_OPERATION; +import static run.mone.mimeter.dashboard.bo.operationlog.OperationLogTypeEnum.UPDATE_OPERATION; +import static run.mone.mimeter.dashboard.bo.operationlog.OperationTypeEnum.COPY_SNAPSHOT; +import static run.mone.mimeter.dashboard.bo.operationlog.OperationTypeEnum.VIEW_SNAPSHOT; +import static run.mone.mimeter.dashboard.bo.snapshot.SnapshotTypeEnum.SCENE_SNAPSHOT; + +@Service +@Slf4j +public class SceneServiceImpl implements SceneService { + + @Autowired + private SceneInfoMapper sceneInfoMapper; + + @Autowired + private SceneSnapshotService sceneSnapshotService; + + @Autowired + private SlaService slaService; + + @Autowired + private SceneApiService sceneApiService; + + @Autowired + private SceneApiInfoMapper sceneApiInfoMapper; + + @Autowired + private SerialLinkMapper serialLinkMapper; + + @Autowired + private DatasetService datasetService; + + @Autowired + private OperationLogService operationLogService; + + @Autowired + private SceneGroupMapper sceneGroupMapper; + /** + * 操作记录 + */ + @Autowired + private OperationLogMapper logMapper; + + @Autowired + private AgentInfoMapper agentInfoMapper; + + private static final Gson gson = Util.getGson(); + + private static final Integer SCENE_REQ_TIMEOUT = 1000; + + /** + * 创建压测场景 + * 1、创建场景实体插表 + * 2、json保存接口施压配置 + * 3、数据集处理 + * 4、分类型处理api接口结构,创建链路,插表 + * 5、创建sla,插表 + * 6、数据集处理 + * 7、操作记录和场景快照 + * ... + * + * @param createSceneReq 创建场景所需数据 + * @param opUser 创建人 + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result newScene(CreateSceneDTO createSceneReq, String opUser) { + + Pair checkRes = checkSceneParam(createSceneReq); + if (checkRes.getKey() != 0) { + throw new CommonException(CommonError.InvalidParamError.code, checkRes.getValue()); + } + SceneInfoExample oldExp = new SceneInfoExample(); + oldExp.createCriteria().andNameEqualTo(createSceneReq.getName()); + List olds = sceneInfoMapper.selectByExample(oldExp); + if (olds != null && olds.size() != 0) { + return Result.fail(CommonError.SceneAlreadyExist); + } + SceneInfo sceneInfo; + try { + sceneInfo = new SceneInfo(); + BeanUtils.copyProperties(createSceneReq, sceneInfo); + sceneInfo.setCreator(opUser); + sceneInfo.setUpdator(opUser); + sceneInfo.setSceneGroupId(createSceneReq.getGroupID()); + long now = System.currentTimeMillis(); + sceneInfo.setCtime(now); + sceneInfo.setUtime(now); + sceneInfo.setSceneStatus(TaskStatus.Init.code); + if (createSceneReq.getGlobalHeaderList() != null && createSceneReq.getGlobalHeaderList().size() != 0) { + sceneInfo.setGlobalHeader(gson.toJson(createSceneReq.getGlobalHeaderList())); + } else { + sceneInfo.setGlobalHeader("[]"); + } + if (createSceneReq.getGroupID() == null) { + sceneInfo.setSceneGroupId(0); + } else { + sceneInfo.setSceneGroupId(createSceneReq.getGroupID()); + } + //施压配置中的接口数据配置 + sceneInfo.setApiBenchInfos(gson.toJson(createSceneReq.getApiBenchInfos())); + + //插入sla配置 + if (Objects.nonNull(createSceneReq.getSlaDto())) { + sceneInfo.setSla(gson.toJson(createSceneReq.getSlaDto())); + } + + //自定义成功状态码 + if (createSceneReq.getSuccessCode() != null) { + sceneInfo.setSuccessCode(createSceneReq.getSuccessCode()); + } + + //检查施压机配置 + if (createSceneReq.getAgentIdList() != null && createSceneReq.getAgentIdList().size() != 0) { + List agentDTOList = new ArrayList<>(); + AgentInfoExample example = new AgentInfoExample(); + example.createCriteria().andIdIn(createSceneReq.getAgentIdList()); + + List agentInfos = agentInfoMapper.selectByExample(example); + agentInfos.forEach(agentInfo -> { + AgentDTO agentDTO = new AgentDTO(); + BeanUtils.copyProperties(agentInfo, agentDTO); + agentDTOList.add(agentDTO); + }); + sceneInfo.setAgentList(gson.toJson(agentDTOList)); + } else { + sceneInfo.setAgentList("[]"); + } + + //汽车部tsp接口鉴权 + if (createSceneReq.getGlobalTspAuth() != null) { + sceneInfo.setGlobalTspAuth(gson.toJson(createSceneReq.getGlobalTspAuth())); + } else { + sceneInfo.setGlobalTspAuth(gson.toJson(new TspAuthInfo(false))); + } + + if (createSceneReq.getRefDatasetIds() != null) { + sceneInfo.setRefDatasetIds(gson.toJson(createSceneReq.getRefDatasetIds())); + } + + //插入租户信息 + if (createSceneReq.getTenant() != null) { + sceneInfo.setTenant(createSceneReq.getTenant()); + } + + //有效接口数 + AtomicInteger apiNum = new AtomicInteger(); + if (Constants.SCENE_TYPE_HTTP == createSceneReq.getSceneType()) { + createSceneReq.getSerialLinkDTOs().forEach(serialLinkDTO -> apiNum.addAndGet(serialLinkDTO.getHttpApiInfoDTOList().size())); + } else if (Constants.SCENE_TYPE_DUBBO == createSceneReq.getSceneType()) { + createSceneReq.getSerialLinkDTOs().forEach(serialLinkDTO -> apiNum.addAndGet(serialLinkDTO.getDubboApiInfoDTOList().size())); + } + sceneInfo.setApinum(apiNum.get()); + //场景来源 控制台创建或openapi创建 + sceneInfo.setSceneSource(createSceneReq.getSceneSource()); + + //场景负责人 + List personsInCharge = new ArrayList<>(); + personsInCharge.add(opUser); + sceneInfo.setPersonInCharge(gson.toJson(personsInCharge)); + + //压测次数 + sceneInfo.setBenchCount(0); + + //上次压测时间 + sceneInfo.setLastBenchTime(0L); + + sceneInfoMapper.insert(sceneInfo); + + //插入场景api + if (Constants.SCENE_TYPE_HTTP == createSceneReq.getSceneType()) { + createSceneReq.getSerialLinkDTOs().forEach(serialLinkDTO -> { + //创建串联链路 + SerialLink serialLink = new SerialLink(); + serialLink.setSceneId(sceneInfo.getId()); + serialLink.setName(serialLinkDTO.getSerialLinkName()); + serialLink.setEnable(serialLinkDTO.getEnable()); + serialLinkMapper.insert(serialLink); + + serialLinkDTO.setSerialLinkID(serialLink.getId()); + //http(||网关)类场景 + sceneApiService.newHttpSceneApis(serialLinkDTO.getHttpApiInfoDTOList(), sceneInfo.getId(), serialLink.getId()); + }); + + } else if (Constants.SCENE_TYPE_DUBBO == createSceneReq.getSceneType()) { + createSceneReq.getSerialLinkDTOs().forEach(serialLinkDTO -> { + //创建串联链路 + SerialLink serialLink = new SerialLink(); + serialLink.setSceneId(sceneInfo.getId()); + serialLink.setName(serialLinkDTO.getSerialLinkName()); + serialLink.setEnable(serialLinkDTO.getEnable()); + serialLinkMapper.insert(serialLink); + serialLinkDTO.setSerialLinkID(serialLink.getId()); + //dubbo场景 + sceneApiService.newDubboSceneApis(serialLinkDTO.getDubboApiInfoDTOList(), sceneInfo.getId(), serialLink.getId()); + }); + } else { + return Result.fail(CommonError.InvalidParamError); + } + + createSceneReq.setId(sceneInfo.getId()); + //绑定数据集 + datasetService.bindDataSetsByScene(createSceneReq.getDatasetIds(), new HashSet<>(createSceneReq.getRefDatasetIds().values()), sceneInfo.getId()); + this.postOperationLog(createSceneReq, true, opUser); + } catch (Exception e) { + log.error("new scene failed,error:{}", e.getMessage()); + throw e; + } + return Result.success(transferToDetailSceneDTO(sceneInfo, false)); + } + + /** + * 删场景 + * 删场景绑定的接口 + * + * @param sceneID + * @param opUser + * @return + */ + @Override + @Transactional + public Result delScene(Integer sceneID, String opUser) { + if (sceneInfoMapper.deleteByPrimaryKey(sceneID) > 0) { + SceneApiInfoExample example = new SceneApiInfoExample(); + example.createCriteria().andSceneIdEqualTo(sceneID); + sceneApiInfoMapper.deleteByExample(example); + return Result.success(true); + } + return Result.fail(CommonError.UnknownError); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result editScene(EditSceneDTO editSceneReq, String opUser) { + try { + SceneInfo sceneInfo = sceneInfoMapper.selectByPrimaryKey(editSceneReq.getId()); + String oTenant = sceneInfo.getTenant(); + BeanUtils.copyProperties(editSceneReq, sceneInfo); + sceneInfo.setTenant(oTenant); + sceneInfo.setId(editSceneReq.getId()); + sceneInfo.setRpsRate(editSceneReq.getRpsRate()); + sceneInfo.setSceneGroupId(editSceneReq.getGroupID()); + long now = System.currentTimeMillis(); + sceneInfo.setUtime(now); + //施压配置中的接口数据配置 + sceneInfo.setApiBenchInfos(gson.toJson(editSceneReq.getApiBenchInfos())); + sceneInfo.setGlobalHeader(gson.toJson(editSceneReq.getGlobalHeaderList())); + sceneInfo.setUpdator(opUser); + + if (editSceneReq.getGroupID() == null) { + sceneInfo.setSceneGroupId(Constants.DEFAULT_SCENE_GROUP); + } + if (editSceneReq.getSceneEnv() == null) { + sceneInfo.setSceneEnv(SCENE_ENV_ST); + } + if (editSceneReq.getIncreasePercent() == null) { + sceneInfo.setIncreasePercent(0); + } + //插入sla配置 + if (Objects.nonNull(editSceneReq.getSlaDto())) { + sceneInfo.setSla(gson.toJson(editSceneReq.getSlaDto())); + } + //检查施压机配置 + if (editSceneReq.getAgentIdList() != null && editSceneReq.getAgentIdList().size() != 0) { + List agentDTOList = new ArrayList<>(); + AgentInfoExample example = new AgentInfoExample(); + example.createCriteria().andIdIn(editSceneReq.getAgentIdList()); + + List agentInfos = agentInfoMapper.selectByExample(example); + AtomicBoolean ok = new AtomicBoolean(true); + agentInfos.forEach(agentInfo -> { + if (!agentInfo.getEnable()) { + ok.set(false); + } else { + AgentDTO agentDTO = new AgentDTO(); + BeanUtils.copyProperties(agentInfo, agentDTO); + agentDTOList.add(agentDTO); + } + }); + if (!ok.get()) { + return Result.fail(CommonError.UnableBenchAgent); + } + sceneInfo.setAgentList(gson.toJson(agentDTOList)); + } else { + sceneInfo.setAgentList("[]"); + } + + //汽车部tsp接口鉴权 + if (editSceneReq.getGlobalTspAuth() != null) { + sceneInfo.setGlobalTspAuth(gson.toJson(editSceneReq.getGlobalTspAuth())); + } else { + sceneInfo.setGlobalTspAuth(gson.toJson(new TspAuthInfo(false))); + } + + if (editSceneReq.getSuccessCode() != null) { + sceneInfo.setSuccessCode(editSceneReq.getSuccessCode()); + } + + if (editSceneReq.getRefDatasetIds() != null) { + sceneInfo.setRefDatasetIds(gson.toJson(editSceneReq.getRefDatasetIds())); + } + + //兼容,早期的场景没有租户信息,这里在更新的时候补充进去 + if (sceneInfo.getTenant() == null) { + sceneInfo.setTenant(editSceneReq.getTenant()); + } + + //有效接口数 + AtomicInteger apiNum = new AtomicInteger(); + if (Constants.SCENE_TYPE_HTTP == editSceneReq.getSceneType()) { + editSceneReq.getSerialLinkDTOs().forEach(serialLinkDTO -> apiNum.addAndGet(serialLinkDTO.getHttpApiInfoDTOList().size())); + } else if (Constants.SCENE_TYPE_DUBBO == editSceneReq.getSceneType()) { + editSceneReq.getSerialLinkDTOs().forEach(serialLinkDTO -> apiNum.addAndGet(serialLinkDTO.getDubboApiInfoDTOList().size())); + } + sceneInfo.setApinum(apiNum.get()); + //场景来源 控制台创建或openapi创建 + sceneInfo.setSceneSource(editSceneReq.getSceneSource()); + + //场景负责人 + List bindUsers = new ArrayList<>(editSceneReq.getPersonsInCharge().size()); + editSceneReq.getPersonsInCharge().forEach(user -> { + if (user.contains("@")) { + user = user.substring(0, user.indexOf("@")); + } + bindUsers.add(user); + }); + sceneInfo.setPersonInCharge(gson.toJson(bindUsers)); + + sceneInfoMapper.updateByPrimaryKeyWithBLOBs(sceneInfo); + + SerialLinkExample linkExample = new SerialLinkExample(); + linkExample.createCriteria().andSceneIdEqualTo(editSceneReq.getId()); + //原有链路 + List oldLinkIds = serialLinkMapper.selectByExample(linkExample).stream().map(SerialLink::getId).collect(Collectors.toList()); + + removeOldLinks(oldLinkIds, editSceneReq); + //更新场景下api列表 + if (Constants.SCENE_TYPE_HTTP == editSceneReq.getSceneType()) { + //http(||网关)类场景 + editSceneReq.getSerialLinkDTOs().forEach(serialLinkDTO -> { + SerialLink serialLink = serialLinkMapper.selectByPrimaryKey(serialLinkDTO.getSerialLinkID()); + if (serialLink == null) { + //新增链路 + //创建串联链路 + serialLink = new SerialLink(); + serialLink.setSceneId(sceneInfo.getId()); + serialLink.setName(serialLinkDTO.getSerialLinkName()); + if (serialLinkDTO.getEnable() == null) { + serialLink.setEnable(false); + } else { + serialLink.setEnable(serialLinkDTO.getEnable()); + } + serialLinkMapper.insert(serialLink); + + serialLinkDTO.setSerialLinkID(serialLink.getId()); + //http(||网关)类场景 + sceneApiService.newHttpSceneApis(serialLinkDTO.getHttpApiInfoDTOList(), sceneInfo.getId(), serialLink.getId()); + } else { + //更新链路 + serialLink.setName(serialLinkDTO.getSerialLinkName()); + if (serialLinkDTO.getEnable() == null) { + serialLink.setEnable(false); + } else { + serialLink.setEnable(serialLinkDTO.getEnable()); + } + //更新链路信息 + serialLinkMapper.updateByPrimaryKey(serialLink); + + //更新链路中的接口信息 + List apisToBeAdded = new ArrayList<>(); + //新接口id集 + List newApiIds = serialLinkDTO.getHttpApiInfoDTOList().stream().map(HttpApiInfoDTO::getApiID).collect(Collectors.toList()); + //删除旧的 + SceneApiInfoExample apiInfoExample = new SceneApiInfoExample(); + apiInfoExample.createCriteria().andSceneIdEqualTo(sceneInfo.getId()).andSerialLinkIdEqualTo(serialLink.getId()); + + //原接口id集 + List oldApiIds = sceneApiInfoMapper.selectByExample(apiInfoExample).stream().map(SceneApiInfo::getId).collect(Collectors.toList()); + oldApiIds.forEach(oldId -> { + if (!newApiIds.contains(oldId)) { + //删除 + sceneApiInfoMapper.deleteByPrimaryKey(oldId); + } + }); + + //更新原有接口 + serialLinkDTO.getHttpApiInfoDTOList().forEach(httpApiDTO -> { + if (httpApiDTO.getApiID() != null) { + sceneApiService.updateHttpSceneApi(httpApiDTO); + } else { + apisToBeAdded.add(httpApiDTO); + } + }); + + //添加新的接口 + if (apisToBeAdded.size() != 0) { + sceneApiService.newHttpSceneApis(apisToBeAdded, sceneInfo.getId(), serialLink.getId()); + } + } + }); + + } else if (Constants.SCENE_TYPE_DUBBO == editSceneReq.getSceneType()) { + //dubbo场景 + editSceneReq.getSerialLinkDTOs().forEach(serialLinkDTO -> { + SerialLink serialLink = serialLinkMapper.selectByPrimaryKey(serialLinkDTO.getSerialLinkID()); + if (serialLink == null) { + //创建串联链路 + serialLink = new SerialLink(); + serialLink.setSceneId(sceneInfo.getId()); + serialLink.setName(serialLinkDTO.getSerialLinkName()); + + if (serialLinkDTO.getEnable() == null) { + serialLink.setEnable(false); + } else { + serialLink.setEnable(serialLinkDTO.getEnable()); + } + serialLinkMapper.insert(serialLink); + //dubbo场景 + sceneApiService.newDubboSceneApis(serialLinkDTO.getDubboApiInfoDTOList(), sceneInfo.getId(), serialLink.getId()); + } else { + serialLink.setName(serialLinkDTO.getSerialLinkName()); + serialLink.setEnable(serialLinkDTO.getEnable()); + //更新链路信息 + serialLinkMapper.updateByPrimaryKey(serialLink); + List apisToBeAdded = new ArrayList<>(); + //新接口id集 + List newApiIds = serialLinkDTO.getDubboApiInfoDTOList().stream().map(DubboApiInfoDTO::getApiID).collect(Collectors.toList()); + + //删除旧的 + SceneApiInfoExample apiInfoExample = new SceneApiInfoExample(); + apiInfoExample.createCriteria().andSceneIdEqualTo(sceneInfo.getId()).andSerialLinkIdEqualTo(serialLink.getId()); + + //原接口id集 + List oldApiIds = sceneApiInfoMapper.selectByExample(apiInfoExample).stream().map(SceneApiInfo::getId).collect(Collectors.toList()); + oldApiIds.forEach(oldId -> { + if (!newApiIds.contains(oldId)) { + //删除 + sceneApiInfoMapper.deleteByPrimaryKey(oldId); + } + }); + + serialLinkDTO.getDubboApiInfoDTOList().forEach(dubboApiDTO -> { + if (dubboApiDTO.getApiID() != null) { + sceneApiService.updateDubboSceneApi(dubboApiDTO); + } else { + apisToBeAdded.add(dubboApiDTO); + } + }); + + if (apisToBeAdded.size() != 0) { + sceneApiService.newDubboSceneApis(apisToBeAdded, sceneInfo.getId(), serialLink.getId()); + } + } + }); + } else { + return Result.fail(CommonError.InvalidParamError); + } + //绑定数据集 + datasetService.bindDataSetsByScene(editSceneReq.getDatasetIds(), new HashSet<>(editSceneReq.getRefDatasetIds().values()), sceneInfo.getId()); + this.postOperationLog(editSceneReq, false, opUser); + } catch (Exception e) { + log.error("edit scene failed,error:{}", e.getMessage()); + throw e; + } + return Result.success(true); + } + + private void removeOldLinks(List oldLinkIds, EditSceneDTO editSceneDTO) { + List curLinkIds = editSceneDTO.getSerialLinkDTOs().stream(). + map(SerialLinkDTO::getSerialLinkID).filter(Objects::nonNull).collect(Collectors.toList()); + List idToBeRemoved = new ArrayList<>(); + + oldLinkIds.forEach(oldLinkId -> { + if (!curLinkIds.contains(oldLinkId)) { + idToBeRemoved.add(oldLinkId); + } + }); + if (idToBeRemoved.size() == 0) { + return; + } + //删除接口 + SceneApiInfoExample example = new SceneApiInfoExample(); + example.createCriteria().andSceneIdEqualTo(editSceneDTO.getId()).andSerialLinkIdIn(idToBeRemoved); + sceneApiInfoMapper.deleteByExample(example); + + //删除链路 + SerialLinkExample linkExample = new SerialLinkExample(); + linkExample.createCriteria().andIdIn(idToBeRemoved); + serialLinkMapper.deleteByExample(linkExample); + } + + @Override + public Result getSceneByID(Integer sceneID, boolean engine) { + SceneInfo sceneInfo = sceneInfoMapper.selectByPrimaryKey(sceneID); + if (sceneInfo == null) { + return Result.fail(CommonError.InvalidParamError); + } + return Result.success(transferToDetailSceneDTO(sceneInfo, engine)); + } + + @Override + public Result> getSceneInfoByIds(List sceneIds) { + checkArgument(sceneIds != null && !sceneIds.isEmpty(), + "[SceneService]getSceneInfoByIds empty input"); + SceneInfoExample example = new SceneInfoExample(); + example.createCriteria().andIdIn(sceneIds); + return Result.success(sceneInfoMapper.selectByExample(example)); + } + + @Override + public Result getSceneList(GetSceneListReq req) { + if (req.getPage() <= 0) { + req.setPage(1); + } + if (req.getPageSize() <= 0) { + req.setPageSize(DEFAULT_PAGE_SIZE); + } + if (req.getKeyword() == null) { + req.setKeyword(""); + } + SceneList sceneList = new SceneList(); + + int offset = (req.getPage() - 1) * req.getPageSize(); + + sceneList.setPage(req.getPage()); + sceneList.setPageSize(req.getPageSize()); + + SceneInfoExample totalExp = new SceneInfoExample(); + SceneInfoExample.Criteria totalExpCriteria = totalExp.createCriteria(); + SceneInfoExample sceneInfoExample = new SceneInfoExample(); + SceneInfoExample.Criteria sceneInfoCriteria = sceneInfoExample.createCriteria(); + + if (req.getKeyword() != null && !req.getKeyword().isEmpty()) { + sceneInfoExample.or(sceneInfoCriteria.andNameLike("%" + req.getKeyword() + "%")); + totalExp.or(totalExpCriteria.andNameLike("%" + req.getKeyword() + "%")); + + sceneInfoExample.or(sceneInfoExample.createCriteria().andCreatorLike("%" + req.getKeyword() + "%")); + totalExp.or(sceneInfoExample.createCriteria().andCreatorLike("%" + req.getKeyword() + "%")); + } + //场景状态 + if (req.getStatus() != null) { + sceneInfoCriteria.andSceneStatusEqualTo(req.getStatus()); + totalExpCriteria.andSceneStatusEqualTo(req.getStatus()); + } + + sceneInfoExample.setOrderByClause("id desc limit " + req.getPageSize() + " offset " + offset); + + List infoList = sceneInfoMapper.selectByExample(sceneInfoExample); + if (infoList == null || infoList.size() == 0) { + return Result.success(sceneList); + } + + List basicSceneDTOS = infoList.stream().map(this::transferToBasicSceneDTO).collect(Collectors.toList()); + + sceneList.setList(basicSceneDTOS); + sceneList.setTotal(sceneInfoMapper.countByExample(totalExp)); + + return Result.success(sceneList); + } + + @Override + public Result> getSceneListByIds(GetSceneListByIdsReq req) { + List sceneDTOList = new ArrayList<>(); + req.getSceneIdList().forEach(id -> sceneDTOList.add(getSceneByID(id, false).getData())); + return Result.success(sceneDTOList); + } + + @Override + public Result getSceneListByGroup(GetSceneGroupListReq req) { + + if (req.getPage() <= 0) { + req.setPage(1); + } + if (req.getPageSize() <= 0) { + req.setPageSize(DEFAULT_PAGE_SIZE); + } + if (req.getKeyword() == null) { + req.setKeyword(""); + } + + int offset = (req.getPage() - 1) * req.getPageSize(); + + + SceneGroupList groupList = new SceneGroupList(); + groupList.setPage(req.getPage()); + groupList.setPageSize(req.getPageSize()); + + //总数 + SceneGroupExample totalExp = new SceneGroupExample(); + SceneGroupExample.Criteria totalExpCriteria = totalExp.createCriteria(); + + SceneGroupExample sceneGroupExample = new SceneGroupExample(); + SceneGroupExample.Criteria sceneGroupCriteria = sceneGroupExample.createCriteria(); + //租户筛选 +// if (req.getTenant() != null && !req.getTenant().equals(MiOne_Tenant)) { +// sceneGroupCriteria.andTenantEqualTo(req.getTenant()); +// totalExpCriteria.andTenantEqualTo(req.getTenant()); +// } + + if (req.getKeyword() != null) { + sceneGroupExample.or(sceneGroupCriteria.andCreatorLike("%" + req.getKeyword() + "%")); + sceneGroupExample.or(sceneGroupExample.createCriteria().andGroupNameLike("%" + req.getKeyword() + "%")); + totalExp.or(totalExpCriteria.andCreatorLike("%" + req.getKeyword() + "%")); + totalExp.or(totalExp.createCriteria().andGroupNameLike("%" + req.getKeyword() + "%")); + } + + sceneGroupExample.setOrderByClause("id desc limit " + req.getPageSize() + " offset " + offset); + + groupList.setTotal(sceneGroupMapper.countByExample(totalExp)); + + List groupInfoList = sceneGroupMapper.selectByExample(sceneGroupExample); + if (groupInfoList == null || groupInfoList.size() == 0) { + return Result.success(groupList); + } + + List list = new ArrayList<>(); + groupInfoList.forEach(groupInfo -> { + GroupSceneDTO groupSceneDTO = new GroupSceneDTO(); + groupSceneDTO.setSceneGroupID(groupInfo.getId()); + groupSceneDTO.setGroupName(groupInfo.getGroupName()); + groupSceneDTO.setGroupDesc(groupInfo.getGroupDesc()); + groupSceneDTO.setCtime(groupInfo.getCtime()); + + SceneInfoExample sceneInfoExample = new SceneInfoExample(); + sceneInfoExample.createCriteria().andSceneGroupIdEqualTo(groupInfo.getId()); + + List sceneInfos = sceneInfoMapper.selectByExample(sceneInfoExample); + groupSceneDTO.setList(sceneInfos.stream().map(this::transferToBasicSceneDTO).collect(Collectors.toList())); + + list.add(groupSceneDTO); + }); + groupList.setList(list); + return Result.success(groupList); + } + + @Override + public Result getSceneListByKeyword(GetSceneListReq req) { + if (req.getPage() <= 0) { + req.setPage(1); + } + if (req.getPageSize() <= 0) { + req.setPageSize(DEFAULT_PAGE_SIZE); + } + if (req.getKeyword() == null) { + req.setKeyword(""); + } + SceneList sceneList = new SceneList(); + + int offset = (req.getPage() - 1) * req.getPageSize(); + + sceneList.setPage(req.getPage()); + sceneList.setPageSize(req.getPageSize()); + + SceneInfoExample totalExp = new SceneInfoExample(); + totalExp.createCriteria(); + + SceneInfoExample sceneInfoExample = new SceneInfoExample(); + sceneInfoExample.or(sceneInfoExample.createCriteria().andNameLike("%" + req.getKeyword() + "%")); + sceneInfoExample.or(sceneInfoExample.createCriteria().andCreatorLike("%" + req.getKeyword() + "%")); + + sceneInfoExample.or(sceneInfoExample.createCriteria().andSceneTypeEqualTo(req.getSceneType())); + + sceneInfoExample.setOrderByClause("id desc limit " + req.getPageSize() + " offset " + offset); + + List infoList = sceneInfoMapper.selectByExample(sceneInfoExample); + if (infoList == null || infoList.size() == 0) { + return Result.success(sceneList); + } + + List basicSceneDTOS = infoList.stream().map(this::transferToBasicSceneDTO).collect(Collectors.toList()); + + sceneList.setList(basicSceneDTOS); + sceneList.setTotal(sceneInfoMapper.countByExample(totalExp)); + + return Result.success(sceneList); + } + + public List getSerialLinksByIds(List serialIds) { + if (serialIds == null || serialIds.isEmpty()) { + return new ArrayList<>(); + } + SerialLinkExample example = new SerialLinkExample(); + example.createCriteria().andIdIn(serialIds); + List poList = this.serialLinkMapper.selectByExample(example); + + return poList.stream().map((po) -> SerialLinkDTO.builder() + .serialLinkID(po.getId()) + .serialLinkName(po.getName()) + .build()).collect(Collectors.toList()); + } + + private BasicSceneDTO transferToBasicSceneDTO(SceneInfo sceneInfo) { + BasicSceneDTO basicSceneDTO = new BasicSceneDTO(); + basicSceneDTO.setId(sceneInfo.getId()); + basicSceneDTO.setName(sceneInfo.getName()); + basicSceneDTO.setRemark(sceneInfo.getRemark()); + basicSceneDTO.setBenchTime(sceneInfo.getBenchTime()); + basicSceneDTO.setSceneType(sceneInfo.getSceneType()); + basicSceneDTO.setStatus(sceneInfo.getSceneStatus()); + basicSceneDTO.setCurReportId(sceneInfo.getCurReportId()); + basicSceneDTO.setRpsRate(sceneInfo.getRpsRate()); + basicSceneDTO.setCreator(sceneInfo.getCreator()); + basicSceneDTO.setUTime(sceneInfo.getUtime()); + basicSceneDTO.setCTime(sceneInfo.getCtime()); + return basicSceneDTO; + } + + private SceneDTO transferToDetailSceneDTO(SceneInfo sceneInfo, boolean engine) { + + SceneDTO sceneDTO = new SceneDTO(); + BeanUtils.copyProperties(sceneInfo, sceneDTO); + + sceneDTO.setGroupID(sceneInfo.getSceneGroupId()); + + sceneDTO.setRpsRate(sceneInfo.getRpsRate()); + sceneDTO.setId(sceneInfo.getId()); + sceneDTO.setSceneSource(sceneInfo.getSceneSource()); + sceneDTO.setCTime(sceneInfo.getCtime()); + sceneDTO.setUTime(sceneInfo.getUtime()); + sceneDTO.setCreator(sceneInfo.getCreator()); + sceneDTO.setUpdater(sceneInfo.getUpdator()); + sceneDTO.setBenchCount(sceneInfo.getBenchCount()); + sceneDTO.setApiNum(sceneInfo.getApinum()); + sceneDTO.setLastBenchTime(sceneInfo.getLastBenchTime()); + + BenchCalendar benchCalendar; + if (sceneInfo.getBenchCalendar() == null || sceneInfo.getBenchCalendar().isEmpty()) { + benchCalendar = new BenchCalendar(); + benchCalendar.setBenchDateList(new ArrayList<>()); + } else { + benchCalendar = gson.fromJson(sceneInfo.getBenchCalendar(), BenchCalendar.class); + } + List tmpList = new ArrayList<>(); + //过滤一年前的记录 + benchCalendar.getBenchDateList().forEach(benchDate -> { + if (System.currentTimeMillis() - benchDate.getTimestamp() <= ONE_YEAR_MS) { + tmpList.add(benchDate); + } + }); + benchCalendar.setBenchDateList(tmpList); + //压测日历 + sceneDTO.setBenchCalendar(benchCalendar); + + if (sceneInfo.getSla() == null || sceneInfo.getSla().equals("")) { + sceneDTO.setUseSla(0); + } else { + sceneDTO.setUseSla(1); + } + + //责任人 + if (sceneInfo.getPersonInCharge() != null) { + if (sceneInfo.getPersonInCharge().equals("")) { + sceneDTO.setPersonsInCharge(new ArrayList<>()); + } else { + sceneDTO.setPersonsInCharge(gson.fromJson(sceneInfo.getPersonInCharge(), new TypeToken>() { + }.getType())); + } + } + + //全局请求头 + if (sceneInfo.getGlobalHeader() != null) { + if (sceneInfo.getGlobalHeader().equals("")) { + sceneDTO.setGlobalHeaderList(new ArrayList<>()); + } else { + List globalHeaders = gson.fromJson(sceneInfo.getGlobalHeader(), new TypeToken>() { + }.getType()); + sceneDTO.setGlobalHeaderList(globalHeaders); + } + } + + //汽车部tsp鉴权消息 + if (sceneInfo.getGlobalTspAuth() != null) { + if (sceneInfo.getGlobalTspAuth().equals("")) { + sceneDTO.setGlobalTspAuth(new TspAuthInfo(false)); + } else { + TspAuthInfo globalTspAuth = gson.fromJson(sceneInfo.getGlobalTspAuth(), new TypeToken() { + }.getType()); + sceneDTO.setGlobalTspAuth(globalTspAuth); + } + } + + SerialLinkExample example = new SerialLinkExample(); + example.createCriteria().andSceneIdEqualTo(sceneInfo.getId()); + //该场景的串联链路集 + List serialLinkList = serialLinkMapper.selectByExample(example); + List serialLinkDTOS = new ArrayList<>(serialLinkList.size()); + + serialLinkList.forEach(serialLink -> { + SceneApiInfoExample example1 = new SceneApiInfoExample(); + example1.createCriteria().andSceneIdEqualTo(sceneInfo.getId()).andSerialLinkIdEqualTo(serialLink.getId()); + List apiInfoList = sceneApiInfoMapper.selectByExampleWithBLOBs(example1); + + //串联链路信息 + SerialLinkDTO serialLinkDTO = new SerialLinkDTO(); + serialLinkDTO.setSerialLinkID(serialLink.getId()); + serialLinkDTO.setSerialLinkName(serialLink.getName()); + serialLinkDTO.setEnable(serialLink.getEnable()); + //获取处理压测接口信息 + if (sceneInfo.getSceneType() == Constants.SCENE_TYPE_HTTP) { + List apiDTOList = new ArrayList<>(); + apiInfoList.forEach(api -> { + HttpApiInfoDTO httpApiInfoDTO = new HttpApiInfoDTO(); + BeanUtils.copyProperties(api, httpApiInfoDTO); + httpApiInfoDTO.setApiID(api.getId()); + httpApiInfoDTO.setApiProtocol(Constants.HTTP_API_TYPE); + httpApiInfoDTO.setApiRequestType(api.getRequestMethod()); + httpApiInfoDTO.setHeaderInfo(api.getApiHeader()); + if (api.getContentType() == null || api.getContentType().equals("")) { + //get + httpApiInfoDTO.setRequestInfo(api.getRequestParamInfo()); + } else if (api.getContentType().equals(Constants.CONTENT_TYPE_APP_FORM) || api.getContentType().equals(CONTENT_TYPE_APP_FORM2)) { + httpApiInfoDTO.setRequestInfo(api.getRequestParamInfo()); + } else if (api.getContentType().equals(CONTENT_TYPE_APP_JSON)) { + httpApiInfoDTO.setRequestInfoRaw(api.getRequestBody()); + } + //输出参数定义 + List outputParams = gson.fromJson(api.getOutputParamInfo(), new TypeToken>() { + }.getType()); + + httpApiInfoDTO.setOutputParamInfos(outputParams); + + + //汽车部tsp鉴权消息 + if (api.getApiTspAuth() != null) { + if (api.getApiTspAuth().equals("")) { + httpApiInfoDTO.setApiTspAuth(new TspAuthInfo(false)); + } else { + TspAuthInfo apiTspAuth = gson.fromJson(api.getApiTspAuth(), new TypeToken() { + }.getType()); + httpApiInfoDTO.setApiTspAuth(apiTspAuth); + } + } + + //接口是否使用录制流量的配置信息 + if (api.getApiTrafficInfo() != null) { + if (api.getApiTrafficInfo().equals("")) { + httpApiInfoDTO.setApiTrafficInfo(new ApiTrafficInfo(false)); + } else { + ApiTrafficInfo apiTrafficInfo = gson.fromJson(api.getApiTrafficInfo(), new TypeToken() { + }.getType()); + httpApiInfoDTO.setApiTrafficInfo(apiTrafficInfo); + } + } + + //接口是否启用x5鉴权 + if (api.getApiX5Info() != null) { + if (api.getApiX5Info().equals("")) { + httpApiInfoDTO.setApiX5Info(new ApiX5Info(false)); + } else { + ApiX5Info apiX5Info = gson.fromJson(api.getApiX5Info(), new TypeToken() { + }.getType()); + httpApiInfoDTO.setApiX5Info(apiX5Info); + } + } + + //检查点 + if (api.getCheckPoint() != null && !api.getCheckPoint().isEmpty()) { + List checkPointInfoList = gson.fromJson(api.getCheckPoint(), new TypeToken>() { + }.getType()); + + List checkPointInfoDTOs = new ArrayList<>(checkPointInfoList.size()); + + checkPointInfoList.forEach(checkPointInfo -> { + CheckPointInfoDTO checkPointInfoDTO = new CheckPointInfoDTO(); + BeanUtils.copyProperties(checkPointInfo, checkPointInfoDTO); + checkPointInfoDTOs.add(checkPointInfoDTO); + }); + httpApiInfoDTO.setCheckPointInfoList(checkPointInfoDTOs); + } + //过滤条件 + if (api.getFilterCondition() != null && !api.getFilterCondition().isEmpty()) { + List filterConditions = gson.fromJson(api.getFilterCondition(), new TypeToken>() { + }.getType()); + if (filterConditions != null) { + List filterConditionList = new ArrayList<>(filterConditions.size()); + filterConditions.forEach(filterCondition -> { + CheckPointInfoDTO checkPointInfoDTO = new CheckPointInfoDTO(); + BeanUtils.copyProperties(filterCondition, checkPointInfoDTO); + filterConditionList.add(checkPointInfoDTO); + }); + httpApiInfoDTO.setFilterCondition(filterConditionList); + } + } + apiDTOList.add(httpApiInfoDTO); + }); + + serialLinkDTO.setHttpApiInfoDTOList(apiDTOList.stream().sorted().collect(Collectors.toList())); + serialLinkDTOS.add(serialLinkDTO); + + } else if (sceneInfo.getSceneType() == SCENE_TYPE_DUBBO) { + List apiDTOList = new ArrayList<>(); + apiInfoList.forEach(api -> { + DubboApiInfoDTO dubboApiInfoDTO = new DubboApiInfoDTO(); + BeanUtils.copyProperties(api, dubboApiInfoDTO); + dubboApiInfoDTO.setApiID(api.getId()); + dubboApiInfoDTO.setApiProtocol(Constants.DUBBO_API_TYPE); + dubboApiInfoDTO.setGroup(api.getDubboGroup()); + dubboApiInfoDTO.setVersion(api.getDubboVersion()); + //dubbo接口的nacos环境 + if (api.getNacosType() == Constants.NACOS_TYPE_ST) { + dubboApiInfoDTO.setDubboEnv("staging"); + } else if (api.getNacosType() == Constants.NACOS_TYPE_OL) { + dubboApiInfoDTO.setDubboEnv("online"); + } + dubboApiInfoDTO.setAttachments(api.getApiHeader()); + + //参数类型列表 + List paramTypeList = gson.fromJson(api.getParamTypeList(), new TypeToken>() { + }.getType()); + dubboApiInfoDTO.setRequestParamTypeList(paramTypeList); + + //参数体 json + dubboApiInfoDTO.setRequestBody(api.getDubboParamJson()); + + //输出参数定义 + List outputParams = gson.fromJson(api.getOutputParamInfo(), new TypeToken>() { + }.getType()); + if (!engine) { + for (SceneApiOutputParam output : + outputParams) { + output.setParseExpr(output.getParseExpr().substring(DEFAULT_EXPR_PREX.length())); + } + } + dubboApiInfoDTO.setOutputParamInfos(outputParams); + //检查点 + if (api.getCheckPoint() != null && !api.getCheckPoint().isEmpty()) { + List checkPointInfoList = gson.fromJson(api.getCheckPoint(), new TypeToken>() { + }.getType()); + + List checkPointInfoDTOs = new ArrayList<>(checkPointInfoList.size()); + + checkPointInfoList.forEach(checkPointInfo -> { + CheckPointInfoDTO checkPointInfoDTO = new CheckPointInfoDTO(); + BeanUtils.copyProperties(checkPointInfo, checkPointInfoDTO); + checkPointInfoDTOs.add(checkPointInfoDTO); + }); + dubboApiInfoDTO.setCheckPointInfoList(checkPointInfoDTOs); + } + //过滤条件 + if (api.getFilterCondition() != null && !api.getFilterCondition().isEmpty()) { + List filterConditions = gson.fromJson(api.getFilterCondition(), new TypeToken>() { + }.getType()); + if (filterConditions != null) { + List filterConditionList = new ArrayList<>(filterConditions.size()); + + filterConditions.forEach(filterCondition -> { + CheckPointInfoDTO checkPointInfoDTO = new CheckPointInfoDTO(); + BeanUtils.copyProperties(filterCondition, checkPointInfoDTO); + filterConditionList.add(checkPointInfoDTO); + }); + dubboApiInfoDTO.setFilterCondition(filterConditionList); + } + } + + apiDTOList.add(dubboApiInfoDTO); + }); + serialLinkDTO.setDubboApiInfoDTOList(apiDTOList.stream().sorted().collect(Collectors.toList())); + serialLinkDTOS.add(serialLinkDTO); + } + }); + sceneDTO.setSerialLinkDTOs(serialLinkDTOS); + + //转换接口压测量信息 + List apiBenchInfoList = new ArrayList<>(); + if (Objects.nonNull(sceneInfo.getApiBenchInfos())) { + apiBenchInfoList = gson.fromJson(sceneInfo.getApiBenchInfos(), new TypeToken>() { + }.getType()); + } + sceneDTO.setApiBenchInfos(apiBenchInfoList); + + if (sceneInfo.getSla() != null) { + SlaDto slaDto = gson.fromJson(sceneInfo.getSla(), new TypeToken() { + }.getType()); + sceneDTO.setSlaDto(slaDto); + } + + if (sceneInfo.getAgentList() != null) { + List agentDTOList = gson.fromJson(sceneInfo.getAgentList(), new TypeToken>() { + }.getType()); + + sceneDTO.setAgentIdList(agentDTOList.stream().map(AgentDTO::getId).collect(Collectors.toList())); + sceneDTO.setAgentDTOList(agentDTOList); + } else { + sceneDTO.setAgentDTOList(new ArrayList<>()); + } + + sceneDTO.setDatasetIds(datasetService.getDatasetIdsBySceneId(sceneInfo.getId())); + if (sceneInfo.getRefDatasetIds() != null) { + Map refDatasetIds = gson.fromJson(sceneInfo.getRefDatasetIds(), new TypeToken>() { + }.getType()); + sceneDTO.setRefDatasetIds(refDatasetIds); + } + return sceneDTO; + } + + @Override + public Result getSceneParamData(Integer sceneId) { + SceneParamData sceneParamData = new SceneParamData(); + sceneParamData.setParamDataType(Constants.SCENE_PARAM_DATA_TYPE_GLOBAL); + sceneParamData.setParamDataList(datasetService.getParamDataBySceneId(sceneId).getData()); + return Result.success(sceneParamData); + } + + private void postOperationLog(SceneDTO sceneDTO, boolean create, String opUser) { + String snapshotId = this.sceneSnapshotService.createSnapshot(SceneSnapshotBo.builder() + .sceneId((long) sceneDTO.getId()) + .type(SCENE_SNAPSHOT.typeCode) + .createBy(opUser) + .scene(gson.toJson(sceneDTO)) + .build()).getData(); + + OperationLogDto opRecord = new OperationLogDto(); + opRecord.setSceneId(sceneDTO.getId()); + opRecord.setCreateBy(opUser); + opRecord.setType(create ? NEW_OPERATION.typeCode : UPDATE_OPERATION.typeCode); + opRecord.setContent(create ? "创建场景" : "更新场景"); + + List supportOperations = new ArrayList<>(); + PerOperation perOperationViewSnapshot = new PerOperation(VIEW_SNAPSHOT.typeCname, VIEW_SNAPSHOT.typeName, snapshotId); + PerOperation perOperationCopySnapshot = new PerOperation(COPY_SNAPSHOT.typeCname, COPY_SNAPSHOT.typeName, snapshotId); + supportOperations.add(perOperationViewSnapshot); + supportOperations.add(perOperationCopySnapshot); + opRecord.setSupportOperation(supportOperations); + operationLogService.newOperationLog(opRecord); + } + + private Pair checkSceneParam(SceneDTO sceneDTO) { + if (sceneDTO.getRequestTimeout() == null) { + sceneDTO.setRequestTimeout(SCENE_REQ_TIMEOUT); + } + if (sceneDTO.getGroupID() == null) { + sceneDTO.setGroupID(Constants.DEFAULT_SCENE_GROUP); + } + if (sceneDTO.getSceneEnv() == null) { + return Pair.of(-1, "场景环境必传"); + } + if (sceneDTO.getSceneType() == null) { + return Pair.of(-1, "场景类型必传"); + } + if (sceneDTO.getLogRate() == null) { + return Pair.of(-1, "日志采样率必传"); + } +// if (sceneDTO.getLogRate() >= 100) { +// return Pair.of(-1, "日志采样率不能超过100"); +// } + if (sceneDTO.getBenchTime() == null) { + return Pair.of(-1, "施压时间必传"); + } + if (sceneDTO.getIncreasePercent() == null) { + //默认值 + sceneDTO.setIncreasePercent(0); + } + return Pair.of(0, "success"); + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/SceneSnapshotServiceImpl.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/SceneSnapshotServiceImpl.java new file mode 100644 index 000000000..21eaf60ca --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/SceneSnapshotServiceImpl.java @@ -0,0 +1,120 @@ +package run.mone.mimeter.dashboard.service.impl; + +import com.google.gson.Gson; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import run.mone.mimeter.dashboard.bo.SceneNameDTO; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.scene.SceneSnapshotBo; +import run.mone.mimeter.dashboard.common.util.Util; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.mapper.SceneSnapshotMapper; +import run.mone.mimeter.dashboard.pojo.SceneSnapshot; +import run.mone.mimeter.dashboard.pojo.SceneSnapshotExample; +import run.mone.mimeter.dashboard.service.SceneSnapshotService; +import run.mone.mimeter.dashboard.common.util.Utility; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import static com.google.common.base.Preconditions.checkArgument; +import static run.mone.mimeter.dashboard.bo.snapshot.SnapshotTypeEnum.SCENE_SNAPSHOT; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/6/23 + */ +@Slf4j +@Service +public class SceneSnapshotServiceImpl implements SceneSnapshotService { + + @Autowired + private SceneSnapshotMapper sceneSnapshotMapper; + + private static final Gson gson = Util.getGson(); + + @Override + public Result getSceneSnapshotById(String snapshotId) { + SceneSnapshotExample example = new SceneSnapshotExample(); + SceneSnapshotExample.Criteria criteria = example.createCriteria(); + criteria.andSnapshotIdEqualTo(snapshotId); + return this.getSceneSnapshotByExample(example, true); + } + + private Result getSceneSnapshotByExample(SceneSnapshotExample example, boolean withBlob) { + List list = withBlob ? this.sceneSnapshotMapper.selectByExampleWithBLOBs(example) : + this.sceneSnapshotMapper.selectByExample(example); + + if (list.isEmpty()) { + return Result.success(null); + } + SceneSnapshotBo bo = new SceneSnapshotBo(); + BeanUtils.copyProperties(list.get(0), bo); + return Result.success(bo); + } + + @Override + public Result getSceneSnapshotByScene(Long sceneId) { + return this.doGetSceneSnapshotByScene(sceneId, SCENE_SNAPSHOT.typeCode, false); + } + + private Result doGetSceneSnapshotByScene(Long sceneId, int type, boolean withBlob) { + SceneSnapshotExample example = new SceneSnapshotExample(); + SceneSnapshotExample.Criteria criteria = example.createCriteria(); + criteria.andSceneIdEqualTo(sceneId); +// criteria.andTypeEqualTo(type); + example.setOrderByClause("id desc"); + example.setLimit(1); + return this.getSceneSnapshotByExample(example, withBlob); + } + + @Override + public Result getSceneSnapshotDetailByScene(Long sceneId) { + return this.doGetSceneSnapshotByScene(sceneId, SCENE_SNAPSHOT.typeCode, true); + } + + @Override + public Result createSnapshot(SceneSnapshotBo bo) { + String logPrefix = "[SceneSnapshotService]"; + checkArgument(bo != null && bo.checkCreate(), logPrefix + "createSnapshot invalid input: " + new Gson().toJson(bo)); + Result oldResult = getSceneSnapshotByScene(bo.getSceneId()); + int version = 1; + + if (oldResult.getData() != null) { + version += Optional.ofNullable(oldResult.getData().getVersion()).orElse(0); + } + + String snapshotId = Utility.saltVersionedId(bo.getSceneId(), version); + bo.setSnapshotId(snapshotId); + bo.setMd5(Utility.generateSha256(bo.getScene())); + bo.setVersion(version); + + SceneSnapshot po = new SceneSnapshot(); + BeanUtils.copyProperties(bo, po); + + if (this.sceneSnapshotMapper.insertSelective(po) > 0) { + return Result.success(snapshotId); + } + return Result.fail(CommonError.UnknownError); + } + + public Map sceneNameMapFromIds(List snapshotIds) { + SceneSnapshotExample example = new SceneSnapshotExample(); + example.createCriteria().andSnapshotIdIn(snapshotIds); + List snapshotList = this.sceneSnapshotMapper.selectByExampleWithBLOBs(example); + Map sceneNameMap = new HashMap<>(); + + if (snapshotList != null) { + snapshotList.forEach(snapshot -> { + SceneNameDTO nameDTO = gson.fromJson(snapshot.getScene(), SceneNameDTO.class); + sceneNameMap.putIfAbsent(Math.toIntExact(snapshot.getSceneId()), nameDTO.getName()); + }); + } + return sceneNameMap; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/SlaServiceImpl.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/SlaServiceImpl.java new file mode 100644 index 000000000..35344914e --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/SlaServiceImpl.java @@ -0,0 +1,210 @@ +package run.mone.mimeter.dashboard.service.impl; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.Pair; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.sla.GetSlaListReq; +import run.mone.mimeter.dashboard.bo.sla.SlaDto; +import run.mone.mimeter.dashboard.bo.sla.SlaList; +import run.mone.mimeter.dashboard.bo.sla.SlaRuleDto; +import run.mone.mimeter.dashboard.mapper.SlaMapper; +import run.mone.mimeter.dashboard.mapper.SlaRuleMapper; +import run.mone.mimeter.dashboard.service.SceneService; +import run.mone.mimeter.dashboard.service.SlaService; +import run.mone.mimeter.dashboard.pojo.Sla; +import run.mone.mimeter.dashboard.pojo.SlaExample; +import run.mone.mimeter.dashboard.pojo.SlaRule; +import run.mone.mimeter.dashboard.pojo.SlaRuleExample; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import static run.mone.mimeter.dashboard.bo.common.Constants.DEFAULT_PAGE_SIZE; +import static run.mone.mimeter.dashboard.exception.CommonError.SlaRuleAtLeastOneError; + +@Service +public class SlaServiceImpl implements SlaService { + + @Autowired + SlaMapper slaMapper; + + @Autowired + SlaRuleMapper slaRuleMapper; + + @Autowired + private SceneService sceneService; + + @Override + public Result newSla(SlaDto param) { + Pair checkRes = checkParam(param); + if (checkRes.getKey() != 0) { + return Result.fail(checkRes.getKey(), checkRes.getValue()); + } + + Sla sla = toSla(param); + slaMapper.insert(sla); + List slaRules = toSlaRule(sla.getId(), param.getSlaRuleDtos()); + slaRuleMapper.batchInsert(slaRules); + return Result.success(sla.getId()); + } + + @Override + public Result updateSla(SlaDto param) { + Pair checkRes = checkParam(param); + if (checkRes.getKey() != 0) { + return Result.fail(checkRes.getKey(), checkRes.getValue()); + } + + int slaId = param.getId(); + Sla sla = toSla(param); + sla.setId(slaId); + slaMapper.updateByPrimaryKey(sla); + SlaRuleExample slaRuleExample = new SlaRuleExample(); + slaRuleExample.createCriteria().andSlaIdEqualTo(slaId); + slaRuleMapper.deleteByExample(slaRuleExample); + List slaRules = toSlaRule(slaId, param.getSlaRuleDtos()); + slaRuleMapper.batchInsert(slaRules); + return Result.success(true); + } + + @Override + public Result getSlaList(GetSlaListReq req) { + + if (req.getPage() <= 0) { + req.setPage(1); + } + if (req.getPageSize() <= 0) { + req.setPageSize(DEFAULT_PAGE_SIZE); + } + int offset = (req.getPage() - 1) * req.getPageSize(); + + SlaExample totalSlaExample = new SlaExample(); + SlaExample.Criteria totalCriteria = totalSlaExample.createCriteria(); + SlaExample slaExample = new SlaExample(); + SlaExample.Criteria criteria = slaExample.createCriteria(); + + if (StringUtils.isNotEmpty(req.getSlaName())) { + totalCriteria.andNameLike("%" + req.getSlaName() + "%"); + criteria.andNameLike("%" + req.getSlaName() + "%"); + } + if (StringUtils.isNotEmpty(req.getCreator())) { + totalCriteria.andCreatorLike("%" + req.getCreator() + "%"); + criteria.andCreatorLike("%" + req.getCreator() + "%"); + } + + slaExample.setOrderByClause("id desc limit " + req.getPageSize() + " offset " + offset); + + SlaList slaList = new SlaList(); + slaList.setPage(req.getPage()); + slaList.setPageSize(req.getPageSize()); + List slas = slaMapper.selectByExample(slaExample); + if (slas == null || slas.size() == 0) { + return Result.success(slaList); + } + List slaDtos = slas.stream().map(it -> { + SlaDto slaDto = toSlaDto(it); + SlaRuleExample slaRuleExample = new SlaRuleExample(); + slaRuleExample.createCriteria().andSlaIdEqualTo(it.getId()); + List slaRuleDtos = toSlaRuleDto(slaRuleMapper.selectByExample(slaRuleExample)); + slaDto.setSlaRuleDtos(slaRuleDtos); + return slaDto; + }).collect(Collectors.toList()); + slaList.setList(slaDtos); + slaList.setTotal(slaMapper.countByExample(totalSlaExample)); + + return Result.success(slaList); + } + + @Override + public Result getSlaById(int id) { + Sla sla = slaMapper.selectByPrimaryKey(id); + SlaDto slaDto = toSlaDto(sla); + SlaRuleExample slaRuleExample = new SlaRuleExample(); + slaRuleExample.createCriteria().andSlaIdEqualTo(id); + List slaRules = slaRuleMapper.selectByExample(slaRuleExample); + List slaRuleDtos = toSlaRuleDto(slaRules); + slaDto.setSlaRuleDtos(slaRuleDtos); + return Result.success(slaDto); + } + + @Override + public Result delSla(int id) { + slaMapper.deleteByPrimaryKey(id); + return Result.success(true); + } + + @Override + public Result multiDelSla(List ids) { + SlaExample slaExample = new SlaExample(); + slaExample.createCriteria().andIdIn(ids); + slaMapper.deleteByExample(slaExample); + return Result.success(true); + } + + private Sla toSla(SlaDto param) { + Sla sla = new Sla(); + BeanUtils.copyProperties(param, sla); + long now = System.currentTimeMillis(); + if (sla.getCtime() == null || sla.getCtime() == 0) { + sla.setCtime(now); + } + sla.setUtime(now); + return sla; + } + + private SlaDto toSlaDto(Sla sla) { + SlaDto slaDto = new SlaDto(); + BeanUtils.copyProperties(sla, slaDto); + return slaDto; + } + + private List toSlaRule(int id, List slaRuleDtoList) { + if (slaRuleDtoList == null || slaRuleDtoList.size() == 0) { + return new ArrayList<>(); + } + long now = System.currentTimeMillis(); + List slaRules = slaRuleDtoList.stream().map(it -> { + SlaRule slaRule = new SlaRule(); + BeanUtils.copyProperties(it, slaRule); + slaRule.setCtime(now); + slaRule.setSlaId(id); + slaRule.setUtime(now); + slaRule.setCompareValue(it.getValue()); + slaRule.setActionLevel(it.getAction()); + slaRule.setCompareCondition(it.getCondition()); + return slaRule; + }).collect(Collectors.toList()); + + return slaRules; + } + + private List toSlaRuleDto(List slaRuleList) { + if (slaRuleList == null || slaRuleList.size() == 0) { + return new ArrayList<>(); + } + List slaRuleDtos = slaRuleList.stream().map(it -> { + SlaRuleDto slaRuleDto = new SlaRuleDto(); + BeanUtils.copyProperties(it, slaRuleDto); + slaRuleDto.setValue(it.getCompareValue()); + slaRuleDto.setAction(it.getActionLevel()); + slaRuleDto.setCondition(it.getCompareCondition()); + return slaRuleDto; + }).collect(Collectors.toList()); + + return slaRuleDtos; + } + + private Pair checkParam(SlaDto param) { + List slaRuleDtos = param.getSlaRuleDtos(); + if (slaRuleDtos == null || slaRuleDtos.size() == 0) { + return Pair.of(SlaRuleAtLeastOneError.code, SlaRuleAtLeastOneError.message); + } + + return Pair.of(0, "success"); + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/TaskServiceImpl.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/TaskServiceImpl.java new file mode 100644 index 000000000..f384ac80d --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/TaskServiceImpl.java @@ -0,0 +1,782 @@ +package run.mone.mimeter.dashboard.service.impl; + +import com.alibaba.nacos.api.config.annotation.NacosValue; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.tuple.Pair; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; +import run.mone.mimeter.dashboard.bo.ChangeQpsReq; +import run.mone.mimeter.dashboard.bo.DubboSceneDebugResult; +import run.mone.mimeter.dashboard.bo.HttpSceneDebugResult; +import run.mone.mimeter.dashboard.bo.SubmitTaskRes; +import run.mone.mimeter.dashboard.bo.common.Constants; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.operationlog.OperationLogDto; +import run.mone.mimeter.dashboard.bo.operationlog.PerOperation; +import run.mone.mimeter.dashboard.bo.report.ReportInfoBo; +import run.mone.mimeter.dashboard.bo.scene.*; +import run.mone.mimeter.dashboard.bo.sceneapi.ApiHeader; +import run.mone.mimeter.dashboard.bo.sceneapi.FormParamValue; +import run.mone.mimeter.dashboard.bo.task.*; +import run.mone.mimeter.dashboard.common.*; +import run.mone.mimeter.dashboard.common.util.BizUtils; +import run.mone.mimeter.dashboard.common.util.Util; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.mapper.*; +import run.mone.mimeter.dashboard.pojo.*; +import run.mone.mimeter.dashboard.service.*; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import static run.mone.mimeter.dashboard.bo.common.Constants.*; +import static run.mone.mimeter.dashboard.bo.operationlog.OperationLogTypeEnum.DEBUG_OPERATION; +import static run.mone.mimeter.dashboard.bo.operationlog.OperationLogTypeEnum.START_BENCH; +import static run.mone.mimeter.dashboard.bo.operationlog.OperationTypeEnum.DEBUG_RECORD; +import static run.mone.mimeter.dashboard.bo.operationlog.OperationTypeEnum.VIEW_REPORT; +import static run.mone.mimeter.dashboard.bo.snapshot.SnapshotTypeEnum.DEBUG_SNAPSHOT; +import static run.mone.mimeter.dashboard.common.util.Utility.generateId; + +@Service +@Slf4j +public class TaskServiceImpl implements TaskService { + + private final String logPrefix = "[TaskService]"; + + @Autowired + private SceneService sceneService; + + @Autowired + private FeiShuService feiShuService; + + @Autowired + private SceneInfoMapper sceneInfoMapper; + + @Autowired + private MibenchTaskMapper mibenchTaskMapper; + + @Autowired + private SceneApiInfoMapper sceneApiInfoMapper; + + @Autowired + private SerialLinkMapper serialLinkMapper; + + @Autowired + private ReportInfoService reportInfoService; + + @Autowired + private ReportInfoMapper reportInfoMapper; + + @Autowired + private ReportEmitterService reportEmitterService; + + @Autowired + private OperationLogService operationLogService; + + @Autowired + private SceneSnapshotService sceneSnapshotService; + + @Autowired + private HttpDao httpDao; + + private static final Pattern EL_PATTERN = Pattern.compile("\\{([^}]*)}"); + + /** + * bench manager addr + */ + @NacosValue(autoRefreshed = true, value = "${bench.api_manager_url}") + private String apiSvrUrl; + + /** + * bench allow switch + * 发布时可控制不允许压测 + */ + @NacosValue(autoRefreshed = true, value = "${bench.allow.switch}") + private String benchAllowSwitch; + + private static final Gson gson = Util.getGson(); + + private final ExecutorService executorService = Executors.newSingleThreadExecutor(); + + @Override + public Result submitTask(TaskDTO taskDTO, String opUser) { + + if (!benchAllowSwitch.equalsIgnoreCase("true")){ + return Result.fail(CommonError.SystemDeployingError); + } + String reportId = ""; + if (taskDTO.getSubmitTaskType() != SINGLE_API_DEBUG) { + reportId = generateId((long) taskDTO.getSceneId()); + } + Pair checkRes = checkSubmitTaskParam(taskDTO, reportId); + if (checkRes.getKey() != 0) { + return Result.fail(CommonError.InvalidParamError.code, checkRes.getValue()); + } + HttpResult result; + + try { + result = httpDao.post(apiSvrUrl + "/submit/task", gson.toJson(taskDTO)); + } catch (Exception e) { + log.error("[TaskService.submitTask] failed to submit task, msg: {}", e.getMessage(), e); + return Result.fail(CommonError.APIServerError); + } + if (result == null) { + log.error("[TaskService.submitTask] failed to get result from api server, param: {}", taskDTO); + return Result.fail(CommonError.APIServerError); + } + if (result.getCode() == 200) { + SubmitTaskRes res = gson.fromJson(result.getData(), SubmitTaskRes.class); + if (taskDTO.getSubmitTaskType() == SCENE_BENCH) { + SceneInfo sceneInfo = sceneInfoMapper.selectByPrimaryKey(taskDTO.getSceneId()); + if (sceneInfo == null) { + return Result.fail(CommonError.InvalidParamError); + } + + this.reportInfoService.createReport(ReportInfoBo.builder() + .sceneId((long) taskDTO.getSceneId()) + .reportId(reportId) + .reportName(genReportName(sceneInfo.getName(), String.valueOf(sceneInfo.getRpsRate()))) + .createBy(opUser) + .tenant(taskDTO.getTenant()) + .status(REPORT_STATUS_RUNNING) + .agents(gson.toJson(res.getAgentIpList())) + .linkToDagId(gson.toJson(res.getLinkTaskIdMap())) + .build()); + + //更新场景当前报告id + sceneInfo.setCurReportId(reportId); + //压测次数+1 + sceneInfo.setBenchCount(sceneInfo.getBenchCount() + 1); + //最近一次压测时间 + long now = System.currentTimeMillis(); + sceneInfo.setLastBenchTime(now); + + //记录压测日历 + recordBenchCalendar(sceneInfo, now); + sceneInfoMapper.updateByPrimaryKeyWithBLOBs(sceneInfo); + + String finalReportId = reportId; + //通知负责人 + CompletableFuture.runAsync(() -> notifyPersonsInCharge(sceneInfo, finalReportId, opUser), executorService); + + this.postOperationLog(taskDTO.getSceneId(), SCENE_BENCH, reportId, "", opUser); + } + return Result.success(res); + } else { + log.error("[TaskService.submitTask], failed and result is: {}", result); + return Result.fail(result.getCode(), result.getMessage()); + } + } + + @Override + public Result stopTask(Integer type, TaskDTO taskDTO, String opUser) { + taskDTO.setOpUser(opUser); + Pair checkRes = checkStopTaskParam(type, taskDTO); + if (checkRes.getKey() != 0) { + return Result.fail(CommonError.InvalidParamError.code, checkRes.getValue()); + } + HttpResult result; + try { + List taskIds; + if (type == 1) { + //场景id + SceneInfo sceneInfo = sceneInfoMapper.selectByPrimaryKey(taskDTO.getSceneId()); + if (sceneInfo == null) { + return Result.fail(CommonError.InvalidParamError.code, "场景不存在"); + } + if (sceneInfo.getSceneStatus() != TaskStatus.Running.code) { + return Result.fail(CommonError.InvalidParamError.code, "场景不在运行状态"); + } + if (sceneInfo.getCurReportId() == null) { + return Result.fail(CommonError.InvalidParamError.code, "任务不存在"); + } + taskDTO.setReportId(sceneInfo.getCurReportId()); + } + //报告id + MibenchTaskExample example = new MibenchTaskExample(); + example.createCriteria().andReportIdEqualTo(taskDTO.getReportId()).andTaskTypeEqualTo(TaskType.dag.code); + List MibenchTasks = mibenchTaskMapper.selectByExample(example); + + //fix temp + MibenchTasks.forEach(MibenchTask -> { + MibenchTask.setState(TaskStatus.STOPPED.code); + mibenchTaskMapper.updateByPrimaryKey(MibenchTask); + }); + + taskIds = MibenchTasks.stream().map(MibenchTask::getId).collect(Collectors.toList()); + taskDTO.setIds(taskIds); + + ReportInfoExample reportInfoExample = new ReportInfoExample(); + reportInfoExample.createCriteria().andReportIdEqualTo(taskDTO.getReportId()); + ReportInfo reportInfo = reportInfoMapper.selectByExample(reportInfoExample).get(0); + taskDTO.setSceneId(Math.toIntExact(reportInfo.getSceneId())); + + //直接更新为结束状态 + SceneInfo sceneInfo = sceneInfoMapper.selectByPrimaryKey(Math.toIntExact(reportInfo.getSceneId())); + sceneInfo.setSceneStatus(TaskStatus.STOPPED.code); + sceneInfoMapper.updateByPrimaryKey(sceneInfo); + + if (taskDTO.getIds().size() == 0) { + return Result.success(true); + } + result = httpDao.post(apiSvrUrl + "/cancel/task", gson.toJson(taskDTO)); + } catch (Exception e) { + return Result.fail(CommonError.APIServerError); + } + if (result == null) { + log.error("[TaskService.stopTask] failed to get result from api server, param: {}", taskDTO); + return Result.fail(CommonError.APIServerError); + } + if (result.getCode() == 200) { + return Result.success(true); + } else { + log.error("[TaskService.stopTask], failed and result is: {}", result); + return Result.fail(result.getCode(), result.getMessage()); + } + } + + @Override + public Result manualUpdateRps(ChangeQpsReq req) { + HttpResult result; + if (req == null || req.getDagTaskRpsList() == null) { + return Result.fail(CommonError.InvalidParamError); + } + try { + result = httpDao.post(apiSvrUrl + "/task/manualUpdateQps", gson.toJson(req)); + } catch (Exception e) { + return Result.fail(CommonError.APIServerError); + } + if (result == null) { + log.error("[TaskService.manualUpdateRps] failed to get result from api server, param: {}", req); + return Result.fail(CommonError.APIServerError); + } + if (result.getCode() == 200) { + return Result.success(true); + } else { + log.error("[TaskService.manualUpdateRps], failed and result is: {}", result); + return Result.fail(result.getCode(), result.getMessage()); + } + } + + @Override + public Result manualUpdateSceneRpsRate(SceneRpsRateReq req) { + log.info("manualUpdateSceneRpsRate sceneRpsRateReq:{}", req); + Pair checkRes = checkUpdateSceneRateParam(req); + if (checkRes.getKey() != 0) { + return Result.fail(CommonError.InvalidParamError.code, checkRes.getValue()); + } + SceneInfo sceneInfo = sceneInfoMapper.selectByPrimaryKey(req.getSceneID()); + if (sceneInfo == null) { + return Result.fail(CommonError.InvalidParamError); + } + ChangeQpsReq changeQpsReq = new ChangeQpsReq(); + changeQpsReq.setRpsRate(req.getRpsRate()); + List dagTaskRpsList = new ArrayList<>(); + changeQpsReq.setDagTaskRpsList(dagTaskRpsList); + //转换接口压测量信息 + Map linkMaps = new HashMap<>(); + SerialLinkExample example = new SerialLinkExample(); + example.createCriteria().andSceneIdEqualTo(req.getSceneID()); + + //该场景的串联链路集 + List serialLinkList = serialLinkMapper.selectByExample(example); + serialLinkList.forEach(serialLink -> { + if (serialLink.getEnable()) { + linkMaps.putIfAbsent(serialLink.getName(), new LinkRpsInfo(serialLink.getId())); + } + }); + + List apiBenchInfoList = new ArrayList<>(); + if (Objects.nonNull(sceneInfo.getApiBenchInfos())) { + apiBenchInfoList = gson.fromJson(sceneInfo.getApiBenchInfos(), new TypeToken>() { + }.getType()); + } + //最大链路rps + apiBenchInfoList.forEach(apiBenchInfo -> { + if (linkMaps.containsKey(apiBenchInfo.getSerialName())) { + linkMaps.get(apiBenchInfo.getSerialName()).setRps(apiBenchInfo.getLinkTps()); + } + }); + //变更所有任务 rps 量级请求 + linkMaps.values().forEach(linkRpsInfo -> { + Integer taskId = req.getLinkToTaskMaps().get(linkRpsInfo.getLinkId()); + if (taskId != null) { + int curRps = (int) Math.ceil(linkRpsInfo.getRps() * (req.getRpsRate() / 100d)); + dagTaskRpsList.add(new DagTaskRps(linkRpsInfo.getLinkId(), taskId, curRps)); + } + }); + log.debug("manualUpdateSceneRpsRate changeQpsReq:{}", changeQpsReq); + if (this.manualUpdateRps(changeQpsReq).getData()) { + //更新报告名 + log.debug("manualUpdateSceneRpsRate changeQpsReq:{}", changeQpsReq); + CompletableFuture.runAsync(() -> { + ReportInfoExample reportInfoExample = new ReportInfoExample(); + reportInfoExample.createCriteria().andReportIdEqualTo(req.getReportID()); + ReportInfo reportInfo = reportInfoMapper.selectByExample(reportInfoExample).get(0); + String curName = reportInfo.getReportName().split("——", 2)[0] + req.getRpsRate() + "%"; + reportInfo.setReportName(curName); + reportInfoMapper.updateByPrimaryKey(reportInfo); + }); + return Result.success(true); + } + return Result.fail(CommonError.InvalidParamError); + } + + @Override + public Result>> getHttpSceneDebugResultByTaskId(String reportId, String opUser) { + if (reportId == null || reportId.isEmpty()) { + return Result.fail(CommonError.InvalidParamError); + } + MibenchTaskExample exp = new MibenchTaskExample(); + exp.createCriteria().andReportIdEqualTo(reportId); + List MibenchTasks = mibenchTaskMapper.selectByExample(exp); + List taskIds = MibenchTasks.stream().map(MibenchTask::getId).collect(Collectors.toList()); + + AtomicBoolean record = new AtomicBoolean(true); + TreeMap> resultMap = new TreeMap<>(); + + taskIds.forEach(taskId -> { + final String[] serialLinkName = {""}; + List resultList = new ArrayList<>(); + + MibenchTask dagTag = mibenchTaskMapper.selectByPrimaryKey(taskId); + + HttpSceneDebugResult dagTaskResult = new HttpSceneDebugResult(); + dagTaskResult.setParentTask(true); + dagTaskResult.setSceneId(dagTag.getSceneId()); + dagTaskResult.setTaskStatus(dagTag.getState()); + resultList.add(dagTaskResult); + + MibenchTaskExample example = new MibenchTaskExample(); + example.createCriteria().andParentTaskIdEqualTo(taskId); + List childTasks = mibenchTaskMapper.selectByExampleWithBLOBs(example); + + childTasks.forEach(childTask -> { + HttpSceneDebugResult childResult = new HttpSceneDebugResult(); + SceneApiInfo httpApi = sceneApiInfoMapper.selectByPrimaryKey(childTask.getSceneApiId()); + if (serialLinkName[0].isEmpty()) { + SerialLink serialLink = serialLinkMapper.selectByPrimaryKey(httpApi.getSerialLinkId()); + serialLinkName[0] = serialLink.getName(); + } + BeanUtils.copyProperties(httpApi, childResult); + childResult.setTaskStatus(childTask.getState()); + if (childTask.getState() != TaskStatus.Success.code) { + record.set(false); + } + if (childTask.getDebugUrl() != null && !childTask.getDebugUrl().isEmpty()){ + childResult.setApiUrl(childTask.getDebugUrl()); + } + childResult.setApiOrder(httpApi.getApiOrder()); + childResult.setParentTask(false); + if (childTask.getReqParamType() != null) { + childResult.setReqParamType(childTask.getReqParamType()); + } + if (childTask.getRequestParams() != null && !childTask.getRequestParams().isEmpty()) { + childResult.setRealParam(childTask.getRequestParams()); + } + if (childTask.getDebugResultHeader() != null) { + childResult.setRespHeader(childTask.getDebugResultHeader()); + } + if (childTask.getDebugReqHeaders() != null) { + List apiHeaders = new ArrayList<>(); + Map reqHeaders = gson.fromJson(childTask.getDebugReqHeaders(), new TypeToken>() { + }.getType()); + reqHeaders.forEach((k, v) -> apiHeaders.add(new ApiHeader(k, v))); + childResult.setApiHeader(gson.toJson(apiHeaders)); + } + if (childTask.getDebugTriggerCp() != null) { + childResult.setTriggerCpInfo(childTask.getDebugTriggerCp()); + } + if (childTask.getDebugTriggerFilterCondition() != null) { + childResult.setDebugTriggerFilterCondition(childTask.getDebugTriggerFilterCondition()); + } + childResult.setOk(childTask.getOk()); + childResult.setDebugResult(childTask.getDebugResult()); + childResult.setRt(childTask.getDebugRt()); + childResult.setSize(childTask.getDebugSize()); + resultList.add(childResult); + }); + resultMap.put(serialLinkName[0], resultList); + }); + + if (MibenchTasks.size() > 0 && record.get()) { + this.postOperationLog(MibenchTasks.get(0).getSceneId(), SCENE_DEBUG, reportId, gson.toJson(resultMap), opUser); + } + + return Result.success(resultMap); + } + + @Override + public Result>> getDubboSceneDebugResultByTaskId(String reportId, String opUser) { + if (reportId == null || reportId.isEmpty()) { + return Result.fail(CommonError.InvalidParamError); + } + AtomicBoolean record = new AtomicBoolean(true); + + MibenchTaskExample exp = new MibenchTaskExample(); + exp.createCriteria().andReportIdEqualTo(reportId); + List MibenchTasks = mibenchTaskMapper.selectByExample(exp); + List taskIds = MibenchTasks.stream().map(MibenchTask::getId).collect(Collectors.toList()); + + TreeMap> resultMap = new TreeMap<>(); + + taskIds.forEach(taskId -> { + final String[] serialLinkName = {""}; + List resultList = new ArrayList<>(); + + MibenchTask dagTag = mibenchTaskMapper.selectByPrimaryKey(taskId); + + DubboSceneDebugResult dagTaskResult = new DubboSceneDebugResult(); + dagTaskResult.setParentTask(true); + dagTaskResult.setSceneId(dagTag.getSceneId()); + dagTaskResult.setTaskStatus(dagTag.getState()); + resultList.add(dagTaskResult); + + MibenchTaskExample example = new MibenchTaskExample(); + example.createCriteria().andParentTaskIdEqualTo(taskId); + List childTasks = mibenchTaskMapper.selectByExampleWithBLOBs(example); + + childTasks.forEach(childTask -> { + DubboSceneDebugResult childResult = new DubboSceneDebugResult(); + SceneApiInfo dubboApi = sceneApiInfoMapper.selectByPrimaryKey(childTask.getSceneApiId()); + if (serialLinkName[0].isEmpty()) { + SerialLink serialLink = serialLinkMapper.selectByPrimaryKey(dubboApi.getSerialLinkId()); + serialLinkName[0] = serialLink.getName(); + } + BeanUtils.copyProperties(dubboApi, childResult); + childResult.setServiceName(dubboApi.getServiceName()); + childResult.setMethodName(dubboApi.getMethodName()); + childResult.setGroup(dubboApi.getDubboGroup()); + childResult.setVersion(dubboApi.getDubboVersion()); + + childResult.setTaskStatus(childTask.getState()); + if (childTask.getState() != TaskStatus.Success.code) { + record.set(false); + } + childResult.setApiOrder(dubboApi.getApiOrder()); + childResult.setParentTask(false); + if (dubboApi.getParamTypeList() != null) { + childResult.setParamsTypeList(dubboApi.getParamTypeList()); + } + if (childTask.getRequestParams() != null && !childTask.getRequestParams().isEmpty()) { + childResult.setRealParam(childTask.getRequestParams()); + } + if (childTask.getDebugTriggerCp() != null) { + childResult.setTriggerCpInfo(childTask.getDebugTriggerCp()); + } + if (childTask.getDebugTriggerFilterCondition() != null) { + childResult.setDebugTriggerFilterCondition(childTask.getDebugTriggerFilterCondition()); + } + childResult.setOk(childTask.getOk()); + childResult.setDebugResult(childTask.getDebugResult()); + childResult.setRt(childTask.getDebugRt()); + childResult.setSize(childTask.getDebugSize()); + resultList.add(childResult); + }); + resultMap.put(serialLinkName[0], resultList); + }); + + if (MibenchTasks.size() > 0 && record.get()) { + this.postOperationLog(MibenchTasks.get(0).getSceneId(), SCENE_DEBUG, reportId, gson.toJson(resultMap), opUser); + } + + return Result.success(resultMap); + } + + @Override + public SseEmitter stream(String reportId, String username) { + return this.reportEmitterService.connect(reportId, username); + } + + private void postOperationLog(Integer sceneId, int type, String reportId, String snapshotRes, String opUser) { + try { + OperationLogDto opRecord = new OperationLogDto(); + opRecord.setSceneId(sceneId); + opRecord.setCreateBy(opUser); + List supportOperations = new ArrayList<>(); + opRecord.setSupportOperation(supportOperations); + + if (type == SCENE_DEBUG) { + String snapshotId = this.sceneSnapshotService.createSnapshot(SceneSnapshotBo.builder() + .sceneId((long) sceneId) + .type(DEBUG_SNAPSHOT.typeCode) + .createBy(opUser) + .scene(snapshotRes) + .build()).getData(); + opRecord.setType(DEBUG_OPERATION.typeCode); + opRecord.setContent("调试场景"); + opRecord.setReportId(reportId); + PerOperation perOperationDebugRecord = new PerOperation(DEBUG_RECORD.typeCname, DEBUG_RECORD.typeName, snapshotId); + supportOperations.add(perOperationDebugRecord); + } else if (type == SCENE_BENCH) { + opRecord.setType(START_BENCH.typeCode); + opRecord.setContent("启动压测"); + PerOperation perOperationViewReport = new PerOperation(VIEW_REPORT.typeCname, VIEW_REPORT.typeName, reportId); + supportOperations.add(perOperationViewReport); + } + operationLogService.newOperationLog(opRecord); + } catch (Exception e) { + log.error("TaskServiceImpl.postOperationLog, error msg: {}", e.getMessage(), e); + } + } + + /** + * 通知负责人 + */ + private void notifyPersonsInCharge(SceneInfo sceneInfo, String reportId, String opUser) { + //场景负责人 + List personsInCharge = gson.fromJson(sceneInfo.getPersonInCharge(), new TypeToken>() { + }.getType()); + + Map info = new HashMap<>(); + info.put("sceneName", sceneInfo.getName()); + info.put("opUser", opUser); + info.put("benchTime", String.valueOf(sceneInfo.getBenchTime())); + info.put("totalRps", String.valueOf(sceneInfo.getMaxBenchQps() * (sceneInfo.getRpsRate() / 100d))); + info.put("reportId", String.valueOf(reportId)); + + String content = TemplateUtils.processTemplate(BENCH_BEGIN_MSG, info); + try { + feiShuService.sendCard2Person(personsInCharge, content); + } catch (Exception e) { + log.error("notifyPersonsInCharge error:{}", e.getMessage()); + } + } + + /** + * 记录压测日历 + */ + private void recordBenchCalendar(SceneInfo sceneInfo, long now) { + BenchCalendar benchCalendar; + if (sceneInfo.getBenchCalendar() == null || sceneInfo.getBenchCalendar().isEmpty()) { + benchCalendar = new BenchCalendar(); + benchCalendar.setBenchDateList(new ArrayList<>()); + } else { + benchCalendar = gson.fromJson(sceneInfo.getBenchCalendar(), BenchCalendar.class); + } + List tmpList = new ArrayList<>(); + //过滤一年前的记录 + benchCalendar.getBenchDateList().forEach(benchDate -> { + if (now - benchDate.getTimestamp() <= ONE_YEAR_MS) { + tmpList.add(benchDate); + } + }); + LocalDate date = LocalDate.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + String nowDate = date.format(formatter); + boolean find = false; + for (BenchDate value : tmpList) { + if (nowDate.equals(value.getBenchDate())) { + find = true; + value.setDateBenchCount(value.getDateBenchCount() + 1); + break; + } + } + //没找到,追加 + if (!find) { + BenchDate benchDate = new BenchDate(); + benchDate.setBenchDate(nowDate); + benchDate.setTimestamp(now); + benchDate.setDateBenchCount(1); + tmpList.add(benchDate); + } + benchCalendar.setBenchDateList(tmpList); + sceneInfo.setBenchCalendar(gson.toJson(benchCalendar)); + } + + + /** + * 检查校验场景比例请求数据 + */ + private Pair checkUpdateSceneRateParam(SceneRpsRateReq req) { + + if (req.getSceneID() == null || req.getSceneID() == 0) { + return Pair.of(-1, "无效的场景id"); + } + if (req.getReportID() == null || req.getReportID().isEmpty()) { + return Pair.of(-1, "无效的报告id"); + } + if (req.getRpsRate() > 100 || req.getRpsRate() < 0) { + return Pair.of(-1, "无效的发压比例"); + } + return Pair.of(0, "success"); + } + + private Pair checkStopTaskParam(int type, TaskDTO taskDTO) { + + if (type == 0 && taskDTO.getReportId() == null) { + return Pair.of(-1, "报告id必传"); + } + + if (type == 1 && taskDTO.getSceneId() == null) { + return Pair.of(-1, "场景id必传"); + } + return Pair.of(0, "success"); + } + + private Pair checkSubmitTaskParam(TaskDTO taskDTO, String reportId) { + + if (taskDTO.getSubmitTaskType() == null) { + return Pair.of(-1, "任务类型必填"); + } + switch (taskDTO.getSubmitTaskType()) { + case SINGLE_API_DEBUG: + return checkSingleDebugParam(taskDTO); + case SCENE_DEBUG: + return checkSceneDebugParam(taskDTO, reportId); + case SCENE_BENCH: + return checkSceneBenchParam(taskDTO, reportId); + default: + return Pair.of(-1, "不支持的任务类型"); + } + } + + private Pair checkSingleDebugParam(TaskDTO taskDTO) { + DebugSceneApiInfoReq apiInfo = taskDTO.getApiInfo(); + + if (null == apiInfo) { + return Pair.of(-1, "调试接口参数必传"); + } + if (null == apiInfo.getApiType()) { + return Pair.of(-1, "接口类型必传"); + } + if (apiInfo.getApiType() == Constants.HTTP_API_TYPE) { + if (null == apiInfo.getApiUrl()) { + return Pair.of(-1, "接口 url 必传"); + } + if (null == apiInfo.getRequestMethod()) { + return Pair.of(-1, "接口请求方式必传"); + } + } + if (apiInfo.getApiType() == DUBBO_API_TYPE) { + if (null == apiInfo.getServiceName()) { + return Pair.of(-1, "dubbo接口 服务名 必传"); + } + if (null == apiInfo.getMethodName()) { + return Pair.of(-1, "dubbo接口 方法名必传"); + } + if (null == apiInfo.getDubboGroup()) { + apiInfo.setDubboGroup(""); + } + if (null == apiInfo.getDubboVersion()) { + apiInfo.setDubboVersion(""); + } + if (null == apiInfo.getDubboParamJson()) { + apiInfo.setDubboParamJson(""); + } + if (null == apiInfo.getRequestBody()) { + apiInfo.setRequestBody(""); + } + } + + if (null == apiInfo.getRequestTimeout()) { + return Pair.of(-1, "请求超时时间必传"); + } + + if (apiInfo.getApiType() == HTTP_API_TYPE && apiInfo.getRequestMethod() == HTTP_REQ_GET) { + Pair> res = parseGetUrl(apiInfo.getApiUrl()); + if (res.getLeft() == -1) { + return Pair.of(-1, "请求url格式错误"); + } else { + apiInfo.setRequestBody(gson.toJson(res.getRight())); + if (apiInfo.getApiUrl().contains("?")) { + apiInfo.setApiUrl(apiInfo.getApiUrl().split("\\?")[0]); + } + } + } + if (apiInfo.getCheckPointInfoList() != null) { + apiInfo.setCheckPointInfoListStr(gson.toJson(apiInfo.getCheckPointInfoList())); + } + //转换解析表达式 + if (apiInfo.getOutputParamInfos() != null) { + BizUtils.processOutputParamExpr(apiInfo.getOutputParamInfos()); + apiInfo.setOutputParamInfosStr(gson.toJson(apiInfo.getOutputParamInfos())); + } + + return Pair.of(0, "success"); + } + + private Pair checkSceneDebugParam(TaskDTO taskDTO, String reportId) { + if (null == taskDTO.getSceneId()) { + return Pair.of(-1, "场景id必传"); + } + if (sceneService.getSceneByID(taskDTO.getSceneId(), false).getData() == null) { + return Pair.of(-1, "场景id不存在"); + } + taskDTO.setReportId(reportId); + return Pair.of(0, "success"); + } + + private Pair checkSceneBenchParam(TaskDTO taskDTO, String reportId) { + //若正在运行,驳回 + MibenchTaskExample example = new MibenchTaskExample(); + example.createCriteria().andSceneIdEqualTo(taskDTO.getSceneId()).andStateEqualTo(TaskStatus.Running.code); + List MibenchTasks = mibenchTaskMapper.selectByExample(example); + if (MibenchTasks.size() != 0) { + return Pair.of(-1, "该场景有正在执行的压测任务"); + } + SceneDTO sceneDTO = sceneService.getSceneByID(taskDTO.getSceneId(), false).getData(); + if (sceneDTO == null) { + return Pair.of(-1, "场景id不存在"); + } + Set enableSerialSet = new HashSet<>(); + sceneDTO.getSerialLinkDTOs().forEach(serialLinkDTO -> { + if (serialLinkDTO.getEnable()) { + enableSerialSet.add(serialLinkDTO.getSerialLinkName()); + } + }); + if (enableSerialSet.size() == 0) { + return Pair.of(-1, "至少需要启用一条链路"); + } + + //rps 模式 + if (sceneDTO.getBenchMode() == BenchModeEnum.RPS.code && sceneDTO.getIncrementMode() == BenchIncreaseModeEnum.PERCENT_INCREASE.code) { + if (sceneDTO.getBenchTime() < 60) { + //百分比递增模式不能小于1分钟 + return Pair.of(-1, "百分比递增模式压测时间不得小于一分钟"); + } + for (ApiBenchInfo apiBenchInfo : + sceneDTO.getApiBenchInfos()) { + if (enableSerialSet.contains(apiBenchInfo.getSerialName()) && apiBenchInfo.getMaxRps() - apiBenchInfo.getOriginRps() < 100) { + return Pair.of(-1, "百分比递增模式压测链路Rps差值不得小于 100"); + } + } + } + taskDTO.setReportId(reportId); + return Pair.of(0, "success"); + } + + private Pair> parseGetUrl(String url) { + //url 例: http://www.baidu.com?a=b&b=2 + List kvPairs = new ArrayList<>(); + if (url.contains("?")) { + String[] urlArr = url.split("\\?", 2); + if (urlArr.length != 2) { + return Pair.of(-1, null); + } + //[a=b,b=2] + String[] kvStrPair = urlArr[1].split("&"); + for (int i = 0; i < kvStrPair.length; i++) { + String[] kAndV = kvStrPair[i].split("=", 2); + kvPairs.add(new FormParamValue(kAndV[0], kAndV[1])); + } + } + return Pair.of(0, kvPairs); + } + + private String genReportName(String sceneName, String rpsRate) { + return sceneName + "——" + rpsRate + "%"; + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/UploadService.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/UploadService.java new file mode 100644 index 000000000..170792f58 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/UploadService.java @@ -0,0 +1,200 @@ +package run.mone.mimeter.dashboard.service.impl; + +import com.alibaba.nacos.api.config.annotation.NacosValue; +import com.opencsv.CSVReader; +import com.opencsv.CSVReaderBuilder; +import com.xiaomi.youpin.ks3.KsyunService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.Pair; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.dataset.UploadFileRes; +import run.mone.mimeter.dashboard.pojo.Dataset; + +import javax.annotation.PostConstruct; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import static run.mone.mimeter.dashboard.bo.common.Constants.TRUE; +import static run.mone.mimeter.dashboard.exception.CommonError.*; + +@Service +@Slf4j +public class UploadService { + + public static final int PreviewFileRowNum = 8; + + private static final int MaxFileSizeMB = 100; + + private static final int MaxFileSizeB = MaxFileSizeMB * 1024 * 1024; + + + private static final int MaxFileRows = 50000; + + + @Value("${upload.save.base}") + private String basePath; + + private KsyunService ksyunService; + + @NacosValue("${ks3.AccessKeyID}") + private String accesskey; + + @NacosValue("${ks3.AccessKeySecret}") + private String accessSecret; + + @PostConstruct + private void init() { + ksyunService = new KsyunService(); + ksyunService.setAccessKeyID(accesskey); + ksyunService.setAccessKeySecret(accessSecret); + ksyunService.init(); + } + + public Result save(MultipartFile file) { + + String fileName = file.getOriginalFilename(); + if (fileName == null){ + fileName = "tmpFileName"; + } + String url; + String ksKey; + long rows; + long size = file.getSize(); + List previewFileRows = new ArrayList<>(); + String firstRow = ""; + + try { + File tmpFile = File.createTempFile("upload-mimeter-file-", file.getOriginalFilename()); + OutputStream os = new FileOutputStream(tmpFile); + os.write(file.getBytes()); + os.flush(); + + FileReader fileReader = new FileReader(tmpFile); + LineNumberReader lineNumberReader = new LineNumberReader(fileReader); + lineNumberReader.skip(Long.MAX_VALUE); + rows = lineNumberReader.getLineNumber(); + fileReader.close(); + lineNumberReader.close(); + + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(file.getInputStream(), StandardCharsets.UTF_8)); + for (int i = 0; i < PreviewFileRowNum; i++) { + String str = bufferedReader.readLine(); + if (i == 0) { + firstRow = str; + } + if (str == null) { + break; + } + previewFileRows.add(str); + } + + Pair checkRes = checkParam(fileName, rows, size, firstRow); + if (checkRes.getKey() != 0) { + return Result.fail(checkRes.getKey(), checkRes.getValue()); + } + ksKey = basePath + System.currentTimeMillis() + "/" + fileName; + url = ksyunService.uploadFile(ksKey, tmpFile, 60 * 60 * 24 * 23999); + boolean success = tmpFile.delete(); + if (!success) { + log.info("[UploadService.save] file {} upload successfully: {}", fileName, url); + return Result.fail(UploadFileError.code, UploadFileError.message); + } + + } catch (IOException e) { + log.error("[UploadService.save] failed to save file {}, err: {}", fileName, e); + return Result.fail(UploadFileError.code, UploadFileError.message); + } + + //这一行有问题 todo + List firstRowList = Arrays.asList(firstRow.split(",")); + + UploadFileRes uploadFileRes = new UploadFileRes(); + uploadFileRes.setFileName(fileName); + uploadFileRes.setFileKsKey(ksKey); + uploadFileRes.setFileRows(rows); + uploadFileRes.setFileSize(size); + uploadFileRes.setFileUrl(url); + uploadFileRes.setFileColumns(firstRowList.size()); + uploadFileRes.setFirstRow(firstRowList); + uploadFileRes.setPreviewFileRows(previewFileRows); + + return Result.success(uploadFileRes); + } + + + public Result> loadFileByRange(Dataset dataset, int from, int to) { + + List lines = new ArrayList<>(); + try { + byte[] data = ksyunService.getFileByKey(dataset.getFileKsKey()); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(data), "UTF8")); + for (int i = 0; i < to; i++) { + String line = bufferedReader.readLine(); + if (i == 0 && dataset.getIgnoreFirstRow() == TRUE) { + to++; + continue; + } + if (i >= from) { + lines.add(line); + } + if (line == null) { + break; + } + } + } catch (IOException e) { + return Result.fail(UploadFileError.code, LoadFileError.message); + } + return Result.success(lines); + } + + public Result> loadStringArrByRange(Dataset dataset, int from, int to) { + + List lines = new ArrayList<>(); + try { + byte[] data = ksyunService.getFileByKey(dataset.getFileKsKey()); + CSVReader csvReader = new CSVReaderBuilder(new InputStreamReader(new ByteArrayInputStream(data), "UTF8")).withSkipLines(from).build(); + + if (dataset.getIgnoreFirstRow() == TRUE) { + to++; + } + String[] rawLine; + int i = 0; + while((rawLine = csvReader.readNext()) != null && i < to - from) { + if (from == 0 && i == 0 && dataset.getIgnoreFirstRow() == TRUE) { + i++; + continue; + } + lines.add(rawLine); + i++; + } + } catch (IOException e) { + return Result.fail(UploadFileError.code, LoadFileError.message); + } + return Result.success(lines); + } + + + private Pair checkParam(String fileName, long rows, long size, String firstRow) { + if (!fileName.endsWith(".csv")) { + return Pair.of(WrongFileTypeError.code, WrongFileTypeError.message); + } + if (rows > MaxFileRows) { + return Pair.of(OverMaxFileRowsError.code, "上传文件行数不得超过" + MaxFileRows + "行"); + } + if (size > MaxFileSizeB) { + return Pair.of(OverMaxFileSizeError.code, "上传文件大小不得超过" + MaxFileSizeMB + "M"); + } + if (StringUtils.isEmpty(firstRow)) { + return Pair.of(FileFirstRowEmptyError.code, FileFirstRowEmptyError.message); + } + return Pair.of(0, "success"); + } + +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/UserV1Service.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/UserV1Service.java new file mode 100644 index 000000000..2f969c938 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/impl/UserV1Service.java @@ -0,0 +1,129 @@ +package run.mone.mimeter.dashboard.service.impl; + +import com.alibaba.nacos.api.config.annotation.NacosValue; +import com.xiaomi.mone.tpc.api.service.NodeUserFacade; +import com.xiaomi.mone.tpc.api.service.UserFacade; +import com.xiaomi.mone.tpc.common.enums.NodeUserRelTypeEnum; +import com.xiaomi.mone.tpc.common.enums.UserStatusEnum; +import com.xiaomi.mone.tpc.common.enums.UserTypeEnum; +import com.xiaomi.mone.tpc.common.param.NodeUserQryParam; +import com.xiaomi.mone.tpc.common.param.UserQryParam; +import com.xiaomi.mone.tpc.common.vo.NodeUserRelVo; +import com.xiaomi.mone.tpc.common.vo.PageDataVo; +import com.xiaomi.mone.tpc.common.vo.UserVo; +import com.xiaomi.mone.tpc.login.util.UserUtil; +import com.xiaomi.mone.tpc.login.vo.AuthUserVo; +import com.xiaomi.youpin.gateway.manager.bo.user.UserInfoVo; +import com.xiaomi.youpin.infra.rpc.Result; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.stereotype.Component; +import run.mone.mimeter.dashboard.bo.UserInfo; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.exception.CommonException; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author wmin + * @date 2023/5/10 + */ +@Component +@Slf4j +public class UserV1Service { + + @DubboReference(group = "${ref.tpc.service.group}", interfaceClass = UserFacade.class, version = "1.0") + private UserFacade userFacade; + + @DubboReference(group = "${ref.tpc.service.group}", interfaceClass = NodeUserFacade.class, version = "1.0") + private NodeUserFacade nodeUserFacade; + + @NacosValue(value = "${tpc.gatewayManager.id:10}", autoRefreshed = true) + private long tpcNodeId; + + /** + * 获取用户登录信息 + * @return + */ + public UserInfo getUserInfo(){ + AuthUserVo userVo = UserUtil.getUser(); + // 适配private/api类型的请求 + if(userVo == null){ + return null; + } + UserInfo userInfo = new UserInfo(); + userInfo.setDepartmentName(userVo.getDepartmentName()); + userInfo.setDisplayName(userVo.getName()); + userInfo.setEmail(userVo.getEmail()); + userInfo.setName(userVo.getName()); + userInfo.setUsername(userVo.getAccount()); + userInfo.setFullAccount(userVo.genFullAccount()); + userInfo.setAvatar(userVo.getAvatarUrl()); + userInfo.setAdmin(true); + return userInfo; + } + + + public boolean isAdmin(String username, AuthUserVo userVo){ + if(true)return true; + if (StringUtils.isBlank(username)){ + return false; + } + if (userVo==null){ + throw new CommonException(CommonError.InvalidUserInfoError); + } + boolean isAdmin = false; + NodeUserQryParam param = new NodeUserQryParam(); + param.setNodeId(tpcNodeId); + param.setType(NodeUserRelTypeEnum.MANAGER.getCode()); + param.setAccount(userVo.getAccount()); + param.setUserType(userVo.getUserType()); + Result> rst = nodeUserFacade.list(param); + log.debug("nodeUserFacade.list rst:{}", rst); + if(rst != null && rst.getData() != null && CollectionUtils.isNotEmpty(rst.getData().getList())){ + for (NodeUserRelVo vo : rst.getData().getList()){ + if (username.equals(vo.getAccount())){ + isAdmin = true; + break; + } + } + } + return isAdmin; + } + + + /** + * 用户列表搜索 + */ + public List qryUserList(String username, Integer userType, AuthUserVo userVo) { + List list = new ArrayList<>(); + UserQryParam qryParam = new UserQryParam(); + if (userType!=null){ + qryParam.setType(userType); + } + qryParam.setUserAcc(username); + qryParam.setStatus(UserStatusEnum.ENABLE.getCode()); + qryParam.setAccount(userVo.getAccount()); + qryParam.setUserType(userVo.getUserType()); + Result> rst = userFacade.list(qryParam); + if(rst != null && rst.getData() != null && CollectionUtils.isNotEmpty(rst.getData().getList())){ + List nodeUserRelVos = rst.getData().getList(); + nodeUserRelVos.forEach(nodeUser->{ + UserInfoVo userInfoVo = new UserInfoVo(); + userInfoVo.setUserName(nodeUser.getAccount()); + userInfoVo.setUserType(nodeUser.getType()); + userInfoVo.setFullAccount(UserUtil.getFullAccount(nodeUser.getAccount(), nodeUser.getType())); + UserTypeEnum anEnum = UserTypeEnum.getEnum(nodeUser.getType()); + if(anEnum != null){ + userInfoVo.setFullUserName(nodeUser.getAccount()+"("+ anEnum.getDesc() +")"); + } + list.add(userInfoVo); + }); + } + return list; + } +} + diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/openservice/DatasetInfoServiceImpl.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/openservice/DatasetInfoServiceImpl.java new file mode 100644 index 000000000..164cfc282 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/openservice/DatasetInfoServiceImpl.java @@ -0,0 +1,73 @@ +package run.mone.mimeter.dashboard.service.openservice; + +import org.apache.dubbo.config.annotation.DubboService; +import org.springframework.beans.factory.annotation.Autowired; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.dataset.DatasetLineNum; +import run.mone.mimeter.dashboard.bo.dataset.DatasetLinesReq; +import run.mone.mimeter.dashboard.mapper.DatasetMapper; +import run.mone.mimeter.dashboard.pojo.Dataset; +import run.mone.mimeter.dashboard.service.DatasetInfoSercice; +import run.mone.mimeter.dashboard.service.DatasetService; + +import java.util.ArrayList; +import java.util.List; +import java.util.TreeMap; + +@DubboService(group = "${dubbo.group}",version = "${dubbo.version}",timeout = 10000) +public class DatasetInfoServiceImpl implements DatasetInfoSercice { + + @Autowired + private DatasetService datasetService; + + @Autowired + private DatasetMapper datasetMapper; + + private static final int MAX_DUBBO_DATA = 8*1024; + + @Override + public Result> getLineNumBySceneId(Integer sceneID) { + List datasetLineNums = new ArrayList<>(); + + List datasetsIds = datasetService.getDatasetIdsBySceneId(sceneID); + + if (datasetsIds == null || datasetsIds.size() == 0) { + return Result.success(datasetLineNums); + } + List datasets = datasetService.getDatasetListByIds(datasetsIds).getData(); + datasets.forEach(dataset -> { + DatasetLineNum datasetLineNum = new DatasetLineNum(); + datasetLineNum.setDatasetId(dataset.getId()); + datasetLineNum.setFileName(dataset.getFileName()); + datasetLineNum.setFileUrl(dataset.getFileUrl()); + datasetLineNum.setFileKsKey(dataset.getFileKsKey()); + datasetLineNum.setFileRaw(dataset.getFileRows()); + datasetLineNum.setDefaultParamName(dataset.getDefaultParamName()); + datasetLineNum.setIgnoreFirstLine(dataset.getIgnoreFirstRow() == 1); + datasetLineNums.add(datasetLineNum); + }); + return Result.success(datasetLineNums); + } + + @Override + public Result>> getDatasetMap(List linesReqs) { + TreeMap> dataRes = datasetService.getParamDataMap(linesReqs); +// if (dataRes.toString().getBytes().length >= MAX_DUBBO_DATA){ +// return Result.fail(CommonError.DubboDataTooLong); +// } + return Result.success(dataRes); + } + + @Override + public Result syncTenant() { + return Result.success(datasetService.syncTenant()); + } + + @Override + public Result updateDatasetTenant(Integer datasetId, String tenant) { + Dataset dataset = datasetMapper.selectByPrimaryKey(datasetId); + dataset.setTenant(tenant); + datasetMapper.updateByPrimaryKey(dataset); + return Result.success(true); + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/openservice/MonitorInfoServiceImpl.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/openservice/MonitorInfoServiceImpl.java new file mode 100644 index 000000000..5dc22999c --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/openservice/MonitorInfoServiceImpl.java @@ -0,0 +1,50 @@ +package run.mone.mimeter.dashboard.service.openservice; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.xiaomi.faas.func.api.MimeterService; +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.config.annotation.DubboReference; +import org.apache.dubbo.config.annotation.DubboService; +import run.mone.mimeter.dashboard.bo.scene.SceneTaskAppsBo; +import run.mone.mimeter.dashboard.common.util.Util; +import run.mone.mimeter.dashboard.service.MonitorInfoService; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@DubboService(group = "${dubbo.group}", version = "${dubbo.version}") +@Slf4j +public class MonitorInfoServiceImpl implements MonitorInfoService { + + private static final Gson gson = Util.getGson(); + @DubboReference(check = false,group = "${ref.hera.service.group}",timeout = 3000) + private MimeterService mimeterService; + + + @Override + public List getAppListByReportID(Integer sceneId, String reportId) { + List appList = new ArrayList<>(); + + String flag = sceneId + "_" + reportId; + com.xiaomi.youpin.infra.rpc.Result res; + try { + res = mimeterService.getApps(flag); + } catch (Exception e) { + return appList; + } + if (res.getCode() == 0 && res.getData() != null) { + //succ + SceneTaskAppsBo sceneTaskAppsBo = gson.fromJson(res.getData().toString(), new TypeToken() { + }.getType()); + List linkTaskAppsBos = sceneTaskAppsBo.getSerialLinks(); + linkTaskAppsBos.forEach(linkTaskAppsBo -> { + List> apps =linkTaskAppsBo.getApis().stream().map(SceneTaskAppsBo.ApiTaskAppsBo::getApps).collect(Collectors.toList()); + apps.forEach(appList::addAll); + }); +// List apiTaskAppsBos = linkTaskAppsBos.stream().map(SceneTaskAppsBo.LinkTaskAppsBo::getApis); + } + return appList; + } +} diff --git a/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/openservice/SceneInfoServiceImpl.java b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/openservice/SceneInfoServiceImpl.java new file mode 100644 index 000000000..5430d4fb5 --- /dev/null +++ b/ozburst-all/mimeter-dashboard/mimeter-dashboard-service/src/main/java/run/mone/mimeter/dashboard/service/openservice/SceneInfoServiceImpl.java @@ -0,0 +1,114 @@ +package run.mone.mimeter.dashboard.service.openservice; + +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.config.annotation.DubboService; +import org.springframework.beans.factory.annotation.Autowired; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.scene.SceneDTO; +import run.mone.mimeter.dashboard.common.TaskStatus; +import run.mone.mimeter.dashboard.exception.CommonError; +import run.mone.mimeter.dashboard.mapper.MibenchTaskMapper; +import run.mone.mimeter.dashboard.mapper.SceneInfoMapper; +import run.mone.mimeter.dashboard.pojo.MibenchTask; +import run.mone.mimeter.dashboard.pojo.MibenchTaskExample; +import run.mone.mimeter.dashboard.pojo.SceneInfo; +import run.mone.mimeter.dashboard.service.SceneInfoService; +import run.mone.mimeter.dashboard.service.SceneService; + +import java.util.List; +import java.util.stream.Collectors; + +@DubboService(group = "${dubbo.group}",version = "${dubbo.version}") +@Slf4j +public class SceneInfoServiceImpl implements SceneInfoService { + + @Autowired + private SceneService sceneService; + + @Autowired + private SceneInfoMapper sceneInfoMapper; + + @Autowired + private MibenchTaskMapper mibenchTaskMapper; + + /** + * 15s后未结束认为状态已丢失 + */ + private static final long MAX_DELAY_TIME = 15; + + @Override + public Result getSceneByID(Integer sceneID) { + return sceneService.getSceneByID(sceneID,true); + } + + @Override + public void updateSceneStatus(Integer sceneId,Integer sceneStatus) { + if (sceneId == null || sceneStatus == null){ + return; + } + try { + SceneInfo sceneInfo = sceneInfoMapper.selectByPrimaryKey(sceneId); + sceneInfo.setSceneStatus(sceneStatus); + sceneInfoMapper.updateByPrimaryKey(sceneInfo); + } catch (Exception e) { + log.error("update scene status error:{}",e.getMessage()); + } + } + + @Override + public Result updatemimeterTaskStatus(String report, Integer status) { + MibenchTaskExample example = new MibenchTaskExample(); + example.createCriteria().andReportIdEqualTo(report); + List MibenchTasks = mibenchTaskMapper.selectByExample(example); + MibenchTasks.forEach(MibenchTask -> { + MibenchTask.setState(status); + mibenchTaskMapper.updateByPrimaryKey(MibenchTask); + }); + + return Result.success(true); + } + + @Override + public Result updateSceneTenant(Integer sceneId, String tenant) { + SceneInfo sceneInfo = sceneInfoMapper.selectByPrimaryKey(sceneId); + sceneInfo.setTenant(tenant); + sceneInfoMapper.updateByPrimaryKey(sceneInfo); + return Result.success(true); + } + + @Override + public Result tmpUpdateLogRate(int sceneId, int logRate) { + SceneInfo sceneInfo = sceneInfoMapper.selectByPrimaryKey(sceneId); + sceneInfo.setLogRate(logRate); + sceneInfoMapper.updateByPrimaryKey(sceneInfo); + return Result.success(true); + } + + /** + * 定时任务,处理丢失状态的任务 + * @return + */ + @Override + public Result processLossTask() { + try { + MibenchTaskExample example = new MibenchTaskExample(); + example.createCriteria().andStateEqualTo(TaskStatus.Running.code); + List runningTasks = mibenchTaskMapper.selectByExample(example); + if (runningTasks == null || runningTasks.size() == 0){ + return Result.success(true); + } + List toDoTaskList = runningTasks.stream().filter(runningTask -> (System.currentTimeMillis() - runningTask.getCtime()) >= (runningTask.getTime() + MAX_DELAY_TIME)).collect(Collectors.toList()); + if (toDoTaskList.size() == 0){ + return Result.success(true); + } + toDoTaskList.forEach(toDoTask ->{ + toDoTask.setState(TaskStatus.Success.code); + mibenchTaskMapper.updateByPrimaryKey(toDoTask); + }); + } catch (Exception e) { + log.error("SceneInfoServiceImpl processLossTask failed,cause by:{}",e.getMessage()); + return Result.fail(CommonError.UnknownError); + } + return Result.success(true); + } +} diff --git a/ozburst-all/mimeter-dashboard/pom.xml b/ozburst-all/mimeter-dashboard/pom.xml new file mode 100644 index 000000000..7a856efbc --- /dev/null +++ b/ozburst-all/mimeter-dashboard/pom.xml @@ -0,0 +1,52 @@ + + + + 4.0.0 + run.mone + mimeter-dashboard + 1.0.0-SNAPSHOT + pom + + + mimeter-dashboard-api + mimeter-dashboard-common + mimeter-dashboard-service + mimeter-dashboard-server + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + true + true + UTF-8 + + + ${project.basedir}/src/main/java + + + + + + + + + + + ossrh + https://s01.oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + diff --git a/ozburst-all/mimeter-engine/mimeter-agent-manager/README.md b/ozburst-all/mimeter-engine/mimeter-agent-manager/README.md new file mode 100644 index 000000000..5e383f300 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-manager/README.md @@ -0,0 +1,6 @@ ++ 用来分配和调度压测任务 ++ new_mibench_manager ++ env ++ mione.faas.func.env.id=1;mione.faas.func.id=1 (agent-manager) ++ jvm ++ --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.math=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED \ No newline at end of file diff --git a/ozburst-all/mimeter-engine/mimeter-agent-manager/dependency-reduced-pom.xml b/ozburst-all/mimeter-engine/mimeter-agent-manager/dependency-reduced-pom.xml new file mode 100644 index 000000000..39ed65bed --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-manager/dependency-reduced-pom.xml @@ -0,0 +1,85 @@ + + + + mimeter-engine + run.mone + 1.0-SNAPSHOT + + 4.0.0 + mimeter-agent-manager + + + + maven-shade-plugin + 3.1.1 + + + package + + shade + + + + + + + + + + com.xiaomi.mone + sautumn-serverless-api + 1.0.0-SNAPSHOT + provided + + + youpin-infra-rpc + com.xiaomi.youpin + + + docean-plugin-dubbo-serverless + run.mone + + + sautumn-filter-api + com.xiaomi.mone + + + sidecar-docs-annotations + run.mone + + + + + javax.annotation + javax.annotation-api + 1.3.2 + provided + + + run.mone + docean-plugin-rpc + 1.4-SNAPSHOT + provided + + + rpc + run.mone + + + docean-plugin-config + run.mone + + + + + org.projectlombok + lombok + 1.18.24 + provided + + + + 20 + 20 + + diff --git a/ozburst-all/mimeter-engine/mimeter-agent-manager/pom.xml b/ozburst-all/mimeter-engine/mimeter-agent-manager/pom.xml new file mode 100644 index 000000000..1220fa0ca --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-manager/pom.xml @@ -0,0 +1,127 @@ + + + + mimeter-engine + run.mone + 1.0-SNAPSHOT + + 4.0.0 + + mimeter-agent-manager + + + 20 + 20 + + + + + + + + com.xiaomi.mone + sautumn-serverless-api + 1.0.0-SNAPSHOT + provided + + + youpin-infra-rpc + com.xiaomi.youpin + + + + + + run.mone + docean + 1.4-SNAPSHOT + + + + + com.xiaomi.faas + hera-api-dubboapi + 1.0.6 + + + + javax.annotation + javax.annotation-api + 1.3.2 + provided + + + + run.mone + docean-plugin-rpc + 1.4-SNAPSHOT + provided + + + + run.mone + mimeter-dashboard-api + 1.0.0-SNAPSHOT + + + com.xiaomi.youpin + youpin-infra-rpc + + + + + + com.xiaomi.mone + mimonitor-api + 1.0-SNAPSHOT + + + + com.xiaomi.youpin + tesla-k8s-proxy-api + 1.0.0-SNAPSHOT + + + + run.mone + struct + 1.4-SNAPSHOT + + + + run.mone + mimeter-api + 1.0-SNAPSHOT + + + + run.mone + mimeter-dashboard-api + 1.0.0-SNAPSHOT + + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.1.1 + + + + + package + + shade + + + + + + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/DataStatService.java b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/DataStatService.java new file mode 100644 index 000000000..a9fcfd4f5 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/DataStatService.java @@ -0,0 +1,556 @@ +package run.mone.mimeter.agent.manager; + +import com.xiaomi.faas.func.api.PrometheusService; +import com.xiaomi.faas.func.domain.MimeterApiDetailRes; +import com.xiaomi.youpin.docean.anno.Service; +import com.xiaomi.youpin.infra.rpc.Result; +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.annotation.DubboReference; +import run.mone.mimeter.dashboard.bo.common.EmitterTypeEnum; +import run.mone.mimeter.dashboard.bo.statistics.ApiStatistics; +import run.mone.mimeter.dashboard.bo.statistics.ErrorTypeAnalysis; +import run.mone.mimeter.dashboard.bo.statistics.TotalStatAnalysisEvent; +import run.mone.mimeter.dashboard.service.BenchBroadcastService; +import run.mone.mimeter.engine.agent.bo.data.AgentReq; +import run.mone.mimeter.engine.agent.bo.stat.SceneTotalCountContextDTO; +import run.mone.mimeter.engine.agent.bo.stat.TotalCounterStatistic; +import run.mone.mimeter.engine.agent.bo.task.DagTaskRps; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.LongAdder; + +import static common.Const.*; +import static common.Const.API_REQ_FAIL; + +@Service +@Slf4j +public class DataStatService { + + @DubboReference(check = false, group = "${mimeter.dashboard.dubbo.group}", version = "${mimeter.dashboard.dubbo.version}", interfaceClass = BenchBroadcastService.class, timeout = 20000) + private BenchBroadcastService benchBroadcastService; + + /** + * 监控打点数据服务 + */ + @DubboReference(check = false, interfaceClass = PrometheusService.class, timeout = 5000) + private PrometheusService prometheusService; + + /** + * <"reportId",{}> + */ + private final ConcurrentMap totalCountStatistic = new ConcurrentHashMap<>(); + + public void processTotalCountCtxEvent(AgentReq req) throws InterruptedException { + //处理回调过来的返回数据 + SceneTotalCountContextDTO totalCountContextDTO = req.getTotalCountContextDTO(); + + //get p95 p99 data from remote + Map p95Map = new HashMap<>(); + Map p99Map = new HashMap<>(); + try { + Result pRtData = prometheusService.getMimeterApiDetail(String.valueOf(totalCountContextDTO.getSceneId()), totalCountContextDTO.getSceneType()); + log.debug("get remote p99 p95,scene id:{},type:{}, data :{}", totalCountContextDTO.getSceneId(), totalCountContextDTO.getSceneType(), pRtData.getData()); + if (pRtData.getCode() == 0 || pRtData.getData() != null) { + MimeterApiDetailRes res = (MimeterApiDetailRes) pRtData.getData(); + if (res.getP95() != null) { + res.getP95().forEach((k, v) -> { + if (k.contains(":")) { + Integer apiId = Integer.valueOf(k.substring(k.indexOf(":") + 1)); + double value = Double.parseDouble(v); + p95Map.put(apiId, (int) value); + } + }); + } + if (res.getP99() != null) { + res.getP99().forEach((k, v) -> { + if (k.contains(":")) { + Integer apiId = Integer.valueOf(k.substring(k.indexOf(":") + 1)); + double value = Double.parseDouble(v); + p99Map.put(apiId, (int) value); + } + }); + } + } + } catch (Exception e) { + log.error("get p99 and p95 data from remote failed,cause by:{}", e.getMessage()); + } + log.debug("get p99 p95 data p95:{},p99:{}", p95Map, p99Map); + + if (totalCountStatistic.containsKey(totalCountContextDTO.getReportId())) { + + //总记录中存在本压测任务 + //合并数据 错误数据、rt、tps数据 + //通知 + mergeTotalStatistic(totalCountContextDTO); + notifyTotalStatistic(totalCountContextDTO.getReportId(), p95Map, p99Map, false); + if (totalCountContextDTO.isLastTime()) { + //该压测机结束 + TotalCounterStatistic statistic = totalCountStatistic.get(totalCountContextDTO.getReportId()); + int finishNum = statistic.getFinishAgentNum().addAndGet(1); + if (finishNum >= totalCountContextDTO.getConnectTaskNum() * totalCountContextDTO.getAgentNum()) { + //所有机器执行完成 + notifyTotalStatistic(totalCountContextDTO.getReportId(), p95Map, p99Map, true); + //清除该任务记录 + totalCountStatistic.remove(totalCountContextDTO.getReportId()); + } + } + } else { + totalCountStatistic.put(totalCountContextDTO.getReportId(), new TotalCounterStatistic(new AtomicInteger(), new LongAdder(), new LongAdder(), new LongAdder(), + new LongAdder(), new LongAdder(), new ConcurrentHashMap<>(), new ConcurrentHashMap<>(), new ConcurrentHashMap<>(), new ConcurrentHashMap<>())); + //总记录中存在本压测任务 + //合并数据 + //通知 + mergeTotalStatistic(totalCountContextDTO); + notifyTotalStatistic(totalCountContextDTO.getReportId(), p95Map, p99Map, false); + } + } + + /** + * 合并总体统计数据 + */ + private void mergeTotalStatistic(SceneTotalCountContextDTO countContextDTO) { + String reportId = countContextDTO.getReportId(); + TotalCounterStatistic statistic = this.totalCountStatistic.get(reportId); + + //场景发压比例 + statistic.setRpsRate(countContextDTO.getRpsRate()); + + //合并总请求数 + statistic.getTotalReq().add(countContextDTO.getTotalReq()); + + //合并总处理数 + statistic.getTotalTCount().add(countContextDTO.getTotalTCount()); + + //丢失连接数 + statistic.getLossConnNum().add(countContextDTO.getLossConnNum()); + + //更新链路rps + updateLinkRps(countContextDTO, statistic); + + //合并更新错误统计数据 + mergeErrData(countContextDTO, statistic); + + //合并更新rt、tps相关数据 + mergeRtAndTpsData(countContextDTO, statistic); + + //合并更新各接口统计数据 + mergeApiCountData(countContextDTO, statistic); + + //合并完后替换原先数据 + totalCountStatistic.put(reportId, statistic); + } + + private void updateLinkRps(SceneTotalCountContextDTO countContextDTO, TotalCounterStatistic statistic) { + if (statistic.getReportLinkRps() != null) { + DagTaskRps dagTaskRps = countContextDTO.getDagTaskRps(); + if (statistic.getReportLinkRps().get(dagTaskRps.getLinkId()) != null) { + statistic.getReportLinkRps().get(dagTaskRps.getLinkId()).setRps(dagTaskRps.getRps()); + } else { + statistic.getReportLinkRps().put(dagTaskRps.getLinkId(), dagTaskRps); + } + } + } + + /** + * 合并统计错误数据 + */ + private void mergeErrData(SceneTotalCountContextDTO countContextDTO, TotalCounterStatistic statistic) { + //合并总错误次数 + statistic.getTotalErrReq().add(countContextDTO.getTotalErrReq()); + //合并总错误次数 + statistic.getTotalSuccReq().add(countContextDTO.getTotalSuccReq()); + + //合并错误统计 + //errKey:s_code_errorCode countMap: + //例:<"s_code_404",<2342,10>> or <"cp_id_141242",<2342,10>> + countContextDTO.getCounterMap().forEach((errKey, countMap) -> { + if (statistic.getCounterMap().containsKey(errKey)) { + //已存在该错误类型 + countMap.forEach((apiId, count) -> { + if (statistic.getCounterMap().get(errKey).containsKey(apiId)) { + //已记录该api + statistic.getCounterMap().get(errKey).get(apiId).add(count); + } else { + //尚未记录该api + LongAdder longAdder = new LongAdder(); + longAdder.add(count); + statistic.getCounterMap().get(errKey).put(apiId, longAdder); + } + }); + } else { + //尚不存在该类错误 + ConcurrentHashMap tmpMap = new ConcurrentHashMap<>(); + countMap.forEach((k, v) -> { + LongAdder tmpAdder = new LongAdder(); + tmpAdder.add(v); + tmpMap.put(k, tmpAdder); + }); + statistic.getCounterMap().put(errKey, tmpMap); + } + }); + } + + /** + * 合并接口中rt、tps、rps 数据 + */ + private void mergeRtAndTpsData(SceneTotalCountContextDTO countContextDTO, TotalCounterStatistic statistic) { + //合并接口中rt、tps数据 + //所有接口本次的rt汇总 + CopyOnWriteArrayList tmpAllRt = new CopyOnWriteArrayList<>(); + CopyOnWriteArrayList tmpAllTps = new CopyOnWriteArrayList<>(); + CopyOnWriteArrayList tmpAllRps = new CopyOnWriteArrayList<>(); + + countContextDTO.getApiRtMap().forEach((apiId, typeMap) -> { + if (statistic.getApiRtAndTpsMap().containsKey(apiId)) { + //已存在该api的记录 + AtomicInteger apiAvgRt = new AtomicInteger(); + final int[] apiMaxRt = {0}; + ConcurrentHashMap apiMap = statistic.getApiRtAndTpsMap().get(apiId); + typeMap.forEach((type, list) -> { + if (type.equals(RT_LIST)) { + //rt 列表 + tmpAllRt.addAll(list); + //之前存储的平均值 + int oriAvgRt = apiMap.get(AVG_RT).get(); + AtomicInteger tmpApiTotalRt = new AtomicInteger(); + list.forEach(apiRt -> { + tmpApiTotalRt.addAndGet(apiRt); + if (apiRt >= apiMaxRt[0]) { + apiMaxRt[0] = apiRt; + } + }); + //接口平均rt + if (list.size() != 0) { + if (oriAvgRt != 0) { + apiAvgRt.set((tmpApiTotalRt.get() + oriAvgRt) / (list.size() + 1)); + } else { + apiAvgRt.set(tmpApiTotalRt.get() / list.size()); + } + //更新接口平均rt + apiMap.get(AVG_RT).set(apiAvgRt.get()); + } + //更新接口最大rt + if (apiMaxRt[0] > apiMap.get(MAX_RT).get()) { + apiMap.get(MAX_RT).set(apiMaxRt[0]); + } + } + }); + //平均rps + if (!countContextDTO.isLastTime()) { + int apiAvgRps; + int tmpCount = (countContextDTO.getApiRpsMap().get(apiId)) * countContextDTO.getAgentNum(); + if (apiMap.get(AVG_RPS).get() != 0) { + apiAvgRps = (tmpCount + apiMap.get(AVG_RPS).get()) / 2; + } else { + apiAvgRps = tmpCount; + } + apiMap.get(AVG_RPS).set(apiAvgRps); + + if (tmpCount != 0) { + tmpAllRps.add(tmpCount); + } + //最大rps + if (apiAvgRps > apiMap.get(MAX_RPS).get()) { + apiMap.get(MAX_RPS).set(apiAvgRps); + } + //平均tps + int apiAvgTps; + int tmpTCount = (countContextDTO.getApiTpsMap().get(apiId)) * countContextDTO.getAgentNum(); + if (apiMap.get(AVG_TPS).get() != 0) { + apiAvgTps = (tmpTCount + apiMap.get(AVG_TPS).get()) / 2; + } else { + apiAvgTps = tmpTCount; + } + apiMap.get(AVG_TPS).set(apiAvgTps); + + if (tmpTCount != 0) { + tmpAllTps.add(tmpTCount); + } + //最大tps + if (apiAvgTps > apiMap.get(MAX_TPS).get()) { + apiMap.get(MAX_TPS).set(apiAvgTps); + } + } + } else { + //初始化 + ConcurrentHashMap apiMap = new ConcurrentHashMap<>(); + apiMap.put(AVG_RT, new AtomicInteger(0)); + apiMap.put(MAX_RT, new AtomicInteger(0)); + apiMap.put(AVG_TPS, new AtomicInteger(0)); + apiMap.put(MAX_TPS, new AtomicInteger(0)); + apiMap.put(MAX_RPS, new AtomicInteger(0)); + apiMap.put(AVG_RPS, new AtomicInteger(0)); + statistic.getApiRtAndTpsMap().put(apiId, apiMap); + } + }); + //场景平均rt + int avgRt; + //最大rt + AtomicInteger maxRt = new AtomicInteger(); + AtomicInteger totalRt = new AtomicInteger(0); + tmpAllRt.forEach(rt -> { + totalRt.addAndGet(rt); + if (rt >= maxRt.get()) { + maxRt.set(rt); + } + }); + if (tmpAllRt.size() != 0) { + if (statistic.getAvgRt() != 0) { + avgRt = (totalRt.get() + statistic.getAvgRt()) / (tmpAllRt.size() + 1); + } else { + avgRt = totalRt.get() / tmpAllRt.size(); + } + //更新平均rt + statistic.setAvgRt(avgRt); + } + //更新最大rt + if (maxRt.get() >= statistic.getMaxRt()) { + statistic.setMaxRt(maxRt.get()); + } + + if (!countContextDTO.isLastTime()) { + //场景平均rps + int avgRps; + AtomicInteger maxRps = new AtomicInteger(); + AtomicInteger totalRps = new AtomicInteger(); + if (tmpAllRps.size() != 0) { + tmpAllRps.forEach(rps -> { + totalRps.addAndGet(rps); + if (rps > maxRps.get()) { + maxRps.set(rps); + } + }); + + int tmpAvgRps = totalRps.get() / tmpAllRps.size(); + + if (statistic.getAvgRps() != 0) { + avgRps = (statistic.getAvgRps() + tmpAvgRps) / 2; + } else { + avgRps = tmpAvgRps; + } + statistic.setAvgRps(avgRps); + } + //更新最大rps + if (maxRps.get() > statistic.getMaxRps()) { + statistic.setMaxRps(maxRps.get()); + } + + //场景平均tps + int avgTps; + AtomicInteger maxTps = new AtomicInteger(); + AtomicInteger totalTps = new AtomicInteger(); + if (tmpAllTps.size() != 0) { + tmpAllTps.forEach(tps -> { + totalTps.addAndGet(tps); + if (tps > maxTps.get()) { + maxTps.set(tps); + } + }); + + int tmpAvgTps = totalTps.get() / tmpAllTps.size(); + + if (statistic.getAvgTps() != 0) { + avgTps = (statistic.getAvgTps() + tmpAvgTps) / 2; + } else { + avgTps = tmpAvgTps; + } + statistic.setAvgTps(avgTps); + } + + //更新最大tps + if (maxTps.get() > statistic.getMaxTps()) { + statistic.setMaxTps(maxTps.get()); + } + } + } + + /** + * 合并各接口统计数据 + */ + private void mergeApiCountData(SceneTotalCountContextDTO countContextDTO, TotalCounterStatistic statistic) { + ConcurrentHashMap> apiCountMap = countContextDTO.getApiCountMap(); + apiCountMap.forEach((apiId, countMap) -> { + if (statistic.getApiCountMap().containsKey(apiId)) { + //已记录该接口数据 + countMap.forEach((type, count) -> statistic.getApiCountMap().get(apiId).get(type).add(count)); + } else { + //未记录,初始化第一次 + ConcurrentHashMap apiAdderMap = new ConcurrentHashMap<>(); + countMap.forEach((type, count) -> { + LongAdder longAdder = new LongAdder(); + longAdder.add(count); + apiAdderMap.put(type, longAdder); + }); + statistic.getApiCountMap().put(apiId, apiAdderMap); + } + }); + } + + /** + * 推送错误统计数据 + */ + private void notifyTotalStatistic(String reportId, Map p95Map, Map p99Map, boolean finish) throws InterruptedException { + if (!totalCountStatistic.containsKey(reportId)) { + return; + } + if (finish) { + //等下同时间推送的事件merge完成 + Thread.sleep(100); + } + TotalCounterStatistic totalCounterStatistic = totalCountStatistic.get(reportId); + + TotalStatAnalysisEvent analysisEvent = new TotalStatAnalysisEvent(); + analysisEvent.setFinish(finish); + int totalCount = totalCounterStatistic.getTotalReq().intValue(); + int totalSuccCount = totalCounterStatistic.getTotalSuccReq().intValue(); + int totalErrCount = totalCounterStatistic.getTotalErrReq().intValue(); + + //链路rps + ConcurrentHashMap innerRpsMap = totalCounterStatistic.getReportLinkRps(); + Map dagTaskRpsMap = new HashMap<>(); + innerRpsMap.forEach((linkId,rpsObj) -> dagTaskRpsMap.putIfAbsent(linkId,new run.mone.mimeter.dashboard.bo.task.DagTaskRps(linkId,rpsObj.getTaskId(), rpsObj.getRps()))); + analysisEvent.setLinkToDagTaskRpsMap(dagTaskRpsMap); + + //当前发压比例 + analysisEvent.setRpsRate(totalCounterStatistic.getRpsRate()); + //总请求数 + analysisEvent.setTotalReq(totalCount); + + analysisEvent.setLossConnNum(totalCounterStatistic.getLossConnNum().intValue()); + //业务总处理次数 + analysisEvent.setTotalTCount(totalCounterStatistic.getTotalTCount().intValue()); + //总成功数 + analysisEvent.setTotalSuccReq(totalSuccCount); + //总错误数 + analysisEvent.setTotalErrReq(totalErrCount); + //总平均rt + analysisEvent.setAvgRt(totalCounterStatistic.getAvgRt()); + //总最大rt + analysisEvent.setMaxRt(totalCounterStatistic.getMaxRt()); + //总平均tps + analysisEvent.setAvgTps(totalCounterStatistic.getAvgTps()); + //总最大tps + analysisEvent.setMaxTps(totalCounterStatistic.getMaxTps()); + //总最大rps + analysisEvent.setMaxRps(totalCounterStatistic.getMaxRps()); + //总平均rps + analysisEvent.setAvgRps(totalCounterStatistic.getAvgRps()); + + double totalErrRate = 0; + if (totalCount != 0) { + totalErrRate = (1.0 * totalErrCount / totalCount) * 100d; + } + + analysisEvent.setTotalErrRate(format2(totalErrRate)); + + double totalSuccRate = 0; + if (totalCount != 0) { + totalSuccRate = (1.0 * totalSuccCount / totalCount) * 100d; + } + analysisEvent.setTotalSuccRate(format2(totalSuccRate)); + + List errorTypeAnalyses = new ArrayList<>(); + totalCounterStatistic.getCounterMap().forEach((errFlag, apiMap) -> { + ErrorTypeAnalysis analysis = new ErrorTypeAnalysis(); + + String[] flagAndCode = errFlag.split("_", 2); + + if (errFlag.startsWith(ERR_STATUS_CODE_PREFIX)) { + //错误状态码 + analysis.setErrorType(ERR_STATUS_CODE_TYPE); + analysis.setErrorCode(Integer.parseInt(flagAndCode[1])); + + } else if (errFlag.startsWith(ERR_CHECKPOINT_PREFIX)) { + //检查点规则 + analysis.setErrorType(ERR_CHECKPOINT_TYPE); + //检查点id + analysis.setCheckPointId(Integer.valueOf(flagAndCode[1])); + } else if (errFlag.equals(ERR_STATUS_DUBBO_PREFIX)) { + //检查点规则 + analysis.setErrorType(ERR_DUBBO_CALL_TYPE); + //检查点id + analysis.setCheckPointId(500); + } + //本错误总数 + AtomicInteger thisErrTotalCount = new AtomicInteger(); + AtomicInteger mostErrApiId = new AtomicInteger(); + final int[] tmpMostErrApiCount = {0}; + Map errInApis = new HashMap<>(); + apiMap.forEach((apiId, count) -> { + errInApis.put(apiId, count.intValue()); + thisErrTotalCount.addAndGet(count.intValue()); + + if (count.intValue() >= tmpMostErrApiCount[0]) { + tmpMostErrApiCount[0] = count.intValue(); + mostErrApiId.set(apiId); + } + }); + //本错误占比 + double thisErrRate = 0; + if (totalErrCount != 0) { + thisErrRate = (1.0 * thisErrTotalCount.get() / totalErrCount) * 100d; + } + + analysis.setErrRate(format2(thisErrRate)); + analysis.setMostErrApi(mostErrApiId.get()); + analysis.setErrInApis(errInApis); + + errorTypeAnalyses.add(analysis); + }); + //错误分析数据 + analysisEvent.setErrorTypeAnalyses(errorTypeAnalyses); + + List apiStatisticsList = new ArrayList<>(); + ConcurrentHashMap> apiCountMaps = totalCounterStatistic.getApiCountMap(); + + totalCounterStatistic.getApiRtAndTpsMap().forEach((apiId, apiMap) -> { + ApiStatistics apiStatistics = new ApiStatistics(); + apiStatistics.setApiId(apiId); + apiStatistics.setAvgRt(apiMap.getOrDefault(AVG_RT, new AtomicInteger(0)).get()); + apiStatistics.setMaxRt(apiMap.getOrDefault(MAX_RT, new AtomicInteger(0)).get()); + //remote 的两个数据p95 p99 + apiStatistics.setP95Rt(p95Map.getOrDefault(apiId, 0)); + apiStatistics.setP99Rt(p99Map.getOrDefault(apiId, 0)); + + apiStatistics.setAvgTps(apiMap.getOrDefault(AVG_TPS, new AtomicInteger(0)).get()); + apiStatistics.setMaxTps(apiMap.getOrDefault(MAX_TPS, new AtomicInteger(0)).get()); + apiStatistics.setMaxRps(apiMap.getOrDefault(MAX_RPS, new AtomicInteger(0)).get()); + apiStatistics.setAvgRps(apiMap.getOrDefault(AVG_RPS, new AtomicInteger(0)).get()); + + ConcurrentHashMap apiCountMap = apiCountMaps.get(apiId); + if (apiCountMap != null) { + int apiTotal = apiCountMap.getOrDefault(API_REQ_TOTAL_R, new LongAdder()).intValue(); + int apiTransTotal = apiCountMap.getOrDefault(API_REQ_TOTAL_T, new LongAdder()).intValue(); + int apiSucc = apiCountMap.getOrDefault(API_REQ_SUCC, new LongAdder()).intValue(); + int apiFail = apiCountMap.getOrDefault(API_REQ_FAIL, new LongAdder()).intValue(); + apiStatistics.setReqTotal(apiTotal); + apiStatistics.setTansTotal(apiTransTotal); + apiStatistics.setReqSucc(apiSucc); + apiStatistics.setReqFail(apiFail); + + double apiSuccRate = 0; + if (apiTotal != 0) { + apiSuccRate = (1.0 * apiSucc / apiTotal) * 100d; + } + apiStatistics.setSuccRate(format2(apiSuccRate)); + } + apiStatisticsList.add(apiStatistics); + }); + analysisEvent.setApiStatisticsList(apiStatisticsList); + //推送错误统计数据 + this.benchBroadcastService.notifyEvent(EmitterTypeEnum.TOTAL_STAT_ANALYSIS, reportId, analysisEvent); + } + + public static String format2(double value) { + /* + * %.2f % 表示 小数点前任意位数 2 表示两位小数 格式后的结果为 f 表示浮点型 + */ + return new Formatter().format("%.2f", value).toString(); + } + + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/ManagerHandler.java b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/ManagerHandler.java new file mode 100644 index 000000000..1e9e4b9c8 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/ManagerHandler.java @@ -0,0 +1,179 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.agent.manager; + +import com.xiaomi.youpin.docean.anno.Controller; +import com.xiaomi.youpin.docean.anno.RequestMapping; +import lombok.extern.slf4j.Slf4j; +import org.nutz.dao.impl.NutDao; +import run.mone.mimeter.agent.manager.bo.MibenchTask; +import run.mone.mimeter.dashboard.bo.agent.*; +import run.mone.mimeter.engine.agent.bo.data.AgentInfoDTO; +import run.mone.mimeter.engine.agent.bo.data.HttpResult; +import run.mone.mimeter.engine.agent.bo.task.CancelType; +import run.mone.mimeter.engine.agent.bo.task.ChangeQpsReq; +import run.mone.mimeter.engine.agent.bo.task.Task; + +import javax.annotation.Resource; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author goodjava@qq.com + * @date 2022/5/19 + */ +@Controller +@Slf4j +public class ManagerHandler { + + @Resource + private ManagerService managerService; + + @Resource(name = "$daoName:mibench_st_db", description = "mysql") + private NutDao dao; + + @RequestMapping(path = "/version") + public String version() { + return "2022-10-1 1.0.0"; + } + + @RequestMapping(path = "/system") + public String system() { + return System.getProperty("os.name"); + } + + + @RequestMapping(path = "/test") + public int test() { + MibenchTask dagTask = dao.fetch(MibenchTask.class, 61381); + log.info("test log info:{}",dagTask); + return dagTask.getIncreasePercent(); + } + + /** + * 获取agent 列表 + * @return + */ + @RequestMapping(path = "/agent/list") + public List agentList() { + return managerService.agents().stream().map(it -> { + AgentInfoDTO info = new AgentInfoDTO(); + info.setIp(it.remoteAddress().toString()); + return info; + }).collect(Collectors.toList()); + } + + @RequestMapping(path = "/agent/addr/list") + public List>> agentAddrList() { + Map> result = new HashMap<>(); + List ipList = new ArrayList<>(); + + managerService.agents().forEach(it -> { + try { + String addrStr = it.remoteAddress().toString(); + String[] addrArr = addrStr.split("/"); + String ipAndPort = addrArr[addrArr.length - 1]; + String[] ipAndPortArr = ipAndPort.split(":"); + ipList.add(ipAndPortArr[0] + ":8080"); + } catch (Exception ex) { + log.error("[ManagerHandler]agentAddrList parse agent's ip and port error; " + ex.getMessage()); + } + }); + result.put("targets", ipList); + return Collections.singletonList(result); + } + + /** + * 手动直接修改单台发压机hosts文件 + */ + @RequestMapping(path = "/manual/edit/hosts",timeout = 10000) + public HttpResult manualEditHosts(HostForAgentReq req) throws Exception { + return managerService.manualEditHosts(req); + } + + /** + * 修改发压机hosts文件 + */ + @RequestMapping(path = "/edit/hosts",timeout = 10000) + public HttpResult editHosts(DomainApplyReq domainApplyReq) throws Exception { + return managerService.editHosts(domainApplyReq); + } + + /** + * 同步发压机hosts域名绑定 + */ + @RequestMapping(path = "/sync/hosts",timeout = 10000) + public HttpResult syncHosts(SyncHostsReq syncHostsReq) throws Exception { + return managerService.syncHosts(syncHostsReq); + } + + /** + * 删除发压机hosts文件某项域名绑定 + */ + @RequestMapping(path = "/del/hosts",timeout = 10000) + public HttpResult delHosts(DelHostForAgentsReq req) throws Exception { + return managerService.delHosts(req); + } + + /** + * 删除发压机hosts文件某项域名绑定 + */ + @RequestMapping(path = "/load/hosts",timeout = 10000) + public HttpResult loadHosts(LoadHostsFileReq req) throws Exception { + return managerService.loadHostsFile(req); + } + + /** + * 基于场景创建执行任务 + */ + @RequestMapping(path = "/submit/task",timeout = 10000) + public HttpResult submitTask(Task task) throws Exception { + return managerService.submitTask(task); + } + + /** + * 手动停止某次压测任务 + * + */ + @RequestMapping(path = "/cancel/task") + public HttpResult cancelTask(Task task) { + task.setCancelType(CancelType.Manual.code); + return managerService.cancelTask(task); + } + + /** + * 调整指定场景某次压测任务的qps + * + */ + @RequestMapping(path = "/task/manualUpdateQps") + public HttpResult manualUpdateQps(ChangeQpsReq req) { + return managerService.manualUpdateQps(req); + } + + @RequestMapping(path = "/view") + public String view() { + try { + return new String(Files.readAllBytes(Paths.get("/Users/dongzhenxing/Documents/Mi/Projects/mibench-engine/mibench-agent-manager/src/main/resources/upload.html"))); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/ManagerService.java b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/ManagerService.java new file mode 100644 index 000000000..078233a7c --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/ManagerService.java @@ -0,0 +1,1770 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.agent.manager; + +import com.google.common.collect.Lists; +import com.google.gson.Gson; +import com.google.gson.JsonSyntaxException; +import com.google.gson.reflect.TypeToken; +import com.xiaomi.data.push.context.AgentContext; +import com.xiaomi.data.push.rpc.RpcServer; +import com.xiaomi.data.push.rpc.netty.AgentChannel; +import com.xiaomi.data.push.rpc.protocol.RemotingCommand; +import com.xiaomi.data.push.schedule.task.graph.GraphTaskContext; +import com.xiaomi.data.push.schedule.task.graph.TaskEdgeData; +import com.xiaomi.data.push.schedule.task.graph.TaskVertexData; +import common.Const; +import common.Util; +import org.apache.dubbo.annotation.DubboReference; +import org.nutz.trans.Trans; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.BeanUtils; +import com.xiaomi.youpin.docean.anno.Service; +import org.nutz.dao.impl.NutDao; +import run.mone.mimeter.agent.manager.bo.MibenchTask; +import run.mone.mimeter.dashboard.bo.agent.*; +import run.mone.mimeter.dashboard.bo.common.Constants; +import run.mone.mimeter.dashboard.bo.dataset.DatasetLineNum; +import run.mone.mimeter.dashboard.bo.scene.*; +import run.mone.mimeter.dashboard.bo.sceneapi.ApiTrafficInfo; +import run.mone.mimeter.dashboard.bo.sceneapi.ApiX5Info; +import run.mone.mimeter.dashboard.bo.sceneapi.FormParamValue; +import run.mone.mimeter.dashboard.bo.task.BenchIncreaseModeEnum; +import run.mone.mimeter.dashboard.bo.task.BenchModeEnum; +import run.mone.mimeter.dashboard.service.DatasetInfoSercice; +import run.mone.mimeter.dashboard.service.SceneInfoService; +import run.mone.mimeter.engine.agent.bo.MibenchCmd; +import run.mone.mimeter.engine.agent.bo.data.*; +import run.mone.mimeter.engine.agent.bo.task.*; + +import javax.annotation.Resource; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import static common.Const.*; +import static run.mone.mimeter.dashboard.bo.common.Constants.CONTENT_TYPE_APP_FORM2; + +/** + * @author goodjava@qq.com + * @author dongzhenxing + * @date 2022/5/19 + */ +@Service +public class ManagerService { + + @Resource(name = "rpcServer") + private RpcServer rpcServer; + + @Resource(name = "$daoName:mibench_st_db", description = "mysql") + private NutDao dao; + + @Resource + private SlaService slaService; + + private final ExecutorService pool = Executors.newVirtualThreadPerTaskExecutor(); + + private static final Logger log = LoggerFactory.getLogger(ManagerService.class); + + private static final int DEFAULT_SCENE_MAX_QPS = 500; + + private static final Gson gson = Util.getGson(); + + private static final Pattern EL_PATTERN_MUTI = Pattern.compile("\\$\\{([^}]*)\\}"); + + private final Random random = new Random(System.currentTimeMillis()); + + private final ConcurrentHashMap rateUpWorkingTaskCache = new ConcurrentHashMap<>(); + + @DubboReference(check = false, group = "${mimeter.dashboard.dubbo.group}", version = "${mimeter.dashboard.dubbo.version}", interfaceClass = SceneInfoService.class, timeout = 3000) + private SceneInfoService sceneInfoService; + + @DubboReference(check = false, group = "${mimeter.dashboard.dubbo.group}", version = "${mimeter.dashboard.dubbo.version}", interfaceClass = DatasetInfoSercice.class, timeout = 10000) + private DatasetInfoSercice datasetInfoSercice; + + public List agents() { + return new ArrayList<>(AgentContext.ins().map.values()); + } + + public HttpResult submitTask(Task task) throws Exception { + int num = AgentContext.ins().list().size(); + if (num <= 0) { + return HttpResult.fail(500, "agent num <= 0", "暂无可用的发压机"); + } + List agentList = new ArrayList<>(AgentContext.ins().map.values()); + //构建插入任务 + MibenchTask mibenchTask = buildMibenchTask(task); + + //本场景同一次任务标记 + if (task.getReportId() == null) { + task.setReportId(""); + } + //默认不开启录制流量使用 + task.setEnableTraffic(false); + mibenchTask.setReportId(task.getReportId()); + + switch (task.getSubmitTaskType()) { + case Const.SINGLE_API_DEBUG -> { + return singleApiDebug(task, mibenchTask, agentList); + } + case Const.SCENE_DEBUG -> { + return sceneDebug(task, mibenchTask, agentList); + } + case Const.SINGLE_BENCH -> { + return sceneBench(task, mibenchTask, agentList); + } + default -> { + return HttpResult.fail(500, "error param task type", "错误的任务类型"); + } + } + } + + /** + * 单接口调试 + */ + private HttpResult singleApiDebug(Task task, MibenchTask mibenchTask, List agentList) throws Exception { + //单接口调试 + task.setDebug(true); + + DebugSceneApiInfoReq apiInfo = task.getApiInfo(); + if (apiInfo.getApiType() == Const.API_TYPE_HTTP) { + //处理http调试参数 + try { + httpDebug(apiInfo, task, mibenchTask); + } catch (Exception e) { + return HttpResult.fail(500, "fail", "invalid http param"); + } + } else if (apiInfo.getApiType() == Const.API_TYPE_DUBBO) { + //处理dubbo调试参数 + try { + dubboDebug(apiInfo, task, mibenchTask); + } catch (Exception e) { + log.error("singleApiDebug dubbo error:{}",e); + return HttpResult.fail(500, "fail", "invalid dubbo param"); + } + } + int index = random.nextInt(agentList.size()); + AgentChannel c = agentList.get(index); + agentList.clear(); + agentList.add(c); + + //记录单接口测试任务 + mibenchTask.setAgentNum(agentList.size()); + mibenchTask.setQps(1); + SubmitTaskRes res = null; + try { + Trans.begin(); + dao.insert(mibenchTask); + task.setTime(1); + task.setQps(1); + task.setId(mibenchTask.getId()); + task.setAgentNum(agentList.size()); + + AgentReq agentReq = new AgentReq(); + agentReq.setCmd(AgentReq.SUBMIT_TASK_CMD); + agentReq.setTask(task); + + //发送单接口测试任务 + List agentIps = new ArrayList<>(agentList.stream().map(AgentChannel::getRemoteAddr).toList()); + TaskResult tr = syncCallAgent(agentList.get(0), agentReq); + res = new SubmitTaskRes(task.getReportId(), tr, new HashMap<>(), agentIps); + Trans.commit(); + } catch (Exception e) { + Trans.rollback(); + log.error("single debug error,e:{}", e.getMessage()); + } finally { + Trans.close(); + } + return HttpResult.success(gson.toJson(res)); + } + + + /** + * 场景调试 + */ + private HttpResult sceneDebug(Task task, MibenchTask mibenchTask, List agentList) throws Exception { + //场景调试及场景压测,都需要先基于场景数据构建任务图 + //场景数据 + SceneDTO sceneInfo = sceneInfoService.getSceneByID(task.getSceneId()).getData(); + if (sceneInfo == null) { + log.error("can not get scene info,scene id:{}", task.getSceneId()); + return HttpResult.fail(500, "faild", "can not get scene info"); + } + List agentDTOList = sceneInfo.getAgentDTOList(); + if (agentDTOList == null) { + agentDTOList = new ArrayList<>(); + } + //过滤不可用机器 + agentDTOList = agentDTOList.stream().filter(AgentDTO::getEnable).collect(Collectors.toList()); + + //绑定的机器ip + List bindIps = agentDTOList.stream().filter(AgentDTO::getEnable).map(AgentDTO::getIp).toList(); + + if (bindIps.size() == 0) { + return HttpResult.fail(500, "agent num <= 0", "暂无可用的发压机"); + } + //过滤未启用链路 + filterLink(sceneInfo); + + //链路id与生成的dag 任务id映射 + Map linkTaskIdMap = new HashMap<>(sceneInfo.getSerialLinkDTOs().size()); + + //场景调试 + task.setDebug(true); + task.setType(TaskType.dag); + //施压时间 + task.setTime(sceneInfo.getBenchTime()); + //场景任务整体超时时间 + task.setTimeout(sceneInfo.getRequestTimeout()); + task.setQps(1); + + //自定义成功状态码 + task.setSuccessCode(sceneInfo.getSuccessCode()); + task.setConnectTaskNum(sceneInfo.getSerialLinkDTOs().size()); + List tmpAgentList; + + //有绑定机器 + tmpAgentList = agentList.stream().filter(channel -> { + //过滤在绑定机器内的ip + return bindIps.contains(channel.getRemoteAddr().substring(0, channel.getRemoteAddr().indexOf(":"))); + }).toList(); + + if (tmpAgentList.size() == 0) { + return HttpResult.fail(500, "agent num <= 0", "failed"); + } + int index = random.nextInt(tmpAgentList.size()); + + AgentChannel c = tmpAgentList.get(index); + agentList.clear(); + agentList.add(c); + + //图任务 + mibenchTask.setTaskType(TaskType.dag.code); + mibenchTask.setAgentNum(agentList.size()); + mibenchTask.setQps(1); + mibenchTask.setTime(sceneInfo.getBenchTime()); + mibenchTask.setConnectTaskNum(sceneInfo.getSerialLinkDTOs().size()); + try { + //记录场景调试任务 + Trans.begin(); + //build && 发送场景调试请求 + buildAgentReqs(sceneInfo, task, agentList.size(), mibenchTask, linkTaskIdMap).forEach(agentReq -> { + try { + callTaskAgents(agentList, agentReq); + } catch (Exception e) { + log.error("call agent error:{}", e.getMessage()); + } + }); + Trans.commit(); + } catch (Exception e) { + Trans.rollback(); + log.error("scene debug error,e:{}", e.getMessage()); + } finally { + Trans.close(); + } + List agentIps = new ArrayList<>(agentList.stream().map(AgentChannel::getRemoteAddr).toList()); + return HttpResult.success(gson.toJson(new SubmitTaskRes(task.getReportId(), new TaskResult(), new HashMap<>(), agentIps))); + } + + /** + * 场景压测 + */ + private HttpResult sceneBench(Task task, MibenchTask mibenchTask, List agentList) throws Exception { + //场景调试及场景压测,都需要先基于场景数据构建任务图 + //场景数据 + task.setType(TaskType.dag); + SceneDTO sceneInfo = sceneInfoService.getSceneByID(task.getSceneId()).getData(); + if (sceneInfo == null) { + log.error("can not get scene info,scene id:{}", task.getSceneId()); + return HttpResult.fail(500, "faild", "can not get scene info"); + } + if (sceneInfo.getSceneType() == SCENE_TYPE_HTTP) { + task.setSceneType(TaskType.http); + } else if (sceneInfo.getSceneType() == SCENE_TYPE_DUBBO) { + task.setSceneType(TaskType.dubbo); + } + //过滤链路 + filterLink(sceneInfo); + + //链路id与生成的dag 任务id映射 + Map linkTaskIdMap = new HashMap<>(sceneInfo.getSerialLinkDTOs().size()); + + task.setSceneId(sceneInfo.getId()); + List agentDTOList = sceneInfo.getAgentDTOList(); + if (agentDTOList == null) { + agentDTOList = new ArrayList<>(); + } + //过滤不可用机器 + agentDTOList = agentDTOList.stream().filter(AgentDTO::getEnable).collect(Collectors.toList()); + + //绑定的机器ip + List bindIps = agentDTOList.stream().filter(AgentDTO::getEnable).map(AgentDTO::getIp).toList(); + + if (bindIps.size() == 0) { + return HttpResult.fail(500, "agent num <= 0", "暂无可用的发压机"); + } + + List tmpAgentList; + + //有绑定机器 + tmpAgentList = agentList.stream().filter(channel -> { + //过滤在绑定机器内的ip + return bindIps.contains(channel.getRemoteAddr().substring(0, channel.getRemoteAddr().indexOf(":"))); + }).toList(); + + if (tmpAgentList.size() == 0) { + return HttpResult.fail(500, "agent num <= 0", "请绑定至少一台压测机"); + } + + if (sceneInfo.getMaxBenchQps() < 50) { + int index = random.nextInt(tmpAgentList.size()); + + AgentChannel c = tmpAgentList.get(index); + agentList.clear(); + agentList.add(c); + } else { + agentList = tmpAgentList; + } + int benchAgentNum = agentList.size(); + //校验本场景所使用的数据源行数是否大于压测机数量 + AtomicBoolean ok = new AtomicBoolean(true); + List datasetLineNums = datasetInfoSercice.getLineNumBySceneId(task.getSceneId()).getData(); + datasetLineNums.forEach(datasetLineNum -> { + if (datasetLineNum.getFileRaw() < benchAgentNum){ + ok.set(false); + } + }); + if (!ok.get()){ + return HttpResult.fail(500, "dataset line num < agent num", "数据源文件行数必须大于等于所使用的发压机数量"); + } + + //为图任务 + mibenchTask.setTaskType(TaskType.dag.code); + mibenchTask.setAgentNum(agentList.size()); + mibenchTask.setConnectTaskNum(sceneInfo.getSerialLinkDTOs().size()); + + //总qps,即 + int sceneMaxQps; + if (sceneInfo.getMaxBenchQps() == null) { + sceneMaxQps = DEFAULT_SCENE_MAX_QPS; + } else { + sceneMaxQps = sceneInfo.getMaxBenchQps(); + } + mibenchTask.setQps(sceneMaxQps); + + task.setTime(sceneInfo.getBenchTime()); + //场景任务整体超时时间 + task.setTimeout(sceneInfo.getRequestTimeout()); + task.setLogRate(sceneInfo.getLogRate()); + task.setConnectTaskNum(sceneInfo.getSerialLinkDTOs().size()); + task.setAgentNum(agentList.size()); + //自定义成功状态码 + task.setSuccessCode(sceneInfo.getSuccessCode()); + + try { + //记录场景压测任务 + Trans.begin(); + //构建任务图请求 + List reqList = buildAgentReqs(sceneInfo, task, agentList.size(), mibenchTask, linkTaskIdMap); + + //分发链路任务 + List finalTmpAgentList = agentList; + log.info("use agent num:{},agent list:{}", finalTmpAgentList.size(), finalTmpAgentList); + reqList.forEach(agentReq -> callTaskAgents(finalTmpAgentList, agentReq)); + Trans.commit(); + + //更新场景状态为运行中 + sceneInfoService.updateSceneStatus(task.getSceneId(), TaskStatus.Running.code); + + //开启SLA实时通知 + try { + slaService.processSlaNotifyTask(sceneInfo, task.getReportId()); + } catch (Exception e) { + log.warn("slaService start failed,cause by:{}", e.getMessage()); + } + } catch (Exception e) { + Trans.rollback(); + log.error("scene bench error,e:{}", e.getMessage()); + } finally { + Trans.close(); + } + List agentIps = new ArrayList<>(agentList.stream().map(AgentChannel::getRemoteAddr).toList()); + return HttpResult.success(gson.toJson(new SubmitTaskRes(task.getReportId(), new TaskResult(), linkTaskIdMap, agentIps))); + } + + /** + * 取消任务 + */ + public HttpResult cancelTask(Task task) { + AgentReq ar = new AgentReq(); + ar.setCmd(AgentReq.CANCEL_TASK_CMD); + ar.setTask(task); + RemotingCommand req = RemotingCommand.createGsonRequestCommand(MibenchCmd.TASK, ar); + if (AgentContext.ins().list().size() != 0) { + AgentContext.ins().list().forEach(c -> rpcServer.tell(c.getChannel(), req)); + } else { + //没有agent机器,直接更新场景及任务状态 + directStopTask(task.getIds()); + } + return HttpResult.success("ok"); + } + + private void directStopTask(List taskIds) { + taskIds.forEach(taskId -> { + MibenchTask task = dao.fetch(MibenchTask.class, taskId); + if (task != null) { + task.setState(TaskStatus.Stopped.code); + task.setUtime(System.currentTimeMillis()); + dao.update(task); + } + }); + } + + /** + * 图压测任务开始执行后的回调通知 + * 百分比递增模式下,周期性执行rps递增 + */ + public void taskRunningNotify(MibenchTask dagTask) { + if (rateUpWorkingTaskCache.containsKey(dagTask.getId())) { + return; + } + //同一个链路任务只接收一次通知,仅用一个协程进行调度 + rateUpWorkingTaskCache.put(dagTask.getId(), true); + + log.info("manualUpdateQps in bench mode:{},increase mode :{},dagTask increasePercent:{}", dagTask.getBenchMode(), dagTask.getIncreaseMode(), dagTask.getIncreasePercent()); + if (dagTask.getBenchMode() == BenchModeEnum.RPS.code && dagTask.getIncreaseMode() == BenchIncreaseModeEnum.PERCENT_INCREASE.code) { + //百分比递增默认比例 + List increasePercentList = Lists.newArrayList(5, 10, 20, 25, 50); + // RPS 百分比递增模式 + pool.submit(() -> { + long start = System.currentTimeMillis(); + int benchTime = dagTask.getTime(); + int percentNum = dagTask.getIncreasePercent(); + if (benchTime >= 60 && increasePercentList.contains(percentNum)) { + int curRps = dagTask.getOriginQps(); + double percent = percentNum / 100d; + //调度周期 ms + long schedule = (long) (benchTime * percent * 1000); + //最大、最小RPS差值 + int distance = dagTask.getMaxQps() - curRps; + //差值100以内不处理 + if (distance >= 100) { + //步长 + int step = (int) Math.ceil(distance * percent); + log.info("manualUpdateQps step:{},schedule:{}", step, schedule); + try { + //起始rps需要先跑一个周期 + Thread.sleep(schedule); + } catch (InterruptedException e) { + log.error("taskRunningNotify thread sleep failed,cause by:{}", e.getMessage()); + } + while (System.currentTimeMillis() - start < benchTime * 1000L) { + //在压测时间内 + curRps += step; + if (curRps > dagTask.getMaxQps()) { + curRps = dagTask.getMaxQps(); + } + if (curRps <= dagTask.getMaxQps()) { + DagTaskRps dagTaskRps = new DagTaskRps(dagTask.getReportId(), dagTask.getSerialLinkId(), dagTask.getId(), curRps); + List dagTaskRpsList = Lists.newArrayList(dagTaskRps); + ChangeQpsReq req = new ChangeQpsReq(dagTaskRpsList); + //发送调速命令 + log.info("manualUpdateQps cur rps:{}", curRps); + this.manualUpdateQps(req); + try { + Thread.sleep(schedule); + } catch (InterruptedException e) { + log.error("taskRunningNotify thread sleep failed,cause by:{}", e.getMessage()); + } + if (curRps == dagTask.getMaxQps()) { + break; + } + } else { + break; + } + } + //最多维护到压测时间截止 + rateUpWorkingTaskCache.remove(dagTask.getId()); + } + } + }); + } + } + + public HttpResult manualUpdateQps(ChangeQpsReq qpsReq) { + AgentReq ar = new AgentReq(); + ar.setCmd(AgentReq.CHANGE_TASK_QPS); + ar.setChangeQpsReq(qpsReq); + RemotingCommand req = RemotingCommand.createGsonRequestCommand(MibenchCmd.TASK, ar); + AgentContext.ins().list().forEach(c -> rpcServer.tell(c.getChannel(), req)); + return HttpResult.success("ok"); + } + + private void httpDebug(DebugSceneApiInfoReq apiInfo, Task task, MibenchTask mibenchTask) throws Exception { + //http单接口测试任务 + HttpData httpData = new HttpData(); + httpData.setUrl(apiInfo.getApiUrl()); + + httpData.setTspAuthInfoDTO(apiInfo.getApiTspAuth()); + + if (apiInfo.getOutputParamInfosStr() != null) { + List outputParams = new ArrayList<>(); + List outputParamList = gson.fromJson(apiInfo.getOutputParamInfosStr(), new TypeToken>() { + }.getType()); + // key 表达式,需要取上游接口的出参定义合成 + outputParamList.forEach(oParam -> outputParams.add(new OutputParam(oParam.getOrigin(), oParam.getParamName(), oParam.getParseExpr()))); + + httpData.setOutputParams(new CopyOnWriteArrayList<>(outputParams)); + } + if (apiInfo.getCheckPointInfoListStr() != null) { + List checkPointInfos = gson.fromJson(apiInfo.getCheckPointInfoListStr(), new TypeToken>() { + }.getType()); + httpData.setCheckPointInfoList(new CopyOnWriteArrayList<>(checkPointInfos)); + } + List types = new ArrayList<>(); + ConcurrentHashMap headerMap; + //请求头 + try { + headerMap = gson.fromJson(apiInfo.getApiHeader(), new TypeToken>() { + }.getType()); + + if (headerMap == null) { + headerMap = new ConcurrentHashMap<>(); + } + headerMap.put("User-Agent", Const.MIMETER_UA_KEY); + if (apiInfo.getRequestMethod() == Const.HTTP_REQ_GET || apiInfo.getContentType().equals(Constants.CONTENT_TYPE_APP_FORM) || apiInfo.getContentType().equals(CONTENT_TYPE_APP_FORM2)) { + List paramValues; + //get + if (apiInfo.getRequestMethod() == Const.HTTP_REQ_GET) { + httpData.setMethod(Const.HTTP_GET); + } else { + if (apiInfo.getContentType().equals(CONTENT_TYPE_APP_FORM2)) { + headerMap.put("Content-type", CONTENT_TYPE_APP_FORM); + } else { + headerMap.put("Content-type", apiInfo.getContentType()); + } + httpData.setMethod(Const.HTTP_POST); + } + //表单/get 类型参数 + //例:[{"paramKey": "v1", "paramValue": "v2"}] + CopyOnWriteArrayList tmpValues = new CopyOnWriteArrayList<>(); + if (null != apiInfo.getRequestBody()) { + paramValues = gson.fromJson(apiInfo.getRequestBody(), new TypeToken>() { + }.getType()); + paramValues.forEach(paramValue -> { + ParamType paramType = new ParamType(ParamTypeEnum.primary, paramValue.getParamKey()); + types.add(paramType); + tmpValues.add(paramValue.getParamValue()); + }); + } + httpData.initTypeList(types); + //["a","b"...] + httpData.getParams().addAll(new CopyOnWriteArrayList(tmpValues)); + } else { + headerMap.put("Content-type", apiInfo.getContentType()); + httpData.setMethod(Const.HTTP_POST); + List objectList; + // 处理参数 + if (null != apiInfo.getRequestBody()) { + objectList = gson.fromJson(apiInfo.getRequestBody(), new TypeToken>() { + }.getType()); + if (objectList.size() == 0) { + httpData.setPostParamJson(""); + return; + } + if (isStringType(objectList.get(0).getClass())) { + //字符串 + httpData.getJsonParam().set(objectList.get(0).toString()); + httpData.setPostParamJson(objectList.get(0).toString()); + } else { + String jsonParam = gson.toJson(objectList.get(0)); + httpData.getJsonParam().set(jsonParam); + httpData.setPostParamJson(jsonParam); + } + } + } + } catch (JsonSyntaxException e) { + log.error("parse http param error,url:" + apiInfo.getApiUrl() + ",error:{}", e); + throw new Exception(e); + } + httpData.setHeaders(headerMap); + httpData.setContentType(apiInfo.getContentType()); + httpData.setTimeout(apiInfo.getRequestTimeout()); + + task.setHttpData(httpData); + task.setType(TaskType.http); + + //http任务 + mibenchTask.setTaskType(TaskType.http.code); + } + + private void dubboDebug(DebugSceneApiInfoReq apiInfo, Task task, MibenchTask mibenchTask) { + //dubbo单接口测试任务 + DubboData dubboData = new DubboData(); + dubboData.setServiceName(apiInfo.getServiceName()); + dubboData.setMethodName(apiInfo.getMethodName()); + dubboData.setGroup(apiInfo.getDubboGroup()); + dubboData.setVersion(apiInfo.getDubboVersion()); + dubboData.setMavenVersion(apiInfo.getDubboMavenVersion()); + + if (apiInfo.getOutputParamInfosStr() != null) { + + List outputParams = new ArrayList<>(); + List outputParamList = gson.fromJson(apiInfo.getOutputParamInfosStr(), new TypeToken>() { + }.getType()); + // key 表达式,需要取上游接口的出参定义合成 + outputParamList.forEach(oParam -> outputParams.add(new OutputParam(oParam.getOrigin(), oParam.getParamName(), oParam.getParseExpr()))); + + dubboData.setOutputParams(new CopyOnWriteArrayList<>(outputParams)); + } + if (apiInfo.getAttachments() != null && !apiInfo.getAttachments().isEmpty()) { + List attachmentList = gson.fromJson(apiInfo.getAttachments(), new TypeToken>() { + }.getType()); + ConcurrentHashMap attachmentMap = new ConcurrentHashMap<>(attachmentList.size()); + + //可以覆盖 + attachmentList.forEach(headerInfo -> attachmentMap.put(headerInfo.getParamKey(), headerInfo.getParamValue())); + //mimeter标记 + attachmentMap.put("User-Agent", Const.MIMETER_UA_KEY); + dubboData.setAttachments(attachmentMap); + } + //检查点 + if (apiInfo.getCheckPointInfoListStr() != null) { + List checkPointInfos = gson.fromJson(apiInfo.getCheckPointInfoListStr(), new TypeToken>() { + }.getType()); + dubboData.setCheckPointInfoList(new CopyOnWriteArrayList<>(checkPointInfos)); + } + //参数类型列表 + List paramTypeList = gson.fromJson(apiInfo.getParamTypeList(), new TypeToken>() { + }.getType()); + dubboData.setRequestParamTypeList(paramTypeList); + dubboData.setRequestBody(apiInfo.getDubboParamJson()); + dubboData.setRequestTimeout(apiInfo.getRequestTimeout()); + task.setDubboData(dubboData); + task.setType(TaskType.dubbo); + + //dubbo任务 + mibenchTask.setTaskType(TaskType.dubbo.code); + } + + private List buildAgentReqs(SceneDTO sceneInfo, Task task, int agentNum, MibenchTask dagTask, Map linkTaskIdMap) { + List reqList = new ArrayList<>(); + if (sceneInfo.getSceneType() == SCENE_TYPE_HTTP) { + + //对链路中接口排序 + for (SerialLinkDTO serialLink : sceneInfo.getSerialLinkDTOs()) { + serialLink.setHttpApiInfoDTOList(serialLink.getHttpApiInfoDTOList().stream().sorted().collect(Collectors.toList())); + } + //构建 http接口 任务图 + if (sceneInfo.getSerialLinkDTOs().size() == 1) { + //构建taskContext前的初始化工作 + SerialLinkDTO serialLink = sceneInfo.getSerialLinkDTOs().get(0); + buildDagBefore(sceneInfo, serialLink, dagTask, task, agentNum, linkTaskIdMap); + //http 单链路场景 + GraphTaskContext taskContext = buildHttpDagContext(sceneInfo.getId(), serialLink, task, dagTask, sceneInfo.getApiBenchInfos(), sceneInfo.getGlobalHeaderList(), sceneInfo.getGlobalTspAuth()); + task.setDagInfo(taskContext); + + AgentReq agentReq = new AgentReq(); + agentReq.setCmd(AgentReq.SUBMIT_TASK_CMD); + agentReq.setTask(task); + reqList.add(agentReq); + } else { + //多链路并发场景 + for (SerialLinkDTO serialLink : + sceneInfo.getSerialLinkDTOs()) { + processMutiLinkTask(SCENE_TYPE_HTTP, sceneInfo, serialLink, dagTask, task, agentNum, reqList, linkTaskIdMap); + } + } + } else if (sceneInfo.getSceneType() == Const.SCENE_TYPE_DUBBO) { + //对链路中接口排序 + for (SerialLinkDTO serialLink : sceneInfo.getSerialLinkDTOs()) { + serialLink.setDubboApiInfoDTOList(serialLink.getDubboApiInfoDTOList().stream().sorted().collect(Collectors.toList())); + } + if (sceneInfo.getSerialLinkDTOs().size() == 1) { + //单链路场景 + SerialLinkDTO serialLink = sceneInfo.getSerialLinkDTOs().get(0); + buildDagBefore(sceneInfo, serialLink, dagTask, task, agentNum, linkTaskIdMap); + //构建 dubbo接口 任务图 + GraphTaskContext taskContext = buildDubboDagContext(sceneInfo.getId(), serialLink, task, dagTask, sceneInfo.getApiBenchInfos(), sceneInfo.getGlobalHeaderList()); + task.setDagInfo(taskContext); + + AgentReq agentReq = new AgentReq(); + agentReq.setCmd(AgentReq.SUBMIT_TASK_CMD); + agentReq.setTask(task); + reqList.add(agentReq); + + } else { + //多链路并发场景 + for (SerialLinkDTO serialLink : + sceneInfo.getSerialLinkDTOs()) { + processMutiLinkTask(Const.SCENE_TYPE_DUBBO, sceneInfo, serialLink, dagTask, task, agentNum, reqList, linkTaskIdMap); + } + } + } else { + log.error("un support scene type"); + } + return reqList; + } + + private void processMutiLinkTask(int sceneType, SceneDTO sceneInfo, SerialLinkDTO serialLink, MibenchTask dagTask, Task task, int agentNum, List reqList, Map linkTaskIdMap) { + //构建taskContext前的初始化工作 + buildDagBefore(sceneInfo, serialLink, dagTask, task, agentNum, linkTaskIdMap); + + //多次构建单链路任务 + AgentReq agentReq = new AgentReq(); + agentReq.setCmd(AgentReq.SUBMIT_TASK_CMD); + + Task tempTask = new Task(); + BeanUtils.copyProperties(task, tempTask); + + //该链路下的接口发压信息 + List apiBenchInfos = sceneInfo.getApiBenchInfos().stream().filter(apiBenchInfo -> apiBenchInfo.getSerialName().equals(serialLink.getSerialLinkName())).collect(Collectors.toList()); + //排序 + apiBenchInfos = apiBenchInfos.stream().sorted().collect(Collectors.toList()); + GraphTaskContext taskContext = null; + if (sceneType == SCENE_TYPE_HTTP) { + taskContext = buildHttpDagContext(sceneInfo.getId(), serialLink, task, dagTask, apiBenchInfos, sceneInfo.getGlobalHeaderList(), sceneInfo.getGlobalTspAuth()); + } else if (sceneType == Const.SCENE_TYPE_DUBBO) { + taskContext = buildDubboDagContext(sceneInfo.getId(), serialLink, task, dagTask, apiBenchInfos, sceneInfo.getGlobalHeaderList()); + } + tempTask.setDagInfo(taskContext); + + agentReq.setTask(tempTask); + reqList.add(agentReq); + } + + private void buildDagBefore(SceneDTO sceneInfo, SerialLinkDTO serialLink, MibenchTask dagTask, Task task, int agentNum, Map linkTaskIdMap) { + dagTask.setSerialLinkId(serialLink.getSerialLinkID()); + dagTask.setState(TaskStatus.Init.code); + //链路任务插库 + List apiBenchInfos = sceneInfo.getApiBenchInfos().stream().filter(apiBenchInfo -> apiBenchInfo.getSerialName().equals(serialLink.getSerialLinkName())).toList(); + //固定rps + int finalRps = 0; + int linkBenchTime = 60; + if (sceneInfo.getBenchMode() == BenchModeEnum.RPS.code) { + if (apiBenchInfos.size() != 0) { + //手动和百分比递增都以其实为基准 + if (sceneInfo.getIncrementMode() != BenchIncreaseModeEnum.STABLE.code) { + finalRps = apiBenchInfos.get(0).getOriginRps(); + } else { + finalRps = apiBenchInfos.get(0).getLinkTps(); + } + dagTask.setQps(finalRps); + if (apiBenchInfos.get(0).getLinkBenchTime() != null) { + linkBenchTime = apiBenchInfos.get(0).getLinkBenchTime(); + } + dagTask.setTime(linkBenchTime); + + dagTask.setOriginQps(apiBenchInfos.get(0).getOriginRps()); + dagTask.setMaxQps(apiBenchInfos.get(0).getMaxRps()); + } + } + + task.setQps(Util.calculateAgentRps(finalRps, agentNum)); + + //发压比例 + task.setRpsRate(sceneInfo.getRpsRate()); + //链路施压时间 + task.setTime(linkBenchTime); + //压力模式 + dagTask.setBenchMode(sceneInfo.getBenchMode()); + //rps 递增模式 + if (sceneInfo.getIncrementMode() != null) { + dagTask.setIncreaseMode(sceneInfo.getIncrementMode()); + } + //发压比例 + if (sceneInfo.getIncreasePercent() != null) { + dagTask.setIncreasePercent(sceneInfo.getIncreasePercent()); + } + dao.insert(dagTask); + task.setId(dagTask.getId()); + task.setSerialLinkID(dagTask.getSerialLinkId()); + + //记录dag 任务id与链路的映射关系 + DagTaskRps dagTaskRps = new DagTaskRps(task.getReportId(), dagTask.getSerialLinkId(), dagTask.getId(), finalRps); + task.setDagTaskRps(dagTaskRps); + linkTaskIdMap.putIfAbsent(serialLink.getSerialLinkID(), dagTaskRps); + + HeraContextInfo heraContextInfo = new HeraContextInfo(sceneInfo.getId(), serialLink.getSerialLinkID(), 0, dagTask.getReportId()); + + task.setHeraContextInfo(heraContextInfo); + //单链路,直接对接口对压测qps信息排序 + sceneInfo.setApiBenchInfos(sceneInfo.getApiBenchInfos().stream().sorted().collect(Collectors.toList())); + + task.setAgentNum(agentNum); + } + + /** + * 基于单个链路接口信息构建http任务图 + */ + public GraphTaskContext buildHttpDagContext(int sceneId, SerialLinkDTO serialLinkDTO, Task dagTask, MibenchTask mibenchTask, List apiBenchInfos, List globalHeaders, TspAuthInfo globalTspAuthInfo) { + GraphTaskContext taskContext = new GraphTaskContext<>(); + + //任务图顶点集 + List> taskList = new ArrayList<>(); + //任务图 边集 + List dependList = new ArrayList<>(); + + int benchInfoIndex = 0; + + //用来临时记录每个接口的出参定义,用于依赖连接 + Map outputParamsMap = new HashMap<>(); + + //该链路拉取流量参数的配置信息 + PullTrafficReqBase pullTrafficReqBase = new PullTrafficReqBase(); + dagTask.setTrafficToPullConfList(pullTrafficReqBase); + List apiTrafficReqList = new ArrayList<>(); + pullTrafficReqBase.setApiTrafficReqList(apiTrafficReqList); + //接口在链路中的顺序 + int index = 0; + for (HttpApiInfoDTO apiInfo : serialLinkDTO.getHttpApiInfoDTOList()) { + ApiTrafficInfo apiTrafficInfo = apiInfo.getApiTrafficInfo(); + if (apiTrafficInfo != null && apiTrafficInfo.isEnableTraffic()) { + //顺带校验该链路中是否有启用录制流量参数的api,有的话再开启开关 + dagTask.setEnableTraffic(true); + apiTrafficReqList.add(new PullApiTrafficReq(apiTrafficInfo.getRecordingConfigId(), apiTrafficInfo.getUrl(), apiTrafficInfo.getFromTime(), apiTrafficInfo.getToTime())); + } + + TaskVertexData httpCalVertex = buildVertexForTask(sceneId, serialLinkDTO, mibenchTask, dagTask, index, TaskType.http.code, benchInfoIndex, apiBenchInfos, apiInfo, null, outputParamsMap, globalHeaders, globalTspAuthInfo); + taskList.add(httpCalVertex); + index++; + benchInfoIndex++; + } + //多接口,按顺序构建顶点依赖关系 + if (serialLinkDTO.getHttpApiInfoDTOList().size() > 1) { + List vertexIdList = taskList.stream().map(TaskVertexData::getIndex).toList(); + for (int i = 0; i < vertexIdList.size() - 1; i++) { + //连结当前顶点与下一个顶点 + TaskEdgeData edge = new TaskEdgeData(vertexIdList.get(i), vertexIdList.get(i + 1)); + dependList.add(edge); + } + } + //连接具有结果依赖的结点 + for (TaskVertexData taskVertexData : taskList) { + HttpData httpData = taskVertexData.getData().getTask().getHttpData(); + if (httpData.getMethod().equals("get")) { + //处理get请求的 http任务,更新keys表达式列表及连接依赖的边 + parseHttpGetTaskDep(taskVertexData, httpData.getUrl(), outputParamsMap, taskList, dependList); + } else { + //处理post请求的 http任务 + parseHttpPostTaskDep(taskVertexData, outputParamsMap, taskList, dependList); + } + } + + //解析结点条件过滤关系 + for (TaskVertexData taskVertexData : taskList) { + parseTaskFilterConditionDep(taskVertexData, taskVertexData.getData().getTask().getHttpData().getFilterCondition(), outputParamsMap, taskList, dependList, TaskType.http.code); + } + taskContext.setTaskList(taskList); + //任务是有依赖关系的 + taskContext.setDependList(dependList); + return taskContext; + } + + /** + * 构建dubbo任务图 + * + * @return + */ + public GraphTaskContext buildDubboDagContext(int sceneId, SerialLinkDTO serialLinkDTO, Task dagTask, MibenchTask mibenchTask, List apiBenchInfos, List globalAttachments) { + GraphTaskContext taskContext = new GraphTaskContext<>(); + + //任务图顶点集 + List> taskList = new ArrayList<>(); + //任务图 边集 + List dependList = new ArrayList<>(); + + int benchInfoIndex = 0; + + //用来临时记录每个接口的出参定义,用于依赖连接 + Map outputParamsMap = new HashMap<>(); + int index = 0; + for (DubboApiInfoDTO apiInfo : serialLinkDTO.getDubboApiInfoDTOList()) { + TaskVertexData dubboCalVertex = buildVertexForTask(sceneId, serialLinkDTO, mibenchTask, + dagTask, index, TaskType.dubbo.code, benchInfoIndex, apiBenchInfos, null, apiInfo, outputParamsMap, globalAttachments, null); + taskList.add(dubboCalVertex); + index++; + benchInfoIndex++; + } + + //多接口,按顺序构建顶点依赖关系 + if (serialLinkDTO.getDubboApiInfoDTOList().size() > 1) { + List vertexIdList = taskList.stream().map(TaskVertexData::getIndex).toList(); + for (int i = 0; i < vertexIdList.size() - 1; i++) { + //连结当前顶点与下一个顶点 + TaskEdgeData edge = new TaskEdgeData(vertexIdList.get(i), vertexIdList.get(i + 1)); + dependList.add(edge); + } + } + + //连接具有结果依赖的结点 + for (TaskVertexData taskVertexData : taskList) { + parseDubboTaskDep(taskVertexData, outputParamsMap, taskList, dependList); + } + + //连接具有结果条件依赖的结点 + for (TaskVertexData taskVertexData : taskList) { + parseTaskFilterConditionDep(taskVertexData, taskVertexData.getData().getTask().getDubboData().getFilterCondition(), outputParamsMap, taskList, dependList, TaskType.dubbo.code); + } + taskContext.setTaskList(taskList); + //任务是有依赖关系的 + taskContext.setDependList(dependList); + return taskContext; + } + + private TaskVertexData buildVertexForTask(int sceneId, SerialLinkDTO serialLinkDTO, MibenchTask mibenchTask, + Task dagTask, int apiIndex, int taskType, int benchInfoIndex, + List apiBenchInfos, HttpApiInfoDTO httpApiInfo, DubboApiInfoDTO dubboApiInfo, Map outputParamsMap, + List globalAttachments, TspAuthInfo globalTspAuthInfo) { + MibenchTask apiTask = buildMibenchTask(dagTask); + apiTask.setParentTaskId(mibenchTask.getId()); + if (taskType == TaskType.http.code) { + apiTask.setSceneApiId(httpApiInfo.getApiID()); + } else if (taskType == TaskType.dubbo.code) { + apiTask.setSceneApiId(dubboApiInfo.getApiID()); + } + apiTask.setTaskType(taskType); + apiTask.setAgentNum(mibenchTask.getAgentNum()); + //每个接口需要使用各自的qps + ApiBenchInfo apiBenchInfo = apiBenchInfos.get(benchInfoIndex); + int agentNum = mibenchTask.getAgentNum(); + int apiOneAgentOriTps = apiBenchInfo.getOriginRps() / agentNum; + int apiOneAgentMaxTps = apiBenchInfo.getMaxRps() / agentNum; + + apiTask.setQps(mibenchTask.getQps()); + //起始qps + apiTask.setOriginQps(apiOneAgentOriTps); + //最大qps + apiTask.setMaxQps(apiOneAgentMaxTps); + apiTask.setReportId(mibenchTask.getReportId()); + apiTask.setState(TaskStatus.Init.code); + //每个接口独立任务插库 + dao.insert(apiTask); + + //用于hera传参的信息,任务id使用dagTask的 + HeraContextInfo heraContextInfo; + TaskVertexData calVertex = new TaskVertexData<>(); + //分类型创建任务顶点 + if (taskType == TaskType.http.code) { + heraContextInfo = new HeraContextInfo(sceneId, serialLinkDTO.getSerialLinkID(), httpApiInfo.getApiID(), mibenchTask.getReportId()); + calVertex = createHttpCalVertex(heraContextInfo, apiIndex, apiTask.getId(), httpApiInfo, globalAttachments, globalTspAuthInfo, apiOneAgentOriTps, dagTask, outputParamsMap); + } else if (taskType == TaskType.dubbo.code) { + heraContextInfo = new HeraContextInfo(sceneId, serialLinkDTO.getSerialLinkID(), dubboApiInfo.getApiID(), mibenchTask.getReportId()); + calVertex = createDubboCalVertex(heraContextInfo, apiIndex, apiTask.getId(), dubboApiInfo, globalAttachments, apiOneAgentOriTps, dagTask, outputParamsMap); + } + return calVertex; + } + + /** + * 解析构建具有条件依赖的顶点关系 + */ + private void parseTaskFilterConditionDep(TaskVertexData currentNode, + CopyOnWriteArrayList filterConditions, + Map outputParamsMap, + List> taskList, + List dependList, int taskType) { + if (filterConditions != null && filterConditions.size() != 0) { + List keys = new ArrayList<>(); + + for (CheckPointInfo filterCondition : filterConditions) { + //条件 key 在出参中,即具有依赖关系 + String paramValue = filterCondition.getCheckObj(); + if (outputParamsMap.containsKey(paramValue)) { + int parentTaskVertexId = outputParamsMap.get(paramValue); + + OutputParam outputParam; + Optional> optional = taskList.stream().filter(vertexData -> vertexData.getIndex() == parentTaskVertexId).findFirst(); + + TaskVertexData parentVertexData = optional.get(); + if (taskType == TaskType.http.code) { + outputParam = parentVertexData.getData().getTask().getHttpData().getOutputParams().stream().filter(tmpOutputParam -> tmpOutputParam.getParamName().equals(paramValue)).findFirst().get(); + } else if (taskType == TaskType.dubbo.code) { + outputParam = parentVertexData.getData().getTask().getDubboData().getOutputParams().stream().filter(tmpOutputParam -> tmpOutputParam.getParamName().equals(paramValue)).findFirst().get(); + } else { + return; + } + ExprKey key = new ExprKey(parentTaskVertexId, outputParam.getOrigin(), outputParam.getParamName(), outputParam.getParseExpr(), new ArrayList<>()); + keys.add(key); + //当前顶点依赖该上游顶点 + TaskEdgeData edge = new TaskEdgeData(parentTaskVertexId, currentNode.getIndex()); + if (!dependList.contains(edge)) { + dependList.add(edge); + } + } + } + keys.forEach(key -> currentNode.getData().getExprMap().put(key, "")); + } + } + + /** + * 解析构建 dubbo 请求类型的顶点的依赖关系 + */ + private void parseDubboTaskDep(TaskVertexData currentNode, Map outputParamsMap, List> taskList, List dependList) { + List keys = new ArrayList<>(); + + DubboData dubboData = currentNode.getData().getTask().getDubboData(); + + // json串 + String jsonBody = dubboData.getRequestBody(); + + Matcher m = EL_PATTERN_MUTI.matcher(jsonBody); + + while (m.find()) { + String paramValue = m.group(1); + //该 ${} 参数为上游链路参数,更新结点 key表达式列表 + if (outputParamsMap.containsKey(paramValue)) { + int parentTaskVertexId = outputParamsMap.get(paramValue); + Optional> optional = taskList.stream().filter(vertexData -> vertexData.getIndex() == parentTaskVertexId).findFirst(); + if (optional.isPresent()) { + TaskVertexData parentVertexData = optional.get(); + + OutputParam outputParam = parentVertexData.getData().getTask().getDubboData().getOutputParams().stream() + .filter(tmpOutputParam -> tmpOutputParam.getParamName().equals(paramValue)).findFirst().get(); + + List putValueExpr = new ArrayList<>(); + //用于指定更新http的数据 + putValueExpr.add("dubboData"); + //入参的位置index + putValueExpr.add(String.valueOf(0)); + // 要替换的参数名,大json直接用 例:${name} 内容替代 + putValueExpr.add(m.group(0)); + + ExprKey key = new ExprKey(parentTaskVertexId, outputParam.getOrigin(), outputParam.getParamName(), outputParam.getParseExpr(), putValueExpr); + keys.add(key); + //当前顶点依赖该上游顶点 + TaskEdgeData edge = new TaskEdgeData(parentTaskVertexId, currentNode.getIndex()); + if (!dependList.contains(edge)) { + dependList.add(edge); + } + } + keys.forEach(key -> currentNode.getData().getExprMap().put(key, "")); + } + } + } + + /** + * 解析构建http post请求类型的顶点的依赖关系 + */ + private void parseHttpPostTaskDep(TaskVertexData currentNode, Map outputParamsMap, List> taskList, List dependList) { + //post 参数 + //例:http://www.baidu.com" + + List keys = new ArrayList<>(); + + HttpData httpData = currentNode.getData().getTask().getHttpData(); + + List postParam = httpData.getParams(); + if (httpData.getContentType().equals(Constants.CONTENT_TYPE_APP_FORM) || httpData.getContentType().equals(CONTENT_TYPE_APP_FORM2)) { + //表单 + for (int index = 0; index < postParam.size(); index++) { + if (postParam.get(index).toString().startsWith("${")) { + String paramValue = Util.getElKey(postParam.get(index).toString()).getKey(); + //该 ${} 参数为上游链路参数,更新结点 key表达式列表 + if (outputParamsMap.containsKey(paramValue)) { + int parentTaskVertexId = outputParamsMap.get(paramValue); + Optional> optional = taskList.stream().filter(vertexData -> vertexData.getIndex() == parentTaskVertexId).findFirst(); + if (optional.isPresent()) { + TaskVertexData parentVertexData = optional.get(); + + OutputParam outputParam = parentVertexData.getData().getTask().getHttpData().getOutputParams().stream().filter(tmpOutputParam -> tmpOutputParam.getParamName().equals(paramValue)).findFirst().get(); + + List putValueExpr = new ArrayList<>(); + //用于指定更新http的数据 + putValueExpr.add("httpData"); + //入参的位置index + putValueExpr.add(String.valueOf(index)); + //要替换的参数名 + putValueExpr.add(httpData.getTypes().get(index).getName()); + + ExprKey key = new ExprKey(parentTaskVertexId, outputParam.getOrigin(), outputParam.getParamName(), outputParam.getParseExpr(), putValueExpr); + keys.add(key); + //当前顶点依赖该上游顶点 + TaskEdgeData edge = new TaskEdgeData(parentTaskVertexId, currentNode.getIndex()); + if (!dependList.contains(edge)) { + dependList.add(edge); + } + } + keys.forEach(key -> currentNode.getData().getExprMap().put(key, "")); + } + } + } + } else if (httpData.getContentType().equals(Constants.CONTENT_TYPE_APP_JSON)) { + // json串 + String jsonBody = httpData.getJsonParam().get(); + Matcher m = EL_PATTERN_MUTI.matcher(jsonBody); + + while (m.find()) { + String paramValue = m.group(1); + //该 ${} 参数为上游链路参数,更新结点 key表达式列表 + if (outputParamsMap.containsKey(paramValue)) { + int parentTaskVertexId = outputParamsMap.get(paramValue); + Optional> optional = taskList.stream().filter(vertexData -> vertexData.getIndex() == parentTaskVertexId).findFirst(); + if (optional.isPresent()) { + TaskVertexData parentVertexData = optional.get(); + + OutputParam outputParam = parentVertexData.getData().getTask().getHttpData().getOutputParams().stream().filter(tmpOutputParam -> tmpOutputParam.getParamName().equals(paramValue)).findFirst().get(); + + List putValueExpr = new ArrayList<>(); + //用于指定更新http的数据 + putValueExpr.add("httpData"); + //入参的位置index + putValueExpr.add(String.valueOf(0)); + // 要替换的参数名,大json直接用 例:${name} 内容替代 + putValueExpr.add(m.group(0)); + + ExprKey key = new ExprKey(parentTaskVertexId, outputParam.getOrigin(), outputParam.getParamName(), outputParam.getParseExpr(), putValueExpr); + keys.add(key); + //当前顶点依赖该上游顶点 + TaskEdgeData edge = new TaskEdgeData(parentTaskVertexId, currentNode.getIndex()); + if (!dependList.contains(edge)) { + dependList.add(edge); + } + } + keys.forEach(key -> currentNode.getData().getExprMap().put(key, "")); + } + } + } + } + + private void parseHttpGetTaskDep(TaskVertexData currentNode, String url, Map outputParamsMap, List> taskList, List dependList) { + if (url.contains("?")) { + //带参数 + //例:http://www.baidu.com?name=${name}&age=${rAge}&k=v" + //paramStr: name=${name}&age=${rAge}&k=v + String paramStr = url.split("\\?", 2)[1]; + String[] paramPairStrs = paramStr.split("&"); + + List keys = new ArrayList<>(); + + for (int index = 0; index < paramPairStrs.length; index++) { + String[] kV = paramPairStrs[index].split("=", 2); + if (kV[1].startsWith("${")) { + String paramValue = Util.getElKey(kV[1]).getKey(); + //该 ${} 参数为上游链路参数,更新结点 key表达式列表 + if (outputParamsMap.containsKey(paramValue)) { + int parentTaskVertexId = outputParamsMap.get(paramValue); + Optional> optional = taskList.stream().filter(vertexData -> vertexData.getIndex() == parentTaskVertexId).findFirst(); + if (optional.isPresent()) { + TaskVertexData parentVertexData = optional.get(); + + OutputParam outputParam = parentVertexData.getData().getTask().getHttpData().getOutputParams().stream().filter(tmpOutputParam -> tmpOutputParam.getParamName().equals(paramValue)).findFirst().get(); + + List putValueExpr = new ArrayList<>(); + //用于指定更新http的数据 + putValueExpr.add("httpData"); + //入参的位置index + putValueExpr.add(String.valueOf(index)); + //参数名 + putValueExpr.add(kV[0]); + + ExprKey key = new ExprKey(parentTaskVertexId, outputParam.getOrigin(), outputParam.getParamName(), outputParam.getParseExpr(), putValueExpr); + keys.add(key); + //当前顶点依赖该上游顶点 + TaskEdgeData edge = new TaskEdgeData(parentTaskVertexId, currentNode.getIndex()); + if (!dependList.contains(edge)) { + dependList.add(edge); + } + } + keys.forEach(key -> currentNode.getData().getExprMap().put(key, "")); + } + } + } + currentNode.getData().getTask().getHttpData().setUrl(url.split("\\?")[0]); + } + } + + /** + * 构建 http 任务顶点 + */ + private TaskVertexData createHttpCalVertex(HeraContextInfo heraContextInfo, int apiIndex, int taskId, HttpApiInfoDTO apiInfo, List globalHeaders, TspAuthInfo globalTspAuthInfo, int oriTps, Task dagTask, Map outputParamsMap) { + //任务顶点 + TaskVertexData data = new TaskVertexData<>(); + //结点信息 + NodeInfo nodeInfo = new NodeInfo(); + //任务id + nodeInfo.setId(taskId); + //该结点返回结果名,非必须 + nodeInfo.setResultName("result"); + + //发送给agent的 http 任务体 + Task task = new Task(); + task.setHeraContextInfo(heraContextInfo); + + task.setId(taskId); + task.setDebug(dagTask.isDebug()); + task.setType(TaskType.http); + task.setTimeout(apiInfo.getRequestTimeout()); + task.setQps(oriTps); + + task.setSuccessCode(dagTask.getSuccessCode()); + + HttpData httpData = new HttpData(); + //启用流量数据 + ApiTrafficInfo apiTrafficInfo = apiInfo.getApiTrafficInfo(); + if (apiTrafficInfo != null && apiTrafficInfo.isEnableTraffic()) { + httpData.setEnableTraffic(true); + httpData.setTrafficConfId(apiTrafficInfo.getRecordingConfigId()); + } + //启用x5 + ApiX5Info apiX5Info = apiInfo.getApiX5Info(); + if (apiX5Info != null && apiX5Info.isEnableX5()) { + ApiX5InfoDTO x5InfoDTO = new ApiX5InfoDTO(); + BeanUtils.copyProperties(apiX5Info, x5InfoDTO); + httpData.setApiX5InfoDTO(x5InfoDTO); + } + + httpData.setUrl(apiInfo.getApiUrl()); + httpData.setTimeout(apiInfo.getRequestTimeout()); + + //检查点 + if (apiInfo.getCheckPointInfoList() != null) { + List checkPointInfoList = new ArrayList<>(); + apiInfo.getCheckPointInfoList().forEach(checkPointInfoDTO -> { + CheckPointInfo checkPointInfo = new CheckPointInfo(); + BeanUtils.copyProperties(checkPointInfoDTO, checkPointInfo); + checkPointInfoList.add(checkPointInfo); + }); + httpData.setCheckPointInfoList(new CopyOnWriteArrayList<>(checkPointInfoList)); + } + + //过滤条件 + if (apiInfo.getFilterCondition() != null) { + List filterConditionList = new ArrayList<>(); + apiInfo.getFilterCondition().forEach(filterCondition -> { + CheckPointInfo checkPointInfo = new CheckPointInfo(); + BeanUtils.copyProperties(filterCondition, checkPointInfo); + filterConditionList.add(checkPointInfo); + }); + httpData.setFilterCondition(new CopyOnWriteArrayList<>(filterConditionList)); + } + + String headerStr = apiInfo.getHeaderInfo(); + List headerInfoList = gson.fromJson(headerStr, new TypeToken>() { + }.getType()); + ConcurrentHashMap headerMap = new ConcurrentHashMap<>(headerInfoList.size()); + + //全局请求头 + if (globalHeaders != null && globalHeaders.size() != 0) { + globalHeaders.forEach(globalHeader -> headerMap.putIfAbsent(globalHeader.getHeaderName(), globalHeader.getHeaderValue())); + } + //可以覆盖 + headerInfoList.forEach(headerInfo -> headerMap.put(headerInfo.getHeaderName(), headerInfo.getHeaderValue())); + //mimeter标记 + headerMap.put("User-Agent", Const.MIMETER_UA_KEY); + if (apiInfo.getApiRequestType() == Const.HTTP_REQ_GET) { + httpData.setMethod("get"); + } else { + httpData.setMethod("post"); + if (apiInfo.getContentType().equals(CONTENT_TYPE_APP_FORM2)) { + headerMap.put("Content-type", CONTENT_TYPE_APP_FORM); + httpData.setContentType(CONTENT_TYPE_APP_FORM); + } else { + httpData.setContentType(apiInfo.getContentType()); + headerMap.putIfAbsent("Content-Type", apiInfo.getContentType()); + } + } + httpData.setHeaders(headerMap); + + TspAuthInfoDTO tspAuthInfoDTO = new TspAuthInfoDTO(false, "", ""); + //全局 tsp auth + if (globalTspAuthInfo != null && globalTspAuthInfo.isEnableAuth()) { + //全局启用 + tspAuthInfoDTO.setEnableAuth(true); + tspAuthInfoDTO.setAccessKey(globalTspAuthInfo.getAccessKey()); + tspAuthInfoDTO.setSecretKey(globalTspAuthInfo.getSecretKey()); + } + //接口层 tsp auth + TspAuthInfo apiTspAuth = apiInfo.getApiTspAuth(); + if (apiTspAuth != null && apiTspAuth.isEnableAuth() && !apiTspAuth.getAccessKey().isEmpty() && !apiTspAuth.getSecretKey().isEmpty()) { + //接口层级开启,并有自身配置数据 + tspAuthInfoDTO.setEnableAuth(true); + tspAuthInfoDTO.setAccessKey(apiTspAuth.getAccessKey()); + tspAuthInfoDTO.setSecretKey(apiTspAuth.getSecretKey()); + } else if (apiTspAuth != null && !apiTspAuth.isEnableAuth()) { + tspAuthInfoDTO.setEnableAuth(false); + } + //最终 tsp auth info + httpData.setTspAuthInfoDTO(tspAuthInfoDTO); + + List types = new ArrayList<>(); + List paramValues; + try { + if (apiInfo.getApiRequestType() == Const.HTTP_REQ_GET || (apiInfo.getContentType() != null && (apiInfo.getContentType().equals(Constants.CONTENT_TYPE_APP_FORM) || apiInfo.getContentType().equals(CONTENT_TYPE_APP_FORM2)))) { + //表单类型参数 + //例:[{"paramKey": "v1", "paramValue": "v2"}] + List tmpValues = new ArrayList<>(); + if (null != apiInfo.getRequestInfo()) { + paramValues = gson.fromJson(apiInfo.getRequestInfo(), new TypeToken>() { + }.getType()); + paramValues.forEach(paramValue -> { + ParamType paramType = new ParamType(ParamTypeEnum.primary, paramValue.getParamKey()); + types.add(paramType); + tmpValues.add(paramValue.getParamValue()); + }); + } + httpData.initTypeList(types); + + //["a","b"...] + httpData.getParams().addAll(new CopyOnWriteArrayList<>(tmpValues)); + + } else if (apiInfo.getContentType().equals(Constants.CONTENT_TYPE_APP_JSON)) { + //对象参数 例:"[{\"name\": \"dzx\", \"age\": 19},{\"sex\": \"man\"}]" + + List objectList; + + + if (null != apiInfo.getRequestInfoRaw()) { + objectList = gson.fromJson(apiInfo.getRequestInfoRaw(), new TypeToken>() { + }.getType()); + if (objectList.size() == 0) { + httpData.setOriginJsonParam(""); + httpData.getJsonParam().set(""); + httpData.setPostParamJson(""); + } + String val; + if (isStringType(objectList.get(0).getClass())) { + //字符串 + val = objectList.get(0).toString(); + httpData.setOriginJsonParam(val); + httpData.getJsonParam().set(val); + httpData.setPostParamJson(val); + } else { + val = gson.toJson(objectList.get(0)); + httpData.setOriginJsonParam(val); + httpData.getJsonParam().set(val); + } + } + } + } catch (JsonSyntaxException e) { + log.error("error param type,api id:{},param:{},{}", apiInfo.getApiID(), apiInfo.getRequestInfo(), apiInfo.getRequestInfoRaw()); + throw new RuntimeException(e); + } + + List outputParams = new ArrayList<>(); + + // key 表达式,需要取上游接口的出参定义合成 + apiInfo.getOutputParamInfos().forEach(oParam -> { + outputParamsMap.putIfAbsent(oParam.getParamName(), apiIndex); + outputParams.add(new OutputParam(oParam.getOrigin(), oParam.getParamName(), oParam.getParseExpr())); + }); + + httpData.setOutputParams(new CopyOnWriteArrayList<>(outputParams)); + + task.setHttpData(httpData); + nodeInfo.setTask(task); + + data.setData(nodeInfo); + data.setIndex(apiIndex); + return data; + } + + /** + * 构建dubbo任务顶点 + * + * @return + */ + private TaskVertexData createDubboCalVertex(HeraContextInfo heraContextInfo, int apiIndex, int taskId, DubboApiInfoDTO apiInfo, List globalHeaders, int qps, Task dagTask, Map outputParamsMap) { + //任务顶点 + TaskVertexData data = new TaskVertexData<>(); + //结点信息 + NodeInfo nodeInfo = new NodeInfo(); + //任务id + nodeInfo.setId(taskId); + //该结点返回结果名,非必须 + nodeInfo.setResultName("result"); + + //发送给agent的 dubbo 任务体 + Task task = new Task(); + task.setHeraContextInfo(heraContextInfo); + + task.setId(taskId); + task.setDebug(dagTask.isDebug()); + task.setType(TaskType.dubbo); + task.setTimeout(apiInfo.getRequestTimeout()); + task.setQps(qps); + + DubboData dubboData = new DubboData(); + dubboData.setServiceName(apiInfo.getServiceName()); + dubboData.setMethodName(apiInfo.getMethodName()); + if (apiInfo.getGroup() != null) { + dubboData.setGroup(apiInfo.getGroup()); + } + if (apiInfo.getVersion() != null) { + dubboData.setVersion(apiInfo.getVersion()); + } + if (apiInfo.getDubboMavenVersion() != null) { + dubboData.setMavenVersion(apiInfo.getDubboMavenVersion()); + } + + //检查点 + if (apiInfo.getCheckPointInfoList() != null) { + List checkPointInfoList = new ArrayList<>(); + apiInfo.getCheckPointInfoList().forEach(checkPointInfoDTO -> { + CheckPointInfo checkPointInfo = new CheckPointInfo(); + BeanUtils.copyProperties(checkPointInfoDTO, checkPointInfo); + checkPointInfoList.add(checkPointInfo); + }); + dubboData.setCheckPointInfoList(new CopyOnWriteArrayList<>(checkPointInfoList)); + } + //过滤条件 + if (apiInfo.getFilterCondition() != null) { + List filterConditionList = new ArrayList<>(); + apiInfo.getFilterCondition().forEach(filterCondition -> { + CheckPointInfo checkPointInfo = new CheckPointInfo(); + BeanUtils.copyProperties(filterCondition, checkPointInfo); + filterConditionList.add(checkPointInfo); + }); + dubboData.setFilterCondition(new CopyOnWriteArrayList<>(filterConditionList)); + } + + //注册中心环境 + dubboData.setDubboEnv(apiInfo.getDubboEnv()); + dubboData.setRequestTimeout(apiInfo.getRequestTimeout()); + + String attachmentsStr = apiInfo.getAttachments(); + ConcurrentHashMap attachmentMap = new ConcurrentHashMap<>(8); + + //全局请求头 + if (globalHeaders != null && globalHeaders.size() != 0) { + globalHeaders.forEach(globalHeader -> attachmentMap.putIfAbsent(globalHeader.getHeaderName(), globalHeader.getHeaderValue())); + } + + if (attachmentsStr != null && !attachmentsStr.isEmpty()) { + List attachmentList = gson.fromJson(attachmentsStr, new TypeToken>() { + }.getType()); + //可以覆盖 + attachmentList.forEach(headerInfo -> attachmentMap.put(headerInfo.getParamKey(), headerInfo.getParamValue())); + } + + //mimeter标记 + attachmentMap.put("User-Agent", Const.MIMETER_UA_KEY); + dubboData.setAttachments(attachmentMap); + + dubboData.setRequestParamTypeList(apiInfo.getRequestParamTypeList()); + if (apiInfo.getRequestBody() == null) { + dubboData.setRequestBody("[]"); + dubboData.setOriginJsonParam("[]"); + dubboData.getJsonParam().set("[]"); + } else { + dubboData.setRequestBody(apiInfo.getRequestBody()); + dubboData.setOriginJsonParam(apiInfo.getRequestBody()); + dubboData.getJsonParam().set(apiInfo.getRequestBody()); + } + + List outputParams = new ArrayList<>(); + + // key 表达式,需要取上游接口的出参定义合成 + apiInfo.getOutputParamInfos().forEach(oParam -> { + outputParamsMap.putIfAbsent(oParam.getParamName(), apiIndex); + outputParams.add(new OutputParam(oParam.getOrigin(), oParam.getParamName(), oParam.getParseExpr())); + }); + + dubboData.setOutputParams(new CopyOnWriteArrayList<>(outputParams)); + task.setDubboData(dubboData); + nodeInfo.setTask(task); + data.setData(nodeInfo); + data.setIndex(apiIndex); + return data; + } + + /** + * 过滤链路配置 + */ + private void filterLink(SceneDTO sceneInfo) { + //过滤未启用的链路 + sceneInfo.setSerialLinkDTOs(sceneInfo.getSerialLinkDTOs().stream().filter(SerialLinkDTO::getEnable).collect(Collectors.toList())); + List enableLinkNames = sceneInfo.getSerialLinkDTOs().stream().map(SerialLinkDTO::getSerialLinkName).toList(); + sceneInfo.setApiBenchInfos(sceneInfo.getApiBenchInfos().stream().filter(apiBenchInfo -> enableLinkNames.contains(apiBenchInfo.getSerialName())).collect(Collectors.toList())); + + //默认100%发压比例 + int rpsRate; + if (sceneInfo.getRpsRate() == null) { + rpsRate = 100; + } else { + rpsRate = sceneInfo.getRpsRate(); + } + //配比 + sceneInfo.getApiBenchInfos().forEach(apiBenchInfo -> { + apiBenchInfo.setLinkTps((int) Math.ceil(apiBenchInfo.getLinkTps() * (rpsRate / 100d))); + apiBenchInfo.setOriginRps((int) Math.ceil(apiBenchInfo.getOriginRps() * (rpsRate / 100d))); + apiBenchInfo.setMaxRps((int) Math.ceil(apiBenchInfo.getMaxRps() * (rpsRate / 100d))); + }); + } + + public static boolean isStringType(Class clazz) { + return clazz.getTypeName().startsWith("java.lang.String"); + } + + private MibenchTask buildMibenchTask(Task task) { + MibenchTask mibenchTask = new MibenchTask(); + mibenchTask.setSceneId(task.getSceneId()); + mibenchTask.setCtime(System.currentTimeMillis()); + mibenchTask.setUtime(System.currentTimeMillis()); + if (task.getTime() != 0) { + mibenchTask.setTime(task.getTime()); + } + mibenchTask.setState(TaskStatus.Init.code); + return mibenchTask; + } + + /** + * 获取某台机器host文件内容 + */ + public HttpResult loadHostsFile(LoadHostsFileReq loadHostsFileReq) { + int num = AgentContext.ins().list().size(); + if (num <= 0) { + return HttpResult.fail(500, "agent num <= 0", "暂无可用的发压机"); + } + List agentList = new ArrayList<>(AgentContext.ins().map.values()); + if (loadHostsFileReq.getAgentIp() == null) { + return HttpResult.success("ok"); + } + + AgentReq req = new AgentReq(); + req.setCmd(AgentReq.LOAD_HOST_CMD); + + int i = 0; + boolean find = false; + for (int index = 0; index < agentList.size(); index++) { + String[] ipAndPort = agentList.get(index).getRemoteAddr().split(":", 2); + if (ipAndPort[0].equals(loadHostsFileReq.getAgentIp())) { + i = index; + find = true; + break; + } + } + if (!find) { + return HttpResult.fail(500, "call agent error", "发压机不存在"); + } + HostsFileResult tr; + try { + tr = syncLoadHostsFromAgent(agentList.get(i), req); + return HttpResult.success(tr.getHostsFile()); + } catch (Exception e) { + log.error("call load host interface error"); + return HttpResult.fail(500, "call agent error", e.getMessage()); + } + } + + /** + * 手动修改单台机器host文件 + */ + public HttpResult manualEditHosts(HostForAgentReq hostForAgentReq) { + int num = AgentContext.ins().list().size(); + if (num <= 0) { + return HttpResult.fail(500, "agent num <= 0", "暂无可用的发压机"); + } + List agentList = new ArrayList<>(AgentContext.ins().map.values()); + if (hostForAgentReq.getAgentIp() == null) { + return HttpResult.success("ok"); + } + + AgentReq req = new AgentReq(); + req.setCmd(AgentReq.EDIT_HOST_CMD); + + AgentHostReq hostReq = new AgentHostReq(); + hostReq.setDomain(hostForAgentReq.getDomain()); + hostReq.setIp(hostForAgentReq.getIp()); + req.setAgentHostReqList(Collections.singletonList(hostReq)); + + int i = 0; + boolean find = false; + for (int index = 0; index < agentList.size(); index++) { + String[] ipAndPort = agentList.get(index).getRemoteAddr().split(":", 2); + if (ipAndPort[0].equals(hostForAgentReq.getAgentIp())) { + i = index; + find = true; + break; + } + } + if (!find) { + return HttpResult.fail(500, "call agent error", "发压机不存在"); + } + try { + syncCallAgent(agentList.get(i), req); + } catch (Exception e) { + log.error("call edit host interface error"); + return HttpResult.fail(500, "call agent error", e.getMessage()); + } + return HttpResult.success("ok"); + } + + /** + * 修改host文件 + */ + public HttpResult editHosts(DomainApplyReq domainApplyReq) { + int num = AgentContext.ins().list().size(); + if (num <= 0) { + return HttpResult.fail(500, "agent num <= 0", "暂无可用的发压机"); + } + List agentList = new ArrayList<>(AgentContext.ins().map.values()); + List tmpAgentList = new ArrayList<>(); + if (domainApplyReq.getAgentIPs() == null || domainApplyReq.getAgentIPs().size() == 0) { + return HttpResult.success("ok"); + } + AgentReq req = new AgentReq(); + req.setCmd(AgentReq.EDIT_HOST_CMD); + + AgentHostReq hostReq = new AgentHostReq(); + hostReq.setDomain(domainApplyReq.getDomain()); + hostReq.setIp(domainApplyReq.getIp()); + req.setAgentHostReqList(Collections.singletonList(hostReq)); + + agentList.forEach(channel -> { + String[] ipAndPort = channel.getRemoteAddr().split(":", 2); + if (domainApplyReq.getAgentIPs().contains(ipAndPort[0])) { + tmpAgentList.add(channel); + } + }); + try { + callHostsAgents(tmpAgentList, req); + } catch (Exception e) { + log.error("call edit host interface error"); + return HttpResult.fail(500, "call agent error", e.getMessage()); + } + return HttpResult.success("ok"); + } + + /** + * 同步发压机hosts配置 + */ + public HttpResult syncHosts(SyncHostsReq syncHostsReq) { + int num = AgentContext.ins().list().size(); + if (num <= 0) { + return HttpResult.fail(500, "agent num <= 0", "暂无可用的发压机"); + } + List agentList = new ArrayList<>(AgentContext.ins().map.values()); + if (syncHostsReq.getAgentHostsConfList() == null || syncHostsReq.getAgentHostsConfList().size() == 0) { + return HttpResult.success("ok"); + } + + AgentReq req = new AgentReq(); + req.setCmd(AgentReq.EDIT_HOST_CMD); + + syncHostsReq.getAgentHostsConfList().forEach(agentHostsConf -> { + List hostReqList = new ArrayList<>(); + + agentHostsConf.getDomainConfs().forEach(hostConf -> { + AgentHostReq hostReq = new AgentHostReq(); + hostReq.setDomain(hostConf.getDomain()); + hostReq.setIp(hostConf.getIp()); + hostReqList.add(hostReq); + }); + req.setAgentHostReqList(hostReqList); + + int i = 0; + boolean find = false; + for (int index = 0; index < agentList.size(); index++) { + String[] ipAndPort = agentList.get(index).getRemoteAddr().split(":", 2); + if (ipAndPort[0].equals(agentHostsConf.getAgentIp())) { + i = index; + find = true; + break; + } + } + if (find) { + try { + syncCallAgent(agentList.get(i), req); + } catch (Exception e) { + log.error("call edit host interface error"); + } + } + }); + return HttpResult.success("ok"); + } + + /** + * 删除某项域名绑定配置 + */ + public HttpResult delHosts(DelHostForAgentsReq req) { + int num = AgentContext.ins().list().size(); + if (num <= 0) { + return HttpResult.fail(500, "agent num <= 0", "暂无可用的发压机"); + } + List agentList = new ArrayList<>(AgentContext.ins().map.values()); + List tmpGgentList = new ArrayList<>(); + if (req.getAgentIps() == null || req.getAgentIps().size() == 0) { + return HttpResult.success("ok"); + } + AgentReq agentReq = new AgentReq(); + agentReq.setCmd(AgentReq.DEL_HOST_CMD); + + List hostReqList = new ArrayList<>(); + AgentHostReq hostReq = new AgentHostReq(); + hostReq.setDomain(req.getDomain()); + hostReqList.add(hostReq); + agentReq.setAgentHostReqList(hostReqList); + + agentList.forEach(channel -> { + String[] ipAndPort = channel.getRemoteAddr().split(":", 2); + if (req.getAgentIps().contains(ipAndPort[0])) { + tmpGgentList.add(channel); + } + }); + try { + callHostsAgents(tmpGgentList, agentReq); + } catch (Exception e) { + log.error("call edit host interface error"); + return HttpResult.fail(500, "call agent error", e.getMessage()); + } + return HttpResult.success("ok"); + + } + + private void callTaskAgents(List agentList, AgentReq agentReq) { + for (int agentIndex = 0; agentIndex < agentList.size(); agentIndex++) { + //该机器在所使用发压机集群中的序号索引 + agentReq.getTask().setAgentIndex(agentIndex); + agentReq.setAddr(agentList.get(agentIndex).getRemoteAddr()); + RemotingCommand req = RemotingCommand.createGsonRequestCommand(MibenchCmd.TASK, agentReq, gson); + rpcServer.tell(agentList.get(agentIndex).getChannel(), req); + } + } + + /** + * 修改host文件 + */ + private void callHostsAgents(List agentList, AgentReq agentReq) { + agentList.forEach(ch -> { + agentReq.setAddr(ch.getRemoteAddr()); + RemotingCommand req = RemotingCommand.createGsonRequestCommand(MibenchCmd.TASK, agentReq, gson); + rpcServer.tell(ch.getChannel(), req); + }); + } + + private TaskResult syncCallAgent(AgentChannel channel, AgentReq agentReq) { + agentReq.setAddr(channel.getRemoteAddr()); + RemotingCommand req = RemotingCommand.createGsonRequestCommand(MibenchCmd.TASK, agentReq, gson); + RemotingCommand response = rpcServer.sendMessage(channel, req, 10000); + return gson.fromJson(new String(response.getBody()), TaskResult.class); + } + + private HostsFileResult syncLoadHostsFromAgent(AgentChannel channel, AgentReq agentReq) { + agentReq.setAddr(channel.getRemoteAddr()); + RemotingCommand req = RemotingCommand.createGsonRequestCommand(MibenchCmd.TASK, agentReq, gson); + RemotingCommand response = rpcServer.sendMessage(channel, req, 10000); + return gson.fromJson(new String(response.getBody()), HostsFileResult.class); + } + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/SlaService.java b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/SlaService.java new file mode 100644 index 000000000..ea9eb8e75 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/SlaService.java @@ -0,0 +1,486 @@ +package run.mone.mimeter.agent.manager; + +import com.xiaomi.faas.func.api.PrometheusService; +import com.xiaomi.faas.func.domain.MimeterApiRes; +import com.xiaomi.mone.monitor.service.MiFeiShuService; +import com.xiaomi.mone.monitor.service.SendSmsService; +import com.xiaomi.youpin.docean.anno.Service; +import com.xiaomi.youpin.infra.rpc.Result; +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.annotation.DubboReference; +import org.nutz.dao.Cnd; +import org.nutz.dao.impl.NutDao; +import run.mone.mimeter.agent.manager.bo.MibenchTask; +import run.mone.mimeter.agent.manager.bo.SlaContext; +import run.mone.mimeter.dashboard.bo.common.EmitterTypeEnum; +import run.mone.mimeter.dashboard.bo.scene.SceneDTO; +import run.mone.mimeter.dashboard.bo.sla.*; +import run.mone.mimeter.dashboard.service.BenchBroadcastService; +import run.mone.mimeter.dashboard.service.MonitorInfoService; +import run.mone.mimeter.engine.agent.bo.stat.SysMonitorType; +import run.mone.mimeter.engine.agent.bo.task.CancelType; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskType; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +import static common.Const.*; + +@Service +@Slf4j +public class SlaService { + + private final ExecutorService executorService = Executors.newVirtualThreadPerTaskExecutor(); + + /** + * 当前sla任务集 + */ + private final ConcurrentHashMap slaContextMap = new ConcurrentHashMap<>(); + + @Resource + private ManagerService managerService; + + @DubboReference(check = false, group = "${mimeter.monitor.dubbo.group}", interfaceClass = MiFeiShuService.class, timeout = 3000) + private MiFeiShuService miFeiShuService; + + @DubboReference(check = false, group = "${mimeter.monitor.dubbo.group}", interfaceClass = SendSmsService.class, timeout = 3000) + private SendSmsService sendSmsService; + @DubboReference(check = false, interfaceClass = BenchBroadcastService.class, group = "${mimeter.dashboard.dubbo.group}", version = "${mimeter.dashboard.dubbo.version}", timeout = 20000) + private BenchBroadcastService benchBroadcastService; + + /** + * 监控打点数据服务 + */ + @DubboReference(check = false, interfaceClass = PrometheusService.class,timeout = 5000) + private PrometheusService prometheusService; + + /** + * 获取trace应用列表服务 + */ + @DubboReference(check = false, group = "${mimeter.dashboard.dubbo.group}", version = "${mimeter.dashboard.dubbo.version}", interfaceClass = MonitorInfoService.class, timeout = 3000) + private MonitorInfoService monitorInfoService; + + @Resource(name = "$daoName:mibench_st_db", description = "mysql") + private NutDao dao; + + /** + * 周期检查时间 10s + * 即每 10s 核验一次 SLA + */ + private static final int SCHEDULE = 10; + + public void processSlaNotifyTask(SceneDTO sceneDTO, String reportId) { + SlaContext slaContext = new SlaContext(reportId, sceneDTO.getId(), false, false); + slaContextMap.put(reportId, slaContext); + executorService.submit(() -> { + try { + processSlaNotify(sceneDTO, slaContext); + } catch (InterruptedException e) { + log.error("processSlaNotify error,reportID:{},error:{}", reportId, e.getMessage()); + } + }); + } + + /** + * 校验规则,推送报警通知 + * + * @param sceneDTO + */ + private void processSlaNotify(SceneDTO sceneDTO, SlaContext slaContext) throws InterruptedException { + + if (sceneDTO.getSlaDto() == null) { + return; + } + if (sceneDTO.getSceneType() == SCENE_TYPE_HTTP) { + slaContext.setSceneType(TaskType.http.name()); + } else if (sceneDTO.getSceneType() == SCENE_TYPE_DUBBO) { + slaContext.setSceneType(TaskType.dubbo.name()); + } + long begin = System.currentTimeMillis(); + SlaDto slaDto = sceneDTO.getSlaDto(); + List alarmDtos = slaDto.getAlarmDtos(); + while (((System.currentTimeMillis() - begin) / 1000) <= (sceneDTO.getBenchTime() + SCHEDULE)) { + //校验、通知逻辑 + List rules = slaDto.getSlaRuleDtos(); + + rules.forEach(slaRule -> { + SlaEvent slaEvent = new SlaEvent(); + overRule(slaRule, slaContext, slaEvent, alarmDtos); + }); + + //结束事件通知 + if (slaContext.isCancel() || slaContext.isFinish()) { + //任务被用户手动停止,退出循环,退出线程 或 任务自然结束,退出循环,退出线程 + log.info("task is cancelled: reportId:{}", slaContext.getReportId()); + clearSlaContext(slaContext.getReportId()); + break; + } + + TimeUnit.SECONDS.sleep(SCHEDULE); + } + } + + private void doAlarm(AlarmDto alarmDto, String content) { + if (alarmDto != null) { + alarmDto.getAlarmMethods().forEach(method -> { + if (method == FEI_SHU_ALARM) { + //飞书 + List users = new ArrayList<>(); + alarmDto.getUsernames().forEach(userDTO -> { + String[] tmpArr = userDTO.getEmail().split("@",2); + users.add(tmpArr[0]); + }); + miFeiShuService.batchSendMsg(users, content); + } else if (method == 1) { + //todo 短信 + sendSmsService.batchSendSms("", "", ""); + } + }); + } + } + + /** + * 是否触发规则 + */ + private void overRule(SlaRuleDto slaRule, SlaContext slaContext, SlaEvent slaEvent, List alarmDtos) { + String ruleType = slaRule.getRuleItemType(); + ConcurrentHashMap labelCount = slaContext.getLabelCount(); + if (ruleType.equals(SlaRuleItemTypeEnum.BusinessMetrics.ruleItemTypeName)) { + Result result = null; + try { + result = prometheusService.getMimeterApiInfo(String.valueOf(slaContext.getSceneId()), slaContext.getSceneType()); + } catch (Exception e) { + log.error("prometheusService call error:{}", e.getMessage()); + } + if (result == null || result.getCode() != 0 || result.getData() == null) { + return; + } + MimeterApiRes apiMonitorMap = (MimeterApiRes) result.getData(); + log.info("prometheusService call result:{}", result); + //业务指标 + switch (slaRule.getRuleItem()) { + case SuccessRate -> { + //成功率 + Map successRateMap = apiMonitorMap.getSuccessRate(); + if (successRateMap != null) { + if (checkBusApiMonitorData(successRateMap, slaRule, slaEvent)) { + //超过接口成功率规则限制 + //校验敏感度 + checkDegree(slaRule, labelCount, slaContext, slaEvent, alarmDtos, SuccessRate); + } + } + } + case P99ResponseTime -> { + //p99 rt + //成功率 + Map p99Rt = apiMonitorMap.getP99Rt(); + if (p99Rt != null) { + if (checkBusApiMonitorData(p99Rt, slaRule, slaEvent)) { + //超过接口成功率规则限制 + //校验敏感度 + checkDegree(slaRule, labelCount, slaContext, slaEvent, alarmDtos, P99ResponseTime); + } + } + } + case AvgResponseTime -> { + //平均 rt + //成功率 + Map avgRt = apiMonitorMap.getAvgRt(); + if (avgRt != null) { + if (checkBusApiMonitorData(avgRt, slaRule, slaEvent)) { + //超过接口成功率规则限制 + //校验敏感度 + checkDegree(slaRule, labelCount, slaContext, slaEvent, alarmDtos, AvgResponseTime); + } + } + } + case RequestPerSecond -> { + //平均 qps + //成功率 + Map tps = apiMonitorMap.getTps(); + if (tps != null) { + if (checkBusApiMonitorData(tps, slaRule, slaEvent)) { + //超过接口成功率规则限制 + //校验敏感度 + checkDegree(slaRule, labelCount, slaContext, slaEvent, alarmDtos, RequestPerSecond); + } + } + } + } + } else if (ruleType.equals(SlaRuleItemTypeEnum.MonitorMetrics.ruleItemTypeName)) { + List appList = null; + try { + appList = monitorInfoService.getAppListByReportID(slaContext.getSceneId(), slaContext.getReportId()); + } catch (Exception e) { + log.error("monitorInfoService call error:{}", e.getMessage()); + } + if (appList == null || appList.size() == 0) { + //还未串联到应用 + return; + } + //监控指标 + switch (slaRule.getRuleItem()) { + case CpuUtilization -> { + //cpu指标 + if (checkSysMonitor(appList, slaRule, SysMonitorType.Cpu_Usage.name, slaEvent)) { + //超过cpu规则限制值 + checkDegree(slaRule, labelCount, slaContext, slaEvent, alarmDtos, CpuUtilization); + } + } + case MemoryUtilization -> { + //内存指标 + if (checkSysMonitor(appList, slaRule, SysMonitorType.Mem_Used.name, slaEvent)) { + //超过 mem 规则限制值 + checkDegree(slaRule, labelCount, slaContext, slaEvent, alarmDtos, MemoryUtilization); + } + } + case Load5Average -> { + //load5平均值指标 + if (checkSysMonitor(appList, slaRule, SysMonitorType.Load_Avg.name, slaEvent)) { + //超过平均load规则限制 + checkDegree(slaRule, labelCount, slaContext, slaEvent, alarmDtos, Load5Average); + } + } + case Load5Max -> { + //load5最大值指标 + if (checkSysMonitor(appList, slaRule, SysMonitorType.Load_Max.name, slaEvent)) { + //超过load5最大值指标 + checkDegree(slaRule, labelCount, slaContext, slaEvent, alarmDtos, Load5Max); + } + } + } + } + } + + /** + * 是否超过容忍度 + */ + private void checkDegree(SlaRuleDto slaRule, ConcurrentHashMap labelCount, SlaContext slaContext, + SlaEvent slaEvent, List alarmDtos, String labelName) { + log.info("checkDegree slaRule:{}", slaEvent); + //超过规则限制值 + String key = labelName + "_" + slaRule.getAction(); + if (labelCount.containsKey(key)) { + int currCount = labelCount.get(key).addAndGet(1); + if (currCount >= slaRule.getDegree()) { + //超过容忍度,需要处理 + processOverRule(slaRule, slaContext, slaEvent, alarmDtos); + //处理通知完后清除归零 + labelCount.remove(key); + } + } else { + labelCount.put(key, new AtomicInteger(1)); + if (1 >= slaRule.getDegree()) { + //超过容忍度,需要处理 + processOverRule(slaRule, slaContext, slaEvent, alarmDtos); + //处理通知完后清除归零 + labelCount.remove(key); + } + } + } + + /** + * 基于action,决定发送的事件,以及是否停止压测 + */ + private void processOverRule(SlaRuleDto slaRule, SlaContext slaContext, SlaEvent slaEvent, List alarmDtos) { + log.info("benchBroadcastService.processOverRule alarmDtos:{}", alarmDtos); + + if (alarmDtos == null || alarmDtos.size() == 0) { + return; + } + AlarmDto warnAlarm = null; + AlarmDto errorAlarm = null; + for (AlarmDto alarm : + alarmDtos) { + if (alarm.getAlarmType().equals(ActionEnum.WARNING.name())) { + warnAlarm = alarm; + } else if (alarm.getAlarmType().equals(ActionEnum.ERROR.name())) { + errorAlarm = alarm; + } + } + switch (slaRule.getAction()) { + case "WARNING" -> { + //报警 通知 + slaEvent.setAlarmLevel(slaRule.getAction()); + slaEvent.setCondition(slaRule.getCondition()); + slaEvent.setRuleItem(slaRule.getRuleItem()); + slaEvent.setSlaRuleName(slaRule.getName()); + slaEvent.setDegree(slaRule.getDegree()); + slaEvent.setValue(Double.valueOf(slaRule.getValue())); + slaEvent.setRuleItemType(slaRule.getRuleItemType()); + + String msg = "场景id:" + slaContext.getSceneId() + "压测触发警告规则:" + slaRule.getName(); + slaEvent.setMsg(msg); + + //推送事件流 + try { + log.info("benchBroadcastService.notifyEvent slaEvent:{}", slaEvent); + benchBroadcastService.notifyEvent(EmitterTypeEnum.SLA_WARN, slaContext.getReportId(), slaEvent); + + //通知报警接收人 + doAlarm(warnAlarm, msg); + } catch (Exception e) { + log.error("notify error :{}", e.getMessage()); + } + } + case "ERROR" -> { + //错误 停止 + slaEvent.setAlarmLevel(slaRule.getAction()); + slaEvent.setCondition(slaRule.getCondition()); + slaEvent.setRuleItem(slaRule.getRuleItem()); + slaEvent.setSlaRuleName(slaRule.getName()); + slaEvent.setDegree(slaRule.getDegree()); + slaEvent.setValue(Double.valueOf(slaRule.getValue())); + slaEvent.setRuleItemType(slaRule.getRuleItemType()); + + String msg = "场景id:" + slaContext.getSceneId() + "压测触发错误规则:" + slaRule.getName() + ",即将停止压测"; + + slaEvent.setMsg(msg); + try { + //推送事件流 + benchBroadcastService.notifyEvent(EmitterTypeEnum.SLA_ERROR, slaContext.getReportId(), slaEvent); + + //通知报警接收人 + doAlarm(errorAlarm, msg); + } catch (Exception e) { + log.error("notify error :{}", e.getMessage()); + } + + //停止压测 + taskQuitBySlaRule(slaContext.getReportId(), msg); + } + } + } + + private boolean checkBusApiMonitorData(Map apiDataMap, SlaRuleDto slaRule, SlaEvent slaEvent) { + //检验成功率 + log.info("checkBusApiMonitorData apiDataMap:{}", apiDataMap); + + AtomicBoolean ok = new AtomicBoolean(false); + if (apiDataMap != null) { + for (Map.Entry entry : apiDataMap.entrySet()) { + if (checkNumValueAndRule(Double.parseDouble(entry.getValue()), slaRule)) { + log.info("checkBusApiMonitorData checkNumValueAndRule,value:{}", entry.getValue()); + //触发的接口id + slaEvent.setTriggerApiId(Integer.parseInt(entry.getKey())); + slaEvent.setTriggerItem("Api_Id:" + entry.getKey()); + //该接口的监控值 + slaEvent.setRuleTargetValue(Double.parseDouble(entry.getValue())); + ok.set(true); + break; + } + } + return ok.get(); + } + return true; + } + + private boolean checkSysMonitor(List appList, SlaRuleDto slaRule, String sysMonitorType, SlaEvent slaEvent) { + StringBuffer appNameStr = new StringBuffer(); + appList.forEach(appName -> appNameStr.append(",").append(appName)); + Result result = prometheusService.getAppSystemInfo(appNameStr.toString(), sysMonitorType); + if (result.getCode() != 0 || result.getData() == null) { + return false; + } + Map resultMap = (Map) result.getData(); + AtomicBoolean match = new AtomicBoolean(false); + for (Map.Entry entry : + resultMap.entrySet()) { + if (checkNumValueAndRule((Double.parseDouble(entry.getValue())), slaRule)) { + match.set(true); + //触发的接口id + slaEvent.setTriggerItem("App_Name:" + entry.getKey()); + //该接口的监控值 + slaEvent.setRuleTargetValue(Double.parseDouble(entry.getValue())); + break; + } + } + return match.get(); + } + + private boolean checkNumValueAndRule(double value, SlaRuleDto slaRule) { + log.info("checkBusApiMonitorData checkNumValueAndRule,slaRule:{}", slaRule); + switch (slaRule.getCondition()) { + case ">" -> { + if (value > slaRule.getValue()) { + return true; + } + } + case "≥" -> { + if (value >= slaRule.getValue()) { + return true; + } + } + case "=" -> { + if (value == slaRule.getValue()) { + return true; + } + } + case "≤" -> { + if (value <= slaRule.getValue()) { + return true; + } + } + default -> { + return false; + } + } + return false; + } + + /** + * 压测任务手动结束需要停止sla任务,移出map + */ + public void stopSlaTaskByManual(String reportId) { + SlaContext slaContext = slaContextMap.get(reportId); + if (slaContext != null) { + slaContext.setCancel(true); + } + } + + /** + * 压测任务自然结束,需要停止sla任务,移出map + */ + public void slaTaskFinish(String reportId) { + SlaContext slaContext = slaContextMap.get(reportId); + if (slaContext != null) { + slaContext.setCancel(true); + } + } + + /** + * 基于规则停止压测任务 + */ + private void taskQuitBySlaRule(String reportId, String ruleContent) { + Task task = new Task(); + + List mibenchTasks = dao.query(MibenchTask.class, Cnd.where("report_id", "=", reportId)); + + List taskIds = mibenchTasks.stream().map(MibenchTask::getId).collect(Collectors.toList()); + task.setIds(taskIds); + task.setCancelType(CancelType.BySla.code); + task.setCancelBySlaRule(ruleContent); + managerService.cancelTask(task); + + //清除 内存中的数据 + clearSlaContext(reportId); + } + + + /** + * 压测任务自然结束、手动结束、sla触发结束,都需要停止sla任务,移出map + */ + public void clearSlaContext(String reportId) { + slaContextMap.remove(reportId); + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/bo/AgentInfo.java b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/bo/AgentInfo.java new file mode 100644 index 000000000..0590f494a --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/bo/AgentInfo.java @@ -0,0 +1,56 @@ +package run.mone.mimeter.agent.manager.bo; + +import lombok.Data; +import org.nutz.dao.entity.annotation.Column; +import org.nutz.dao.entity.annotation.Id; + +import java.io.Serializable; + +/** + * 入库的agent信息 + */ +@Data +public class AgentInfo implements Serializable { + + @Id + private Integer id; + + @Column(value = "server_name") + private String serverName; + @Column + private String ip; + + @Column + private String hostname; + + @Column + private int port; + + @Column + private int cpu; + + @Column + private long mem; + + @Column(value = "use_cpu") + private int useCpu; + + @Column(value = "use_mem") + private long useMem; + + @Column + private Long utime; + + @Column + private Long ctime; + + @Column(value = "client_desc") + private String clientDesc; + + @Column(value = "node_ip") + private String nodeIp; + + @Column + private boolean enable; + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/bo/MibenchTask.java b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/bo/MibenchTask.java new file mode 100644 index 000000000..922a50730 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/bo/MibenchTask.java @@ -0,0 +1,139 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.agent.manager.bo; + +import lombok.Data; +import org.nutz.dao.entity.annotation.Column; +import org.nutz.dao.entity.annotation.Id; +import org.nutz.dao.entity.annotation.Table; + +/** + * @author goodjava@qq.com + * @date 2022/5/23 + * 实际执行的压测任务 + */ +@Table("mibench_task") +@Data +public class MibenchTask { + + @Id + private int id; + + @Column(value = "scene_id") + private int sceneId; + + @Column(value = "serial_link_id") + private int serialLinkId; + @Column(value = "scene_api_id") + private int sceneApiId; + + /** + * 1 http 接口任务 + * 2 dubbo 接口任务 + * 3 dag 图任务 + */ + @Column(value = "task_type") + private int taskType; + + @Column + private int qps; + + @Column(value = "origin_qps") + private int originQps; + + @Column(value = "max_qps") + private int maxQps; + + @Column + private int time; + + @Column(value = "agent_num") + private int agentNum; + + @Column(value = "finish_agent_num") + private int finishAgentNum; + + @Column + private long ctime; + + @Column + private long utime; + + @Column + private int state; + + @Column(value = "version", version = true) + private int version; + + @Column(value = "success_num") + private long successNum; + + @Column(value = "failure_num") + private long failureNum; + + @Column(value = "parent_task_id") + private int parentTaskId; + + @Column(value = "debug_result") + private String debugResult; + + @Column(value = "debug_url") + private String debugUrl; + + @Column(value = "debug_result_header") + private String debugResultHeader; + + @Column(value = "debug_req_headers") + private String debugReqHeaders; + + @Column(value = "debug_trigger_cp") + private String debugTriggerCp; + + @Column(value = "debug_trigger_filter_condition") + private String debugTriggerFilterCondition; + + @Column(value = "report_id") + private String reportId; + + @Column(value = "request_params") + private String requestParams; + + @Column(value = "req_param_type") + private int reqParamType; + + @Column(value = "ok") + private boolean ok; + + @Column(value = "connect_task_num") + private int connectTaskNum; + + @Column(value = "debug_rt") + private int debugRt; + + @Column(value = "debug_size") + private int debugSize; + + @Column(value = "bench_mode") + private int benchMode; + + @Column(value = "increase_mode") + private int increaseMode; + + @Column(value = "increase_percent") + private int increasePercent; + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/bo/SlaContext.java b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/bo/SlaContext.java new file mode 100644 index 000000000..fd515fa8d --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/bo/SlaContext.java @@ -0,0 +1,48 @@ +package run.mone.mimeter.agent.manager.bo; + +import lombok.Data; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicInteger; + +@Data +public class SlaContext { + + /** + * 所属任务标识 + */ + private volatile String reportId; + + /** + * 场景id + */ + private volatile int sceneId; + + /** + * 场景类型 + */ + private volatile String sceneType; + + /** + * 完成 + */ + private volatile boolean finish; + + /** + * 被取消掉 + */ + private volatile boolean cancel; + + /** + * 指标名,对应次数触发规则 or + */ + private final ConcurrentHashMap labelCount = new ConcurrentHashMap<>(); + + public SlaContext(String reportId, int sceneId, boolean finish, boolean cancel) { + this.reportId = reportId; + this.sceneId = sceneId; + this.finish = finish; + this.cancel = cancel; + } + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/processor/ManagerProcessor.java b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/processor/ManagerProcessor.java new file mode 100644 index 000000000..c662dbb4c --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/processor/ManagerProcessor.java @@ -0,0 +1,284 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.agent.manager.processor; + +import com.google.gson.Gson; +import com.xiaomi.data.push.rpc.netty.NettyRequestProcessor; +import com.xiaomi.data.push.rpc.protocol.RemotingCommand; +import com.xiaomi.youpin.docean.anno.Component; +import common.Util; +import io.netty.channel.ChannelHandlerContext; +import org.apache.dubbo.annotation.DubboReference; +import org.nutz.dao.impl.NutDao; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import run.mone.mimeter.agent.manager.DataStatService; +import run.mone.mimeter.agent.manager.ManagerService; +import run.mone.mimeter.agent.manager.SlaService; +import run.mone.mimeter.agent.manager.bo.MibenchTask; +import run.mone.mimeter.dashboard.bo.common.EmitterTypeEnum; +import run.mone.mimeter.dashboard.bo.report.ReportInfoBo; +import run.mone.mimeter.dashboard.service.BenchBroadcastService; +import run.mone.mimeter.dashboard.service.SceneInfoService; +import run.mone.mimeter.engine.agent.bo.MibenchCmd; +import run.mone.mimeter.engine.agent.bo.data.AgentReq; +import run.mone.mimeter.engine.agent.bo.data.CommonReqInfo; +import run.mone.mimeter.engine.agent.bo.task.CancelType; +import run.mone.mimeter.engine.agent.bo.task.TaskResult; +import run.mone.mimeter.engine.agent.bo.task.TaskStatus; +import run.mone.mimeter.engine.agent.bo.task.TaskStatusBo; + +import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * @author goodjava@qq.com + * @author dongzhenxing + * @date 2022/5/11 + * 用来处理agent回推的结果 + */ +@Component +public class ManagerProcessor implements NettyRequestProcessor { + + private static final Logger log = LoggerFactory.getLogger(ManagerProcessor.class); + + private static final String logPrefix = "[ManagerProcessor]"; + + private final Gson gson = Util.getGson(); + + @Resource(name = "$daoName:mibench_st_db", description = "mysql") + private NutDao dao; + + @DubboReference(check = false, group = "${mimeter.dashboard.dubbo.group}", version = "${mimeter.dashboard.dubbo.version}", interfaceClass = SceneInfoService.class, timeout = 3000) + private SceneInfoService sceneInfoService; + + @DubboReference(check = false, group = "${mimeter.dashboard.dubbo.group}", version = "${mimeter.dashboard.dubbo.version}", interfaceClass = BenchBroadcastService.class, timeout = 20000) + private BenchBroadcastService benchBroadcastService; + + /** + * 数据统计服务 + */ + @Resource + private DataStatService dataStatService; + + /** + * 记录场景单次压测完成的任务数 + * <"reportId",4> + */ + private final ConcurrentHashMap reportFinishNum = new ConcurrentHashMap<>(); + + /** + * 记录每个任务执行完成的发压机数量 + * <"taskId",4> + */ + private final ConcurrentHashMap taskFinishAgentNum = new ConcurrentHashMap<>(); + + + @Resource + private SlaService slaService; + + @Resource + private ManagerService managerService; + + @Override + public RemotingCommand processRequest(ChannelHandlerContext channelHandlerContext, RemotingCommand remotingCommand) throws InterruptedException { + AgentReq req = remotingCommand.getReq(AgentReq.class); + String logMsg = logPrefix + "processRequest "; + switch (req.getCmd()) { + case AgentReq.TASK_RESULT_CMD ->//处理完成返回结果事件 + processTREvent(req, logMsg); + case AgentReq.TOTAL_DATA_COUNT_CMD ->//处理数据统计事件 + dataStatService.processTotalCountCtxEvent(req); + case AgentReq.UP_TASK_STATUS ->//处理任务状态变更事件 + processUpStatusEvent(req, logMsg); + } + return null; + } + + + private synchronized void processTREvent(AgentReq req, String logMsg) { + //处理回调过来的返回数据 + TaskResult tr = req.getTaskResult(); + try { + MibenchTask task = dao.fetch(MibenchTask.class, tr.getId()); + //场景调试的情况 + if (tr.isDebug()) { + // 更新场景接口结果数据 调用 dashboard 接口,更新scene api info debug result + if (tr.getSuccess().get() == 1) { + task.setState(TaskStatus.Success.code); + } else if (tr.getFailure().get() == 1) { + task.setState(TaskStatus.Failure.code); + } + task.setOk(tr.isOk()); + CommonReqInfo commonReqInfo = tr.getCommonReqInfo(); + if (commonReqInfo != null) { + task.setReqParamType(commonReqInfo.getParamsType()); + task.setRequestParams(commonReqInfo.getParamJson()); + if (commonReqInfo.getHeaders() != null) { + task.setDebugReqHeaders(gson.toJson(commonReqInfo.getHeaders())); + } + if (commonReqInfo.getDebugUrl() != null){ + task.setDebugUrl(commonReqInfo.getDebugUrl()); + } + } + task.setDebugResult(tr.getResult()); + if (tr.getRespHeaders() != null) { + task.setDebugResultHeader(gson.toJson(tr.getRespHeaders())); + } + if (tr.getTriggerCpInfo() != null) { + task.setDebugTriggerCp(tr.getTriggerCpInfo()); + } + if (tr.getTriggerFilterCondition() != null){ + task.setDebugTriggerFilterCondition(tr.getTriggerFilterCondition()); + } + task.setDebugRt((int) tr.getRt()); + task.setDebugSize((int) tr.getSize()); + dao.update(task); + } else { + //执行压测的情况下 + String quitMsg = ""; + int finNum = countTaskFinAgent(task.getId()); + if (checkBenchTaskFinish(finNum, task.getAgentNum())) { + //即该链路任务全部执行结束 + task.setState(TaskStatus.Success.code); + //结束链路任务状态 + dao.update(task); + //手动结束 需要通知结束报告 + if (tr.isQuitByManual()) { + //手动的需要通知sla任务停止 + if (tr.getCancelType() == CancelType.Manual.code) { + slaService.stopSlaTaskByManual(tr.getReportId()); + quitMsg = "当前压测任务已手动停止,操作人: " + tr.getOpUser() + ",停止时间: " + getDateTime(System.currentTimeMillis()); + } + if (tr.getCancelType() == CancelType.BySla.code) { + slaService.slaTaskFinish(tr.getReportId()); + quitMsg = "当前压测任务触发SLA警报已停止,触发规则: " + tr.getCancelBySlaRule() + ",停止时间: " + getDateTime(System.currentTimeMillis()); + } + } else { + //自然结束 + //更新场景状态 + sceneInfoService.updateSceneStatus(tr.getSceneId(), TaskStatus.Success.code); + + slaService.slaTaskFinish(tr.getReportId()); + quitMsg = "当前压测任务已完成,结束时间: " + getDateTime(System.currentTimeMillis()); + } + //检查整个场景全部任务是否完成 + int finishTaskNum; + if (reportFinishNum.containsKey(task.getReportId())) { + finishTaskNum = reportFinishNum.get(task.getReportId()).incrementAndGet(); + } else { + reportFinishNum.put(task.getReportId(), new AtomicInteger(1)); + finishTaskNum = reportFinishNum.get(task.getReportId()).get(); + } + if (finishTaskNum >= task.getConnectTaskNum()) { + //本次压测所有任务完成再通知dashboard + try { + this.notifyFinish(task, quitMsg); + } catch (Exception e) { + log.error(logMsg + "======FAILED TO NOTIFY FINISH!", e); + } + } + } + } + } catch (Exception ex) { + log.error(logMsg + " throws error cmd " + req.getCmd() + "; " + ex.getMessage()); + } + } + + private void processUpStatusEvent(AgentReq req, String logMsg) { + //更新状态 + try { + TaskStatusBo statusBo = req.getStatusBo(); + log.info("processUpStatusEvent task id :{}", statusBo.getTaskId()); + MibenchTask dagTask = dao.fetch(MibenchTask.class, statusBo.getTaskId()); + log.info("processUpStatusEvent dag task :{}", dagTask); + if (dagTask == null){ + Thread.sleep(500); + dagTask = dao.fetch(MibenchTask.class, statusBo.getTaskId()); + } + if (dagTask == null){ + log.error("processUpStatusEvent dag is null"); + return; + } + dagTask.setState(statusBo.getTaskStatus().code); + dagTask.setUtime(System.currentTimeMillis()); + int v = dao.update(dagTask); + if (v > 0) { + if (statusBo.getTaskStatus() == TaskStatus.Stopped) { + //已经停止,更新场景状态为 停止 + sceneInfoService.updateSceneStatus(statusBo.getSceneId(), TaskStatus.Stopped.code); + }else if (statusBo.getTaskStatus() == TaskStatus.Running){ + //任务启动 + log.info("taskRunningNotify in bench mode:{},increase mode :{},dagTask increasePercent:{}", dagTask.getBenchMode(),dagTask.getIncreaseMode(),dagTask.getIncreasePercent()); + managerService.taskRunningNotify(dagTask); + } + log.info(logMsg + "update task cmd " + req.getCmd()); + } + } catch (Exception ex) { + log.error(logMsg + " throws error cmd " + req.getCmd() + "; " + ex.getMessage()); + } + } + + /** + * 累计该任务执行完成的压测机数量 + */ + private int countTaskFinAgent(int taskId) { +// synchronized (taskFinishAgentNum) { + if (!taskFinishAgentNum.containsKey(taskId)) { + taskFinishAgentNum.put(taskId, new AtomicInteger(1)); + return 1; + } else { + return taskFinishAgentNum.get(taskId).incrementAndGet(); + } +// } + } + + private static boolean checkBenchTaskFinish(int finNum, int useAgentNum) { + return finNum >= useAgentNum; + } + + private void notifyFinish(MibenchTask task, String quitMsg) { + //扣除前期大概的初始化时间 + long now = System.currentTimeMillis() - 500; + this.benchBroadcastService.notifyEvent(EmitterTypeEnum.FINISH, task.getReportId(), ReportInfoBo.builder() + .sceneId((long) task.getSceneId()) + .reportId(task.getReportId()) + .duration((int) ((now - task.getCtime()) / 1000)) + .finishTime(now) + .extra(quitMsg) + .build()); + } + + private String getDateTime(long now) { + Date millisecondDate = new Date(now); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return formatter.format(millisecondDate); + } + + @Override + public boolean rejectRequest() { + return false; + } + + @Override + public int cmdId() { + return MibenchCmd.MANAGER; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/processor/PingProcessor.java b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/processor/PingProcessor.java new file mode 100644 index 000000000..028ac02db --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/java/run/mone/mimeter/agent/manager/processor/PingProcessor.java @@ -0,0 +1,157 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.agent.manager.processor; + +import com.google.common.collect.Lists; +import com.xiami.mione.tesla.k8s.service.K8sProxyService; +import com.xiaomi.data.push.context.AgentContext; +import com.xiaomi.data.push.rpc.common.RemotingHelper; +import com.xiaomi.data.push.rpc.netty.AgentChannel; +import com.xiaomi.data.push.rpc.netty.NettyRequestProcessor; +import com.xiaomi.data.push.rpc.protocol.RemotingCommand; +import com.xiaomi.mione.tesla.k8s.bo.PodNode; +import com.xiaomi.youpin.docean.anno.Component; +import com.xiaomi.youpin.docean.plugin.dubbo.anno.Reference; +import io.netty.channel.ChannelHandlerContext; +import org.nutz.dao.Cnd; +import org.nutz.dao.impl.NutDao; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.BeanUtils; +import org.springframework.util.StringUtils; +import run.mone.mimeter.agent.manager.bo.AgentInfo; +import run.mone.mimeter.engine.agent.bo.data.AgentInfoDTO; +import run.mone.mimeter.engine.agent.bo.data.AgentReq; +import run.mone.mimeter.engine.agent.bo.MibenchCmd; + +import javax.annotation.Resource; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.Optional; + +/** + * @author goodjava@qq.com + * @date 2022/5/11 + *

+ * 处理agent 发过来的ping信息 + */ +@Component +public class PingProcessor implements NettyRequestProcessor { + + private static final Logger log = LoggerFactory.getLogger(PingProcessor.class); + + + @Reference(interfaceClass = K8sProxyService.class, group = "${k8s.proxy.dubbo.group}", timeout = 10000, check = false) + private K8sProxyService k8sProxyService; + + @Resource(name = "$daoName:mibench_st_db", description = "mysql") + private NutDao dao; + + @Override + public RemotingCommand processRequest(ChannelHandlerContext ctx, RemotingCommand remotingCommand) throws Exception { + AgentReq req = remotingCommand.getReq(AgentReq.class); + Optional.ofNullable(req.getUser()).ifPresent(it -> { + log.info("client:{} ping", req.getUser().getName()); + final String remoteAddress = RemotingHelper.parseChannelRemoteAddr(ctx.channel()); + AgentChannel ch = AgentContext.ins().map.get(remoteAddress); + if (null == ch) { + ch = new AgentChannel(); + ch.setChannel(ctx.channel()); + AgentContext.ins().map.putIfAbsent(remoteAddress, ch); + } + // 机器信息入库 + insertAgentInfoToDB(req); + }); + + RemotingCommand res = RemotingCommand.createResponseCommand(100, "ok"); + res.setBody("ok".getBytes(StandardCharsets.UTF_8)); + return res; + } + + @Override + public boolean rejectRequest() { + return false; + } + + @Override + public int cmdId() { + return MibenchCmd.PING; + } + + /** + * agent入库 + * + * @param req + */ + private void insertAgentInfoToDB(AgentReq req) { + try { + AgentInfoDTO agentInfoDTO = req.getAgentInfoDTO(); + long now = System.currentTimeMillis(); + if (agentInfoDTO.getIp() == null || agentInfoDTO.getIp().equals("")) { + return; + } + + String nodeIp = ""; + List agents = k8sProxyService.getNodeIP(Lists.newArrayList(agentInfoDTO.getIp())).getData(); + if (agents != null && agents.size() != 0) { + log.info("[PingProcessor.insertAgentInfoToDB], getNodeIP agents: {}, podIp: {}", agents, agentInfoDTO.getIp()); + nodeIp = agents.get(0).getNodeIP(); + } else { + //如果最终获取不到nodeId + nodeIp = agentInfoDTO.getIp() + "_" + agentInfoDTO.getDesc(); + } + AgentInfo agentInfo = StringUtils.isEmpty(nodeIp) + ? null + : dao.fetch(AgentInfo.class, Cnd.where("node_ip", "=", nodeIp)); + + if (agentInfo != null) { + //更新 + agentInfo.setUseCpu(agentInfoDTO.getUseCpu()); + agentInfo.setUseMem(agentInfoDTO.getUseMem()); + agentInfo.setIp(agentInfoDTO.getIp()); + agentInfo.setEnable(true); + agentInfo.setUtime(now); + agentInfo.setClientDesc(agentInfoDTO.getDesc()); + log.info("old !!! update agent info podIp:{}, nodeIp:{}, agentInfo: {}", agentInfoDTO.getIp(), nodeIp, agentInfo); + dao.update(agentInfo); + } else { + AgentInfo ipAgentInfo = dao.fetch(AgentInfo.class, Cnd.where("ip", "=", agentInfoDTO.getIp())); + if (ipAgentInfo != null) { + ipAgentInfo.setNodeIp(nodeIp); + ipAgentInfo.setUtime(now); + ipAgentInfo.setEnable(true); + log.info("new !!! update agent info podIp:{},nodeIp:{}", agentInfoDTO.getIp(), nodeIp); + dao.update(ipAgentInfo); + } else { + agentInfo = new AgentInfo(); + BeanUtils.copyProperties(agentInfoDTO, agentInfo); + agentInfo.setCtime(now); + agentInfo.setUtime(now); + agentInfo.setEnable(true); + agentInfo.setClientDesc(agentInfoDTO.getDesc()); + agentInfo.setNodeIp(nodeIp); + log.info("new!!! insert agent info podIp:{},nodeIp:{}", agentInfoDTO.getIp(), nodeIp); + dao.insert(agentInfo); + } + } + } catch (Exception e) { + log.error("update agent info error:{}", e.getMessage()); + } + } + + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/resources/upload.html b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/resources/upload.html new file mode 100644 index 000000000..05ed87388 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-manager/src/main/resources/upload.html @@ -0,0 +1,17 @@ + + + + +

+
+ + +
+
+ +
+
+ + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/pom.xml b/ozburst-all/mimeter-engine/mimeter-agent-service/pom.xml new file mode 100644 index 000000000..588b5030c --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/pom.xml @@ -0,0 +1,156 @@ + + + + mimeter-engine + run.mone + 1.0-SNAPSHOT + + 4.0.0 + + mimeter-agent-service + + + + + + + + + + run.mone + mimeter-api + 1.0-SNAPSHOT + + + + com.xiaomi.youpin + tesla-filter-api + 1.0.1-SNAPSHOT + + + run.mone + mimeter-dashboard-api + 1.0.0-SNAPSHOT + + + com.xiaomi.youpin + youpin-infra-rpc + + + + + + javax.annotation + javax.annotation-api + 1.3.2 + provided + + + + ch.qos.logback + logback-classic + 1.1.2 + provided + + + + ch.qos.logback + logback-core + 1.1.2 + provided + + + + junit + junit + 4.12 + test + + + + run.mone + log + 1.6.1-SNAPSHOT + + + + run.mone + event + 1.4-SNAPSHOT + + + + com.xiaomi.mone + sautumn-serverless-api + 1.0.0-SNAPSHOT + provided + + + + run.mone + docean + 1.4-SNAPSHOT + + + + + run.mone + http + 1.4-SNAPSHOT + + + fastjson + com.alibaba + + + + + + + run.mone + docean-plugin-rpc + 1.4-SNAPSHOT + provided + + + + com.xiaomi.youpin + prometheus-client + 0.0.5-SNAPSHOT + + + + com.google.guava + guava + 25.1-jre + provided + + + + run.mone + antlr + 1.4-SNAPSHOT + + + + com.xiaomi.youpin + hera-trace + 1.4-SNAPSHOT + + + + com.xiaomi.youpin + tesla-traffic-recording-api + 1.0.0-SNAPSHOT + + + org.apache.dubbo + dubbo + + + + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/bo/DataMapCache.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/bo/DataMapCache.java new file mode 100644 index 000000000..f47cc97d1 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/bo/DataMapCache.java @@ -0,0 +1,18 @@ +package run.mone.mimeter.engine.bo; + +import lombok.Data; + +import java.util.List; +import java.util.TreeMap; +import java.util.concurrent.atomic.AtomicInteger; + +@Data +public class DataMapCache { + private AtomicInteger countFinLinkNum; + private TreeMap> dataMap; + + public DataMapCache(AtomicInteger countFinLinkNum, TreeMap> dataMap) { + this.countFinLinkNum = countFinLinkNum; + this.dataMap = dataMap; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/bo/TaskStatus.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/bo/TaskStatus.java new file mode 100644 index 000000000..addfec207 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/bo/TaskStatus.java @@ -0,0 +1,37 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.bo; + +/** + * + * @author zhangzhiyong + * @date 29/05/2018 + */ +public enum TaskStatus { + Init(0), + Success(1), + Failure(2), + Retry(3), + Running(4), + ; + + public int code; + + private TaskStatus(int code) { + this.code = code; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/client/base/BaseClient.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/client/base/BaseClient.java new file mode 100644 index 000000000..05c08b250 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/client/base/BaseClient.java @@ -0,0 +1,214 @@ +package run.mone.mimeter.engine.client.base; + +import com.google.common.collect.Lists; +import com.xiaomi.youpin.docean.Ioc; +import com.xiaomi.youpin.docean.anno.Component; +import com.xiaomi.youpin.docean.listener.event.EventType; +import lombok.extern.slf4j.Slf4j; +import run.mone.mimeter.engine.agent.bo.data.CommonReqInfo; +import run.mone.mimeter.engine.agent.bo.data.Result; +import run.mone.mimeter.engine.agent.bo.stat.SceneTotalCountContext; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskContext; +import run.mone.mimeter.engine.filter.common.BasePostFilter; +import run.mone.mimeter.engine.filter.common.BasePreFilter; +import run.mone.mimeter.engine.filter.common.FilterOrder; +import run.mone.mimeter.engine.filter.common.MimeterFilterInfo; +import run.mone.mimeter.engine.filter.postFilter.IPostFilterChain; +import run.mone.mimeter.engine.filter.postFilter.PostFilterAnno; +import run.mone.mimeter.engine.filter.postFilter.filters.MimeterPostFilter; +import run.mone.mimeter.engine.filter.preFilter.filters.MimeterPreFilter; +import run.mone.mimeter.engine.filter.postFilter.PostFilter; +import run.mone.mimeter.engine.filter.preFilter.IPreFilterChain; +import run.mone.mimeter.engine.filter.preFilter.PreFilter; +import run.mone.mimeter.engine.filter.preFilter.PreFilterAnno; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Collectors; + +/** + * @author dongzhenxing + */ +@Slf4j +@Component +public class BaseClient implements IClient, IPreFilterChain, IPostFilterChain { + + private final CopyOnWriteArrayList preFilterList = new CopyOnWriteArrayList<>(); + + private final CopyOnWriteArrayList postFilterList = new CopyOnWriteArrayList<>(); + + + private volatile BasePreFilter lastFilter; + + private volatile BasePostFilter firstFilter; + + /** + * 前置过滤器链是否初始化完成 + */ + private final AtomicBoolean preFilterInit = new AtomicBoolean(false); + + /** + * 后置过滤器链是否初始化完成 + */ + private final AtomicBoolean postFilterInit = new AtomicBoolean(false); + + + @Override + public Result call(Task task, TaskContext context, CommonReqInfo commonReqInfo, SceneTotalCountContext totalCountContext) { + return Result.success("ok"); + } + + @Override + public CommonReqInfo doPreFilter(Task task,TaskContext context, CommonReqInfo reqInfo) { + if (!preFilterInit.get()) { + //filter 没加载完成,使用原参数 + return reqInfo; + } + try { + return this.lastFilter.doFilter(task, context,reqInfo); + } catch (Exception e) { + log.error("do filter failed:{}", e.getMessage()); + //filter 执行错误,使用原参数 + return reqInfo; + } + } + + @Override + public Object doPostFilter(Task task, Object resInfo) { + if (!postFilterInit.get()) { + //filter 没加载完成,返回结果不做处理 + return resInfo; + } + try { + return this.firstFilter.doFilter(task, resInfo); + } catch (Exception e) { + log.error("do filter failed:{}", e.getMessage()); + //filter 执行错误,使用原参数 + return resInfo; + } + } + + public void init() { + //加载前置过滤器 + this.loadPreFilter(); + + //加载后置过滤器 + this.loadPostFilter(); + } + + private void loadPreFilter() { + Ioc bizIoc = Ioc.ins().getBean("bizIoc"); + bizIoc.regListener(event -> { + if (event.getEventType().equals(EventType.initFinish)){ + Map preFilterMaps = bizIoc.getBeansWithAnnotation(PreFilterAnno.class); + List preList = new ArrayList<>(preFilterMaps.values()); + log.info("pre filter size:{}", preList.size()); + List preFilters = preList.stream().map(filter -> (PreFilter) filter).toList(); + preFilters = sortPreFilterList(preFilters); + preFilterList.addAll(preFilters); + + try { + BasePreFilter last = new MimeterPreFilter(); + int size = preFilters.size(); + for (int i = 0; i < size; i++) { + log.info("init pre filter index:{}", i); + PreFilter filter = preFilters.get(i); + //最后一个为默认filter + BasePreFilter next = last; + last = (task,reqInfo,context) -> filter.doFilter(task, reqInfo,context, next); + } + log.info("init pre filter finish"); + this.lastFilter = last; + } finally { + log.info("load pre filter end"); + } + preFilterInit.set(true); + } + }); + } + + private void loadPostFilter() { + Ioc bizIoc = Ioc.ins().getBean("bizIoc"); + bizIoc.regListener(event -> { + if (event.getEventType().equals(EventType.initFinish)){ + Map postFilterMaps = bizIoc.getBeansWithAnnotation(PostFilterAnno.class); + List postList = new ArrayList<>(postFilterMaps.values()); + log.info("post filter size:{}", postList.size()); + List postFilters = postList.stream().map(filter -> (PostFilter) filter).toList(); + postFilters = sortPostFilterList(postFilters); + postFilterList.addAll(postFilters); + + try { + BasePostFilter last = new MimeterPostFilter(); + int size = postFilters.size(); + for (int i = 0; i < size; i++) { + log.info("init post filter index:{}", i); + PostFilter filter = postFilters.get(i); + //最后一个为默认filter + BasePostFilter next = last; + last = (task, resInfo) -> filter.doFilter(task, resInfo, next); + } + log.info("init post filter finish"); + this.firstFilter = last; + } finally { + log.info("load post filter end"); + } + postFilterInit.set(true); + } + }); + } + + /** + * 前置filter 按order顺序倒序 如:5,4,3,2,1 + */ + private List sortPreFilterList(List list) { + return list.stream().sorted((a, b) -> { + Integer x = a.getClass().getAnnotation(FilterOrder.class).value(); + Integer y = b.getClass().getAnnotation(FilterOrder.class).value(); + return y.compareTo(x); + }).collect(Collectors.toList()); + } + + /** + * 后置filter 按order顺序正序 如:1,2,3,4,5 + */ + private List sortPostFilterList(List list) { + return list.stream().sorted((a, b) -> { + Integer x = a.getClass().getAnnotation(FilterOrder.class).value(); + Integer y = b.getClass().getAnnotation(FilterOrder.class).value(); + return x.compareTo(y); + }).collect(Collectors.toList()); + } + + /** + * 获取前置过滤器列表 + */ + public List getPreFilterInfoList() { + if (this.preFilterList.size() > 0) { + return this.preFilterList.stream().map(it -> { + MimeterFilterInfo info = new MimeterFilterInfo(); + info.setFilterName(it.getClass().getCanonicalName()); + return info; + }).collect(Collectors.toList()); + } + return Lists.newArrayList(); + } + + /** + * 获取后置过滤器列表 + */ + public List getPostFilterInfoList() { + if (this.postFilterList.size() > 0) { + return this.postFilterList.stream().map(it -> { + MimeterFilterInfo info = new MimeterFilterInfo(); + info.setFilterName(it.getClass().getCanonicalName()); + return info; + }).collect(Collectors.toList()); + } + return Lists.newArrayList(); + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/client/base/DagClient.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/client/base/DagClient.java new file mode 100644 index 000000000..538ff0fd0 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/client/base/DagClient.java @@ -0,0 +1,373 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.client.base; + +import com.google.common.base.Stopwatch; +import com.google.gson.JsonArray; +import com.xiaomi.data.push.antlr.expr.Expr; +import com.xiaomi.data.push.graph.Graph; +import com.xiaomi.data.push.graph.Vertex; +import com.xiaomi.data.push.schedule.task.graph.GraphTaskContext; +import com.xiaomi.data.push.schedule.task.graph.TaskVertexData; +import com.xiaomi.youpin.docean.Ioc; +import com.xiaomi.youpin.docean.anno.Component; +import com.xiaomi.youpin.docean.common.MutableObject; +import com.xiaomi.youpin.docean.common.StringUtils; +import common.Replacer; +import common.Util; +import lombok.extern.slf4j.Slf4j; +import run.mone.event.Event; +import run.mone.mimeter.dashboard.bo.sceneapi.OutputOriginEnum; +import run.mone.mimeter.engine.agent.bo.data.CommonReqInfo; +import run.mone.mimeter.engine.agent.bo.data.NodeInfo; +import run.mone.mimeter.engine.agent.bo.data.Result; +import run.mone.mimeter.engine.agent.bo.stat.SceneTotalCountContext; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskContext; +import run.mone.mimeter.engine.agent.bo.task.TaskResult; +import run.mone.mimeter.engine.agent.bo.task.TaskType; +import run.mone.mimeter.engine.bo.TaskStatus; +import run.mone.mimeter.engine.common.ErrorCode; +import run.mone.mimeter.engine.common.Safe; +import run.mone.mimeter.engine.service.DatasetService; + +import javax.annotation.Resource; +import java.util.*; +import java.util.concurrent.*; +import java.util.stream.Collectors; + +import static common.Const.TASK_CTX_LINE_FLAG; + +/** + * @author goodjava@qq.com + * @author dongzhenxing + * @date 2022/5/30 + */ +@Component(name = "dagMClient") +@Slf4j +public class DagClient implements IClient { + + /** + * 使用jdk19的协程池 + */ + private final ExecutorService pool = Executors.newVirtualThreadPerTaskExecutor(); + + private static final String UP_PARAM_METHOD = "updateParam"; + + @Resource + private Ioc ioc; + + @Resource + private DatasetService datasetService; + + private static final ConcurrentHashMap latchMap = new ConcurrentHashMap<>(); + + + @Override + public Result call(Task task, TaskContext context, CommonReqInfo commonReqInfo, SceneTotalCountContext totalCountContext) { + Stopwatch sw = Stopwatch.createStarted(); + + GraphTaskContext taskContext = task.getDagInfo(); + log.debug("taskContext info :{}", taskContext); + //构建任务图 + Graph> graph = new Graph<>(taskContext.getTaskList().size()); + //添加顶点 + taskContext.getTaskList().forEach(it -> { + it.getData().getTask().setDataMap(task.getDataMap()); + graph.addVertex(new Vertex(it.getIndex(), it)); + }); + //基于接口任务依赖关系添加边 + taskContext.getDependList().forEach(it -> graph.addEdge(it.getFrom(), it.getTo())); + //主线程等待n个任务顶点执行完成 + final int taskSize = taskContext.getTaskList().size(); + CountDownLatch mainThreadLatch = new CountDownLatch(taskSize); + List latchKeyList = new ArrayList<>(16); + try { + graph.getVertexMap().forEach((key, value) -> { + List list = graph.dependList(key); + log.debug("task id:{} {}", value.getData().getTask().getId(), list.size()); + if (list.size() > 0) { + String latchKey = getLatchKey(context.getNum(), value.getData().getTask().getId()); + latchKeyList.add(latchKey); + latchMap.put(latchKey, new CountDownLatch(list.size())); + } + }); + //遍历任务图 + graph.bfsAll((v, d) -> { + try { + //顶点结点数据 + final NodeInfo nodeInfo = d.getData(); + d.setTaskId(nodeInfo.getId()); + + //当前顶点的边,依赖的顶点 + List list = graph.dependList(d.getIndex()); + d.setDependList(list); + //获取 set 边/子任务顶点 + List childList = graph.getAdj()[v]; + d.setChildList(childList.stream().map(graph::getVertexData).collect(Collectors.toList())); + + //初始化状态 + d.setStatus(TaskStatus.Init.code); + + //提交异步发压任务到协程池 + CompletableFuture.runAsync(() -> doWork(d, context, mainThreadLatch, totalCountContext), pool); + return true; + } catch (Throwable e) { + log.error("bfsAll error:" + e.getMessage(), e); + if (task.isDebug()) { + //当前顶点内的任务 + Task currTask = d.getData().getTask(); + TaskResult tr = new TaskResult(); + tr.setDebug(currTask.isDebug()); + tr.setId(currTask.getId()); + } + return false; + } + }); + } finally { + try { + //主线程等待直到tag 任务超时 + mainThreadLatch.await(task.getTimeout(), TimeUnit.MILLISECONDS); + + //这里等整个dag执行完成后,再清理本次dag调用产生的latch + clearLatch(latchKeyList); + } catch (InterruptedException e) { + log.error("[DagClient] call interrupted exception countDownLatch wait exception task id:" + task.getId() + ", report id:" + task.getReportId() + ", scene id:" + + task.getSceneId() + ", serial id:" + task.getSerialLinkID() + "; " + e.getMessage()); + } + + long time = sw.elapsed(TimeUnit.MILLISECONDS); + if (time > 10000) { + log.info("call dag client:{} use time:{}", task.getId() + ":" + context.getNum(), time); + } + + //有没完成的任务 + if (context.getFinishTaskNum().get() != taskSize) { + context.setError(true); + return Result.fail(ErrorCode.ERROR_505.code, ErrorCode.ERROR_505.message, false); + } + } + return Result.success(true); + } + + private void doWork(TaskVertexData d, TaskContext context, CountDownLatch mainThreadLatch, SceneTotalCountContext errorContext) { + try { + //当前任务结点阻塞,等待依赖任务完成,参数拿全 (finally 的safe.run中会更新本结点参数) + log.debug("doWork begin:{},latch num:{}", d.getData().getTask().getId(), latchMap.get(getLatchKey(context.getNum(), d.getData().getTask().getId()))); + await(latchMap.get(getLatchKey(context.getNum(), d.getData().getTask().getId()))); + log.debug("doWork await finish:{},latch num:{}", d.getData().getTask().getId(), latchMap.get(getLatchKey(context.getNum(), d.getData().getTask().getId()))); + + //返回数据 + MutableObject resData = new MutableObject(); + //请求是否成功 + MutableObject success = new MutableObject(false); + + try { + //当前顶点内的任务 + Task currTask = d.getData().getTask(); + TaskResult tr = new TaskResult(); + tr.setDebug(currTask.isDebug()); + tr.setId(currTask.getId()); + + IClient client = getClient(currTask.getType()); + Result res; + try { + //replace with the param dataset + CommonReqInfo commonReqInfo = null; + try { + commonReqInfo = datasetService.processTaskParam(currTask, (Integer) context.getAttachments().getOrDefault(TASK_CTX_LINE_FLAG, 1), currTask.isDebug()); + } catch (Exception e) { + log.error("processTaskParam error,e:{}", e.getMessage()); + } + res = client.call(currTask, context, commonReqInfo, errorContext); + + if (currTask.isDebug()) { + tr.setCode(res.getCode()); + tr.setOk(res.isOk()); + tr.setCommonReqInfo(res.getCommonReqInfo()); + tr.setResult(res.getData().toString()); + tr.setRespHeaders(res.getRespHeaders()); + if (!res.isOk() && res.getTriggerCp() != null) { + tr.setTriggerCpInfo(res.getTriggerCp()); + } + if (!res.isOk() && res.getTriggerFilterCondition() != null) { + tr.setTriggerFilterCondition(res.getTriggerFilterCondition()); + } + tr.setRt(res.getRt()); + tr.setSize(res.getSize()); + tr.getSuccess().incrementAndGet(); + } + success.setObj(res.isSuccess()); + resData.setObj(res.getData()); + } catch (Throwable e) { + log.error("call http error:" + e.getMessage(), e); + if (currTask.isDebug()) { + tr.setCode(ErrorCode.ERROR_500.code); + tr.setResult(e.getMessage()); + tr.getFailure().incrementAndGet(); + } + context.setError(true); + success.setObj(false); + resData.setObj(e.getMessage()); + } + //任务执行成功 + d.setStatus(TaskStatus.Success.code); + + if (currTask.isDebug()) { + //异步推送更新调试结果 + tr.setDebug(currTask.isDebug()); + tr.setId(currTask.getId()); + Event.ins().post(tr); + } + } catch (Throwable ex) { + log.error(ex.getMessage()); + context.setError(true); + throw new RuntimeException(ex); + } finally { + //依赖该任务的顶点列表 + log.debug("cur task id:{},child list:{}", d.getData().getTask().getId(), d.getChildList()); + d.getChildList().forEach(it -> { + //需要先将参数塞入线程本地变量 + if (success.getObj()) { + //当前顶点任务执行成功,需要回填返回数据 + //子节点信息 + final NodeInfo childNI = it.getData(); + //遍历处理参数表达式,将当前顶点取到的结果 更新替换到下游依赖结点的入参 + Safe.run(() -> { + Map> replacerMap = new HashMap<>(8); + childNI.getExprMap().forEach((key, v) -> { + //强制使用为字符串 + boolean forceStr = false; + //需要从这里取值(哪些子节点依赖我的结果,在这里update进去) + if (key.getIndex() == d.getIndex()) { + log.debug("antlr version:{}", Expr.version()); + Object value; + if (key.getOrigin() == OutputOriginEnum.BODY_TXT.code) { + //文本类型,直接赋值 + value = resData.getObj().toString(); + } else { + //json类型,解析 + if (key.getExpr().contains("|")) { + //存在该标识符说明为list中取值 + //表达式 例如:params.json().get(data).get(goodIds)|0.string + try { + String[] exprArr = key.getExpr().split("\\|", 2); + value = Expr.params(resData.getObj().toString(), exprArr[0]); + JsonArray valList = (JsonArray) value; + if (exprArr[1].contains(".")) { + String[] indexAndType = exprArr[1].split("\\.", 2); + value = Util.getListValByType(valList, Integer.parseInt(indexAndType[0]), indexAndType[1]); + } else { + value = valList.get(Integer.parseInt(exprArr[1])); + } + } catch (Exception e) { + value = ""; + log.error("parse get list val error,expr:{},cause by:{}", key.getExpr(), e.getMessage()); + } + } else { + try { + value = Expr.params(resData.getObj().toString(), key.getExpr()); + } catch (Exception e) { + log.error("parse params error,obj:{},expr:{},cause by:{}", resData.getObj(), key.getExpr(), e.getMessage()); + value = ""; + } +// log.debug("debug parse param,expr:{},res:{},value:{}", key, resData.getObj().toString(), value); + //强制指定为字符串 + if (key.getExpr().endsWith("getAsString()")) { + forceStr = true; + } + } + } + log.debug("context.getAttachments().put before key :{}", key); + if (StringUtils.isNotEmpty(key.getName())) { + log.debug("context.getAttachments().put key :{}", key); + context.getAttachments().put(key.getName(), value); + } + List putValueExpr = key.getPutValueExpr(); + if (putValueExpr.size() > 0) { + //httpData(dubboData)(数据协议类型)->0(index)->name(参数名) + int paramIndex = Integer.parseInt(putValueExpr.get(1)); + String paramName = putValueExpr.get(2); + List replacer = new ArrayList<>(Arrays.asList(new Replacer(childNI.getTask().getId(), paramIndex, paramName, value, forceStr))); + List replacers = replacerMap.putIfAbsent(paramName, replacer); + if (replacers != null) { + replacers.addAll(replacer); + } + } + } + }); + if (replacerMap.size() != 0) { + if (context.getAttachments().get("replacerMap") != null) { + replacerMap.entrySet().stream().forEach(entry -> { + List replacerList = ((Map>)context.getAttachments().get("replacerMap")).putIfAbsent(entry.getKey(), entry.getValue()); + if (replacerList != null) { + replacerList.addAll(entry.getValue()); + } + }); + } else { + context.getAttachments().put("replacerMap", replacerMap); + } + } + }); + } + //处理更新完每个依赖本顶点的 顶点任务后,释放其 latch + log.debug("cur child task id:{},context:{},latch num:{}", it.getData().getTask().getId(), context.getNum(), getLatchKey(context.getNum(), it.getData().getTask().getId())); + + //在单个顶点拥有多个父顶点的情况下,直接remove会导致下游同样以该顶点为子顶点的子任务无法再对完成顶点完成 countDown 动作,导致该latch泄漏,对应顶点的awit操作将持续阻塞直到超时。 + //CountDownLatch latch = latchMap.remove(getLatchKey(context.getNum(), it.getData().getTask().getId())); + CountDownLatch latch = latchMap.get(getLatchKey(context.getNum(), it.getData().getTask().getId())); + if (null != latch) { + latch.countDown(); + } + }); + } + } catch (Throwable ex) { + context.setError(true); + log.error(ex.getMessage()); + throw new RuntimeException(ex); + } finally { + //当前顶点执行完成后需要释放一个latch + context.getFinishTaskNum().incrementAndGet(); + mainThreadLatch.countDown(); + } + } + + private void await(CountDownLatch latch) { + if (null == latch) { + return; + } + try { + //容错处理.不至于线程不能归还 + latch.await(30, TimeUnit.SECONDS); + } catch (Throwable e) { + log.error("await error:{}", e.getMessage()); + throw new RuntimeException(e); + } + } + + private void clearLatch(List latchKeys) { + latchKeys.forEach(latchMap::remove); + } + + private static String getLatchKey(int num, int taskId) { + return num + "_" + taskId; + } + + private IClient getClient(TaskType type) { + return ioc.getBean(type.name() + "MClient"); + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/client/base/IClient.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/client/base/IClient.java new file mode 100644 index 000000000..9167e1348 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/client/base/IClient.java @@ -0,0 +1,17 @@ +package run.mone.mimeter.engine.client.base; + +import run.mone.mimeter.engine.agent.bo.data.CommonReqInfo; +import run.mone.mimeter.engine.agent.bo.data.Result; +import run.mone.mimeter.engine.agent.bo.stat.SceneTotalCountContext; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskContext; + +/** + * @author goodjava@qq.com + * @author dongzhenxing + * @date 2022/5/23 + */ +public interface IClient { + Result call(Task task, TaskContext context, CommonReqInfo commonReqInfo, SceneTotalCountContext totalCountContext); + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/client/impl/DemoClient.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/client/impl/DemoClient.java new file mode 100644 index 000000000..177d75676 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/client/impl/DemoClient.java @@ -0,0 +1,70 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.client.impl; + +import com.xiaomi.youpin.docean.anno.Component; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import run.mone.mimeter.engine.agent.bo.data.DemoData; +import run.mone.mimeter.engine.agent.bo.data.CommonReqInfo; +import run.mone.mimeter.engine.agent.bo.data.Result; +import run.mone.mimeter.engine.agent.bo.stat.SceneTotalCountContext; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskContext; +import run.mone.mimeter.engine.client.base.IClient; + +import java.util.concurrent.TimeUnit; + +/** + * @author goodjava@qq.com + * @date 2022/5/23 + *

+ * 用来测试代码逻辑 + */ +@Component(name = "demoClient") +public class DemoClient implements IClient { + + private static final Logger log = LoggerFactory.getLogger(DemoClient.class); + + public Result call(Task task, TaskContext context, CommonReqInfo commonReqInfo, SceneTotalCountContext totalCountContext) { + log.info("call task id:{} begin", task.getId()); + DemoData demoData = task.getDemoData(); + int i = 0; + + Result result = new Result<>(); + result.setCode(0); + + if (task.isDebug()) { + result.setData(String.valueOf(i + 1)); + } + result.setMessage("msg:" + task.getId()); + if (task.getAttachments().containsKey("sleep")) { + int time = Integer.valueOf(task.getAttachments().get("sleep")); + if (time > 0) { + try { + TimeUnit.SECONDS.sleep(time); + } catch (InterruptedException e) { + log.error("[DemoClient] call time sleep exception", e); + } + } + } + log.info("call demo task:{} context:{} result:{} success", task.getId(), context, result); + return result; + } + + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/client/impl/DubboClient.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/client/impl/DubboClient.java new file mode 100644 index 000000000..c89410004 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/client/impl/DubboClient.java @@ -0,0 +1,244 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.client.impl; + +import com.google.gson.Gson; +import com.google.gson.JsonSyntaxException; +import com.google.gson.reflect.TypeToken; +import com.xiaomi.youpin.docean.anno.Component; +import com.xiaomi.youpin.gateway.dubbo.Dubbo; +import com.xiaomi.youpin.gateway.dubbo.MethodInfo; +import common.Util; +import org.apache.dubbo.rpc.RpcContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import run.mone.mimeter.engine.agent.bo.data.CheckFilterConditionRes; +import run.mone.mimeter.engine.agent.bo.data.DubboData; +import run.mone.mimeter.engine.agent.bo.data.CommonReqInfo; +import run.mone.mimeter.engine.agent.bo.data.Result; +import run.mone.mimeter.engine.agent.bo.stat.DubboResultCheckInfo; +import run.mone.mimeter.engine.agent.bo.stat.SceneTotalCountContext; +import run.mone.mimeter.engine.agent.bo.task.HeraContextInfo; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskContext; +import run.mone.mimeter.engine.client.base.BaseClient; +import run.mone.mimeter.engine.common.CustomLogBuilder; +import run.mone.mimeter.engine.common.ResultCheck; +import run.mone.mimeter.engine.common.TraceUtil; +import run.mone.mimeter.engine.service.LoggerBuilder; + +import javax.annotation.Resource; + + +import static common.Const.*; +import static run.mone.mimeter.dashboard.bo.sceneapi.DubboMavenVersionEnum.ORIGIN_MAVEN; +import static run.mone.mimeter.engine.service.MetricsService.recordApiRpsMetrics; +import static run.mone.mimeter.engine.service.MetricsService.recordTpsAndRtMetrics; + +/** + * @author goodjava@qq.com + * @author dongzhenxing + * @date 2022/5/19 + */ +@Component(name = "dubboMClient") +public class DubboClient extends BaseClient { + @Resource + private Dubbo dubbo; + + private final Gson gson = new Gson(); + + private static final Logger log = LoggerFactory.getLogger(DubboClient.class); + + @Resource + private LoggerBuilder loggerBuilder; + + @Override + public Result call(Task task, TaskContext context, CommonReqInfo commonReqInfo, SceneTotalCountContext totalCountContext) { + //目前的逻辑是有一个发生错误了,后边就不在调用了 + if (context.isError()) { + return Result.cancel(); + } + DubboData dubboData = task.getDubboData(); + //检查是否满足忽略的条件 + Result result = new Result(); + //检查是否满足忽略的条件 + CheckFilterConditionRes checkFilterConditionRes = ResultCheck.checkFilterConditionSatisfy(context.getAttachments(), dubboData.getFilterCondition()); + if (checkFilterConditionRes.isMatch()) { + result.setOk(false); + result.setData("passed"); + result.setCode(0); + result.setTriggerFilterCondition(checkFilterConditionRes.getTriggerFilterCondition()); + return result; + } + HeraContextInfo heraContextInfo = task.getHeraContextInfo(); + + Integer sceneId = 0; + Integer serialId = 0; + String reportId = ""; + Integer apiId = 0; + + if (!task.isDebug()) { + sceneId = heraContextInfo.getSceneId(); + serialId = heraContextInfo.getSerialLinkId(); + reportId = heraContextInfo.getTaskFlag(); + apiId = heraContextInfo.getSceneApiId(); + } + + //前置过滤器,用于根据业务需求自定义处理转换入参 + commonReqInfo = this.doPreFilter(task,context, commonReqInfo); + + MethodInfo mi = new MethodInfo(); + if (dubboData.getServiceName().startsWith("providers:")) { + mi.setServiceName(dubboData.getServiceName().substring("provider:".length() + 1)); + } else { + mi.setServiceName(dubboData.getServiceName()); + } + mi.setMethodName(dubboData.getMethodName()); + if (dubboData.getGroup() != null) { + mi.setGroup(dubboData.getGroup()); + } + if (dubboData.getVersion() != null) { + mi.setVersion(dubboData.getVersion()); + } + if (!ORIGIN_MAVEN.mavenVersion.equals(dubboData.getMavenVersion())) { + mi.setProto("json"); + } + + mi.setArgsProto("gson"); + RpcContext.getContext().setAttachment("gson_generic_args", "true"); + mi.setProtoVersion("v1"); + mi.setTimeout(task.getTimeout()); + mi.setParameterTypes(dubboData.getRequestParamTypeList().toArray(new String[0])); + Object[] params; + try { + params = gson.fromJson(commonReqInfo.getParamJson(), new TypeToken() { + }.getType()); + } catch (JsonSyntaxException e) { + return Result.cancel(); + } + mi.setArgs(params); + + //携带Attachments + setAttachment(dubboData); + + //生成traceid + String trace = trace(); + + //带入trace标记 + injectHeraContext(task.isDebug(), task.getHeraContextInfo()); + + Object res; + String errorInfo = null; + + int code = 500; + long start = 0; + try { + start = System.currentTimeMillis(); + res = dubbo.call(mi); + code = 0; + } catch (Exception exception) { + errorInfo = exception.getMessage(); + log.error("[DubboClient] call invoke exception, task id: " + task.getId() + ", " + "scene id: " + sceneId + + ", report id: " + reportId + ", " + "serial id: " + serialId + + ", submit type: " + task.getSubmitTaskType() + ", task type: " + task.getType().code + ", " + errorInfo); + res = errorInfo; + } + //后置过滤器,用于根据业务需求自定义处理转换出参 + this.doPostFilter(task,res); + + // check point, error analysis + DubboResultCheckInfo checkInfo = ResultCheck.checkDubboResult(dubboData, res, code, task.isDebug()); + + if (!checkInfo.isOk()) { + log.error("dubbo call error:{}", errorInfo); + context.setError(true); + } + long elapsed = System.currentTimeMillis() - start; + + if (!task.isDebug()) { + //打点rps + recordApiRpsMetrics(new String[]{String.valueOf(sceneId), reportId, String.valueOf(serialId), + task.getType().name(), dubboData.getServiceName(), dubboData.getMethodName(), String.valueOf(apiId), String.valueOf(checkInfo.isOk())}); + ResultCheck.recordRpsCount(apiId, totalCountContext); + + // check point, error analysis + String[] labelVals = new String[]{String.valueOf(sceneId), reportId, String.valueOf(serialId), + task.getType().name(), String.valueOf(code), dubboData.getServiceName(), dubboData.getMethodName(), + String.valueOf(apiId), String.valueOf(checkInfo.isOk())}; + + recordTpsAndRtMetrics(elapsed, labelVals, true); + + //rt统计 + ResultCheck.recordApiRtAndCount(apiId, elapsed, checkInfo.isOk(), totalCountContext, true); + + //错误统计 + ResultCheck.dubboApiErrorAnalysis(apiId, checkInfo, totalCountContext); + + //采样日志 + if (sendLog && ((boolean) context.getAttachments().getOrDefault(TASK_CTX_RECORD_LOG, false) || !checkInfo.isOk())) { + loggerBuilder.getLogger().info(CustomLogBuilder.buildApiLog(!checkInfo.isOk(), task.getId(), API_TYPE_DUBBO, dubboData.getServiceName(), dubboData.getMethodName(), + elapsed, code, sceneId, serialId, reportId, apiId, gson.toJson(res), commonReqInfo.getParamJson(), "", "", trace, errorInfo)); + } + } + result.setCode(code); + result.setOk(checkInfo.isOk()); + result.setData(gson.toJson(res)); + result.setCommonReqInfo(commonReqInfo); + result.setRt(elapsed); + result.setSize(res.toString().getBytes().length); + return result; + } + + + /** + * 设置attachments + */ + private void setAttachment(DubboData dubboData) { + RpcContext.getContext().setAttachments(dubboData.getAttachments()); + } + + /** + * 插入trace id + */ + private String trace() { + String traceId = TraceUtil.traceId(); + RpcContext.getContext().getAttachments().put(DUBBO_TRACE_HEADER_KEY, "00-" + traceId + "-" + TraceUtil.spanId() + "-01"); + return traceId; + } + + /** + * 注入tracing信息 + */ + private void injectHeraContext(boolean isDebug, HeraContextInfo heraContextInfo) { + if (!isDebug && checkHeraInfoParam(heraContextInfo)) { + StringBuilder sb = new StringBuilder(); + String sceneTask = heraContextInfo.getSceneId() + "_" + heraContextInfo.getTaskFlag(); + + sb.append(HERA_SCENE_TASK).append(":").append(sceneTask).append(";"); + sb.append(HERA_SERIAL_LINK).append(":").append(heraContextInfo.getSerialLinkId()).append(";"); + sb.append(HERA_API_ID).append(":").append(heraContextInfo.getSceneApiId()).append(";"); + + RpcContext.getContext().getAttachments().put(HEAR_HEADER_KEY, sb.toString()); + } + } + + private boolean checkHeraInfoParam(HeraContextInfo heraContextInfo) { + return heraContextInfo.getTaskFlag() != null && heraContextInfo.getSceneId() != null + && heraContextInfo.getSerialLinkId() != null; + } + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/client/impl/HttpClient.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/client/impl/HttpClient.java new file mode 100644 index 000000000..76ab5aede --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/client/impl/HttpClient.java @@ -0,0 +1,291 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.client.impl; + +import com.google.common.collect.Maps; +import com.google.gson.Gson; +import com.xiaomi.hera.trace.annotation.Trace; +import com.xiaomi.youpin.docean.anno.Component; +import common.*; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import run.mone.mimeter.engine.agent.bo.data.CheckFilterConditionRes; +import run.mone.mimeter.engine.agent.bo.data.HttpData; +import run.mone.mimeter.engine.agent.bo.data.CommonReqInfo; +import run.mone.mimeter.engine.agent.bo.data.Result; +import run.mone.mimeter.engine.agent.bo.stat.HttpResultCheckInfo; +import run.mone.mimeter.engine.agent.bo.stat.SceneTotalCountContext; +import run.mone.mimeter.engine.agent.bo.task.HeraContextInfo; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskContext; +import run.mone.mimeter.engine.client.base.BaseClient; +import run.mone.mimeter.engine.common.CustomLogBuilder; +import run.mone.mimeter.engine.common.ErrorCode; +import run.mone.mimeter.engine.common.ResultCheck; +import run.mone.mimeter.engine.common.TraceUtil; +import run.mone.mimeter.engine.service.LoggerBuilder; + +import javax.annotation.Resource; +import java.nio.charset.StandardCharsets; +import java.util.*; + +import static common.Const.*; +import static run.mone.mimeter.engine.service.MetricsService.recordApiRpsMetrics; +import static run.mone.mimeter.engine.service.MetricsService.recordTpsAndRtMetrics; + +/** + * @author goodjava@qq.com + * @author dongzhenxing + * @date 2023/3/23 + */ +@Component(name = "httpMClient") +public class HttpClient extends BaseClient { + private static final Logger log = LoggerFactory.getLogger(HttpClient.class); + + private final Gson gson = Util.getGson(); + @Resource + private LoggerBuilder loggerBuilder; + + @Override + @Trace + public Result call(Task task, TaskContext context, CommonReqInfo commonReqInfo, SceneTotalCountContext totalCountContext) { + try { + //目前的逻辑是有一个发生错误了,后边就不在调用了 + if (context.isError()) { + log.info("http call cancel:{}", task.getId()); + return Result.cancel(); + } + + HttpData httpData = task.getHttpData(); + + Result result = new Result(); + //检查是否满足忽略的条件 + CheckFilterConditionRes checkFilterConditionRes = ResultCheck.checkFilterConditionSatisfy(context.getAttachments(), httpData.getFilterCondition()); + if (checkFilterConditionRes.isMatch()) { + result.setOk(false); + result.setData("passed"); + result.setCode(0); + result.setTriggerFilterCondition(checkFilterConditionRes.getTriggerFilterCondition()); + return result; + } + HeraContextInfo heraContextInfo = task.getHeraContextInfo(); + + Integer sceneId = 0; + Integer serialId = 0; + String reportId = ""; + Integer apiId = 0; + + if (!task.isDebug()) { + sceneId = heraContextInfo.getSceneId(); + serialId = heraContextInfo.getSerialLinkId(); + reportId = heraContextInfo.getTaskFlag(); + apiId = heraContextInfo.getSceneApiId(); + } + + String url = httpData.getUrl(); + String method = httpData.getMethod(); + int timeout = Math.max(httpData.getTimeout(), 10); + + HttpResult res = null; + + //前置过滤器,用于根据业务需求自定义处理转换入参 + log.debug("do pre filter before,common req:{}",commonReqInfo); + + commonReqInfo = this.doPreFilter(task,context, commonReqInfo); + + log.debug("do pre filter after,common req:{}",commonReqInfo); + if(StringUtils.isNotBlank(commonReqInfo.getDebugUrl())){ + url = commonReqInfo.getDebugUrl(); + } + String paramBody = ""; + String encoding = "utf-8"; + if (commonReqInfo.getHeaders().getOrDefault(Const.DISABLE_URL_ENCODE, "false").equals("true")) { + encoding = ""; + } + String errorInfo = ""; + boolean needLog = (boolean) context.getAttachments().getOrDefault(TASK_CTX_RECORD_LOG, false); + boolean logIgnore = false; + TpsRecord needRecordTps = new TpsRecord(true); + String traceId = ""; + long start = 0; + try { + //注入trace信息 + traceId = this.trace(commonReqInfo.getHeaders()); + //注入探针信息 + injectHeraContext(task.isDebug(), heraContextInfo, commonReqInfo.getHeaders()); + List headers = new ArrayList<>(); + commonReqInfo.getHeaders().forEach((key, value) -> { + headers.add(key); + headers.add(value); + }); + if (method.equalsIgnoreCase(HTTP_GET)) { + if (needLog) { + paramBody = gson.toJson(commonReqInfo.getQueryParamMap()); + } + start = System.currentTimeMillis(); + log.debug("http get api url:{}.headers:{}", url, headers); + + res = HttpClientV6.httpGet(needRecordTps, url, headers, commonReqInfo.getQueryParamMap(), encoding, timeout); + } else if (method.equalsIgnoreCase(HTTP_POST)) { + //json格式为 对象 {} 或基本类型 "d"/1/true... + //表单参数格式 + if (httpData.getContentType().equals(CONTENT_TYPE_APP_FORM) || httpData.getContentType().equals(CONTENT_TYPE_APP_FORM2)) { + if (needLog) { + paramBody = gson.toJson(commonReqInfo.getQueryParamMap()); + } + start = System.currentTimeMillis(); + res = HttpClientV6.httpPost(needRecordTps, url, commonReqInfo.getHeaders(), commonReqInfo.getQueryParamMap(), encoding, timeout); + } else { + paramBody = commonReqInfo.getParamJson(); + //application/json格式 + start = System.currentTimeMillis(); + log.debug("do call before,common req:{}",commonReqInfo); + res = HttpClientV6.postRt(needRecordTps, url, commonReqInfo.getParamJson().getBytes(StandardCharsets.UTF_8), commonReqInfo.getHeaders(), timeout); + } + } + } catch (Throwable ex) { + needRecordTps.setNeedRecordTps(false); + if (ex.getMessage() != null) { + errorInfo = ex.getMessage(); + } else { + errorInfo = ex.getCause().getMessage(); + } + log.error("[HttpClient] call invoke exception, task id: " + task.getId() + ", " + "scene id: " + sceneId + + ", report id: " + reportId + ", " + "serial id: " + serialId + + ", submit type: " + task.getSubmitTaskType() + ", task type: " + task.getType().code + " " + errorInfo); + + res = new HttpResult(ErrorCode.ERROR_500.code, errorInfo, Maps.newHashMap()); + } finally { + long elapsed = (System.currentTimeMillis() - start); + int respCode = res == null ? ErrorCode.ERROR_500.code : res.code; + + //后置过滤器,用于根据业务需求自定义处理转换出参 + this.doPostFilter(task, res); + + // check point, error analysis + HttpResultCheckInfo checkInfo = ResultCheck.checkHttpResult(httpData, res, task.getSuccessCode(), task.isDebug()); + + if (!checkInfo.isOk()) { + if (method.equalsIgnoreCase(HTTP_GET) || httpData.getContentType().equals(CONTENT_TYPE_APP_FORM) || httpData.getContentType().equals(CONTENT_TYPE_APP_FORM2)) { + paramBody = gson.toJson(commonReqInfo.getQueryParamMap()); + } + log.error("http call error:{}", res.code); + context.setError(true); + } + if (!task.isDebug()) { + if (!needRecordTps.isNeedRecordTps()) { + //httpclient 请求报错 + //检查是否为连接超时 + assert res != null; + if (judgeIfConnectTimeout(res)) { + //统计丢失连接数 + ResultCheck.recordLossConnCount(totalCountContext); + logIgnore = true; + } else { + collectData(task, sceneId, reportId, serialId, url, method, apiId, checkInfo, totalCountContext, elapsed, respCode, needRecordTps); + } + } else { + collectData(task, sceneId, reportId, serialId, url, method, apiId, checkInfo, totalCountContext, elapsed, respCode, needRecordTps); + } + } + result.setCode(res.code); + result.setOk(checkInfo.isOk()); + result.setData(res.content); + result.setRespHeaders(res.getHeaders()); + result.setCommonReqInfo(commonReqInfo); + if (!checkInfo.isOk() && checkInfo.getTriggerCpInfo() != null) { + //触发的检查点信息 + result.setTriggerCp(checkInfo.getTriggerCpInfo()); + } + result.setRt(elapsed); + result.setSize(res.content.getBytes().length); + //采样日志 + if (sendLog && (needLog || (!checkInfo.isOk()) && !logIgnore)) { + loggerBuilder.getLogger().info(CustomLogBuilder.buildApiLog(!checkInfo.isOk(), task.getId(), API_TYPE_HTTP, url, method, elapsed, result.getCode(), sceneId, serialId, + reportId, apiId, Objects.equals("Read timed out",res.content)?(res.content + " ( start = "+start ):res.content, paramBody, gson.toJson(commonReqInfo.getHeaders()), gson.toJson(res.getHeaders()), traceId, errorInfo)); + } + } + return result; + } finally { + log.debug("finish:{}:{}", task.getId(), task.getHttpData().getUrl()); + } + } + + /** + * 统计打点数据 + */ + private void collectData(Task task, Integer sceneId, String reportId, Integer serialId + , String url, String method, Integer apiId, HttpResultCheckInfo checkInfo, + SceneTotalCountContext totalCountContext, long elapsed, Integer respCode, + TpsRecord needRecordTps) { + //打点rps + recordApiRpsMetrics(new String[]{String.valueOf(sceneId), reportId, String.valueOf(serialId), + task.getType().name(), url, method, String.valueOf(apiId), String.valueOf(checkInfo.isOk())}); + ResultCheck.recordRpsCount(apiId, totalCountContext); + + //打点 tps + recordTpsAndRtMetrics(elapsed, new String[]{String.valueOf(sceneId), reportId, String.valueOf(serialId), + task.getType().name(), String.valueOf(respCode), url, method, String.valueOf(apiId), + String.valueOf(checkInfo.isOk())}, needRecordTps.isNeedRecordTps()); + //rt 次数统计 + ResultCheck.recordApiRtAndCount(apiId, elapsed, checkInfo.isOk(), totalCountContext, needRecordTps.isNeedRecordTps()); + //错误统计 + ResultCheck.httpApiErrorAnalysis(apiId, checkInfo, totalCountContext, task.getSuccessCode()); + } + + /** + * 插入trace id + */ + private String trace(Map headers) { + String traceId = TraceUtil.traceId(); + headers.put(DUBBO_TRACE_HEADER_KEY, "00-" + traceId + "-" + TraceUtil.spanId() + "-01"); + return traceId; + } + + /** + * 注入tracing信息 + */ + private void injectHeraContext(boolean isDebug, HeraContextInfo heraContextInfo, Map headers) { + if (!isDebug && checkHeraInfoParam(heraContextInfo)) { + StringBuilder sb = new StringBuilder(); + String sceneTask = heraContextInfo.getSceneId() + "_" + heraContextInfo.getTaskFlag(); + + sb.append(HERA_SCENE_TASK).append(":").append(sceneTask).append(";"); + sb.append(HERA_SERIAL_LINK).append(":").append(heraContextInfo.getSerialLinkId()).append(";"); + sb.append(HERA_API_ID).append(":").append(heraContextInfo.getSceneApiId()).append(";"); + + headers.put(Const.HEAR_HEADER_KEY, sb.toString()); + } + } + + private boolean checkHeraInfoParam(HeraContextInfo heraContextInfo) { + return heraContextInfo.getTaskFlag() != null && heraContextInfo.getSceneId() != null + && heraContextInfo.getSerialLinkId() != null; + } + + /** + * 是否连接超时,是则作为丢失连接 + */ + private boolean judgeIfConnectTimeout(HttpResult res) { + if (res.code != 500) { + return false; + } + return res.content.equals("Connect timed out") || res.content.equals("Connection timed out"); + } + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/common/CustomLogBuilder.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/common/CustomLogBuilder.java new file mode 100644 index 000000000..d3ae4b959 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/common/CustomLogBuilder.java @@ -0,0 +1,38 @@ +package run.mone.mimeter.engine.common; + + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + +import static common.Const.API_TYPE_HTTP; + +public class CustomLogBuilder { + + public static DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + public static String buildApiLog(boolean failed, int taskId, int apiType,String url, String method, + long elapsed, int code, Integer sceneId, Integer serialId, String reportId, + Integer apiId, String resContent, String paramBody, String reqHeader, + String resHeader, String traceId, String errorInfo) { + return sdf.format(new Date()) + "∩" + + failed + "∩" + + taskId + "∩" + + apiType + "∩" + + url + "∩" + + method + "∩" + + elapsed + "∩" + + code + "∩" + + sceneId + "∩" + + serialId + "∩" + + reportId + "∩" + + apiId + "∩" + + resContent + "∩" + + paramBody + "∩" + + reqHeader + "∩" + + resHeader + "∩" + + traceId + "∩" + + errorInfo; + } + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/common/ErrorCode.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/common/ErrorCode.java new file mode 100644 index 000000000..bd7c1fa34 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/common/ErrorCode.java @@ -0,0 +1,23 @@ +package run.mone.mimeter.engine.common; + +/** + * @author goodjava@qq.com + * @date 2022/9/20 22:35 + */ +public enum ErrorCode { + + ERROR_505(505, "main_thread_latch_timeout"), + + ERROR_500(500, "500 error"); + + public final int code; + + public final String message; + + ErrorCode(int code, String message) { + this.code = code; + this.message = message; + } + + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/common/ResultCheck.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/common/ResultCheck.java new file mode 100644 index 000000000..c4ebb4c77 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/common/ResultCheck.java @@ -0,0 +1,718 @@ +package run.mone.mimeter.engine.common; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.xiaomi.data.push.antlr.expr.Expr; +import common.HttpResult; +import common.Util; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import run.mone.mimeter.dashboard.bo.sceneapi.OutputOriginEnum; +import run.mone.mimeter.engine.agent.bo.data.BaseData; +import run.mone.mimeter.engine.agent.bo.data.CheckPointInfo; +import run.mone.mimeter.engine.agent.bo.data.CheckFilterConditionRes; +import run.mone.mimeter.engine.agent.bo.stat.DubboResultCheckInfo; +import run.mone.mimeter.engine.agent.bo.stat.HttpResultCheckInfo; +import run.mone.mimeter.engine.agent.bo.data.OutputParam; +import run.mone.mimeter.engine.agent.bo.stat.SceneTotalCountContext; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.LongAdder; + +import static common.Const.*; + +@Slf4j +public class ResultCheck { + + public static final Gson gson = Util.getGson(); + + /** + * 错误分析,检查点 + */ + public static HttpResultCheckInfo checkHttpResult(BaseData baseData, HttpResult res, String successCode, boolean debug) { + HttpResultCheckInfo checkInfo = new HttpResultCheckInfo(); + if (baseData.getCheckPointInfoList() == null || baseData.getCheckPointInfoList().size() == 0) { + //没有配置检查点,以状态码为主 + List succCodes = new ArrayList<>(); + if (successCode != null) { + succCodes.addAll(Arrays.stream(successCode.split(",")).toList()); + } else { + succCodes.add("200"); + succCodes.add("0"); + } + if (!succCodes.contains(String.valueOf(res.code))) { + checkInfo.setOk(false); + checkInfo.setCheckPointId(0); + checkInfo.setHttpStatusCode(String.valueOf(res.code)); + return checkInfo; + } else { + checkInfo.setOk(true); + } + } else { + //以检查点为主 + CheckPointInfo triggerCp = ResultCheck.checkPointSatisfyHttp(baseData.getOutputParams(), baseData.getCheckPointInfoList(), res); + if (triggerCp != null && triggerCp.getId() != null && triggerCp.getId() != 0) { + //触发检查点 + checkInfo.setOk(false); + checkInfo.setCheckPointId(triggerCp.getId()); + if (debug) { + checkInfo.setTriggerCpInfo(gson.toJson(triggerCp)); + } + return checkInfo; + } else { + if (debug && triggerCp != null) { + checkInfo.setOk(false); + checkInfo.setTriggerCpInfo(gson.toJson(triggerCp)); + } + if (triggerCp == null) { + checkInfo.setOk(true); + } + } + checkInfo.setHttpStatusCode(String.valueOf(res.code)); + } + return checkInfo; + } + + /** + * dubbo 错误判断,检查点 + */ + public static DubboResultCheckInfo checkDubboResult(BaseData baseData, Object res, int code, boolean debug) { + DubboResultCheckInfo checkInfo = new DubboResultCheckInfo(); + + if (baseData.getCheckPointInfoList() == null || baseData.getCheckPointInfoList().size() == 0) { + //未配置检查点,默认已code为准,即调用没有报错就算成功 + + if (code != 0) { + checkInfo.setOk(false); + checkInfo.setCheckPointId(0); + return checkInfo; + } else { + checkInfo.setOk(true); + } + } else { + CheckPointInfo triggerCp = ResultCheck.checkPointSatisfyDubbo(baseData.getOutputParams(), baseData.getCheckPointInfoList(), res); + if (triggerCp != null && triggerCp.getId() != null && triggerCp.getId() != 0) { + //触发检查点 + checkInfo.setOk(false); + checkInfo.setCheckPointId(triggerCp.getId()); + if (debug) { + checkInfo.setTriggerCpInfo(gson.toJson(triggerCp)); + } + } else { + checkInfo.setOk(true); + } + } + return checkInfo; + } + + /** + * dubbo请求错误分析统计 + */ + public static void dubboApiErrorAnalysis(int apiId, DubboResultCheckInfo checkInfo, SceneTotalCountContext errorContext) { + if (checkInfo.isOk()) { + errorContext.getTotalSuccReq().increment(); + return; + } + //总错误次数+1 + errorContext.getTotalErrReq().increment(); + String checkPointId = String.valueOf(checkInfo.getCheckPointId()); + if (!checkPointId.equals("0")) { + // 检查点触发 + String checkPointKey = ERR_CHECKPOINT_PREFIX + checkPointId; + if (errorContext.getErrCounterMap().containsKey(checkPointKey)) { + //已存在该检查点错误 + if (errorContext.getErrCounterMap().get(checkPointKey).containsKey(apiId)) { + //已记录该接口,+1 + errorContext.getErrCounterMap().get(checkPointKey).get(apiId).increment(); + } else { + //初始化1次 + LongAdder newAdder = new LongAdder(); + newAdder.increment(); + errorContext.getErrCounterMap().get(checkPointKey).put(apiId, newAdder); + } + } else { + //初始化1次 + ConcurrentHashMap tmpMap = new ConcurrentHashMap<>(); + + LongAdder newAdder = new LongAdder(); + newAdder.increment(); + tmpMap.put(apiId, newAdder); + //该检查点错误尚未记录 + errorContext.getErrCounterMap().put(checkPointKey, tmpMap); + } + } else { + //调用异常触发 + String statusCodeKey = "dubbo_call_fail"; + if (errorContext.getErrCounterMap().containsKey(statusCodeKey)) { + //已存在该错误码 + if (errorContext.getErrCounterMap().get(statusCodeKey).containsKey(apiId)) { + //已记录该接口,+1 + errorContext.getErrCounterMap().get(statusCodeKey).get(apiId).increment(); + } else { + //初始化1次 + LongAdder newAdder = new LongAdder(); + newAdder.increment(); + errorContext.getErrCounterMap().get(statusCodeKey).put(apiId, newAdder); + } + } else { + //该错误码尚未记录 + //初始化1次 + ConcurrentHashMap tmpMap = new ConcurrentHashMap<>(); + LongAdder newAdder = new LongAdder(); + newAdder.increment(); + tmpMap.put(apiId, newAdder); + errorContext.getErrCounterMap().put(statusCodeKey, tmpMap); + } + } + } + + /** + * http请求错误分析统计 + */ + public static void httpApiErrorAnalysis(int apiId, HttpResultCheckInfo checkInfo, SceneTotalCountContext errorContext, String successCode) { + if (checkInfo.isOk()) { + errorContext.getTotalSuccReq().increment(); + return; + } + List succCodes = new ArrayList<>(); + if (successCode != null) { + succCodes.addAll(Arrays.stream(successCode.split(",")).toList()); + } else { + succCodes.add("200"); + succCodes.add("0"); + } + //总错误次数+1 + errorContext.getTotalErrReq().increment(); + String statusCode = checkInfo.getHttpStatusCode(); + String checkPointId = String.valueOf(checkInfo.getCheckPointId()); + if (!checkPointId.equals("0")) { + // 检查点触发 + String checkPointKey = ERR_CHECKPOINT_PREFIX + checkPointId; + if (errorContext.getErrCounterMap().containsKey(checkPointKey)) { + //已存在该检查点错误 + if (errorContext.getErrCounterMap().get(checkPointKey).containsKey(apiId)) { + //已记录该接口,+1 + errorContext.getErrCounterMap().get(checkPointKey).get(apiId).increment(); + } else { + //初始化1次 + LongAdder newAdder = new LongAdder(); + newAdder.increment(); + errorContext.getErrCounterMap().get(checkPointKey).put(apiId, newAdder); + } + } else { + //初始化1次 + ConcurrentHashMap tmpMap = new ConcurrentHashMap<>(); + + LongAdder newAdder = new LongAdder(); + newAdder.increment(); + tmpMap.put(apiId, newAdder); + //该检查点错误尚未记录 + errorContext.getErrCounterMap().put(checkPointKey, tmpMap); + } + } else if (!succCodes.contains(statusCode)) { + //http 状态码触发 + String statusCodeKey = ERR_STATUS_CODE_PREFIX + statusCode; + if (errorContext.getErrCounterMap().containsKey(statusCodeKey)) { + //已存在该错误码 + if (errorContext.getErrCounterMap().get(statusCodeKey).containsKey(apiId)) { + //已记录该接口,+1 + errorContext.getErrCounterMap().get(statusCodeKey).get(apiId).increment(); + } else { + //初始化1次 + LongAdder newAdder = new LongAdder(); + newAdder.increment(); + errorContext.getErrCounterMap().get(statusCodeKey).put(apiId, newAdder); + } + } else { + //该错误码尚未记录 + //初始化1次 + ConcurrentHashMap tmpMap = new ConcurrentHashMap<>(); + LongAdder newAdder = new LongAdder(); + newAdder.increment(); + tmpMap.put(apiId, newAdder); + errorContext.getErrCounterMap().put(statusCodeKey, tmpMap); + } + } + } + + /** + * 是否满足检查点规则 dubbo + */ + public static CheckPointInfo checkPointSatisfyDubbo(List outputParams, List checkPointInfos, Object res) { + if (checkPointInfos == null || checkPointInfos.size() == 0) { + return null; + } + AtomicBoolean ok = new AtomicBoolean(true); + for (CheckPointInfo checkPointInfo : + checkPointInfos) { + //dubbo接口的检查点只有出参校验类型 + if (checkPointInfo.getCheckType() == OUTPUT_CODE) { + String outputKey = checkPointInfo.getCheckObj(); + OutputParam opParam = outputParams.stream().filter(outputParam -> outputParam.getParamName().equals(outputKey)).findFirst().get(); + try { + Object value; + if (opParam.getOrigin() == OutputOriginEnum.BODY_TXT.code) { + value = res.toString(); + } else { + if (opParam.getParseExpr().contains("|")) { + //存在该标识符说明为list中取值 + //表达式 例如:params.json().get(data).get(goodIds)|0.string + try { + String[] exprArr = opParam.getParseExpr().split("\\|", 2); + value = Expr.params(gson.toJson(res), exprArr[0]); + JsonArray valList = (JsonArray) value; + if (exprArr[1].contains(".")) { + String[] indexAndType = exprArr[1].split("\\.", 2); + value = Util.getListValByType(valList, Integer.parseInt(indexAndType[0]), indexAndType[1]); + } else { + value = valList.get(Integer.parseInt(exprArr[1])); + } + } catch (Exception e) { + value = ""; + log.error("dubbo check point parse get list val error,expr:{},cause by:{}", opParam.getParseExpr(), e.getMessage()); + } + } else { + try { + value = Expr.params(gson.toJson(res), opParam.getParseExpr()); + } catch (Exception e) { + value = ""; + } + } + } + ok.set(checkOutput(value, checkPointInfo.getCheckCondition(), checkPointInfo.getCheckContent())); + } catch (Exception e) { + ok.set(false); + } + } + if (!ok.get()) { + //一个不满足即错误 + //一个不满足即错误 + CheckPointInfo triggerCp = new CheckPointInfo(); + BeanUtils.copyProperties(checkPointInfo, triggerCp); + return triggerCp; + } + } + + return null; + } + + /** + * 是否满足过滤规则 + * 条件list中关系为 条件与 and,即满足所有条件则过滤 + * 单条中以 | 间隔为 条件或 or + */ + public static CheckFilterConditionRes checkFilterConditionSatisfy(Map attachments, List filterConditionList) { + CheckFilterConditionRes checkFilterConditionRes = new CheckFilterConditionRes(); + if (filterConditionList == null || filterConditionList.size() == 0) { + checkFilterConditionRes.setMatch(false); + return checkFilterConditionRes; + } + log.debug("checkFilterConditionSatisfy attachments:{},filterCondition :{}", attachments, filterConditionList.get(0)); + //若 + //起始置为匹配,条件list中有不满足的则置为false + AtomicBoolean ok = new AtomicBoolean(true); + for (CheckPointInfo checkPointInfo : filterConditionList) { + if (checkPointInfo.getCheckType() == OUTPUT_CODE) { + String outputKey = checkPointInfo.getCheckObj(); + Object value = attachments.get(outputKey); + //取不到上游值,直接抛出不匹配 + if (value == null) { + checkFilterConditionRes.setMatch(false); + return checkFilterConditionRes; + } + try { + //若取值比较不满足,直接抛出不匹配 + if (!checkOutput(value, checkPointInfo.getCheckCondition(), checkPointInfo.getCheckContent())){ + ok.set(false); + break; + } + } catch (Exception e) { + ok.set(false); + break; + } + } + } + //满足所有条件,需要过滤该接口 + if (ok.get()) { + checkFilterConditionRes.setMatch(ok.get()); + checkFilterConditionRes.setTriggerFilterCondition(gson.toJson(filterConditionList)); + } + return checkFilterConditionRes; + } + + /** + * 是否满足检查点规则 http + */ + public static CheckPointInfo checkPointSatisfyHttp(List outputParams, List checkPointInfos, HttpResult res) { + if (checkPointInfos == null || checkPointInfos.size() == 0) { + return null; + } + AtomicBoolean ok = new AtomicBoolean(true); + for (CheckPointInfo checkPointInfo : + checkPointInfos) { + switch (checkPointInfo.getCheckType()) { + case STATUS_CODE -> + ok.set(checkStatusCode(res.code, checkPointInfo.getCheckCondition(), checkPointInfo.getCheckContent())); + case HEADER_CODE -> { + String headerValue = res.getHeader(checkPointInfo.getCheckObj()); + ok.set(checkHeader(checkPointInfo.getCheckObj(), checkPointInfo.getCheckCondition(), headerValue)); + } + case OUTPUT_CODE -> { + String outputKey = checkPointInfo.getCheckObj(); + OutputParam opParam = outputParams.stream().filter(outputParam -> outputParam.getParamName().equals(outputKey)).findFirst().get(); + Object value; + try { + if (opParam.getOrigin() == OutputOriginEnum.BODY_TXT.code) { + value = res.content; + } else { + if (opParam.getParseExpr().contains("|")) { + //存在该标识符说明为list中取值 + //表达式 例如:params.json().get(data).get(goodIds)|0.string + try { + String[] exprArr = opParam.getParseExpr().split("\\|", 2); + value = Expr.params(res.content, exprArr[0]); + JsonArray valList = (JsonArray) value; + if (exprArr[1].contains(".")) { + String[] indexAndType = exprArr[1].split("\\.", 2); + value = Util.getListValByType(valList, Integer.parseInt(indexAndType[0]), indexAndType[1]); + } else { + value = valList.get(Integer.parseInt(exprArr[1])); + } + } catch (Exception e) { + value = ""; + log.error("http check point parse get list val error,expr:{},cause by:{}", opParam.getParseExpr(), e.getMessage()); + } + } else { + value = Expr.params(res.content, opParam.getParseExpr()); + } + } + ok.set(checkOutput(value, checkPointInfo.getCheckCondition(), checkPointInfo.getCheckContent())); + } catch (Exception e) { + ok.set(false); + } + } + } + if (!ok.get()) { + //一个不满足即错误 + CheckPointInfo triggerCp = new CheckPointInfo(); + BeanUtils.copyProperties(checkPointInfo, triggerCp); + return triggerCp; + } + } + return null; + } + + /** + * 取值比较 + * @param opValue 上游实际值 + * @param condition 比较条件 + * @param targetStr 目标值 + */ + public static boolean checkOutput(Object opValue, int condition, String targetStr) { + String v = opValue.toString(); + String[] targetStrArr; + if (targetStr.contains("|")) { + targetStrArr = targetStr.split("\\|"); + } else { + targetStrArr = new String[]{targetStr}; + } + boolean match = false; + + switch (condition) { + case EQ -> { + //= + for (String s : targetStrArr) { + if (v.equals(s)) { + match = true; + break; + } + } + } + case NOT_EQ -> { + //!= + for (String s : targetStrArr) { + if (!v.equals(s)) { + match = true; + break; + } + } + } + case BIGGER -> { + // > + for (String s : targetStrArr) { + if ((Integer.parseInt(v) > Integer.parseInt(s))) { + match = true; + break; + } + } + } + case BIGGER_AND_EQ -> { + // >= + for (String s : targetStrArr) { + if ((Integer.parseInt(v) >= Integer.parseInt(s))) { + match = true; + break; + } + } + } + case SMLLER -> { + // < + for (String s : targetStrArr) { + if ((Integer.parseInt(v) < Integer.parseInt(s))) { + match = true; + break; + } + } + } + case SMALLER_AND_EQ -> { + // <= + for (String s : targetStrArr) { + if ((Integer.parseInt(v) <= Integer.parseInt(s))) { + match = true; + break; + } + } + } + case CONTAIN -> { + //包含 + for (String s : targetStrArr) { + if (v.contains(s)) { + match = true; + break; + } + } + } + case NOT_CONTAIN -> { + //不包含 + for (String s : targetStrArr) { + if (!v.contains(s)) { + match = true; + break; + } + } + } + } + return match; + } + + public static boolean checkStatusCode(int httpStatus, int condition, String targetStr) { + + String[] targetStrArr; + if (targetStr.contains("|")) { + targetStrArr = targetStr.split("\\|"); + } else { + targetStrArr = new String[]{targetStr}; + } + boolean match = false; + + switch (condition) { + case EQ -> { + //= + for (String target : targetStrArr) { + if (httpStatus == Integer.parseInt(target)) { + match = true; + break; + } + } + } + case NOT_EQ -> { + //= + for (String target : targetStrArr) { + if (httpStatus != Integer.parseInt(target)) { + match = true; + break; + } + } + } + case BIGGER -> { + // > + for (String target : targetStrArr) { + if ((httpStatus > Integer.parseInt(target))) { + match = true; + break; + } + } + } + case BIGGER_AND_EQ -> { + // >= + for (String target : targetStrArr) { + if ((httpStatus >= Integer.parseInt(target))) { + match = true; + break; + } + } + } + case SMLLER -> { + // < + for (String target : targetStrArr) { + if ((httpStatus < Integer.parseInt(target))) { + match = true; + break; + } + } + } + case SMALLER_AND_EQ -> { + // <= + for (String target : targetStrArr) { + if ((httpStatus <= Integer.parseInt(target))) { + match = true; + break; + } + } + } + case CONTAIN -> { + //包含 + String statusCodeStr = String.valueOf(httpStatus); + for (String target : targetStrArr) { + if (statusCodeStr.contains(target)) { + match = true; + break; + } + } + } + case NOT_CONTAIN -> { + //不包含 + String statusCodeStr = String.valueOf(httpStatus); + for (String target : targetStrArr) { + if (!statusCodeStr.contains(target)) { + match = true; + break; + } + } + } + } + return match; + } + + public static boolean checkHeader(String headerVal, int condition, String targetStr) { + + String[] targetStrArr; + if (targetStr.contains("|")) { + targetStrArr = targetStr.split("\\|"); + } else { + targetStrArr = new String[]{targetStr}; + } + boolean match = false; + + switch (condition) { + case EQ -> { + //= + for (String target : targetStrArr) { + if (headerVal.equals(target)) { + match = true; + break; + } + } + } + case NOT_EQ -> { + //= + for (String target : targetStrArr) { + if (!headerVal.equals(target)) { + match = true; + break; + } + } + } + case CONTAIN -> { + //包含 + for (String target : targetStrArr) { + if (headerVal.contains(target)) { + match = true; + break; + } + } + } + case NOT_CONTAIN -> { + //不包含 + for (String target : targetStrArr) { + if (!headerVal.contains(target)) { + match = true; + break; + } + } + } + } + return match; + } + + public static void recordLossConnCount(SceneTotalCountContext totalCountContext) { +// 总请求次数+1 +// totalCountContext.getTotalReq().increment(); + //总丢失连接次数+1 + totalCountContext.getLossConnNum().increment(); + } + + /** + * 统计记录接口rt数据 + */ + public static void recordApiRtAndCount(int apiId, long rt, boolean success, SceneTotalCountContext totalCountContext, boolean recordTps) { + + //tps 请求数+1 + if (recordTps) { + totalCountContext.getTmpTpsCounter().increment(); + totalCountContext.getTotalTCount().increment(); + } + + ConcurrentHashMap>> apiRtAndTpsMap = totalCountContext.getApiRtMap(); + if (!apiRtAndTpsMap.containsKey(apiId)) { + //首次执行该接口 + ConcurrentHashMap> map = new ConcurrentHashMap<>(); + CopyOnWriteArrayList rtList = new CopyOnWriteArrayList<>(); + rtList.add((int) rt); + map.put(RT_LIST, rtList); + apiRtAndTpsMap.put(apiId, map); + + } else { + //已存在该接口记录,相关rt记录必然已初始化 + apiRtAndTpsMap.get(apiId).get(RT_LIST).add((int) rt); + } + + //接口请求次数统计 实际上是tps + ConcurrentHashMap> apiCountMap = totalCountContext.getApiCountMap(); + //总数+1 + if (apiCountMap.get(apiId) == null) { + log.error("api Id API_REQ_TOTAL_T is null:{}", apiId); + } else { + if (recordTps) { + apiCountMap.get(apiId).get(API_REQ_TOTAL_T).increment(); + } + if (success) { + apiCountMap.get(apiId).get(API_REQ_SUCC).increment(); + } else { + apiCountMap.get(apiId).get(API_REQ_FAIL).increment(); + } + } + } + + public static void recordRpsCount(int apiId, SceneTotalCountContext totalCountContext) { + //总次数+1 + //tps 请求数+1 + totalCountContext.getTmpRpsCounter().increment(); + + totalCountContext.getTotalReq().increment(); + //接口请求次数统计 实际上是rps + ConcurrentHashMap> apiCountMap = totalCountContext.getApiCountMap(); + if (!apiCountMap.containsKey(apiId)) { + //首次统计该接口 + ConcurrentHashMap map = new ConcurrentHashMap<>(); + LongAdder total = new LongAdder(); + total.increment(); + map.put(API_REQ_TOTAL_R, total); + map.put(API_REQ_TOTAL_T, new LongAdder()); + map.put(API_REQ_SUCC, new LongAdder()); + map.put(API_REQ_FAIL, new LongAdder()); + + apiCountMap.put(apiId, map); + } else { + //总数+1 + apiCountMap.get(apiId).get(API_REQ_TOTAL_R).increment(); + } + } + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/common/Safe.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/common/Safe.java new file mode 100644 index 000000000..448c048ab --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/common/Safe.java @@ -0,0 +1,44 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.common; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author goodjava@qq.com + * @date 2022/5/19 + */ +public class Safe { + + private static final Logger log = LoggerFactory.getLogger(Safe.class); + + public interface ExRunnable { + void run() throws Throwable; + + } + + + public static void run(ExRunnable runnable) { + try { + runnable.run(); + } catch (Throwable ex) { + log.error(ex.getMessage()); + } + } + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/common/TraceUtil.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/common/TraceUtil.java new file mode 100644 index 000000000..4dcf08724 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/common/TraceUtil.java @@ -0,0 +1,30 @@ +package run.mone.mimeter.engine.common; + +import java.util.concurrent.ThreadLocalRandom; + +public class TraceUtil { + static String traceString = "0123456789abcdef"; + + public static String traceId() { + ThreadLocalRandom random = ThreadLocalRandom.current(); + char[] chars = new char[32]; + chars[0] = 'f'; + chars[1] = 'f'; + chars[2] = '8'; + chars[3] = '8'; + for (int i = 4; i < 32; i++) { + chars[i] = traceString.charAt(random.nextInt(16)); + } + return new String(chars); + } + + public static String spanId() { + ThreadLocalRandom random = ThreadLocalRandom.current(); + char[] chars = new char[16]; + for (int i = 0; i < 16; i++) { + chars[i] = traceString.charAt(random.nextInt(16)); + } + return new String(chars); + } + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/event/EventProcessor.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/event/EventProcessor.java new file mode 100644 index 000000000..55a500402 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/event/EventProcessor.java @@ -0,0 +1,82 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.event; + +import com.google.common.eventbus.Subscribe; +import com.xiaomi.data.push.rpc.RpcClient; +import com.xiaomi.data.push.rpc.protocol.RemotingCommand; +import com.xiaomi.youpin.docean.anno.Component; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import run.mone.mimeter.engine.agent.bo.MibenchCmd; +import run.mone.mimeter.engine.agent.bo.data.AgentReq; +import run.mone.mimeter.engine.agent.bo.stat.SceneTotalCountContextDTO; +import run.mone.mimeter.engine.agent.bo.task.TaskResult; +import run.mone.mimeter.engine.agent.bo.task.TaskStatusBo; + +import javax.annotation.Resource; + +/** + * @author goodjava@qq.com + * @author dongzhenxing + * @date 2022/5/19 + */ +@Component +public class EventProcessor { + + private static final Logger log = LoggerFactory.getLogger(EventProcessor.class); + + @Resource(name = "rpcClient") + private RpcClient rpcClient; + + @Subscribe + public void taskResultCallback(TaskResult tr) { + log.info("tr id:{} success:{} failue:{}", tr.getId(), tr.getSuccess().get(), tr.getFailure().get()); + AgentReq ar = new AgentReq(); + ar.setTaskResult(tr); + ar.setCmd(AgentReq.TASK_RESULT_CMD); + try { + rpcClient.sendMessage(RemotingCommand.createGsonRequestCommand(MibenchCmd.MANAGER, ar)); + } catch (Exception e) { + log.error("taskResultCallback failed,reportId:{},cause by:{}",tr.getReportId(),e.getMessage()); + } + } + + @Subscribe + public void taskTotalContextCallback(SceneTotalCountContextDTO totalCountContextDTO) { + AgentReq ar = new AgentReq(); + ar.setTotalCountContextDTO(totalCountContextDTO); + ar.setCmd(AgentReq.TOTAL_DATA_COUNT_CMD); + try { + rpcClient.sendMessage(RemotingCommand.createGsonRequestCommand(MibenchCmd.MANAGER, ar)); + } catch (Exception e) { + log.error("taskTotalContextCallback failed,reportId:{},cause by:{}",totalCountContextDTO.getReportId(),e.getMessage()); + } + } + + @Subscribe + public void taskStatusCallback(TaskStatusBo taskStatusBo) { + AgentReq ar = new AgentReq(); + ar.setStatusBo(taskStatusBo); + ar.setCmd(AgentReq.UP_TASK_STATUS); + try { + rpcClient.sendMessage(RemotingCommand.createGsonRequestCommand(MibenchCmd.MANAGER, ar)); + } catch (Exception e) { + log.error("taskStatusCallback failed,tasktId:{},cause by:{}",taskStatusBo.getTaskId(),e.getMessage()); + } + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/common/BasePostFilter.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/common/BasePostFilter.java new file mode 100644 index 000000000..dbb8e394c --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/common/BasePostFilter.java @@ -0,0 +1,10 @@ +package run.mone.mimeter.engine.filter.common; + +import run.mone.mimeter.engine.agent.bo.task.Task; + +/** + * @author dongzhenxing + */ +public interface BasePostFilter { + Object doFilter(Task task, Object object); +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/common/BasePreFilter.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/common/BasePreFilter.java new file mode 100644 index 000000000..ed9442db7 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/common/BasePreFilter.java @@ -0,0 +1,13 @@ +package run.mone.mimeter.engine.filter.common; + +import run.mone.mimeter.engine.agent.bo.data.CommonReqInfo; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskContext; + +/** + * @author dongzhenxing + */ +public interface BasePreFilter { + CommonReqInfo doFilter(Task task, TaskContext context,CommonReqInfo commonReqInfo); + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/common/FilterOrder.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/common/FilterOrder.java new file mode 100644 index 000000000..3bccbf922 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/common/FilterOrder.java @@ -0,0 +1,15 @@ +package run.mone.mimeter.engine.filter.common; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author dongzhenxing + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE}) +public @interface FilterOrder { + int value(); +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/common/MimeterFilterInfo.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/common/MimeterFilterInfo.java new file mode 100644 index 000000000..0ea9acf05 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/common/MimeterFilterInfo.java @@ -0,0 +1,20 @@ +package run.mone.mimeter.engine.filter.common; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author dongzhenxing + */ +@Data +public class MimeterFilterInfo implements Serializable { + private String filterName; + private int order; + + /** + * 0 前置 + * 1 后置 + */ + private int type; +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/dto/BasicTrafficListDTO.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/dto/BasicTrafficListDTO.java new file mode 100644 index 000000000..29c9941f5 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/dto/BasicTrafficListDTO.java @@ -0,0 +1,30 @@ +/* + * Copyright 2020 XiaoMi. + * + * Licensed 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 the following link. + * + * 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. + */ +package run.mone.mimeter.engine.filter.dto; + +import com.xiaomi.youpin.tesla.traffic.recording.api.bo.traffic.BasicTrafficList; +import lombok.Data; + +import java.io.Serializable; +import java.util.concurrent.atomic.LongAdder; + +/** + * Created by dongzhenxing on 2023/3/7 4:45 PM + */ +@Data +public class BasicTrafficListDTO extends BasicTrafficList implements Serializable { + private LongAdder pointer = new LongAdder(); +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/postFilter/IPostFilterChain.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/postFilter/IPostFilterChain.java new file mode 100644 index 000000000..8588ca7b7 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/postFilter/IPostFilterChain.java @@ -0,0 +1,10 @@ +package run.mone.mimeter.engine.filter.postFilter; + +import run.mone.mimeter.engine.agent.bo.task.Task; + +/** + * @author dongzhenxing + */ +public interface IPostFilterChain { + Object doPostFilter(Task task, Object resInfo); +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/postFilter/PostFilter.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/postFilter/PostFilter.java new file mode 100644 index 000000000..d97648a91 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/postFilter/PostFilter.java @@ -0,0 +1,11 @@ +package run.mone.mimeter.engine.filter.postFilter; + +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.filter.common.BasePostFilter; + +/** + * @author dongzhenxing + */ +public abstract class PostFilter { + public abstract Object doFilter(Task task, Object res, BasePostFilter filter); +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/postFilter/PostFilterAnno.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/postFilter/PostFilterAnno.java new file mode 100644 index 000000000..2638e74fa --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/postFilter/PostFilterAnno.java @@ -0,0 +1,14 @@ +package run.mone.mimeter.engine.filter.postFilter; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author dongzhenxing + */ +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface PostFilterAnno { +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/postFilter/filters/Demo2PostFilter.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/postFilter/filters/Demo2PostFilter.java new file mode 100644 index 000000000..8b4df4a99 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/postFilter/filters/Demo2PostFilter.java @@ -0,0 +1,22 @@ +package run.mone.mimeter.engine.filter.postFilter.filters; + +import com.xiaomi.youpin.docean.anno.Component; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.filter.common.BasePostFilter; +import run.mone.mimeter.engine.filter.common.FilterOrder; +import run.mone.mimeter.engine.filter.postFilter.PostFilter; +import run.mone.mimeter.engine.filter.postFilter.PostFilterAnno; + +/** + * @author dongzhenxing + */ +@Component +@PostFilterAnno +@FilterOrder(2) +public class Demo2PostFilter extends PostFilter { + @Override + public Object doFilter(Task task, Object res, BasePostFilter filter) { + System.out.println(res.toString()); + return filter.doFilter(task,res); + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/postFilter/filters/DemoPostFilter.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/postFilter/filters/DemoPostFilter.java new file mode 100644 index 000000000..7cf86ec12 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/postFilter/filters/DemoPostFilter.java @@ -0,0 +1,22 @@ +package run.mone.mimeter.engine.filter.postFilter.filters; + +import com.xiaomi.youpin.docean.anno.Component; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.filter.common.BasePostFilter; +import run.mone.mimeter.engine.filter.common.FilterOrder; +import run.mone.mimeter.engine.filter.postFilter.PostFilter; +import run.mone.mimeter.engine.filter.postFilter.PostFilterAnno; + +/** + * @author dongzhenxing + */ +@Component +@PostFilterAnno +@FilterOrder(1) +public class DemoPostFilter extends PostFilter { + @Override + public Object doFilter(Task task, Object res, BasePostFilter filter) { + System.out.println(res.toString()); + return filter.doFilter(task,res); + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/postFilter/filters/MimeterPostFilter.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/postFilter/filters/MimeterPostFilter.java new file mode 100644 index 000000000..777ac4a28 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/postFilter/filters/MimeterPostFilter.java @@ -0,0 +1,16 @@ +package run.mone.mimeter.engine.filter.postFilter.filters; + +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.filter.common.BasePostFilter; + +/** + * @author dongzhenxing + */ +public class MimeterPostFilter implements BasePostFilter { + + @Override + public Object doFilter(Task task, Object object) { + System.out.println("MimeterPostFilter"); + return object; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/IPreFilterChain.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/IPreFilterChain.java new file mode 100644 index 000000000..34a3ad66c --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/IPreFilterChain.java @@ -0,0 +1,12 @@ +package run.mone.mimeter.engine.filter.preFilter; + +import run.mone.mimeter.engine.agent.bo.data.CommonReqInfo; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskContext; + +/** + * @author dongzhenxing + */ +public interface IPreFilterChain { + CommonReqInfo doPreFilter(Task task, TaskContext context,CommonReqInfo reqInfo); +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/PreFilter.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/PreFilter.java new file mode 100644 index 000000000..0c6c5a7ed --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/PreFilter.java @@ -0,0 +1,14 @@ +package run.mone.mimeter.engine.filter.preFilter; + +import run.mone.mimeter.engine.agent.bo.data.CommonReqInfo; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskContext; +import run.mone.mimeter.engine.filter.common.BasePreFilter; + +/** + * @author dongzhenxing + */ +public abstract class PreFilter { + public abstract CommonReqInfo doFilter(Task task, TaskContext context,CommonReqInfo commonReqInfo,BasePreFilter filter); + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/PreFilterAnno.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/PreFilterAnno.java new file mode 100644 index 000000000..bd1bd6dd4 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/PreFilterAnno.java @@ -0,0 +1,14 @@ +package run.mone.mimeter.engine.filter.preFilter; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author dongzhenxing + */ +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface PreFilterAnno { +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/filters/DagParamFilter.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/filters/DagParamFilter.java new file mode 100644 index 000000000..483a4ca79 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/filters/DagParamFilter.java @@ -0,0 +1,115 @@ +package run.mone.mimeter.engine.filter.preFilter.filters; + +import com.google.gson.Gson; +import com.xiaomi.youpin.docean.anno.Component; +import common.Replacer; +import common.Util; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.math.NumberUtils; +import run.mone.mimeter.engine.agent.bo.data.CommonReqInfo; +import run.mone.mimeter.engine.agent.bo.data.ParamType; +import run.mone.mimeter.engine.agent.bo.data.ParamTypeEnum; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskContext; +import run.mone.mimeter.engine.agent.bo.task.TaskType; +import run.mone.mimeter.engine.filter.common.BasePreFilter; +import run.mone.mimeter.engine.filter.common.FilterOrder; +import run.mone.mimeter.engine.filter.preFilter.PreFilter; +import run.mone.mimeter.engine.filter.preFilter.PreFilterAnno; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * @author dongzhenxing + * x5 Dag参数替换过滤器 + */ +@Component +@FilterOrder(1) +@PreFilterAnno +@Slf4j +public class DagParamFilter extends PreFilter { + + private static final Gson gson = Util.getGson(); + + @Override + public CommonReqInfo doFilter(Task task, TaskContext context, CommonReqInfo commonReqInfo, BasePreFilter filter) { + + //非http任务,直接略过 + if (task.getType() != TaskType.http && task.getType() != TaskType.dubbo) { + return filter.doFilter(task, context, commonReqInfo); + } + Map contextMap = context.getAttachments(); + //替换参数 + updateParam(task, commonReqInfo, contextMap); + return filter.doFilter(task, context, commonReqInfo); + } + + /** + * 用于上游节点接口动态更新本接口实际参数 + * + * @ paramIndex 参数索引位置 + * @ paramName 参数名 若paramName 为例:${name} 类型,则直接替换 + * @ value 上游传下来的实际参数值 + */ + private void updateParam(Task task, CommonReqInfo reqInfo, Map contextMap) { + if (contextMap.get("replacerMap") == null) { + return; + } + Map> replacerMap = (Map>) contextMap.get("replacerMap"); + replacerMap.values().forEach(replacers -> { + replacers.stream().filter(replacer -> replacer.getTaskId() == task.getId()).forEach(replacer -> { + if (replacer.getParamName().startsWith("${")) { + try { + //post请求 的 json参数 + String valStr = replacer.getValue().toString(); + + if (!replacer.isForceStr()) { + if (NumberUtils.isNumber(valStr)) { + if (isNumeric(valStr)) { + replacer.setValue(Long.parseLong(valStr)); + } else { + replacer.setValue(Double.parseDouble(valStr)); + } + } else { + replacer.setValue(valStr); + } + } + + reqInfo.setParamJson(Util.Parser.parse$(Util.getElKey(replacer.getParamName()).getKey(), reqInfo.getParamJson(), replacer.getValue())); + } catch (Exception e) { + log.error("updateParam param after,body:{},time:{},error:{}", reqInfo.getParamJson(), System.currentTimeMillis(), e); + } + } else { + if (task.getHttpData().getTypes().size() > replacer.getParamIndex()) { + ParamType type = task.getHttpData().getTypes().get(replacer.getParamIndex()); + //对象类型 + if (type.getTypeEnum().equals(ParamTypeEnum.pojo)) { + ConcurrentHashMap params = (ConcurrentHashMap) task.getHttpData().getParams().get(replacer.getParamIndex()); + params.put(replacer.getParamName(), replacer.getValue()); + } + //基本类型 + if (type.getTypeEnum().equals(ParamTypeEnum.primary)) { + task.getHttpData().getParams().set(replacer.getParamIndex(), replacer.getValue()); + } + reqInfo.setQueryParamMap(task.getHttpData().httpGetTmpParams(task.getHttpData().getParams())); + if (task.isDebug()) { + reqInfo.setParamJson(gson.toJson(reqInfo.getQueryParamMap())); + } + } + } + }); + }); + } + + private static boolean isNumeric(String str) { + for (int i = str.length(); --i >= 0; ) { + int chr = str.charAt(i); + if (chr < 48 || chr > 57) + return false; + } + return true; + } + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/filters/MimeterPreFilter.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/filters/MimeterPreFilter.java new file mode 100644 index 000000000..3c750bbcc --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/filters/MimeterPreFilter.java @@ -0,0 +1,18 @@ +package run.mone.mimeter.engine.filter.preFilter.filters; + +import run.mone.mimeter.engine.agent.bo.data.CommonReqInfo; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskContext; +import run.mone.mimeter.engine.filter.common.BasePreFilter; + +/** + * @author dongzhenxing + */ +public class MimeterPreFilter implements BasePreFilter { + @Override + public CommonReqInfo doFilter(Task task, TaskContext context, CommonReqInfo commonReqInfo) { + //默认 filter 原样返回 + return commonReqInfo; + } + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/filters/TrafficFilter.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/filters/TrafficFilter.java new file mode 100644 index 000000000..7f028a726 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/filters/TrafficFilter.java @@ -0,0 +1,111 @@ +package run.mone.mimeter.engine.filter.preFilter.filters; + +import com.google.gson.Gson; +import com.google.gson.JsonSyntaxException; +import com.google.gson.reflect.TypeToken; +import com.xiaomi.youpin.docean.anno.Component; +import com.xiaomi.youpin.tesla.traffic.recording.api.bo.traffic.BasicTraffic; +import com.xiaomi.youpin.tesla.traffic.recording.api.bo.traffic.BasicTrafficList; +import common.Util; +import lombok.extern.slf4j.Slf4j; +import run.mone.mimeter.engine.agent.bo.data.CommonReqInfo; +import run.mone.mimeter.engine.agent.bo.data.HttpData; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskContext; +import run.mone.mimeter.engine.agent.bo.task.TaskType; +import run.mone.mimeter.engine.filter.common.BasePreFilter; +import run.mone.mimeter.engine.filter.common.FilterOrder; +import run.mone.mimeter.engine.filter.dto.BasicTrafficListDTO; +import run.mone.mimeter.engine.filter.preFilter.PreFilter; +import run.mone.mimeter.engine.filter.preFilter.PreFilterAnno; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import static common.Const.HTTP_GET; +import static common.Const.HTTP_POST; + +/** + * @author dongzhenxing + * 录制流量参数过滤器 + */ +@Component +@FilterOrder(4) +@PreFilterAnno +@Slf4j +public class TrafficFilter extends PreFilter { + + public static final Gson gson = Util.getGson(); + + /** + * 用于暂存本 agent 当前所用的流量数据 + */ + private static final ConcurrentHashMap trafficCache = new ConcurrentHashMap<>(); + + @Override + public CommonReqInfo doFilter(Task task, TaskContext context,CommonReqInfo commonReqInfo, BasePreFilter filter) { + //非http任务或未启用流量数据,直接略过 + if (task.getType() != TaskType.http || !task.getHttpData().isEnableTraffic()) { + return filter.doFilter(task,context, commonReqInfo); + } + //启用流量数据,替换header、params + HttpData httpData = task.getHttpData(); + if (!trafficCache.containsKey(httpData.getTrafficConfId())) { + //没有缓存流量数据,直接略过 + return filter.doFilter(task,context, commonReqInfo); + } + BasicTrafficListDTO basicTrafficListDTO = trafficCache.get(httpData.getTrafficConfId()); + + //空数组,跳过 + if (basicTrafficListDTO.getList().size() == 0){ + return filter.doFilter(task,context, commonReqInfo); + } + + //取模,循环读取 + BasicTraffic traffic = basicTrafficListDTO.getList().get(basicTrafficListDTO.getPointer().intValue() % basicTrafficListDTO.getList().size()); + //取完后移动游标 + trafficCache.get(httpData.getTrafficConfId()).getPointer().add(1); + + //增加请求头 + commonReqInfo.getHeaders().putAll(traffic.getOriginHeaders()); + + //替换请求体 + if (httpData.getMethod().equalsIgnoreCase(HTTP_POST)) { + String originBody = traffic.getOrginBody(); + commonReqInfo.setParamJson(originBody); + } else if (httpData.getMethod().equalsIgnoreCase(HTTP_GET)) { + String originBody = traffic.getOriginQueryString(); + try { + Map queryMap = gson.fromJson(originBody, new TypeToken>() { + }.getType()); + commonReqInfo.setQueryParamMap(queryMap); + } catch (JsonSyntaxException e) { + log.error("TrafficFilter doFilter error query body"); + } + } + return filter.doFilter(task, context,commonReqInfo); + } + + /** + * 更新暂存加载到的traffic数据 + */ + public static void updateTrafficCache(List trafficLists) { + trafficLists.forEach(trafficList -> { + BasicTrafficListDTO dto = new BasicTrafficListDTO(); + dto.setRecordingConfigId(trafficList.getRecordingConfigId()); + dto.setList(trafficList.getList()); + dto.setPage(trafficList.getPage()); + dto.setPageSize(trafficList.getPageSize()); + dto.setTotal(trafficList.getTotal()); + trafficCache.put(trafficList.getRecordingConfigId(), dto); + }); + } + + /** + * 压测结束后清理流量数据缓存 + */ + public static void cleanTrafficCache(List trafficConfIdList) { + trafficConfIdList.forEach(trafficCache::remove); + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/filters/TspAuthFilter.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/filters/TspAuthFilter.java new file mode 100644 index 000000000..0ac5e2160 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/filters/TspAuthFilter.java @@ -0,0 +1,136 @@ +package run.mone.mimeter.engine.filter.preFilter.filters; + +import com.google.gson.Gson; +import com.google.gson.JsonSyntaxException; +import com.xiaomi.youpin.docean.anno.Component; +import common.Util; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.binary.Hex; +import run.mone.mimeter.engine.agent.bo.data.CommonReqInfo; +import run.mone.mimeter.engine.agent.bo.data.HttpData; +import run.mone.mimeter.engine.agent.bo.data.TspAuthInfoDTO; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskContext; +import run.mone.mimeter.engine.agent.bo.task.TaskType; +import run.mone.mimeter.engine.filter.common.BasePreFilter; +import run.mone.mimeter.engine.filter.common.FilterOrder; +import run.mone.mimeter.engine.filter.preFilter.PreFilter; +import run.mone.mimeter.engine.filter.preFilter.PreFilterAnno; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import static common.Const.*; +import static common.Const.CONTENT_TYPE_APP_FORM2; + +/** + * @author dongzhenxing + * 汽车部 tsp接口鉴权过滤器 + */ +@Component +@PreFilterAnno +@FilterOrder(1) +@Slf4j +public class TspAuthFilter extends PreFilter { + + private static final String ACCESS_KEY = "accesskey"; + + private static final String SIGNATURE = "signature"; + + private static final String TIMESTAMP = "timestamp"; + + public static final Gson gson = Util.getGson(); + + @Override + public CommonReqInfo doFilter(Task task, TaskContext context,CommonReqInfo commonReqInfo, BasePreFilter filter) { + HttpData httpData = task.getHttpData(); + if (task.getType() != TaskType.http || httpData == null) { + return filter.doFilter(task, context,commonReqInfo); + } + //非http启用该功能的接口任务,直接返回不做处理 + TspAuthInfoDTO tspAuth = httpData.getTspAuthInfoDTO(); + + if (tspAuth == null || !tspAuth.isEnableAuth()) { + return filter.doFilter(task, context, commonReqInfo); + } + + long now = System.currentTimeMillis(); + commonReqInfo.getHeaders().put(ACCESS_KEY, tspAuth.getAccessKey()); + commonReqInfo.getHeaders().put(SIGNATURE, genSignature(httpData, commonReqInfo, tspAuth.getAccessKey(), tspAuth.getSecretKey(), now)); + commonReqInfo.getHeaders().put(TIMESTAMP, String.valueOf(now)); + + return filter.doFilter(task, context, commonReqInfo); + } + + private String genSignature(HttpData httpData, CommonReqInfo reqInfo, String accessKey, String secretKey, long now) { + try { + MessageDigest sha512 = MessageDigest.getInstance("SHA-512"); + String tempStringSignature = accessKey + secretKey + now + string2Sign(httpData, reqInfo); + byte[] tempSignature = sha512.digest(tempStringSignature.getBytes()); + return String.valueOf(Hex.encodeHex(tempSignature)); + } catch (NoSuchAlgorithmException e) { + log.warn("TspAuthFilter genSignature failed:{}", e.getMessage()); + return ""; + } + } + + private String string2Sign(HttpData httpData, CommonReqInfo reqInfo) { + StringBuilder sign = new StringBuilder(); + String url = httpData.getUrl(); + String[] urlArr = url.split("//", 2); + url = urlArr[1]; + if (httpData.getMethod().equalsIgnoreCase(HTTP_GET)) { + //get请求 + if (!url.contains("/")) { + sign.append("/"); + } else { + sign.append(url.substring(url.indexOf("/"))); + } + sign.append('+').append("GET"); + Map paramAndValue = reqInfo.getQueryParamMap(); + List keyList = paramAndValue.keySet().stream().sorted(String::compareTo).toList(); + if (keyList.size() != 0) { + sign.append('+'); + } + for (int i = 0; i < keyList.size(); i++) { + sign.append(keyList.get(i).toLowerCase()).append("=").append(paramAndValue.get(keyList.get(i))); + if (i != keyList.size() - 1) { + sign.append("&"); + } + } + } else if (httpData.getMethod().equalsIgnoreCase(HTTP_POST)) { + //post请求 + TreeMap target = new TreeMap<>(); + if (!url.contains("/")) { + sign.append("/"); + } else { + sign.append(url.substring(url.indexOf("/"))); + } + sign.append('+').append("POST"); + + if (httpData.getContentType().equals(CONTENT_TYPE_APP_FORM) || httpData.getContentType().equals(CONTENT_TYPE_APP_FORM2)) { + Map paramAndValue = reqInfo.getQueryParamMap(); + //对 key 排序 + List keyList = paramAndValue.keySet().stream().sorted(String::compareTo).toList(); + if (keyList.size() != 0) { + sign.append('+'); + } + for (String s : keyList) { + target.put(s, paramAndValue.get(s)); + } + } else { + //json + try { + target = gson.fromJson(httpData.getPostParamJson(), TreeMap.class); + } catch (JsonSyntaxException e) { + log.warn("string2Sign gson.fromJson(httpData.getPostParamJson(),TreeMap.class) failed,cause :{}", e.getMessage()); + } + } + sign.append(gson.toJson(target)); + } + return sign.toString(); + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/filters/X5Filter.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/filters/X5Filter.java new file mode 100644 index 000000000..ab2e5149a --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/filter/preFilter/filters/X5Filter.java @@ -0,0 +1,114 @@ +package run.mone.mimeter.engine.filter.preFilter.filters; + +import com.google.common.base.Strings; +import com.google.gson.Gson; +import com.xiaomi.data.push.common.SafeRun; +import com.xiaomi.youpin.docean.anno.Component; +import common.Util; +import org.apache.commons.codec.Charsets; +import run.mone.mimeter.dashboard.bo.sceneapi.X5VersionEnum; +import run.mone.mimeter.engine.agent.bo.data.ApiX5InfoDTO; +import run.mone.mimeter.engine.agent.bo.data.CommonReqInfo; +import run.mone.mimeter.engine.agent.bo.data.HttpData; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskContext; +import run.mone.mimeter.engine.agent.bo.task.TaskType; +import run.mone.mimeter.engine.common.Safe; +import run.mone.mimeter.engine.filter.common.BasePreFilter; +import run.mone.mimeter.engine.filter.common.FilterOrder; +import run.mone.mimeter.engine.filter.preFilter.PreFilter; +import run.mone.mimeter.engine.filter.preFilter.PreFilterAnno; + +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.util.Base64; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * @author dongzhenxing + * x5 鉴权过滤器 + */ +@Component +@FilterOrder(2) +@PreFilterAnno +public class X5Filter extends PreFilter { + + private static final Gson gson = Util.getGson(); + + @Override + public CommonReqInfo doFilter(Task task, TaskContext context, CommonReqInfo commonReqInfo, BasePreFilter filter) { + + //非http任务,直接略过 + if (task.getType() != TaskType.http) { + return filter.doFilter(task,context, commonReqInfo); + } + HttpData httpData = task.getHttpData(); + //未开启x5 + if (httpData == null || httpData.getApiX5InfoDTO() == null || !httpData.getApiX5InfoDTO().isEnableX5()){ + return filter.doFilter(task,context,commonReqInfo); + } + //启用x5协议 + commonReqInfo.setParamJson(calculateAndReplaceX5Params(httpData.getApiX5InfoDTO(),commonReqInfo)); + return filter.doFilter(task, context,commonReqInfo); + } + + private String calculateAndReplaceX5Params(ApiX5InfoDTO x5InfoDTO,CommonReqInfo commonReqInfo){ + String x5Version = x5InfoDTO.getX5Version(); + Map body = new HashMap<>(); + SafeRun.run(() ->{ + Map x5Body = new HashMap<>(); + Map x5Header = new HashMap<>(); + x5Header.put("appid", x5InfoDTO.getAppId()); + if (!Strings.isNullOrEmpty(x5InfoDTO.getX5Method())) { + x5Header.put("method", x5InfoDTO.getX5Method()); + } + String sign = genSign(x5InfoDTO.getAppId(), commonReqInfo.getParamJson(), x5InfoDTO.getAppKey()); + x5Header.put("sign", sign); + x5Body.put("header", x5Header); + x5Body.put("body", commonReqInfo.getParamJson()); + String data = gson.toJson(x5Body); + body.put("data", Base64.getEncoder().encodeToString(data.getBytes(StandardCharsets.UTF_8))); + }); + + if (X5VersionEnum.CHINA_VERSION.version.equals(x5Version)) { + return gson.toJson(body); + } else if (X5VersionEnum.INFORMATION_VERISON.version.equals(x5Version)) { + return "\""+body.get("data")+"\""; //todo 临时修改,改造json进制转换== + } + return gson.toJson(body); + } + + + /** + * @param appId 应用id + * @param body 入参 + * @param appKey 密钥 secret + * @return 签名 + */ + private static String genSign(String appId, String body, String appKey) { + String str = appId + body + appKey; + StringBuilder md5CodeBuffer = new StringBuilder(); + try { + MessageDigest md5Digest = MessageDigest.getInstance("MD5"); + md5Digest.update(str.getBytes()); + byte[] strBytesDigest = md5Digest.digest(); + + // 将二进制字节信息转换为十六进制字符串 + String strHexDigest; + for (byte b : strBytesDigest) { + strHexDigest = Integer.toHexString(b & 0XFF); + if (strHexDigest.length() == 1) { + md5CodeBuffer.append("0").append(strHexDigest); + } else { + md5CodeBuffer.append(strHexDigest); + } + } + } catch (Exception e) { + return str; + } + + return md5CodeBuffer.toString().toUpperCase(); + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/service/BenchEngineService.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/service/BenchEngineService.java new file mode 100644 index 000000000..531d8213a --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/service/BenchEngineService.java @@ -0,0 +1,491 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.service; + +import com.google.common.base.Stopwatch; +import com.google.common.util.concurrent.RateLimiter; +import com.google.gson.Gson; +import com.xiaomi.youpin.docean.Ioc; +import com.xiaomi.youpin.docean.anno.Service; +import com.xiaomi.youpin.tesla.traffic.recording.api.service.TrafficDubboService; +import common.Const; +import common.Util; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import run.mone.event.Event; +import run.mone.mimeter.engine.agent.bo.data.*; +import run.mone.mimeter.engine.agent.bo.hosts.HostBo; +import run.mone.mimeter.engine.agent.bo.stat.SceneTotalCountContext; +import run.mone.mimeter.engine.client.base.IClient; +import run.mone.mimeter.engine.event.EventProcessor; +import run.mone.mimeter.engine.agent.bo.task.*; +import run.mone.mimeter.engine.filter.preFilter.filters.TrafficFilter; + +import javax.annotation.Resource; +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.LongAdder; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import static common.Const.*; +import static common.Util.*; + +/** + * @author goodjava@qq.com + * @date 2022/5/19 + */ +@Service +public class BenchEngineService { + + private static final Logger log = LoggerFactory.getLogger(BenchEngineService.class); + + private static final String logPrefix = "[BenchEngineService]"; + + private static final int LOG_SAMPLING_PERCENTAGE = 5; + + private static final int MIN_TASK_EXECUTION_TIME = 10; + + private static final int TIME_ONE_SECOND = 1000; + + private final Gson gson = Util.getGson(); + + @Resource + private Ioc ioc; + + @Resource + private EventProcessor eventProcessor; + + @Resource + private DataCountService dataCountService; + + @Resource + private DatasetService datasetService; + + private final ExecutorService pool = Executors.newVirtualThreadPerTaskExecutor(); + + private static final ConcurrentMap contextMap = new ConcurrentHashMap<>(); + + public void init() { + Event.ins().register(eventProcessor); + } + + public TaskResult submitTask(Context context, Task task) throws InterruptedException { + + Stopwatch dsw = Stopwatch.createStarted(); + + String logMsg = logPrefix + "submitTask "; + String logSuffix = ", task id: " + task.getId() + ", " + "scene id: " + task.getSceneId() + + ", submit type: " + task.getSubmitTaskType() + ", task type: " + task.getType().code + " "; + + TaskResult tr = initTaskResult(task, context); + + IClient client = getClient(task.getType()); + final int taskId = task.getId(); + + //分发任务前,加载,初始化参数、header数据源 + if (task.getType() == TaskType.dag) { + //参数数据源 + TreeMap> dataMap = new TreeMap<>(); + try { + dataMap = datasetService.loadAndInitParamDataset(task); + log.debug("loadAndInitParamDataset data map :{}",gson.toJson(dataMap)); + } catch (Exception e) { + log.warn("load dataset error,e:{}", e.getMessage()); + } finally { + log.debug("task {} load dataset use time:{}", task.getId(), dsw.elapsed(TimeUnit.MILLISECONDS)); + } + task.setDataMap(dataMap); + + //流量参数数据源 + if (task.isEnableTraffic()){ + //若该链路开启流量参数使用 + datasetService.loadTrafficData(task); + } + } + + if (task.isDebug()) { + //单接口调试或场景调试 + log.info("debug task:{} begin", task.getId()); + Result res; + try { + res = singleDebugOnce(task, client); + tr.setCode(res.getCode()); + if (res.getData() != null) { + tr.setResult(res.getData().toString()); + } else { + tr.setResult("500 error"); + } + tr.setOk(res.isOk()); + if (res.getRespHeaders() != null) { + tr.setRespHeaders(res.getRespHeaders()); + } + if (!res.isOk() && res.getTriggerCp() != null) { + tr.setTriggerCpInfo(res.getTriggerCp()); + } + tr.setRt(res.getRt()); + tr.setSize(res.getSize()); + tr.getSuccess().incrementAndGet(); + + } catch (Throwable ex) { + tr.getFailure().incrementAndGet(); + tr.setCode(500); + tr.setOk(false); + tr.setResult(ex.getMessage()); + log.error(logMsg + "single debug error" + logSuffix, ex); + } finally { + //每次调试完需要清理数据 + pool.submit(() ->{ + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + log.error(logMsg + "single debug error" + logSuffix, e); + } + this.cleanLoadedDataCache(task); + }); + log.info("task:{} debug one finish use time:{}", taskId, dsw.elapsed(TimeUnit.SECONDS)); + } + } else { + //执行场景压测 + //更新任务状态 + notifyTaskRunning(taskId); + contextMap.put(task.getId(), tr); + if (task.getTime() == 0) { + task.setTime(MIN_TASK_EXECUTION_TIME); + } + + //总协程计数器 + LongAdder counter = new LongAdder(); + + //dag任务前缀标识 + AtomicInteger dagIndex = new AtomicInteger(); + + int qps = task.getQps(); + RateLimiter limiter = RateLimiter.create(qps); + int finalLogRate = (task.getLogRate() > 0 && task.getLogRate() <= 1000) ? task.getLogRate() : LOG_SAMPLING_PERCENTAGE; + Set logIndices = new HashSet<>(sampleByTimeAndQps(task.getTime(), qps, finalLogRate)); + + //数据记录统计初始化 + SceneTotalCountContext totalCountContext = initCountCtx(task); + + log.info(logMsg + "task begin qps:{} task time:{}" + logSuffix, task.getQps(), task.getTime()); + //每次j循环内都是1s + for (int j = 1; j <= task.getTime(); j++) { + Stopwatch sw = Stopwatch.createStarted(); + + int finalJ = j; + int curQps = qps; + // 手动命令控制 qps + if (context.getTaskQps() != 0){ + curQps = Util.calculateAgentRps(context.getTaskQps(), task.getAgentNum()); + } + if (curQps != 0) { + if (curQps != qps) { + logIndices.clear(); + logIndices.addAll(sampleByTimeAndQps(task.getTime(), curQps, finalLogRate)); + qps = curQps; + } + limiter.setRate(qps); + } + int finalQps = qps; + //当前该链路的实际rps + if (context.getTaskQps() != 0){ + totalCountContext.getDagTaskRps().setRps(context.getTaskQps()); + }else { + totalCountContext.getDagTaskRps().setRps(finalQps * task.getAgentNum()); + } + if (context.getRpsRate() != 0){ + totalCountContext.setRpsRate(context.getRpsRate()); + } + counter.add(finalQps); + log.debug(logMsg + "task begin final qps:{} task time:{}" + logSuffix, finalQps, task.getTime()); + IntStream.range(0, finalQps).forEach(i -> { + limiter.acquire(); + pool.submit(() -> { + TaskContext taskCtx = new TaskContext(); + taskCtx.setNum(dagIndex.incrementAndGet()); + taskCtx.getAttachments().put(TASK_CTX_RECORD_LOG, !logIndices.isEmpty() ? + logIndices.contains(((finalJ - 1) % 10) * finalQps + i) : judgeByRateLog(finalLogRate)); + taskCtx.getAttachments().put(TASK_CTX_LINE_FLAG, (finalJ - 1) * finalQps + i); + taskCtx.getAttachments().put(TASK_CTX_SCENE_QPS, task.getQps()); + try { + //只会是 dag 任务 + log.debug("context line flag: "+taskCtx.getAttachments().get(TASK_CTX_LINE_FLAG)); + Result res = client.call(task, taskCtx, null, totalCountContext); + int code = res.getCode(); + + //链路整体是否执行成功 + if (code == 0 || code == 200) { + tr.getSuccess().incrementAndGet(); + } else { + tr.getFailure().incrementAndGet(); + } + } catch (Throwable ex) { + tr.getFailure().incrementAndGet(); + log.error(logMsg + "---pool submit error, i: " + i + ", " + logSuffix + ex.getMessage()); + } finally { + counter.decrement(); + } + }); + }); + + long time = sw.elapsed(TimeUnit.MILLISECONDS); + if (time < TIME_ONE_SECOND) { + try { + TimeUnit.MILLISECONDS.sleep(TIME_ONE_SECOND - time); + } catch (Throwable ex) { + log.error(logMsg + "sleep error " + logSuffix + " error: " + ex.getMessage()); + } + while (limiter.tryAcquire()) { + //把剩余的令牌都拿走 + } + } + + //proms打点 + dataCountService.recordProms(totalCountContext.getTmpTpsCounter(), totalCountContext.getTmpRpsCounter(), task); + + //推送频率 10s一次 + if (j % PUSH_STAT_RATE == 0) { + dataCountService.pushTotalCountData(totalCountContext, false); + } + + //压测取消 + if (context.isCancel()) { + log.info(logMsg + "---------task is cancelled" + logSuffix); + // 手动结束通知 + tr.setQuitByManual(true); + tr.setCancelType(context.getCancelType()); + //退出阻塞 + counter.reset(); + break; + } + } + + //阻塞主线程直到所有调用结束 + this.aWait(counter); + + //任务结束最后一次把剩余数据都推送完成 + dataCountService.pushTotalCountData(totalCountContext, true); + + context.setFinish(true); + contextMap.remove(task.getId()); + + //压测结束清理缓存数据 + this.cleanLoadedDataCache(task); + + log.info(logMsg + "---------task has finished" + logSuffix); + } + //任务结果回调manager + tr.setAddr(task.getAddr()); + try { + Event.ins().post(tr); + } catch (Exception e) { + log.error("bench engine post finish failed:{}", e.getMessage()); + } + return tr; + } + + /** + * 阻塞主线程 + */ + private void aWait(LongAdder counter) throws InterruptedException { + //阻塞主线程直到所有调用结束 + while (counter.intValue() > 0) { + TimeUnit.MILLISECONDS.sleep(500); + } + } + + private TaskResult initTaskResult(Task task, Context context) { + TaskResult tr = new TaskResult(); + tr.setSceneId(task.getSceneId()); + tr.setDebug(task.isDebug()); + tr.setId(task.getId()); + tr.setReportId(task.getReportId()); + tr.setContext(context); + return tr; + } + + private SceneTotalCountContext initCountCtx(Task task) { + return SceneTotalCountContext.builder(). + reportId(task.getReportId()) + .sceneId(task.getSceneId()) + .sceneType(task.getSceneType().name()) + .taskId(task.getId()). + agentNum(task.getAgentNum()) + .dagTaskRps(task.getDagTaskRps()) + .rpsRate(task.getRpsRate()) + .connectTaskNum(task.getConnectTaskNum()) + .lastTime(false) + .totalReq(new LongAdder()) + .lossConnNum(new LongAdder()) + .totalTCount(new LongAdder()) + .totalSuccReq(new LongAdder()) + .totalErrReq(new LongAdder()) + .tmpRpsCounter(new LongAdder()) + .tmpTpsCounter(new LongAdder()) + .errCounterMap(new ConcurrentHashMap<>()) + .apiRtMap(new ConcurrentHashMap<>()) + .apiCountMap(new ConcurrentHashMap<>()) + .apiRpsMap(new ConcurrentHashMap<>()) + .apiTpsMap(new ConcurrentHashMap<>()).build(); + } + + private void notifyTaskRunning(int taskId) { + TaskStatusBo statusBo = new TaskStatusBo(); + statusBo.setTaskId(taskId); + statusBo.setTaskStatus(TaskStatus.Running); + Event.ins().post(statusBo); + } + + public void cancelTask(Task task) { + task.getIds().forEach(taskId -> { + TaskResult tr = contextMap.get(taskId); + if (tr != null) { + tr.setOpUser(task.getOpUser()); + Optional.of(tr).ifPresent(it -> it.getContext().setCancel(true)); + } + //更新任务状态 + TaskStatusBo statusBo = new TaskStatusBo(); + statusBo.setSceneId(task.getSceneId()); + statusBo.setTaskId(taskId); + statusBo.setTaskStatus(TaskStatus.Stopped); + Event.ins().post(statusBo); + }); + } + + /** + * 手动调速 + */ + public void changeTaskQps(ChangeQpsReq req) { + req.getDagTaskRpsList().forEach(dagTaskRps -> { + TaskResult tr = contextMap.get(dagTaskRps.getTaskId()); + Optional.ofNullable(tr).ifPresent(it -> { + it.getContext().setTaskQps(dagTaskRps.getRps()); + if (req.getRpsRate() != null){ + it.getContext().setRpsRate(req.getRpsRate()); + } + }); + }); + } + + + /** + * 加载 host 文件 + */ + public HostsFileResult loadHostsReq() { + HostsFileResult rt = new HostsFileResult(); + List hostsContent; + try { + hostsContent = HostsService.loadHostFile(); + } catch (Exception e) { + log.error("load hosts file from machine error:{}", e.getMessage()); + hostsContent = new ArrayList<>(); + } + rt.setHostsFile(gson.toJson(hostsContent)); + return rt; + } + + /** + * 修改更新host文件 + */ + public void editHostsFile(List hostReqList) { + + List hostBoList = new ArrayList<>(); + + hostReqList.forEach(hostReq -> { + HostBo hostBo = new HostBo(); + hostBo.setDomain(hostReq.getDomain()); + hostBo.setIp(hostReq.getIp()); + hostBoList.add(hostBo); + }); + + HostsService.updateHostConfig(hostBoList); + } + + /** + * 删除host文件配置 + */ + public void delHostsFile(List hostReqList) { + + List hostBoList = new ArrayList<>(); + + hostReqList.forEach(hostReq -> { + HostBo hostBo = new HostBo(); + hostBo.setDomain(hostReq.getDomain()); + hostBoList.add(hostBo); + }); + + HostsService.deleteDomainsConfig(hostBoList); + } + + private Result singleDebugOnce(Task task, IClient client) { + CommonReqInfo commonReqInfo = new CommonReqInfo(); + if (task.getType() != TaskType.dag) { + commonReqInfo = getDebugParam(task); + } + return client.call(task, new TaskContext(), commonReqInfo, new SceneTotalCountContext()); + } + + private CommonReqInfo getDebugParam(Task task) { + CommonReqInfo commonReqInfo = new CommonReqInfo(); + HttpData httpData = task.getHttpData(); + DubboData dubboData = task.getDubboData(); + if (task.getType() == TaskType.http) { + if (httpData.getMethod().equalsIgnoreCase(Const.HTTP_GET)) { + commonReqInfo.setParamsType(ReqParamType.Http_Get.code); +// commonReqInfo.setGetOrFormParamsList(httpData.getParams()); + commonReqInfo.setQueryParamMap(httpData.httpGetTmpParams(httpData.getParams())); + commonReqInfo.setParamJson(gson.toJson(httpData.httpGetParams())); + commonReqInfo.setHeaders(httpData.getHeaders()); + } else if (httpData.getMethod().equalsIgnoreCase(Const.HTTP_POST)) { + if (httpData.getContentType().equals(CONTENT_TYPE_APP_FORM) || httpData.getContentType().equals(CONTENT_TYPE_APP_FORM2)) { + commonReqInfo.setParamsType(ReqParamType.Http_Post_Form.code); +// commonReqInfo.setGetOrFormParamsList(httpData.getParams()); + commonReqInfo.setQueryParamMap(httpData.httpGetTmpParams(httpData.getParams())); + commonReqInfo.setParamJson(gson.toJson(httpData.httpGetParams())); + } else { + commonReqInfo.setParamsType(ReqParamType.Http_Post_Json.code); + commonReqInfo.setParamJson(httpData.getPostParamJson()); + } + commonReqInfo.setHeaders(httpData.getHeaders()); + } + } else if (task.getType() == TaskType.dubbo) { + commonReqInfo.setParamsType(ReqParamType.Dubbo.code); + commonReqInfo.setParamJson(dubboData.getRequestBody()); + } + return commonReqInfo; + } + + private void cleanLoadedDataCache(Task task){ + //清理文件数据源缓存 + pool.submit(() -> { + try { + datasetService.processDataMapCache(task); + } catch (InterruptedException e) { + log.error("cleanLoadedDataCache task has finished remove data cache error:{}", e.getMessage()); + } + }); + //清理流量数据缓存 + pool.submit(() -> TrafficFilter.cleanTrafficCache(task.getTrafficToPullConfList().getApiTrafficReqList().stream(). + map(PullApiTrafficReq::getTrafficConfigId).collect(Collectors.toList()))); + } + private IClient getClient(TaskType type) { + return ioc.getBean(type.name() + "MClient"); + } + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/service/DataCountService.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/service/DataCountService.java new file mode 100644 index 000000000..0657c9f43 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/service/DataCountService.java @@ -0,0 +1,191 @@ +package run.mone.mimeter.engine.service; + +import com.xiaomi.youpin.docean.anno.Service; +import common.Const; +import lombok.extern.slf4j.Slf4j; +import run.mone.event.Event; +import run.mone.mimeter.engine.agent.bo.task.HeraContextInfo; +import run.mone.mimeter.engine.agent.bo.stat.SceneTotalCountContext; +import run.mone.mimeter.engine.agent.bo.stat.SceneTotalCountContextDTO; +import run.mone.mimeter.engine.agent.bo.task.Task; + +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.LongAdder; + +import static common.Const.*; +import static common.Const.METRICS_TYPE_SCENE; +import static run.mone.mimeter.engine.agent.bo.stat.MetricLabelEnum.labelNameSlice; + +@Service +@Slf4j +public class DataCountService { + /** + * 增量统计数据推送 + */ + public void pushTotalCountData(SceneTotalCountContext totalCountContext, boolean lastTime) { + // 结束时最后推送一次统计数据 + if (lastTime) { + totalCountContext.setLastTime(true); + } else { + //兼容,tps不应该是数组了,目前忽略了最后一次剩余的统计 + recordCurTpsAndRps(totalCountContext); + } + try { + //推送数据统计事件 + SceneTotalCountContextDTO dto = copyToDTO(totalCountContext, lastTime); + Event.ins().post(dto); + } catch (Exception e) { + log.warn("push count data error:{}", e.getMessage()); + } + } + + /** + * do copy + */ + private SceneTotalCountContextDTO copyToDTO(SceneTotalCountContext totalCountContext, boolean last) { + SceneTotalCountContextDTO dto = new SceneTotalCountContextDTO(); + //copy 基本信息 + dto.setReportId(totalCountContext.getReportId()); + dto.setSceneId(totalCountContext.getSceneId()); + dto.setSceneType(totalCountContext.getSceneType()); + dto.setTaskId(totalCountContext.getTaskId()); + dto.setAgentNum(totalCountContext.getAgentNum()); + dto.setDagTaskRps(totalCountContext.getDagTaskRps()); + dto.setRpsRate(totalCountContext.getRpsRate()); + dto.setConnectTaskNum(totalCountContext.getConnectTaskNum()); + dto.setLastTime(totalCountContext.isLastTime()); + //copy 总请求数 + synchronized (totalCountContext.getTotalReq()) { + //请求总数 + dto.setTotalReq(totalCountContext.getTotalReq().longValue()); + totalCountContext.getTotalReq().reset(); + //总丢失连接数 + dto.setLossConnNum(totalCountContext.getLossConnNum().longValue()); + totalCountContext.getLossConnNum().reset(); + + //copy 总事务数数 + dto.setTotalTCount(totalCountContext.getTotalTCount().longValue()); + totalCountContext.getTotalTCount().reset(); + //copy 总成功数 + dto.setTotalSuccReq(totalCountContext.getTotalSuccReq().longValue()); + totalCountContext.getTotalSuccReq().reset(); + //copy 总错误数 + dto.setTotalErrReq(totalCountContext.getTotalErrReq().longValue()); + totalCountContext.getTotalErrReq().reset(); + } + + synchronized (totalCountContext.getErrCounterMap()) { + //copy 错误记录map + ConcurrentHashMap> tmpErrCounterMap = new ConcurrentHashMap<>(); + totalCountContext.getErrCounterMap().forEach((errFlag, map) -> { + ConcurrentHashMap subMap = new ConcurrentHashMap<>(); + map.forEach((apiId, adder) -> subMap.put(apiId, adder.longValue())); + tmpErrCounterMap.put(errFlag, subMap); + }); + dto.setCounterMap(tmpErrCounterMap); + if (last) { + totalCountContext.getErrCounterMap().clear(); + } else { + totalCountContext.getErrCounterMap().values().forEach(map -> map.forEach((apiId, value) -> value.reset())); + } + } + + synchronized (totalCountContext.getApiRtMap()) { + //copy rt记录的map + ConcurrentHashMap>> tmpApiRtAndTpsMap = new ConcurrentHashMap<>(); + totalCountContext.getApiRtMap().forEach((apiId, map) -> { + ConcurrentHashMap> subMap = new ConcurrentHashMap<>(); + map.forEach((labFlag, vList) -> subMap.put(labFlag, vList.stream().toList())); + tmpApiRtAndTpsMap.put(apiId, subMap); + }); + + dto.setApiRtMap(tmpApiRtAndTpsMap); + totalCountContext.getApiRtMap().clear(); + } + synchronized (totalCountContext.getApiCountMap()) { + //copy 接口级别统计次数 + ConcurrentHashMap> apiCountMap = new ConcurrentHashMap<>(); + totalCountContext.getApiCountMap().forEach((apiId, map) -> { + ConcurrentHashMap subMap = new ConcurrentHashMap<>(); + map.forEach((type, count) -> subMap.put(type, count.intValue())); + apiCountMap.put(apiId, subMap); + }); + dto.setApiCountMap(apiCountMap); + + if (last) { + totalCountContext.getApiCountMap().clear(); + } else { + totalCountContext.getApiCountMap().values().forEach(it -> { + it.get(API_REQ_TOTAL_T).reset(); + it.get(API_REQ_TOTAL_R).reset(); + it.get(API_REQ_SUCC).reset(); + it.get(API_REQ_FAIL).reset(); + }); + } + } + + synchronized (totalCountContext.getApiRpsMap()) { + //copy api Rps + ConcurrentHashMap apiRpsMap = new ConcurrentHashMap<>(); + totalCountContext.getApiRpsMap().forEach((apiId, avg10Rps) -> apiRpsMap.put(apiId, avg10Rps.intValue())); + dto.setApiRpsMap(apiRpsMap); + totalCountContext.getApiRpsMap().clear(); + } + synchronized (totalCountContext.getApiTpsMap()) { + //copy api Tps + ConcurrentHashMap apiTpsMap = new ConcurrentHashMap<>(); + totalCountContext.getApiTpsMap().forEach((apiId, avg10Tps) -> apiTpsMap.put(apiId, avg10Tps.intValue())); + dto.setApiTpsMap(apiTpsMap); + totalCountContext.getApiTpsMap().clear(); + } + + return dto; + } + + /** + * 计算暂存当前的apis 10s 内tps + */ + private void recordCurTpsAndRps(SceneTotalCountContext totalCountContext) { + totalCountContext.getApiCountMap().forEach((apiId, countMap) -> { + //计算10s 平均 tps + ConcurrentHashMap apiTpsMap = totalCountContext.getApiTpsMap(); + int avg10Tps = countMap.get(API_REQ_TOTAL_T).intValue() / PUSH_STAT_RATE; + if (!apiTpsMap.containsKey(apiId)) { + apiTpsMap.put(apiId, new AtomicInteger(avg10Tps)); + } else { + apiTpsMap.get(apiId).set(avg10Tps); + } + //计算10s 平均 rps + ConcurrentHashMap apiRpsMap = totalCountContext.getApiRpsMap(); + int avg10Rps = countMap.get(API_REQ_TOTAL_R).intValue() / PUSH_STAT_RATE; + if (!apiRpsMap.containsKey(apiId)) { + apiRpsMap.put(apiId, new AtomicInteger(avg10Rps)); + } else { + apiRpsMap.get(apiId).set(avg10Rps); + } + }); + } + + public void recordProms(LongAdder tpsCounter, LongAdder rpsCounter, Task task) { + HeraContextInfo heraContextInfo = task.getHeraContextInfo(); + long rps; + synchronized (rpsCounter) { + rps = rpsCounter.longValue(); + rpsCounter.reset(); + } + MetricsService.recordCounter(Const.METRICS_NAME_RPS, labelNameSlice(4), rps, + String.valueOf(heraContextInfo.getSceneId()), heraContextInfo.getTaskFlag(), String.valueOf(heraContextInfo.getSerialLinkId()), + METRICS_TYPE_SCENE); + + long tps; + synchronized (tpsCounter) { + tps = tpsCounter.longValue(); + tpsCounter.reset(); + } + MetricsService.recordCounter(Const.METRICS_NAME_TPS, labelNameSlice(4), tps, + String.valueOf(heraContextInfo.getSceneId()), heraContextInfo.getTaskFlag(), String.valueOf(heraContextInfo.getSerialLinkId()), + METRICS_TYPE_SCENE); + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/service/DatasetService.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/service/DatasetService.java new file mode 100644 index 000000000..3fec48a32 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/service/DatasetService.java @@ -0,0 +1,450 @@ +package run.mone.mimeter.engine.service; + +import com.google.common.base.Stopwatch; +import com.google.gson.Gson; +import com.xiaomi.youpin.docean.anno.Service; +import com.xiaomi.youpin.docean.common.Pair; +import com.xiaomi.youpin.tesla.traffic.recording.api.bo.traffic.BasicTrafficList; +import com.xiaomi.youpin.tesla.traffic.recording.api.bo.traffic.GetTrafficReq; +import com.xiaomi.youpin.tesla.traffic.recording.api.service.TrafficDubboService; +import common.Const; +import common.Util; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.math.NumberUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.dubbo.annotation.DubboReference; +import run.mone.mimeter.dashboard.bo.common.Result; +import run.mone.mimeter.dashboard.bo.dataset.DatasetLineNum; +import run.mone.mimeter.dashboard.bo.dataset.DatasetLinesReq; +import run.mone.mimeter.dashboard.service.DatasetInfoSercice; +import run.mone.mimeter.engine.agent.bo.data.DubboData; +import run.mone.mimeter.engine.agent.bo.data.HttpData; +import run.mone.mimeter.engine.agent.bo.data.CommonReqInfo; +import run.mone.mimeter.engine.agent.bo.data.ReqParamType; +import run.mone.mimeter.engine.agent.bo.task.PullApiTrafficReq; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskType; +import run.mone.mimeter.engine.bo.DataMapCache; +import run.mone.mimeter.engine.filter.preFilter.filters.TrafficFilter; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.IntStream; + +import static common.Const.*; + +/** + * 数据源服务 + */ +@Service +@Slf4j +public class DatasetService { + + private final Gson gson = Util.getGson(); + + private static final Pattern EL_PATTERN = Pattern.compile("\\$\\{([^}]*)}"); + + /** + * <"reportId",> + */ + private final ConcurrentHashMap datasetCache = new ConcurrentHashMap<>(); + + @DubboReference(check = false, group = "${mimeter.dashboard.dubbo.group}", version = "${mimeter.dashboard.dubbo.version}", interfaceClass = DatasetInfoSercice.class, timeout = 10000) + private DatasetInfoSercice datasetInfoSercice; + + @DubboReference(check = false, group = "${traffic.dubbo.group}", interfaceClass = TrafficDubboService.class, timeout = 10000) + private TrafficDubboService trafficDubboService; + + /** + * 加载录制的流量数据 + */ + public void loadTrafficData(Task task) { + try { + List pullApiTrafficReqs = task.getTrafficToPullConfList().getApiTrafficReqList(); + + //批量加载流量数据的请求列表 + List getTrafficReqList = new ArrayList<>(); + + pullApiTrafficReqs.forEach(pullApiTrafficReq -> { + GetTrafficReq getTrafficReq = new GetTrafficReq(); + getTrafficReq.setRecordingConfigId(pullApiTrafficReq.getTrafficConfigId()); + getTrafficReq.setUrl(pullApiTrafficReq.getUrl()); + getTrafficReq.setStartTime(pullApiTrafficReq.getFromTime()); + getTrafficReq.setEndTime(pullApiTrafficReq.getToTime()); + getTrafficReqList.add(getTrafficReq); + }); + //获取每个conf的流量记录条数 + Map confTrafficSizeMap = trafficDubboService.getTrafficRecordCountList(getTrafficReqList).getData(); + + //更新每个conf请求的拉取数据范围 + getTrafficReqList.forEach(getTrafficReq -> { + if (!confTrafficSizeMap.containsKey(getTrafficReq.getRecordingConfigId())) { + //must be bug + log.warn("load traffic size failed!"); + } else { + //该配置项当前筛选范围的流量总条数 + int totalSize = confTrafficSizeMap.get(getTrafficReq.getRecordingConfigId()); + //当前页数与大小根据压测机集群机器总数及本机器索引位置计算, + //例如 共5台发压机,流量总量10000,本机 index 为1,则page为2,pageSize为2000 + int page = task.getAgentIndex() + 1; + int pageSize = totalSize / task.getAgentNum(); + //最多允许 1w 行 + if (pageSize > AGENT_MAX_TRAFFIC_SIZE) { + pageSize = AGENT_MAX_TRAFFIC_SIZE; + } + getTrafficReq.setPage(page); + getTrafficReq.setPageSize(pageSize); + } + }); + //拉取具体流量数据列表 + List basicTrafficLists = trafficDubboService.getBasicTrafficList(getTrafficReqList).getData(); + + //更新filter内的缓存流量数据 + TrafficFilter.updateTrafficCache(basicTrafficLists); + } catch (Exception e) { + log.error("DatasetService loadTrafficData error:{}", e.getMessage()); + } + } + + public TreeMap> loadAndInitParamDataset(Task task) { + + if (datasetCache.get(task.getReportId()) != null && !task.isDebug()) { + return datasetCache.get(task.getReportId()).getDataMap(); + } else { + //每台发压机随机取一部分请求数据 + int agentNum = task.getAgentNum(); + + log.info("loadAndInitParamDataset agent num:{}",agentNum); + + //该机器索引位置 + int index = task.getAgentIndex(); + + log.info("loadAndInitParamDataset agent index:{}",index); + + List reqList = new ArrayList<>(); + // 从 dashboard 获取该场景下数据源文件名及对应行数 + List datasetLineNums = datasetInfoSercice.getLineNumBySceneId(task.getSceneId()).getData(); + log.info("loadAndInitParamDataset datasetLineNums :{}",gson.toJson(datasetLineNums)); + + datasetLineNums.forEach(datasetLineNum -> { + DatasetLinesReq req = new DatasetLinesReq(); + req.setDatasetId(datasetLineNum.getDatasetId()); + req.setFileUrl(datasetLineNum.getFileUrl()); + req.setFileKsKey(datasetLineNum.getFileKsKey()); + req.setDefaultParamName(datasetLineNum.getDefaultParamName()); + long lineNum = datasetLineNum.getFileRaw(); + if (datasetLineNum.getIgnoreFirstLine()) { + lineNum -= 1; + } + double range = (double) (lineNum / agentNum); + if (range < 1.0) { + range = 1.0; + } + if (isInt(range)) { + req.setFrom(index * (int) range); + req.setTo((index + 1) * (int) range); + } else { + req.setFrom(index * (int) range); + req.setTo((index + 1) * (int) range + 1); + } + + reqList.add(req); + }); + Stopwatch dsw = Stopwatch.createStarted(); + + Result>> dataRes; + try { + log.info("loadAndInitParamDataset getDatasetMap :{}",gson.toJson(reqList)); + + dataRes = datasetInfoSercice.getDatasetMap(reqList); + } catch (Exception e) { + log.error("getDatasetMap faild,cause by:{}", e.getMessage(),e); + return new TreeMap<>(); + } + log.debug("call dubbo data task {} load dataset use time:{}", task.getId(), dsw.elapsed(TimeUnit.MILLISECONDS)); + if (dataRes == null || dataRes.getData() == null || dataRes.getData().isEmpty()) { + log.error("get dataset error ,data is empty,reqList:{}", Arrays.toString(reqList.toArray())); + return new TreeMap<>(); + } + + //每次压测只拉取缓存一次 + if (!task.isDebug()) { + //调试任务直接拉取,不缓存 + datasetCache.putIfAbsent(task.getReportId(), new DataMapCache(new AtomicInteger(1), dataRes.getData())); + } + return dataRes.getData(); + } + } + + + /** + * 数据过大,二分切分重拉 + */ +// private void reverseAppendData(TreeMap> totalRes, List reqList, run.mone.mibench.dashboard.bo.common.Result>> dataRes) { +// if (dataRes.getCode() == Const.DUBBO_DATA_TOO_LONG_ERR_CODE) { +// List reqListFront = new ArrayList<>(); +// List reqListBack = new ArrayList<>(); +// +// for (DatasetLinesReq req : reqList) { +// DatasetLinesReq frontReq = new DatasetLinesReq(); +// BeanUtils.copyProperties(req, frontReq); +// DatasetLinesReq backReq = new DatasetLinesReq(); +// BeanUtils.copyProperties(req, backReq); +// +// int from = req.getFrom(); +// int to = req.getTo(); +// +// frontReq.setFrom(from); +// frontReq.setTo((to + from) / 2); +// reqListFront.add(frontReq); +// +// backReq.setFrom((to + from) / 2 + 1); +// backReq.setTo(to); +// reqListBack.add(backReq); +// } +// +// run.mone.mibench.dashboard.bo.common.Result>> dataResFront = datasetInfoSercice.getDatasetMap(reqListFront); +// reverseAppendData(totalRes, reqListFront, dataResFront); +// +// run.mone.mibench.dashboard.bo.common.Result>> dataResBack = datasetInfoSercice.getDatasetMap(reqListBack); +// reverseAppendData(totalRes, reqListBack, dataResBack); +// +// } else { +// TreeMap> tempData = dataRes.getData(); +// tempData.keySet().forEach(key -> { +// if (totalRes.containsKey(key)) { +// totalRes.get(key).addAll(tempData.get(key)); +// } else { +// totalRes.put(key, tempData.get(key)); +// } +// }); +// } +// } + + /** + * @param currentTask 当前任务 + * @param lineFlag 读取的行数 + */ + public CommonReqInfo processTaskParam(Task currentTask, int lineFlag, boolean isDebug) throws CloneNotSupportedException { + log.debug("processTaskParam lineFlag :{}, dataMap:{}",lineFlag,currentTask.getDataMap()); + + CommonReqInfo commonReqInfo = new CommonReqInfo(); + TreeMap> dataMap = currentTask.getDataMap(); + //替换数据源参数 + if (currentTask.getType() == TaskType.http) { + HttpData httpData = currentTask.getHttpData().clone(); + //替换路径参数 + if (httpData.getUrl().contains("${")) { + processDatasetUrl(httpData, dataMap, lineFlag); + } + commonReqInfo.setDebugUrl(httpData.getUrl()); + //http场景 + if (httpData.getMethod().equalsIgnoreCase(Const.HTTP_GET)) { + //get请求 + List tmpList = new ArrayList<>(httpData.getParamNum()); + IntStream.range(0, httpData.getParamNum()).forEach(i -> { + String paramValue = httpData.getParams().get(i).toString(); + tmpList.add(getValue(paramValue, dataMap, lineFlag)); + }); +// commonReqInfo.setGetOrFormParamsList(tmpList); + commonReqInfo.setQueryParamMap(httpData.httpGetTmpParams(tmpList)); + if (currentTask.isDebug()) { + commonReqInfo.setParamsType(ReqParamType.Http_Get.code); + commonReqInfo.setParamJson(gson.toJson(httpData.httpGetTmpParams(tmpList))); + } + } else if (httpData.getMethod().equalsIgnoreCase(Const.HTTP_POST)) { + if (httpData.getContentType().equals(CONTENT_TYPE_APP_FORM) || httpData.getContentType().equals(CONTENT_TYPE_APP_FORM2)) { + //post 表单,处理方式同get + List tmpList = new ArrayList<>(httpData.getParamNum()); + + IntStream.range(0, httpData.getParamNum()).forEach(i -> { + String paramValue = httpData.getParams().get(i).toString(); + tmpList.add(getValue(paramValue, dataMap, lineFlag)); + }); + commonReqInfo.setQueryParamMap(httpData.httpGetTmpParams(tmpList)); + if (currentTask.isDebug()) { + commonReqInfo.setParamsType(ReqParamType.Http_Post_Form.code); + commonReqInfo.setParamJson(gson.toJson(httpData.httpGetTmpParams(tmpList))); + } + } else { + //post json 先转json处理,后续考虑是否优化 + String body = httpData.getJsonParam().get(); +// if (currentTask.getHttpData().getUrl().contains("proretail-api.nr.mi.com/api/nstrade/mobile/customer/queryCustomerInfo")){ +// log.info("final before json body:{},time:{}", body, System.currentTimeMillis()); +// } +// 使用完成后恢复为源参数体 +// httpData.recoverJsonParam(); + Matcher m = EL_PATTERN.matcher(body); + while (m.find()) { + String expr = m.group(1); + Object targetV; + String v = getDataValue(expr, dataMap, lineFlag); + if (NumberUtils.isNumber(v)) { + if (isNumeric(v)) { + targetV = Long.parseLong(v); + } else { + targetV = Double.parseDouble(v); + } + } else { + targetV = v; + } +// log.info("final target v:{}", targetV); + if (targetV != null && StringUtils.isNotEmpty(targetV.toString())){ + body = Util.Parser.parse$(expr, body, targetV); + } + } +// log.info("final after json body:{}", body); + httpData.setPostParamJson(body); + commonReqInfo.setParamsType(ReqParamType.Http_Post_Json.code); + commonReqInfo.setParamJson(body); + } + } + //替换header参数 + Map tmpHeaders = new HashMap<>(); + for (Map.Entry headerMap : + httpData.getHeaders().entrySet()) { + tmpHeaders.put(headerMap.getKey(), getValue(headerMap.getValue(), dataMap, lineFlag)); + } + commonReqInfo.setHeaders(tmpHeaders); + } else if (currentTask.getType() == TaskType.dubbo) { + DubboData dubboData = currentTask.getDubboData(); + String body = dubboData.getJsonParam().get(); +// dubboData.recoverJsonParam(); + Matcher m = EL_PATTERN.matcher(body); + while (m.find()) { + String expr = m.group(1); + Object targetV; + String v = getDataValue(expr, dataMap, lineFlag); + if (NumberUtils.isNumber(v)) { + if (isNumeric(v)) { + targetV = Long.parseLong(v); + } else { + targetV = Double.parseDouble(v); + } + } else { + targetV = v; + } + if (targetV != null && StringUtils.isNotEmpty(targetV.toString())){ + body = Util.Parser.parse$(expr, body, targetV); + } + } + commonReqInfo.setParamsType(ReqParamType.Dubbo.code); + commonReqInfo.setParamJson(body); + } + return commonReqInfo; + } + + private void processDatasetUrl(HttpData httpData, TreeMap> dataMap, int n) { + if (dataMap == null) { + return; + } + String k; + String v = null; + String url = httpData.getUrl(); + String tmpUrl = url; + if (null != url && url.length() > 0) { + Matcher m = EL_PATTERN.matcher(url); + while (m.find()) { + try { + k = m.group(1); + if (dataMap.get(k) != null && dataMap.get(k).size() != 0) { + int line = n % dataMap.get(k).size(); + v = dataMap.get(k).get(line); + } + try { + if (v != null) { + tmpUrl = Util.Parser.parse$(k, tmpUrl, v); + } + } catch (Exception e) { + log.error("processDatasetUrl error,k:{}, v:{}, error:{}", k, v, e); + } + } catch (Exception e) { + log.error("processDatasetUrl 2 error, v:{}, error:{}", v, e); + } + } + } + httpData.setUrl(tmpUrl); + } + + private String getValue(String key, TreeMap> dataMap, int n) { + if (dataMap == null) { + return key; + } + //适配 ${key} 格式 + if (key.startsWith("${")) { + Pair pair = getElKey(key, dataMap, n); + return pair.getValue(); + } + return key; + } + + private static Pair getElKey(String key, TreeMap> dataMap, int n) { + String k = null; + String v = null; + if (null != key && key.length() > 0) { + Matcher m = EL_PATTERN.matcher(key); + + if (m.find()) { + k = m.group(1); + if (dataMap.get(k) != null && dataMap.get(k).size() != 0) { + int line = n % dataMap.get(k).size(); + v = dataMap.get(k).get(line); + } + } + } + if (v == null) { + v = k; + } + return Pair.of(k, v); + } + + private static String getDataValue(String key, TreeMap> dataMap, int n) { + log.debug("getDataValue lineFlag :{}, dataMap:{}",n,dataMap); + if (dataMap == null) { + return ""; + } + if (null != key && key.length() > 0) { + if (dataMap.get(key) == null) { + return ""; + } + log.debug("getDataValue size :{}",dataMap.get(key).size()); + + if (dataMap.get(key).size() != 0) { + int line = n % dataMap.get(key).size(); + log.debug("getDataValue line :{},val:{}",line,dataMap.get(key).get(line)); + + return dataMap.get(key).get(line); + } + } + return ""; + } + + public void processDataMapCache(Task task) throws InterruptedException { + if (datasetCache.get(task.getReportId()) != null) { + int currFinLinkNum = datasetCache.get(task.getReportId()).getCountFinLinkNum().addAndGet(1); + if (currFinLinkNum == task.getConnectTaskNum()) { + //最后一条链路完成,延迟100s清理该次压测的缓存数据源 + Thread.sleep(100 * 1000); + datasetCache.remove(task.getReportId()); + } + } + } + + private static boolean isInt(double num) { + return Math.abs(num - Math.round(num)) < Double.MIN_VALUE; + } + + public static boolean isNumeric(String str) { + for (int i = str.length(); --i >= 0; ) { + int chr = str.charAt(i); + if (chr < 48 || chr > 57) + return false; + } + return true; + } +} + diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/service/HostsService.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/service/HostsService.java new file mode 100644 index 000000000..0970b609e --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/service/HostsService.java @@ -0,0 +1,202 @@ +package run.mone.mimeter.engine.service; + +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import run.mone.mimeter.engine.agent.bo.hosts.HostBo; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; + +@Slf4j +public class HostsService { + + /** + * 获取host文件路径 + */ + public static String getHostFile() { + String fileName; + // 判断系统 + if ("linux".equalsIgnoreCase(System.getProperty("os.name")) || "Mac OS X".equalsIgnoreCase(System.getProperty("os.name"))) { + fileName = "/etc/hosts"; +// fileName = "/Users/dongzhenxing/Desktop/hosts"; + } else { + //不支持其他系统 + return ""; + } + return fileName; + } + + public static List loadHostFile() { + // Step1: 获取host文件 + String fileName = getHostFile(); + List hostFileDataLines = new ArrayList<>(); + try { + hostFileDataLines = FileUtils.readLines(new File(fileName)); + } catch (IOException e) { + log.error("Reading host file occurs error: " + e.getMessage()); + } + return (List) hostFileDataLines; + } + + /** + * 根据输入Domain,批量删除host文件中的host配置 + */ + public synchronized static boolean deleteDomainsConfig(List confList) { + if (confList == null || confList.size() == 0) { + return true; + } + confList.forEach(domainMap -> { + if (domainMap.getDomain() == null || domainMap.getDomain().trim().isEmpty()) { + throw new IllegalArgumentException("ERROR: ip & domain must be specified"); + } + }); + // Step1: 获取host文件 + String fileName = getHostFile(); + if (fileName.isEmpty()) { + throw new IllegalArgumentException("ERROR:get host file path failed"); + } + List hostFileDataLines; + try { + hostFileDataLines = FileUtils.readLines(new File(fileName)); + } catch (IOException e) { + log.error("Reading host file occurs error: " + e.getMessage()); + return false; + } + // Step2: 解析host文件,如果指定域名不存在,则Ignore,如果已经存在,则直接删除该行配置 + List newLinesList = new ArrayList<>(); + // 标识本次文件是否有更新,比如如果指定的IP和域名已经在host文件中存在,则不用再写文件 + AtomicBoolean updateFlag = new AtomicBoolean(false); + + List finalHostFile = (List) hostFileDataLines; + + confList.forEach(domainMap -> { + String domain = domainMap.getDomain(); + for (Object line : finalHostFile) { + String strLine = line.toString(); + // host文件中的空行或无效行,直接跳过 + if (StringUtils.isEmpty(strLine) || strLine.trim().equals("#")) { + continue; + } + // 如果没有被注释掉,则 + if (!strLine.trim().startsWith("#")) { + int index = strLine.toLowerCase().indexOf(domain.toLowerCase()); + // 如果行字符可以匹配上指定域名,则针对该行做操作 + if (index != -1) { + // 匹配到相同的域名,直接将整行数据干掉 + updateFlag.set(true); + continue; + } + } + // 如果没有匹配到,直接将当前行加入代码中 + newLinesList.add(strLine); + } + finalHostFile.clear(); + finalHostFile.addAll(newLinesList); + newLinesList.clear(); + }); + //Step3: 将更新后的数据写入host文件中去 + if (updateFlag.get()) { + try { + FileUtils.writeLines(new File(fileName), finalHostFile); + } catch (IOException e) { + log.error("Updating host file occurs error: " + e.getMessage()); + return false; + } + } + return true; + } + + /** + * 根据输入IP和Domain,更新host文件中的某个host配置 + */ + public synchronized static boolean updateHostConfig(List confList) { + if (confList == null || confList.size() == 0) { + return true; + } + // Step1: 获取host文件 + String fileName = getHostFile(); + List hostFileDataLines; + List finalHostFile; + try { + hostFileDataLines = FileUtils.readLines(new File(fileName)); + } catch (IOException e) { + log.error("Reading host file occurs error: " + e.getMessage()); + return false; + } + finalHostFile = (List) hostFileDataLines; + //Step2: 解析host文件,如果指定域名不存在,则追加,如果已经存在,则修改IP进行保存 + List newLinesList = new ArrayList<>(); + // 指定domain是否存在,如果存在,则不追加 + final boolean[] findFlag = {false}; + // 标识本次文件是否有更新,比如如果指定的IP和域名已经在host文件中存在,则不用再写文件 + final AtomicBoolean[] updateFlag = {new AtomicBoolean(false)}; + List finalHostFile1 = finalHostFile; + confList.forEach(domainMap -> { + for (Object line : finalHostFile1) { + String strLine = line.toString(); + // 将host文件中的空行或无效行,直接去掉 + if (StringUtils.isEmpty(strLine) || strLine.trim().equals("#")) { + continue; + } + if (!strLine.startsWith("#")) { + int index = strLine.toLowerCase().indexOf(domainMap.getDomain().toLowerCase()); + // 如果行字符可以匹配上指定域名,则针对该行做操作 + if (index != -1) { + // 如果之前已经找到过一条,则说明当前line的域名已重复, + // 故删除当前line, 不将该条数据放到newLinesList中去 + if (findFlag[0]) { + updateFlag[0].set(true); + continue; + } + // 否则,继续寻找 + String[] array = strLine.trim().split(" "); + //遍历域名 + for (int i = 1; i < array.length; i++) { + if (domainMap.getDomain().equalsIgnoreCase(array[i])) { + findFlag[0] = true; + // IP相同,则不更新该条数据,直接将数据放到newLinesList中去 + if (!array[0].equals(domainMap.getIp())) { + // IP不同,将匹配上的domain的ip 更新成设定好的IP地址 + StringBuilder sb = new StringBuilder(); + sb.append(domainMap.getIp()); + for (int j = 1; i < array.length; i++) { + //array[j] 域名 + sb.append(" ").append(array[j]); + } + strLine = sb.toString(); + updateFlag[0].set(true); + } + } + } + } + } + // 如果有更新,则会直接更新到strLine中去 + // 故这里直接将strLine赋值给newLinesList + newLinesList.add(strLine); + } + // Step3: 如果没有任何Host域名匹配上,则追加 + if (!findFlag[0]) { + newLinesList.add(domainMap.getIp() + " " + domainMap.getDomain()); + } + finalHostFile1.clear(); + finalHostFile1.addAll(newLinesList); + newLinesList.clear(); + findFlag[0] = false; + }); + + //Step4: 写设定文件 + if (updateFlag[0].get() || !findFlag[0]) { + try { + FileUtils.writeLines(new File(fileName), finalHostFile1); + } catch (IOException e) { + log.error("Updating host file occurs error: " + e.getMessage()); + return false; + } + } + return true; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/service/LoggerBuilder.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/service/LoggerBuilder.java new file mode 100644 index 000000000..7fc26f0c9 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/service/LoggerBuilder.java @@ -0,0 +1,26 @@ +package run.mone.mimeter.engine.service; + +import com.xiaomi.sautumn.api.bo.ResourceKey; +import com.xiaomi.sautumn.api.bo.ResourceType; +import com.xiaomi.sautumn.api.service.ResourceService; +import com.xiaomi.youpin.docean.anno.Component; +import lombok.Data; +import org.slf4j.Logger; + +import javax.annotation.Resource; + +@Component +@Data +public class LoggerBuilder { + + @Resource + private ResourceService resourceService; + + private Logger logger; + + public void init(){ + ResourceKey customLogKey = new ResourceKey("customLogKey", ResourceType.customLog); + logger = resourceService.getResource(customLogKey); + } + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/service/MetricsService.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/service/MetricsService.java new file mode 100644 index 000000000..25ee6f642 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/main/java/run/mone/mimeter/engine/service/MetricsService.java @@ -0,0 +1,130 @@ +package run.mone.mimeter.engine.service; + +import com.google.common.collect.Sets; +import com.xiaomi.youpin.docean.anno.Service; +import com.xiaomi.youpin.prometheus.client.Metrics; +import io.prometheus.client.Collector; +import io.prometheus.client.CollectorRegistry; +import io.prometheus.client.exporter.common.TextFormat; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.io.StringWriter; +import java.util.*; + +import static com.google.common.base.Preconditions.checkArgument; +import static common.Const.*; +import static run.mone.mimeter.engine.agent.bo.stat.MetricLabelEnum.getLabelApiRpsNames; +import static run.mone.mimeter.engine.agent.bo.stat.MetricLabelEnum.getLabelNames; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/7/25 + */ +@Service +public class MetricsService { + + private static final String logPrefix = "[MetricsService]"; + + private static final Logger log = LoggerFactory.getLogger(MetricsService.class); + + private CollectorRegistry defaultRegistry; + + public void init() { + this.defaultRegistry = CollectorRegistry.defaultRegistry; + } + + public String metrics() { + return this.metrics(this.defaultRegistry); + } + + private String metrics(CollectorRegistry registry) { + List list = new ArrayList<>(); + Enumeration samples = registry.filteredMetricFamilySamples(Sets.newHashSet(list)); + StringWriter writer = new StringWriter(); + String str = ""; + + try { + TextFormat.write004(writer, samples); + StringBuffer sb = writer.getBuffer(); + str = sb.toString(); + } catch (IOException e) { + log.error(logPrefix + "metrics writer buffer error", e); + } + return str; + } + + private static void validate(String metricName, long value, String[] labelNames) { + checkArgument(value >= 0, logPrefix + "record invalid value"); + checkArgument(StringUtils.isNotBlank(metricName), logPrefix + "record empty metricName"); + checkArgument(labelNames != null && labelNames.length > 0, logPrefix + "record empty labelNames"); + } + + public static void recordCounter(String metricName, long value, String... labelValues) { + recordCounter(metricName, getLabelNames(), value, labelValues); + } + + public static void recordCounter(String metricName, String[] labelNames, long value, String... labelValues) { + try { + validate(metricName, value, labelNames); + Metrics.getInstance().newCounter(metricName, labelNames).with(labelValues).add(value, labelValues); + } catch (Exception e) { + log.error(logPrefix + "recordCounter exception; " + e.getMessage()); + } + } + + public static void recordRt(String metricName, long value, String... labelValues) { + recordRt(metricName, getLabelNames(), value, labelValues); + } + + public static void recordRt(String metricName, String[] labelNames, long value, String... labelValues) { + double[] buckets = new double[]{10.0, 100.0, 200.0, 300.0, 400.0, 600.0, 800.0, 1000.0, 1400.0, 1800.0, 2200.0, 2600.0, 3000.0, 6000.0}; + recordHistogram(metricName, labelNames, buckets, value, labelValues); + } + + private static void checkLabelValues(String... labelValues) { + boolean hasNull = false; + + for (int i = 0; i < labelValues.length; i++) { + if (labelValues[i] == null) { + hasNull = true; + labelValues[i] = ""; + } + } + if (hasNull) { + log.error(logPrefix + "checkLabelValues null value; " + Arrays.toString(labelValues)); + } + } + + private static void recordHistogram(String metricName, String[] labelNames, double[] buckets, long value, String... labelValues) { + String logSuffix = ""; + + try { + validate(metricName, value, labelNames); + checkArgument(buckets != null && buckets.length > 0, logPrefix + "recordHistogram empty buckets"); + checkLabelValues(labelValues); + + logSuffix = ", label names " + Arrays.toString(labelNames) + ", label values " + Arrays.toString(labelValues) + "; "; + checkArgument(labelValues != null && labelValues.length == labelNames.length, + logPrefix + "recordHistogram invalid label" + logSuffix); + + Metrics.getInstance().newHistogram(metricName, buckets, labelNames).with(labelValues).observe(value, labelValues); + } catch (Exception e) { + log.error(logPrefix + "recordHistogram exception" + logSuffix + e.getMessage()); + } + } + + public static void recordTpsAndRtMetrics(long elapsed, String[] labelVals,boolean recordTps) { + recordRt(METRICS_NAME_RT_API, elapsed, labelVals); + if (recordTps){ + recordCounter(METRICS_NAME_TPS_API, 1, labelVals); + } + } + + public static void recordApiRpsMetrics(String[] labelVals) { + recordCounter(METRICS_NAME_RPS_API, getLabelApiRpsNames(),1, labelVals); + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/ConcurrencyTest.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/ConcurrencyTest.java new file mode 100644 index 000000000..85aa63591 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/ConcurrencyTest.java @@ -0,0 +1,120 @@ +package run.mone.mimeter.engine.service.test; + +import com.google.common.base.Stopwatch; +import org.junit.Ignore; +import org.junit.Test; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicLong; +import java.util.stream.IntStream; + +import static common.Util.*; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/8/28 + */ +@Ignore +public class ConcurrencyTest { + + + private String m() { + try { + + } finally { + if (1 == 1) { + return "def"; + } + } + System.out.println("return"); + return "abc"; + } + + + @Test + public void testFinally() { + System.out.println(m()); + } + + @Test + public void testLatch() { + CountDownLatch l = new CountDownLatch(10); + IntStream.range(0,22).forEach(i->{ + l.countDown(); + }); + System.out.println(l.getCount()); + } + + + @Test + public void testMap() { + ConcurrentHashMap m = new ConcurrentHashMap<>(); + m.put("abc", "abc"); + Object v = m.remove("def"); + System.out.println(v); + System.out.println(m); + } + + @Test + public void atomicTest() { + AtomicLong al = new AtomicLong(0L); + modifyAL(al, 1L); + System.out.println(al.get()); + } + + private void modifyAL(AtomicLong al, long newVal) { + al.set(newVal); + } + +// @Test +// public void nullCastTest() { +// Integer val = null; +// System.out.println((long) val); +// } + + @Test + public void sampleRateToCntTest() { + System.out.println(sampleRateToCnt(1, 5)); + } + + @Test + public void samplingTest() { + int[][] lists = new int[][]{{10, 10}, {1000, 100}, {100000, 5000}, {100000, 20000}, {100000, 50000}, {100000, 80000}}; + + for (int[] arr : lists) { + Stopwatch sw = Stopwatch.createStarted(); + sampleIndices(arr[0], arr[1]); + System.out.println("sampling indices takes:" + sw.elapsed(TimeUnit.MILLISECONDS) + "ms"); + } + } + + @Test + public void sampleByTimeAndQpsTest() { + int[][] lists = new int[][]{{8, 1, 10}, {1000, 100, 5}}; + + for (int[] arr : lists) { + int duration = arr[0]; + int qps = arr[1]; + Set logIndices = new HashSet<>(sampleByTimeAndQps(duration, qps, arr[2])); + System.out.println("sampling indices:" + logIndices); + + int hits = 0; + + for (int j = 1; j <= duration; j++) { + for (int i = 0; i < qps; i++) { + if (logIndices.contains(((j - 1) % 10) * qps + i)) { + hits++; + } + } + } + int total = duration * qps; + System.out.println("hits:" + hits + ", total:" + total + ", rate:" + ((100.0d * hits) / total)); + } + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/DagClientTest.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/DagClientTest.java new file mode 100644 index 000000000..663938e1d --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/DagClientTest.java @@ -0,0 +1,372 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.service.test; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; +import com.google.gson.Gson; +import com.xiaomi.data.push.schedule.task.graph.GraphTaskContext; +import com.xiaomi.data.push.schedule.task.graph.TaskEdgeData; +import com.xiaomi.data.push.schedule.task.graph.TaskVertexData; +import com.xiaomi.youpin.docean.Ioc; +import com.xiaomi.youpin.docean.common.StringUtils; +import common.HttpClientV6; +import common.HttpResult; +import common.Util; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import run.mone.mimeter.engine.agent.bo.data.*; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskContext; +import run.mone.mimeter.engine.agent.bo.task.TaskType; +import run.mone.mimeter.engine.client.base.DagClient; + +import java.util.*; +import java.util.concurrent.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.IntStream; + +/** + * @author goodjava@qq.com + * @date 2022/5/30 + */ +public class DagClientTest { + + private static Logger log = LoggerFactory.getLogger(DagClientTest.class); + + private static final Pattern EL_PATTERN = Pattern.compile("\\$\\{(.*)}"); + + @Test + public void test5(){ + Map> map = new HashMap<>(); + List tobeR = new ArrayList<>(); + tobeR.add("dzx"); + tobeR.add("dp"); + tobeR.add("yxr"); + + map.put("username",tobeR); + + List age = new ArrayList<>(); + age.add("18"); + age.add("19"); + age.add("20"); + map.put("age",age); + + String body = "[\n" + + " {\n" + + " \"id\": \"${username}\",\n" + + " \"obj\": {\n" + + " \"name\": \"${username}\",\n" + + " \"age\": \"${age}\"\n" + + " }\n" + + " }\n" + + "]"; + + Matcher m = EL_PATTERN.matcher(body); + Random random = new Random(); + int lineFlag = random.nextInt(100); + while (m.find()) { + String expr = m.group(1); + body = Util.Parser.parse$(expr, body, null); + } + System.out.println(body); + } + + @Test + public void testDagClient() { + Ioc ioc = Ioc.ins(); + ioc.putBean(ioc).init("run.mone.mibench.engine"); + DagClient client = ioc.getBean("dagClient"); + Task task = new Task(); + task.setDagInfo(getContext()); + log.info("{}", task.getDagInfo()); + client.call(task, new TaskContext(),null,null); + } + + /** + * 测试纯http的dag链路任务(图的一个形式,一个链表) + * 先获取token 然后根据token获取id 最后通过id获取age + */ + @Test + public void testDagClientHttp() throws InterruptedException { + Ioc ioc = Ioc.ins(); + ioc.putBean(ioc).init("run.mone.mibench.engine"); + DagClient client = ioc.getBean("dagClient"); + Task task = new Task(); + task.setTimeout(5000); + task.setDagInfo(getHttpDagContext()); + + ExprKey key1 = new ExprKey(2,2, "", "params.toMap(){data}", Lists.newArrayList("httpData", "0", "a")); + //获取1的结果中的data + ExprKey key2 = new ExprKey(1,2, "", "params.toMap(){data}", Lists.newArrayList("httpData", "1", "b")); + + Map map = new HashMap<>(); + map.put(key1,""); + map.put(key2,""); + + String j = new Gson().toJson(map); + + log.info("{}", task.getDagInfo()); + client.call(task, new TaskContext(),null,null); + Thread.currentThread().join(); + } + + @Test + public void testClientHttp() { + List headers = new ArrayList<>(); + Map map = new HashMap<>(); + Map headerMap = new HashMap<>(); + headerMap.put("Content-Type","x-www-form-urlencoded"); + headerMap.put("Xm-Forged-Req","true"); + + map.put("invoice_type","4"); + map.put("invoice_title","person"); + map.put("use_red_packet", "1"); + map.put("shipment_id", "2"); + HttpResult res = null; + try { + Gson gson = new Gson(); + //http://api2.order.mi.com/buy/submit + res = HttpClientV6.httpPost(null,"http://www.test.com/submit",headerMap,map,"UTF-8",5000); + String json = gson.toJson(res.content); + System.out.println(json); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @Test + public void testDivide(){ + int totalErrCount = 10; + int totalCount = 141; + double rate = (1.0 * totalErrCount / totalCount)*100; + + System.out.println(Math.round(rate)); + } + @Test + public void testC() { + double v = Double.parseDouble("99"); + System.out.println((int) v); + } + + + static class T { + public String id; + + public String parent; + + public List childList = new ArrayList<>(); + + public CountDownLatch latch = null; + + public T(String id, String parent) { + this.id = id; + this.parent = parent; + if (!StringUtils.isEmpty(parent)) { + latch = new CountDownLatch(1); + } else { + latch = new CountDownLatch(0); + } + } + + public void execute() { + System.out.println("execute:" + this.id); + childList.stream().forEach(it -> { + it.latch.countDown(); + }); + } + + + } + + + @Test + public void testList() throws InterruptedException { + ExecutorService pool = Executors.newVirtualThreadPerTaskExecutor(); + T t2 = new T("2", "1"); + T t1 = new T("1", ""); + t1.childList.add(t2); + List list = Lists.newArrayList(t2, t1); + list.stream().parallel().forEach(it -> { + System.out.println("run:" + it.id); + CompletableFuture.supplyAsync(() -> { + try { + it.latch.await(); + it.execute(); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + return it; + }, pool); + }); + Thread.currentThread().join(); + } + + @Test + public void testLatch() throws InterruptedException { + CountDownLatch latch = new CountDownLatch(1); + new Thread(()->{ + try { + TimeUnit.SECONDS.sleep(5); + latch.countDown(); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + }).start(); + latch.await(); + System.out.println(latch.getCount()); + } + + @Test + public void testCountdownLatch() throws InterruptedException { + CountDownLatch countDownLatch = new CountDownLatch(0); + countDownLatch.await(); + + CountDownLatch countDownLatch1 = new CountDownLatch(10); + + IntStream.range(0, 12).forEach(it -> { + System.out.println(it); + countDownLatch1.countDown(); + }); + countDownLatch1.await(); + + System.out.println("finish"); + } + + public GraphTaskContext getContext() { + GraphTaskContext taskContext = new GraphTaskContext<>(); + taskContext.setTaskList(Lists.newArrayList(createVertex(0, 0, new ExprKey(0, 2,"1_p", "params", Lists.newArrayList()), "0"), + createVertex(1, 3, new ExprKey(0, 2,"1_p", "params", Lists.newArrayList()), "1"), + //直接把0的结果放到2的参数中(map->i) + createVertex(2, 0, new ExprKey(0,2, "2_p", "params", Lists.newArrayList("demoData", "data", "i")), "2"), + createVertex(3, 0, new ExprKey(2, 2,"3_p", "params", Lists.newArrayList("demoData", "data", "i")), "3"))); + //1依赖0 2依赖于0 3依赖于2 (1的执行时间比较久3秒,所以会先输出3的结果) + taskContext.setDependList(Lists.newArrayList(new TaskEdgeData(0, 1), new TaskEdgeData(0, 2), new TaskEdgeData(2, 3))); + return taskContext; + } + + + /** + * 执行三步 获取 token -> 获取 id -> 获取 agent -> 求和 + * + * @return + */ + public GraphTaskContext getHttpDagContext() { + GraphTaskContext taskContext = new GraphTaskContext<>(); + taskContext.setTaskList(Lists.newArrayList( + //获取token + createHttpCalVertex(0, "post", Lists.newArrayList(new ParamType(ParamTypeEnum.pojo, "pojo")), + Lists.newArrayList(new ExprKey(0, 2,"", "", Lists.newArrayList())), + "token", "http://127.0.0.1:7777/token", ImmutableMap.of("uuid", "123")), + //换取id + createHttpCalVertex(1, "post", Lists.newArrayList(new ParamType(ParamTypeEnum.pojo, "pojo")), + Lists.newArrayList(new ExprKey(0, 2,"", "params.toMap(){data}", Lists.newArrayList("httpData", "0", "token"))), + "id", "http://127.0.0.1:7777/id", ImmutableMap.of("uuid", "456")), + //获取age + createHttpCalVertex(2, "post", Lists.newArrayList(new ParamType(ParamTypeEnum.pojo, "pojo")), + Lists.newArrayList(new ExprKey(1, 2,"", "params.toMap(){data}", Lists.newArrayList("httpData", "0", "id"))), + "age", "http://127.0.0.1:7777/age", ImmutableMap.of("uuid", "789")), + //求和(多参数) + createHttpCalVertex(3, "get", Lists.newArrayList( + new ParamType(ParamTypeEnum.primary, "a"), + new ParamType(ParamTypeEnum.primary, "b") + ), + Lists.newArrayList( + //获取2的结果中的data + new ExprKey(2,2, "", "params.toMap(){data}", Lists.newArrayList("httpData", "0", "a")), + //获取1的结果中的data + new ExprKey(1,2, "", "params.toMap(){data}", Lists.newArrayList("httpData", "1", "b")) + ), + "sum", "http://127.0.0.1:7777/sum", ImmutableMap.of("uuid", "799")) + ) + ); + //任务是有依赖关系的 + taskContext.setDependList(Lists.newArrayList(new TaskEdgeData(0, 1), new TaskEdgeData(1, 2), new TaskEdgeData(2, 3), new TaskEdgeData(1, 3))); + return taskContext; + } + + + private TaskVertexData createHttpCalVertex(int id, String method, List types, List keys, String resultName, String url, Map d) { + int time = 100; + TaskVertexData data = new TaskVertexData<>(); + NodeInfo nodeInfo = new NodeInfo(); + nodeInfo.setId(id); + nodeInfo.setResultName(resultName); + Task task = new Task(); + task.setDebug(true); + task.setId(id); + task.setType(TaskType.http); + task.setTimeout(time); + HttpData httpData = new HttpData(); + httpData.setUrl(url); + httpData.setMethod(method); + httpData.initTypeList(types); + if (httpData.getParamNum() == 1) { + Map m = (Map) httpData.getParams().get(0); + m.putAll(d); + } + + task.setHttpData(httpData); + nodeInfo.setTask(task); + keys.forEach(key -> nodeInfo.getExprMap().put(key, "")); + data.setData(nodeInfo); + data.setIndex(id); + return data; + } + + + private TaskVertexData createVertex(int id, int sleepTime, ExprKey key, String resultName) { + TaskVertexData data = new TaskVertexData<>(); + NodeInfo nodeInfo = new NodeInfo(); + nodeInfo.setId(id); + nodeInfo.setResultName(resultName); + Task task = new Task(); + task.setDebug(true); + task.getAttachments().put("sleep", String.valueOf(sleepTime)); + task.setId(id); + task.setType(TaskType.demo); + task.setDemoData(new DemoData()); + nodeInfo.setTask(task); + nodeInfo.getExprMap().put(key, ""); + data.setData(nodeInfo); + data.setIndex(id); + return data; + } + + @Test + public void testFuture() throws ExecutionException, InterruptedException { + ExecutorService pool = Executors.newVirtualThreadPerTaskExecutor(); + CompletableFuture f = CompletableFuture.supplyAsync(() -> { + try { + TimeUnit.SECONDS.sleep(3); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + return "abc"; + }, pool).handle((str, e) -> { + log.info("str:{}", str); + return str; + }); + + System.out.println("get"); + + System.out.println(f.get()); + } + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/EngineTest.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/EngineTest.java new file mode 100644 index 000000000..fe9cf8bc3 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/EngineTest.java @@ -0,0 +1,46 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.service.test; + +import run.mone.mimeter.engine.service.BenchEngineService; +import org.junit.Test; +import run.mone.mimeter.engine.agent.bo.task.Context; +import run.mone.mimeter.engine.agent.bo.data.HttpData; +import run.mone.mimeter.engine.agent.bo.task.Task; + +/** + * @author goodjava@qq.com + * @date 2022/5/19 + */ +public class EngineTest { + + + @Test + public void testEngine() throws InterruptedException { + BenchEngineService engineService = new BenchEngineService(); + Context context = new Context(); + Task task = new Task(); + task.setId(1); + task.setQps(1000); + task.setTime(10); + HttpData data = new HttpData(); + data.setUrl("http://www.baidu.com"); + task.setHttpData(data); + engineService.submitTask(context, task); + + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/ExprTest.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/ExprTest.java new file mode 100644 index 000000000..a94e7450c --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/ExprTest.java @@ -0,0 +1,105 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.service.test; + +import com.xiaomi.data.push.antlr.expr.Expr; +import common.Util; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.junit.Test; +import run.mone.mimeter.engine.agent.bo.data.HttpData; + +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * @author goodjava@qq.com + * @date 2022/6/2 + */ +public class ExprTest { + + @Data + @AllArgsConstructor + @NoArgsConstructor + private class D { + private int id; + private String name; + } + + @Data + private class Result { + private int code; + private String message; + private D data; + } + + + @Test + public void testResultExpr() { + Map m = new HashMap<>(); + Result r = new Result<>(); + r.setData("data:" + System.currentTimeMillis()); + m.put("id", r); + String v = Expr.result(m, "result{id}.data"); + System.out.println(v); + } + + + @Test + public void t() { + List list = new ArrayList<>(2); + list.add("dsds"); + System.out.println(list.get(0)); + } + + + private static final Pattern EL_PATTERN = Pattern.compile("\\$\\{([^}]*)}"); + + private void processDatasetUrl(HttpData httpData, TreeMap> dataMap, int n) { + if (dataMap == null) { + return; + } + String k; + String v = null; + String url = httpData.getUrl(); + String tmpUrl = url; + if (null != url && url.length() > 0) { + Matcher m = EL_PATTERN.matcher(url); + while (m.find()) { + k = m.group(1); + if (dataMap.get(k) != null && dataMap.get(k).size() != 0) { + int line = n % dataMap.get(k).size(); + v = dataMap.get(k).get(line); + } + tmpUrl = Util.Parser.parse$(k, tmpUrl, v); + } + } + httpData.setUrl(tmpUrl); + } + + @Test + public void testExpr() { + + String json = "{\"a\":\"aaa\",\"c\":2,\"b\":\"ccc\"}"; + + TreeMap treeMap = Util.getGson().fromJson(json, TreeMap.class); + System.out.println(treeMap.get("")); + + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/FutureTest.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/FutureTest.java new file mode 100644 index 000000000..76eaa4d5a --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/FutureTest.java @@ -0,0 +1,49 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.service.test; + +import org.junit.Test; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; + +/** + * @author goodjava@qq.com + * @date 2022/6/5 + */ +public class FutureTest { + + + @Test + public void testFuture() throws ExecutionException, InterruptedException { + CompletableFuture f = CompletableFuture.supplyAsync(() -> { + try { + TimeUnit.SECONDS.sleep(2); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + System.out.println("finish"); + return "ok"; + }).completeOnTimeout("timeout",1, TimeUnit.SECONDS).handle((v,e)->{ + System.out.println(v); + return v; + }); + System.out.println("aa"); + Thread.currentThread().join(); + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/HostUtilTest.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/HostUtilTest.java new file mode 100644 index 000000000..93278239e --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/HostUtilTest.java @@ -0,0 +1,49 @@ +package run.mone.mimeter.engine.service.test; + +import org.junit.Test; +import run.mone.mimeter.engine.agent.bo.hosts.HostBo; +import run.mone.mimeter.engine.service.HostsService; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author dongzhenxing + */ +public class HostUtilTest { + + @Test + public void test() throws InterruptedException { + System.out.println(System.getProperty("os.name")); + } + + @Test + public void testUpdateHosts() { + List hostBoList = new ArrayList<>(); + HostBo hostBo = new HostBo(); + hostBo.setIp("127.0.0.1"); + hostBo.setDomain("test.com"); + + HostBo hostBo2 = new HostBo(); + hostBo2.setIp("127.0.0.2"); + hostBo2.setDomain("test2.com"); + hostBoList.add(hostBo); + hostBoList.add(hostBo2); + HostsService.updateHostConfig(hostBoList); + } + + @Test + public void testDelHosts() { + List hostBoList = new ArrayList<>(); + HostBo hostBo = new HostBo(); + hostBo.setDomain("test.com"); + + HostBo hostBo2 = new HostBo(); + hostBo2.setDomain("test2.com"); + hostBoList.add(hostBo); + hostBoList.add(hostBo2); + HostsService.deleteDomainsConfig(hostBoList); + } + + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/RateLimiterTest.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/RateLimiterTest.java new file mode 100644 index 000000000..b1d7fd620 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/RateLimiterTest.java @@ -0,0 +1,40 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.service.test; + +import com.google.common.util.concurrent.RateLimiter; +import org.junit.Test; + +import java.util.Date; + +/** + * @author goodjava@qq.com + * @date 2022/5/23 + */ +public class RateLimiterTest { + + + @Test + public void testRateLimiter() { + RateLimiter limiter = RateLimiter.create(5); + + for (int i = 0; i < 20; i++) { + limiter.acquire(); + System.out.println(new Date()); + } + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/WaitTest.java b/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/WaitTest.java new file mode 100644 index 000000000..7283edb71 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent-service/src/test/java/run/mone/mimeter/engine/service/test/WaitTest.java @@ -0,0 +1,21 @@ +package run.mone.mimeter.engine.service.test; + +import org.junit.Test; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +/** + * @author goodjava@qq.com + * @date 2022/9/17 10:17 + */ +public class WaitTest { + + @Test + public void testCountdownLatch() throws InterruptedException { + CountDownLatch latch = new CountDownLatch(1); +// latch.await(); + latch.await(2, TimeUnit.SECONDS); + System.out.println("finish"); + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent/README.md b/ozburst-all/mimeter-engine/mimeter-agent/README.md new file mode 100644 index 000000000..dbe1357d2 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent/README.md @@ -0,0 +1,21 @@ ++ 压测agent ++ 使用jdk19-loom ++ 启动函数 ++ com.xiaomi.sautumn.server.bootstrap.SautumnApplication ++ env ++ function.App=mibench-agent;mione.faas.func.env=staging;mione.faas.func.env.id=92;mione.faas.func.id=65;mione.faas.local.jar.path=/Users/zzy/IdeaProjects/mibench-engine/mibench-agent/target/mibench-agent-1.0-SNAPSHOT.jar;mione.faas.test.jar.env=true ++ jvm 参数 ++ --add-opens java.base/java.util=ALL-UNNAMED ++ --add-opens java.base/java.lang=ALL-UNNAMED ++ --add-opens java.base/java.math=ALL-UNNAMED ++ --add-opens java.xml/com.sun.org.apache.xerces.internal.impl.dv.util=ALL-UNNAMED ++ 配置名称 ++ mione.faas.func.env.id=1;mione.faas.func.id=1 (agent) ++ serviceName=new_mibench_manager ++ nacosAddr=127.0.0.1:80 ++ mione.faas.web.port=8080 ++ 支持压测类型 + + http + + dubbo + + demo(用来测试代码) ++ 支持debug模式(可以获取到结果) diff --git a/ozburst-all/mimeter-engine/mimeter-agent/dependency-reduced-pom.xml b/ozburst-all/mimeter-engine/mimeter-agent/dependency-reduced-pom.xml new file mode 100644 index 000000000..f92edef2e --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent/dependency-reduced-pom.xml @@ -0,0 +1,97 @@ + + + + mimeter-engine + run.mone + 1.0-SNAPSHOT + + 4.0.0 + mimeter-agent + + + + maven-shade-plugin + 3.1.1 + + + package + + shade + + + + + + + + + + staging + + + src/main/resources/config/staging.properties + + + + staging + + + + online + + + src/main/resources/config/online.properties + + + + online + + + + + + junit + junit + 4.12 + test + + + hamcrest-core + org.hamcrest + + + + + javax.annotation + javax.annotation-api + 1.3.2 + provided + + + run.mone + docean-plugin-rpc + 1.4-SNAPSHOT + provided + + + rpc + run.mone + + + docean-plugin-config + run.mone + + + + + org.projectlombok + lombok + 1.18.24 + provided + + + + 20 + 20 + + diff --git a/ozburst-all/mimeter-engine/mimeter-agent/pom.xml b/ozburst-all/mimeter-engine/mimeter-agent/pom.xml new file mode 100644 index 000000000..3cb5eb665 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent/pom.xml @@ -0,0 +1,107 @@ + + + + mimeter-engine + run.mone + 1.0-SNAPSHOT + + 4.0.0 + + mimeter-agent + + + 20 + 20 + + + + + + + + junit + junit + 4.12 + test + + + + javax.annotation + javax.annotation-api + 1.3.2 + provided + + + + run.mone + mimeter-api + 1.0-SNAPSHOT + + + + run.mone + mimeter-agent-service + 1.0-SNAPSHOT + + + + + run.mone + docean-plugin-rpc + 1.4-SNAPSHOT + provided + + + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.1.1 + + + + + package + + shade + + + + + + + + + + staging + + staging + + + true + + + + src/main/resources/config/staging.properties + + + + + online + + online + + + + src/main/resources/config/online.properties + + + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-engine/mimeter-agent/src/main/java/run/mone/mimeter/engine/agent/bo/Version.java b/ozburst-all/mimeter-engine/mimeter-agent/src/main/java/run/mone/mimeter/engine/agent/bo/Version.java new file mode 100644 index 000000000..fdd6664aa --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent/src/main/java/run/mone/mimeter/engine/agent/bo/Version.java @@ -0,0 +1,29 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo; + +/** + * @author goodjava@qq.com + * @date 2022/5/20 + */ +public class Version { + + @Override + public String toString() { + return "agent:0.0.2:2023-09-19"; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent/src/main/java/run/mone/mimeter/engine/agent/handler/AgentHandler.java b/ozburst-all/mimeter-engine/mimeter-agent/src/main/java/run/mone/mimeter/engine/agent/handler/AgentHandler.java new file mode 100644 index 000000000..5bfdf6ac4 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent/src/main/java/run/mone/mimeter/engine/agent/handler/AgentHandler.java @@ -0,0 +1,64 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.handler; + +import run.mone.mimeter.engine.agent.bo.Version; +import com.xiaomi.youpin.docean.anno.Controller; +import com.xiaomi.youpin.docean.anno.RequestMapping; +import run.mone.mimeter.engine.service.MetricsService; + +import javax.annotation.Resource; + +import java.security.Security; + +/** + * @author goodjava@qq.com + * @author dongzhenxing + * @date 2022/5/19 + */ +@Controller +public class AgentHandler { + + @Resource + private MetricsService metricsService; + + /** + * 控制发压机jvm缓存dns时间,减短缓存时间 + * + * 一般情况下我们不需要完全取消JVM的DNS缓存,只需要调小有效时间,经过一些测试发现一下结论: + * 1)在高并发时,不做DNS缓存时的CPU耗用比做了3s缓存的CPU耗用要高3/4倍,实时DNS请求相当耗用CPU; + * 2)3s和30s缓存有效时间对dns查询响应时间的影响差别不大,cpu内存占用都比较接近; + * 3)建议使用3秒缓存,兼顾运维和性能; + */ + public void init(){ + Security.setProperty("networkaddress.cache.ttl", "3"); + Security.setProperty("networkaddress.cache.negative.ttl", "0"); + } + + @RequestMapping(path = "/info") + public String info() { + return "agent:" + new Version() + " jvm:" + System.getProperty("java.version"); + } + + + @RequestMapping(path = "/metrics", method = "get") + public String metrics() { + return this.metricsService.metrics(); + } + + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent/src/main/java/run/mone/mimeter/engine/agent/processor/AgentProcessor.java b/ozburst-all/mimeter-engine/mimeter-agent/src/main/java/run/mone/mimeter/engine/agent/processor/AgentProcessor.java new file mode 100644 index 000000000..d944bce5e --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent/src/main/java/run/mone/mimeter/engine/agent/processor/AgentProcessor.java @@ -0,0 +1,119 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.processor; + +import com.google.gson.Gson; +import com.xiaomi.data.push.rpc.netty.NettyRequestProcessor; +import com.xiaomi.data.push.rpc.protocol.RemotingCommand; +import com.xiaomi.youpin.docean.anno.Component; +import common.Util; +import io.netty.channel.ChannelHandlerContext; +import run.mone.mimeter.engine.agent.bo.MibenchCmd; +import run.mone.mimeter.engine.agent.bo.data.AgentReq; +import run.mone.mimeter.engine.agent.bo.task.Context; +import run.mone.mimeter.engine.agent.bo.task.HostsFileResult; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskResult; +import run.mone.mimeter.engine.service.BenchEngineService; + +import javax.annotation.Resource; +import java.nio.charset.StandardCharsets; + +/** + * @author goodjava@qq.com + * @date 2022/5/11 + */ +@Component +public class AgentProcessor implements NettyRequestProcessor { + + @Resource + private BenchEngineService engineService; + + private static final Gson gson = Util.getGson(); + + @Override + public RemotingCommand processRequest(ChannelHandlerContext channelHandlerContext, RemotingCommand remotingCommand) throws Exception { + AgentReq req = remotingCommand.getReq(AgentReq.class); + Task task = req.getTask(); + //manager server 地址 + if (task != null){ + task.setAddr(req.getAddr()); + } + if (req.getCmd().equals(AgentReq.SUBMIT_TASK_CMD)) { + if (task.isDebug()){ + TaskResult tr = engineService.submitTask(new Context(), task); + RemotingCommand resp = RemotingCommand.createResponseCommand(MibenchCmd.TASK); + resp.setBody(gson.toJson(tr).getBytes(StandardCharsets.UTF_8)); + return resp; + } + engineService.submitTask(new Context(), task); + } + + //停止任务 + if (req.getCmd().equals(AgentReq.CANCEL_TASK_CMD)) { + engineService.cancelTask(task); + } + + //变更任务rps + if (req.getCmd().equals(AgentReq.CHANGE_TASK_QPS)) { + engineService.changeTaskQps(req.getChangeQpsReq()); + } + + //修改本地host文件 + if (req.getCmd().equals(AgentReq.EDIT_HOST_CMD)) { + engineService.editHostsFile(req.getAgentHostReqList()); + RemotingCommand resp = RemotingCommand.createResponseCommand(MibenchCmd.TASK); + TaskResult tr = new TaskResult(); + tr.setOk(true); + resp.setBody(gson.toJson(tr).getBytes(StandardCharsets.UTF_8)); + return resp; + } + + //删除本地某项host配置 + if (req.getCmd().equals(AgentReq.DEL_HOST_CMD)){ + engineService.delHostsFile(req.getAgentHostReqList()); + RemotingCommand resp = RemotingCommand.createResponseCommand(MibenchCmd.TASK); + TaskResult tr = new TaskResult(); + tr.setOk(true); + resp.setBody(gson.toJson(tr).getBytes(StandardCharsets.UTF_8)); + return resp; + } + + //加载本地某项host配置 + if (req.getCmd().equals(AgentReq.LOAD_HOST_CMD)){ + RemotingCommand resp = RemotingCommand.createResponseCommand(MibenchCmd.TASK); + HostsFileResult hostsFileResult = engineService.loadHostsReq(); + resp.setBody(gson.toJson(hostsFileResult).getBytes(StandardCharsets.UTF_8)); + return resp; + } + + + return RemotingCommand.createResponseCommand(MibenchCmd.TASK); + } + + @Override + public boolean rejectRequest() { + return false; + } + + @Override + public int cmdId() { + return MibenchCmd.TASK; + } + + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent/src/main/java/run/mone/mimeter/engine/agent/task/PingTask.java b/ozburst-all/mimeter-engine/mimeter-agent/src/main/java/run/mone/mimeter/engine/agent/task/PingTask.java new file mode 100644 index 000000000..086d4adcc --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent/src/main/java/run/mone/mimeter/engine/agent/task/PingTask.java @@ -0,0 +1,90 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.task; + +import com.google.gson.Gson; +import com.xiaomi.data.push.rpc.protocol.RemotingCommand; +import com.xiaomi.data.push.task.Task; +import com.xiaomi.youpin.docean.anno.Component; +import com.xiaomi.youpin.docean.common.StringUtils; +import common.NetUtils; +import common.Util; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import run.mone.mimeter.engine.agent.bo.MibenchCmd; +import run.mone.mimeter.engine.agent.bo.Version; +import run.mone.mimeter.engine.agent.bo.data.AgentInfoDTO; +import run.mone.mimeter.engine.agent.bo.data.AgentReq; +import run.mone.mimeter.engine.agent.bo.data.User; + +import java.nio.charset.StandardCharsets; + + +/** + * @author goodjava@qq.com + * @date 2022/5/20 + */ +@Component +public class PingTask extends Task { + + private static final Logger log = LoggerFactory.getLogger(PingTask.class); + + private final Gson gson = Util.getGson(); + + private final String name = System.currentTimeMillis() + ""; + + private static final String SERVER_NAME = "mimeter"; + + public void init() { + this.setRunnable(() -> { + String msg = "ping:" + new Version(); + log.info(msg); + AgentReq agentReq = new AgentReq(); + User user = new User(); + user.setName(name); + agentReq.setUser(user); + agentReq.setAgentInfoDTO(getApiInfoDto()); + RemotingCommand req = RemotingCommand.createRequestCommand(MibenchCmd.PING); + req.setBody(gson.toJson(agentReq).getBytes(StandardCharsets.UTF_8)); + String addr = this.getClient().getServerAddrs(); + if (StringUtils.isNotEmpty(addr)) { + this.getClient().sendMessage(addr, req, responseFuture -> log.info("pong")); + } + }); + //单位秒 + this.setDelay(5); + } + + private AgentInfoDTO getApiInfoDto() { + AgentInfoDTO agentInfoDTO = new AgentInfoDTO(); + agentInfoDTO.setIp(NetUtils.getLocalHost()); + + agentInfoDTO.setPort(0); + agentInfoDTO.setHostname(NetUtils.getHostName()); + //cpu mem信息从proms 同步 + agentInfoDTO.setMem(0); + agentInfoDTO.setUseMem(0); + agentInfoDTO.setCpu(0); + agentInfoDTO.setUseCpu(0); + agentInfoDTO.setServerName(SERVER_NAME); + String selectZone = System.getenv("SELECT_ZONE"); + log.info("[PingTask.getApiInfoDto], selectZone: {}", selectZone); + agentInfoDTO.setDesc(StringUtils.isEmpty(selectZone) ? "default" : selectZone); + return agentInfoDTO; + } + +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent/src/main/resources/config/online.properties b/ozburst-all/mimeter-engine/mimeter-agent/src/main/resources/config/online.properties new file mode 100644 index 000000000..e69de29bb diff --git a/ozburst-all/mimeter-engine/mimeter-agent/src/main/resources/config/staging.properties b/ozburst-all/mimeter-engine/mimeter-agent/src/main/resources/config/staging.properties new file mode 100644 index 000000000..e69de29bb diff --git a/ozburst-all/mimeter-engine/mimeter-agent/src/test/java/run/mone/mimeter/engine/test/CountdownLatchTest.java b/ozburst-all/mimeter-engine/mimeter-agent/src/test/java/run/mone/mimeter/engine/test/CountdownLatchTest.java new file mode 100644 index 000000000..92b9e6aa3 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent/src/test/java/run/mone/mimeter/engine/test/CountdownLatchTest.java @@ -0,0 +1,33 @@ +package run.mone.mimeter.engine.test; + +import org.junit.Test; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +public class CountdownLatchTest { + + + @Test + public void testLatch() throws InterruptedException { + CountDownLatch latch = new CountDownLatch(1); + System.out.println(latch.getCount()); + latch.await(2,TimeUnit.SECONDS); + System.out.println(latch.getCount()); + } + + @Test + public void testCountdownLatch() throws InterruptedException { + CountDownLatch latch = new CountDownLatch(1); + new Thread(()->{ + try { + TimeUnit.SECONDS.sleep(4); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + latch.countDown(); + }).start(); + latch.await(10, TimeUnit.SECONDS); + System.out.println("finish"); + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent/src/test/java/run/mone/mimeter/engine/test/ThreadWaitAndNotify.java b/ozburst-all/mimeter-engine/mimeter-agent/src/test/java/run/mone/mimeter/engine/test/ThreadWaitAndNotify.java new file mode 100644 index 000000000..2c0386a52 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent/src/test/java/run/mone/mimeter/engine/test/ThreadWaitAndNotify.java @@ -0,0 +1,46 @@ +package run.mone.mimeter.engine.test; + +import org.junit.Test; + +import java.util.concurrent.TimeUnit; + +public class ThreadWaitAndNotify { + static final Object object=new Object(); + public static class ThreadWait extends Thread{ + @Override + public void run(){ + synchronized (object){ + System.out.println(System.currentTimeMillis()+" A开始运行"); + try { + object.wait(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + System.out.println(System.currentTimeMillis()+" 重新获取到监视器,继续执行run方法中代码块——A结束运行"); + } + } + } + public static class ThreadNotify extends Thread{ + @Override + public void run(){ + synchronized (object){ + System.out.println(System.currentTimeMillis()+"B开始运行"); + object.notify(); + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + System.out.println(System.currentTimeMillis()+"释放监视器——B结束运行"); + } + } + } + + @Test + public void test() throws InterruptedException { + new ThreadWait().start(); + new ThreadNotify().start(); + + TimeUnit.SECONDS.sleep(10); + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-agent/src/test/java/run/mone/mimeter/engine/test/VirturalThreadTest.java b/ozburst-all/mimeter-engine/mimeter-agent/src/test/java/run/mone/mimeter/engine/test/VirturalThreadTest.java new file mode 100644 index 000000000..55aaafcf8 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-agent/src/test/java/run/mone/mimeter/engine/test/VirturalThreadTest.java @@ -0,0 +1,147 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.test; + +import org.junit.Test; + +import java.util.Random; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.LongAdder; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.IntStream; + +/** + * @author goodjava@qq.com + * @date 2022/5/19 + */ +public class VirturalThreadTest { + + static final Object obj = new Object(); + + @Test + public void test1() throws InterruptedException { + System.out.println("123"); + new Thread(() -> { + System.out.println("123"); + }).start(); + Thread.currentThread().join(); + } + + @Test + public void test3() { + Random random = new Random(); + for (int i = 0; i < 10; i++) { + System.out.println(random.nextInt(3)); + } + } + + @Test + public void test5() { + AtomicInteger counter = new AtomicInteger(10); + long before = System.currentTimeMillis(); +// + new Thread(() -> { + try { + synchronized (obj) { + TimeUnit.SECONDS.sleep(3000); + obj.notify(); + } + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + }).start(); + + System.out.println("123"); + synchronized (obj) { + try { + obj.wait(8000); + } catch (InterruptedException e) { + e.fillInStackTrace(); + } + } + + long now = System.currentTimeMillis(); + System.out.println("time:" + (now - before)); + System.out.println("456"); + } + + @Test + public void test4() { + System.out.println(isInt(1.10)); + } + + + @Test + public void test6(){ + Pattern EL_PATTERN = Pattern.compile("\\$\\{([^}]*)}"); + + String json = "{\"userInfo\":\"${username}\"}"; + Matcher m = EL_PATTERN.matcher(json); + while (m.find()) { + String expr = m.group(1); +// body = Util.Parser.parse$(expr, body, getDataValue(expr, dataMap, lineFlag)); + System.out.println(expr); + } + } + + public static boolean isInt(double num) { + return Math.abs(num - Math.round(num)) < Double.MIN_VALUE; + } + + @Test + public void test2() throws InterruptedException { + + LongAdder total = new LongAdder(); + + total.add(1000*1000); + + LongAdder counter = new LongAdder(); + + ExecutorService pool = Executors.newVirtualThreadPerTaskExecutor(); + IntStream.range(0, 1000).forEach(i -> { + for (int j = 0; j < 1000; j++) { + pool.submit(() -> { + counter.increment(); + try { + Thread.sleep(1000); + total.decrement(); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + System.out.println("fiber-" + i); + }); + } + }); + + aWait(total); + System.out.println("!!!!"+counter.longValue()); + + } + + private void aWait(LongAdder counter) throws InterruptedException { + long before = System.currentTimeMillis(); + //阻塞主线程直到所有调用结束 + while (counter.intValue() != 0) { + TimeUnit.MILLISECONDS.sleep(500); + } + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/pom.xml b/ozburst-all/mimeter-engine/mimeter-api/pom.xml new file mode 100644 index 000000000..9b6df0338 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/pom.xml @@ -0,0 +1,42 @@ + + + + mimeter-engine + run.mone + 1.0-SNAPSHOT + + 4.0.0 + + mimeter-api + + + 20 + 20 + + + + + + run.mone + struct + 1.4-SNAPSHOT + + + + org.nutz + nutz + 1.r.68-youpin-SNAPSHOT + + + + com.xiaomi.mone + 1.0.0-SNAPSHOT + sautumn-api + + + + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/Const.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/Const.java new file mode 100644 index 000000000..64f23032a --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/Const.java @@ -0,0 +1,185 @@ +package common; + +public class Const { + + public static final boolean sendLog = true; + + public static final String HEAR_HEADER_KEY = "heracontext"; + + public static final String DUBBO_TRACE_HEADER_KEY = "traceparent"; + + public static final String MIMETER_UA_KEY = "mimeter"; + + public static final int SINGLE_API_DEBUG = 0; + public static final int SCENE_DEBUG = 1; + public static final int SINGLE_BENCH = 2; + + public static final String METRICS_NAME_TPS = "tps"; + public static final String METRICS_NAME_RPS = "rps"; + + public static final String METRICS_TYPE_SCENE = "scene"; + + + public static final String METRICS_NAME_TPS_API = "tps_api"; + + public static final String METRICS_NAME_RPS_API = "rps_api"; + + public static final String METRICS_NAME_RT_API = "rt_api"; + + public static final String TASK_CTX_RECORD_LOG = "recordLog"; + + public static final String TASK_CTX_LINE_FLAG = "lineFlag"; + + public static final String TASK_CTX_SCENE_QPS = "sceneQps"; + + public static final int PUSH_STAT_RATE = 10; + + public static final int API_TYPE_HTTP = 1; + public static final int API_TYPE_DUBBO = 3; + + public static final int SCENE_TYPE_HTTP = 0; + public static final int SCENE_TYPE_DUBBO = 1; + + public static final int HTTP_REQ_GET = 0; + public static final int HTTP_REQ_POST = 1; + + public static final int FEI_SHU_ALARM = 0; + + public static final int SMS_ALARM = 1; + public static final String HTTP_GET = "get"; + public static final String HTTP_POST = "post"; + + public static final String CONTENT_TYPE_APP_JSON = "application/json"; + public static final String CONTENT_TYPE_APP_FORM = "application/x-www-form-urlencoded"; + public static final String CONTENT_TYPE_APP_FORM2 = "x-www-form-urlencoded"; + + public static final String HERA_SCENE_TASK = "scene_task"; + public static final String HERA_SERIAL_LINK = "serial_link"; + public static final String HERA_API_ID = "api"; + + + public static final String SuccessRate = "SuccessRate"; + + public static final String P99ResponseTime = "P99ResponseTime"; + public static final String AvgResponseTime = "AvgResponseTime"; + public static final String RequestPerSecond = "RequestPerSecond"; + public static final String CpuUtilization = "CpuUtilization"; + public static final String MemoryUtilization = "MemoryUtilization"; + public static final String Load5Average = "Load5Average"; + public static final String Load5Max = "Load5Max"; + + public static final int STATUS_CODE = 1; + public static final int HEADER_CODE = 2; + public static final int OUTPUT_CODE = 3; + + public static final int BIGGER = 1; + public static final int BIGGER_AND_EQ = 2; + public static final int SMLLER = 3; + public static final int SMALLER_AND_EQ = 4; + public static final int EQ = 5; + public static final int CONTAIN = 6; + public static final int NOT_CONTAIN = 7; + public static final int NOT_EQ = 8; + + + /** + * http 错误状态码前缀 + */ + public static final String ERR_STATUS_CODE_PREFIX = "sCode_"; + + /** + * dubbo 错误状态 + */ + public static final String ERR_STATUS_DUBBO_PREFIX = "dubbo_call_fail"; + + /** + * 检查点 错误规则前缀 + */ + public static final String ERR_CHECKPOINT_PREFIX = "cpId_"; + + /** + * http 错误状态码前缀 + */ + public static final int ERR_STATUS_CODE_TYPE = 0; + + /** + * 检查点 错误规则前缀 + */ + public static final int ERR_CHECKPOINT_TYPE = 1; + + + /** + * dubbo调用错误类型 + */ + public static final int ERR_DUBBO_CALL_TYPE = 2; + + public static final int DUBBO_DATA_TOO_LONG_ERR_CODE = 200012; + + /** + * 记录每个接口的rt列表 + */ + public static final String RT_LIST = "rt_list"; + + + /** + * 记录每个接口的平均rt + */ + public static final String AVG_RT = "avg_rt"; + + /** + * 记录每个接口的最大rt + */ + public static final String MAX_RT = "max_rt"; + + /** + * 记录每个接口的平均 tps + */ + public static final String AVG_TPS = "avg_tps"; + + /** + * 记录每个接口的平均 rps + */ + public static final String AVG_RPS = "avg_rps"; + + /** + * 记录每个接口的最大tps + */ + public static final String MAX_TPS = "max_tps"; + + /** + * 记录每个接口的最大rps + */ + public static final String MAX_RPS = "max_rps"; + + /** + * 接口发压请求总次数(返回 用于rps) + */ + public static final String API_REQ_TOTAL_R = "api_req_total_r"; + + /** + * 接口请求总次数(返回 用于tps) + */ + public static final String API_REQ_TOTAL_T = "api_req_total_t"; + + /** + * 接口请求成功数 + */ + public static final String API_REQ_SUCC = "api_req_succ"; + + /** + * 接口请求失败数 + */ + public static final String API_REQ_FAIL = "api_req_fail"; + + /** + * 单台agent最大承受rps量 + */ + public static final int AGENT_MAX_RPS = 15000; + + public static final String DISABLE_URL_ENCODE = "disable-url-encode"; + + /** + * 单台机器单个配置项最多允许使用10000条数据,防止OOM + */ + public static final int AGENT_MAX_TRAFFIC_SIZE = 10000; +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/HttpClientV6.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/HttpClientV6.java new file mode 100644 index 000000000..cc6e51719 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/HttpClientV6.java @@ -0,0 +1,325 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package common; + +import com.google.common.collect.Lists; +import com.google.common.io.ByteStreams; + +import java.io.*; +import java.net.HttpURLConnection; +import java.net.InetAddress; +import java.net.URL; +import java.net.URLEncoder; +import java.security.SecureRandom; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.zip.GZIPInputStream; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import com.google.gson.Gson; +import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Slf4j +public class HttpClientV6 { +// private static final Logger log = LoggerFactory.getLogger(HttpClientV6.class); + + private final Gson gson = Util.getGson(); + + static TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() { + public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { + } + + public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { + } + + public X509Certificate[] getAcceptedIssuers() { + return null; + } + }}; + + public HttpClientV6() { + } + + public static HttpResult postRt(TpsRecord needRecordTps, String url, byte[] body, Map headers, int timeout) { + HttpURLConnection conn = null; + + HttpResult var14; + try { + conn = (HttpURLConnection) (new URL(url)).openConnection(); + conn.setRequestMethod("POST"); + conn.setConnectTimeout(timeout); + conn.setReadTimeout(timeout); + conn.setDoOutput(true); + conn.setDoInput(true); + if (null != headers) { + Iterator var7 = headers.entrySet().iterator(); + + while (var7.hasNext()) { + Map.Entry entry = (Map.Entry) var7.next(); + conn.addRequestProperty((String) entry.getKey(), (String) entry.getValue()); + } + } + + conn.addRequestProperty("Connection", "close"); + conn.getOutputStream().write(body); + + var14 = getResult(conn, false, null); + } catch (Exception var12) { + log.warn("http client v2 error:{}", var12.getCause()); + needRecordTps.setNeedRecordTps(false); + var14 = new HttpResult(500, var12.getMessage(), Collections.emptyMap()); + } finally { + if (null != conn) { + conn.disconnect(); + } + } + + return var14; + } + + public static HttpResult httpPost(TpsRecord needRecordTps, String url, Map headers, Map body, String encoding, int readTimeout) { + List list = Lists.newArrayList(); + if (null != headers) { + headers.entrySet().stream().forEach((it) -> { + list.add(it.getKey()); + list.add(it.getValue()); + }); + } + + return request(needRecordTps, url, list, body, encoding, "POST", readTimeout, false, null); + } + + public static HttpResult httpGet(TpsRecord needRecordTps, String url, List headers, Map paramValues, String encoding, int readTimeout) { + return request(needRecordTps, url, headers, paramValues, encoding, "GET", readTimeout, false, (File) null); + } + + public static HttpResult request(TpsRecord needRecordTps, String url, List headers, Map paramValues, String encoding, String method, int readTimeout, boolean download, File file) { + HttpURLConnection conn = null; + OutputStreamWriter wr = null; + HttpResult var12; + try { + String encodedContent = encodingParams(paramValues, encoding); + + if (method.equalsIgnoreCase(Const.HTTP_GET)){ + url = url + "?" + encodedContent; + } + if (url.startsWith("https")) { + HttpsURLConnection.setDefaultHostnameVerifier(new NullHostNameVerifier()); + SSLContext sc = SSLContext.getInstance("TLS"); + sc.init(null, trustAllCerts, new SecureRandom()); + HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); + } + conn = (HttpURLConnection) (new URL(url)).openConnection(); + conn.setConnectTimeout(readTimeout); + conn.setReadTimeout(readTimeout); + conn.setRequestMethod(method); + setHeaders(conn, headers, encoding); + conn.addRequestProperty("Connection", download ? "keep-alive" : "close"); + + // 向服务器发送请求 + if (!method.equalsIgnoreCase(Const.HTTP_GET)){ + conn.setDoOutput(true); + wr = new OutputStreamWriter(conn.getOutputStream()); + wr.write(encodedContent); + wr.flush(); + } + conn.connect(); + log.debug("Request from server: " + url); + var12 = getResult(conn, download, file); + return var12; + } catch (Exception var18) { + try { + if (conn != null) { + log.warn("failed to request " + conn.getURL() + " from " + InetAddress.getByName(conn.getURL().getHost()).getHostAddress()); + } + } catch (Exception var17) { + log.warn("failed to request:{}", var17.getMessage()); + } + + log.warn("failed to request:{}", var18.getMessage()); + needRecordTps.setNeedRecordTps(false); + var12 = new HttpResult(500, var18.getMessage(), Collections.emptyMap()); + } finally { + if (conn != null) { + conn.disconnect(); + } + if (wr != null){ + try { + wr.close(); + } catch (IOException e) { + log.error("failed to request,failed to close wr"); + } + } + } + return var12; + } + + private static HttpResult getResult(HttpURLConnection conn, boolean download, File file) throws IOException { + int respCode = conn.getResponseCode(); + Object inputStream; + if (200 != respCode && 304 != respCode && 204 != respCode && 201 != respCode) { + inputStream = conn.getErrorStream(); + } else { + inputStream = conn.getInputStream(); + } + + Map respHeaders = new HashMap(conn.getHeaderFields().size()); + Iterator var6 = conn.getHeaderFields().entrySet().iterator(); + + while (var6.hasNext()) { + Map.Entry> entry = (Map.Entry) var6.next(); + respHeaders.put(entry.getKey(), (String) ((List) entry.getValue()).get(0)); + } + + String encodingGzip = "gzip"; + if (encodingGzip.equals(respHeaders.get("Content-Encoding"))) { + inputStream = new GZIPInputStream((InputStream) inputStream); + } + + if (null != file) { + boolean res = getBytes((InputStream) inputStream, file); + return new HttpResult(respCode, res ? "57" : "", respHeaders); + } else { + HttpResult res; + if (inputStream != null) { + byte[] data = download ? getBytes((InputStream) inputStream) : ByteStreams.toByteArray((InputStream) inputStream); + res = new HttpResult(respCode, new String(data, getCharset(conn)), respHeaders); + res.data = data; + } else { + res = new HttpResult(respCode, String.valueOf(respCode), respHeaders); + res.data = String.valueOf(respCode).getBytes(); + } + return res; + } + } + + public static byte[] getBytes(InputStream is) throws IOException { + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + byte[] data = new byte[8192]; + + int nRead; + while ((nRead = is.read(data)) != -1) { + if (Thread.currentThread().isInterrupted()) { + log.warn("interrupted"); + return new byte[0]; + } + + buffer.write(data, 0, nRead); + } + + byte[] res = buffer.toByteArray(); + is.close(); + buffer.close(); + return res; + } + + public static boolean getBytes(InputStream is, File file) throws IOException { + FileOutputStream fos = new FileOutputStream(file); + byte[] data = new byte[8192]; + + try { + int len; + while ((len = is.read(data)) != -1) { + if (Thread.currentThread().isInterrupted()) { + log.warn("interrupted download:{}", file); + boolean var5 = false; + return var5; + } + + fos.write(data, 0, len); + } + + fos.flush(); + } finally { + is.close(); + fos.close(); + } + + return true; + } + + private static String getCharset(HttpURLConnection conn) { + String contentType = conn.getContentType(); + if (null != contentType && !contentType.equals("")) { + String[] values = contentType.split(";"); + if (values.length == 0) { + return "UTF-8"; + } else { + String charset = "UTF-8"; + String[] var4 = values; + int var5 = values.length; + + for (int var6 = 0; var6 < var5; ++var6) { + String value = var4[var6]; + value = value.trim(); + if (value.toLowerCase().startsWith("charset=")) { + charset = value.substring("charset=".length()); + } + } + + return charset; + } + } else { + return "UTF-8"; + } + } + + private static void setHeaders(HttpURLConnection conn, List headers, String encoding) { + if (null != headers) { + Iterator iter = headers.iterator(); + + while (iter.hasNext()) { + conn.addRequestProperty((String) iter.next(), (String) iter.next()); + } + } + + conn.addRequestProperty("Accept-Charset", encoding); + } + + private static String encodingParams(Map params, String encoding) throws UnsupportedEncodingException { + StringBuilder sb = new StringBuilder(); + if (null != params && !params.isEmpty()) { + params.put("encoding", encoding); + + for (Map.Entry stringStringEntry : params.entrySet()) { + if (null != stringStringEntry.getValue() && !stringStringEntry.getValue().equals("")) { + sb.append(stringStringEntry.getKey()).append("="); + if (!encoding.isEmpty()) { + sb.append(URLEncoder.encode(stringStringEntry.getValue(), encoding)); + } else { + sb.append(stringStringEntry.getValue()); + } + sb.append("&"); + } + } + + return sb.toString(); + } else { + return ""; + } + } + + public static class NullHostNameVerifier implements HostnameVerifier { + public NullHostNameVerifier() { + } + + public boolean verify(String arg0, SSLSession arg1) { + return true; + } + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/HttpResult.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/HttpResult.java new file mode 100644 index 000000000..21df46c38 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/HttpResult.java @@ -0,0 +1,25 @@ +package common; + +import java.util.Map; + +public class HttpResult { + public final int code; + public final String content; + public byte[] data; + private final Map respHeaders; + + public HttpResult(int code, String content, Map respHeaders) { + this.code = code; + this.content = content; + this.respHeaders = respHeaders; + } + + public String getHeader(String name) { + return this.respHeaders.get(name); + } + + public Map getHeaders() { + return this.respHeaders; + } + + } \ No newline at end of file diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/MapTypeAdapter.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/MapTypeAdapter.java new file mode 100644 index 000000000..e777d4bc5 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/MapTypeAdapter.java @@ -0,0 +1,112 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package common; + +import com.google.gson.Gson; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.internal.LinkedTreeMap; +import com.google.gson.internal.bind.ObjectTypeAdapter; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonToken; +import com.google.gson.stream.JsonWriter; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public final class MapTypeAdapter extends TypeAdapter { + public static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (type.getRawType() == Object.class) { + return (TypeAdapter) new MapTypeAdapter(gson); + } + return null; + } + }; + + private final Gson gson; + + private MapTypeAdapter(Gson gson) { + this.gson = gson; + } + + @Override + public Object read(JsonReader in) throws IOException { + JsonToken token = in.peek(); + //判断字符串的实际类型 + switch (token) { + case BEGIN_ARRAY: + List list = new ArrayList<>(); + in.beginArray(); + while (in.hasNext()) { + list.add(read(in)); + } + in.endArray(); + return list; + + case BEGIN_OBJECT: + Map map = new LinkedTreeMap<>(); + in.beginObject(); + while (in.hasNext()) { + map.put(in.nextName(), read(in)); + } + in.endObject(); + return map; + case STRING: + return in.nextString(); + case NUMBER: + String s = in.nextString(); + if (s.contains(".")) { + return Double.valueOf(s); + } else { + try { + return Integer.valueOf(s); + } catch (Exception e) { + return Long.valueOf(s); + } + } + case BOOLEAN: + return in.nextBoolean(); + case NULL: + in.nextNull(); + return null; + default: + throw new IllegalStateException(); + } + } + + @Override + public void write(JsonWriter out, Object value) throws IOException { + if (value == null) { + out.nullValue(); + return; + } + //noinspection unchecked + TypeAdapter typeAdapter = (TypeAdapter) gson.getAdapter(value.getClass()); + if (typeAdapter instanceof ObjectTypeAdapter) { + out.beginObject(); + out.endObject(); + return; + } + typeAdapter.write(out, value); + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/NetUtils.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/NetUtils.java new file mode 100644 index 000000000..db5a41db8 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/NetUtils.java @@ -0,0 +1,248 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package common; + +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.tuple.Pair; + +import java.io.IOException; +import java.net.*; +import java.util.*; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +/** + * @author goodjava@qq.com + */ +@Slf4j +public class NetUtils { + + + private static volatile InetAddress LOCAL_ADDRESS = null; + + public static final String LOCALHOST = "127.0.0.1"; + public static final String ANYHOST = "0.0.0.0"; + public static final String DOCKERHOST = "172.17.0.1"; + private static final Pattern IP_PATTERN = Pattern.compile("\\d{1,3}(\\.\\d{1,3}){3,5}$"); + + private static final int RND_PORT_START = 30000; + + private static final int MAX_PORT = 65535; + + private static final Random RANDOM = new Random(System.currentTimeMillis()); + + private static final int RND_PORT_RANGE = 10000; + + + public static String getHostName() { + try { + return InetAddress.getLocalHost().getHostName(); + } catch (UnknownHostException e) { + log.error("get host name error:{}", e.getMessage()); + return ""; + } + } + + + public static String getLocalHost() { + InetAddress address = getLocalAddress(); + return address == null ? LOCALHOST : address.getHostAddress(); + } + + public static InetAddress getLocalAddress() { + if (LOCAL_ADDRESS != null) { + return LOCAL_ADDRESS; + } + InetAddress localAddress = getLocalAddress0(); + LOCAL_ADDRESS = localAddress; + return localAddress; + } + + private static InetAddress getLocalAddress0() { + InetAddress localAddress = null; + try { + localAddress = InetAddress.getLocalHost(); + if (localAddress instanceof Inet6Address) { + Inet6Address address = (Inet6Address) localAddress; + if (isValidV6Address(address)) { + return normalizeV6Address(address); + } + } else if (isValidAddress(localAddress)) { + return localAddress; + } + } catch (Throwable e) { + log.warn(e.getMessage()); + } + try { + Enumeration interfaces = NetworkInterface.getNetworkInterfaces(); + if (null == interfaces) { + return localAddress; + } + while (interfaces.hasMoreElements()) { + try { + NetworkInterface network = interfaces.nextElement(); + Enumeration addresses = network.getInetAddresses(); + while (addresses.hasMoreElements()) { + try { + InetAddress address = addresses.nextElement(); + if (address instanceof Inet6Address) { + Inet6Address v6Address = (Inet6Address) address; + if (isValidV6Address(v6Address)) { + return normalizeV6Address(v6Address); + } + } else if (isValidAddress(address)) { + return address; + } + } catch (Throwable e) { + log.warn(e.getMessage()); + } + } + } catch (Throwable e) { + log.warn(e.getMessage()); + } + } + } catch (Throwable e) { + log.warn(e.getMessage()); + } + return localAddress; + } + + static boolean isValidV6Address(Inet6Address address) { + boolean preferIpv6 = Boolean.getBoolean("java.net.preferIPv6Addresses"); + if (!preferIpv6) { + return false; + } + try { + return address.isReachable(100); + } catch (IOException e) { + // ignore + } + return false; + } + + static InetAddress normalizeV6Address(Inet6Address address) { + String addr = address.getHostAddress(); + int i = addr.lastIndexOf('%'); + if (i > 0) { + try { + return InetAddress.getByName(addr.substring(0, i) + '%' + address.getScopeId()); + } catch (UnknownHostException e) { + // ignore + log.debug("Unknown IPV6 address: ", e); + } + } + return address; + } + + + static boolean isValidAddress(InetAddress address) { + if (address == null || address.isLoopbackAddress()) { + return false; + } + String name = address.getHostAddress(); + return (name != null + && !ANYHOST.equals(name) + && !LOCALHOST.equals(name) + && !DOCKERHOST.equals(name) + && IP_PATTERN.matcher(name).matches()); + } + + + public static int getAvailablePort(int port) { + if (port <= 0) { + return getAvailablePort(); + } + for (int i = port; i < MAX_PORT; i++) { + ServerSocket ss = null; + try { + ss = new ServerSocket(i); + return i; + } catch (IOException e) { + // continue + } finally { + if (ss != null) { + try { + ss.close(); + } catch (IOException e) { + } + } + } + } + return port; + } + + public static int getAvailableUdpPort(int port) { + if (port <= 0) { + return getUdpAvailablePort(); + } + for (int i = port; i < MAX_PORT; i++) { + DatagramSocket ss = null; + try { + ss = new DatagramSocket(i); + return i; + } catch (IOException e) { + // continue + } finally { + if (ss != null) { + ss.close(); + } + } + } + return port; + } + + + public static int getAvailablePort() { + ServerSocket ss = null; + try { + ss = new ServerSocket(); + ss.bind(null); + return ss.getLocalPort(); + } catch (IOException e) { + return getRandomPort(); + } finally { + if (ss != null) { + try { + ss.close(); + } catch (IOException e) { + } + } + } + } + + public static int getUdpAvailablePort() { + DatagramSocket ss = null; + try { + ss = new DatagramSocket(); + ss.bind(null); + return ss.getLocalPort(); + } catch (IOException e) { + return getRandomPort(); + } finally { + if (ss != null) { + ss.close(); + } + } + } + + + public static int getRandomPort() { + return RND_PORT_START + RANDOM.nextInt(RND_PORT_RANGE); + } + + +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/Replacer.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/Replacer.java new file mode 100644 index 000000000..f5ae36746 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/Replacer.java @@ -0,0 +1,40 @@ +/* + * Copyright 2020 XiaoMi. + * + * Licensed 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 the following link. + * + * 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. + */ +package common; + +import lombok.Data; + +import java.io.Serializable; + +/** + * Created by dongzhenxing on 2023/4/4 1:24 AM + */ +@Data +public class Replacer implements Serializable { + int taskId; + int paramIndex; + String paramName; + Object value; + boolean forceStr; + + public Replacer(int taskId, int paramIndex, String paramName, Object value, boolean forceStr) { + this.taskId = taskId; + this.paramIndex = paramIndex; + this.paramName = paramName; + this.value = value; + this.forceStr = forceStr; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/TpsRecord.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/TpsRecord.java new file mode 100644 index 000000000..9b107bed9 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/TpsRecord.java @@ -0,0 +1,12 @@ +package common; + +import lombok.Data; + +@Data +public class TpsRecord { + boolean needRecordTps; + + public TpsRecord(boolean needRecordTps) { + this.needRecordTps = needRecordTps; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/Util.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/Util.java new file mode 100644 index 000000000..bc2c094bb --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/common/Util.java @@ -0,0 +1,242 @@ +package common; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.internal.bind.ObjectTypeAdapter; +import com.xiaomi.youpin.docean.common.Pair; + +import java.lang.reflect.Field; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class Util { + + private static final Pattern EL_PATTERN = Pattern.compile("\\$\\{(.*)\\}"); + + public static Gson getGson() { + Gson gson = new GsonBuilder().serializeNulls().enableComplexMapKeySerialization().disableHtmlEscaping().create(); + try { + Field factories = Gson.class.getDeclaredField("factories"); + factories.setAccessible(true); + Object o = factories.get(gson); + Class[] declaredClasses = Collections.class.getDeclaredClasses(); + for (Class c : declaredClasses) { + if ("java.util.Collections$UnmodifiableList".equals(c.getName())) { + Field listField = c.getDeclaredField("list"); + listField.setAccessible(true); + List list = (List) listField.get(o); + int i = list.indexOf(ObjectTypeAdapter.FACTORY); + list.set(i, MapTypeAdapter.FACTORY); + break; + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return gson; + } + + public static class Parser { + + /** + * 将字符串text中由openToken和closeToken组成的占位符依次替换为args数组中的值 + */ + public static String parse(String openToken, String closeToken, String text, Object... args) { + if (args == null || args.length <= 0) { + return text; + } + int argsIndex = 0; + + if (text == null || text.isEmpty()) { + return ""; + } + char[] src = text.toCharArray(); + int offset = 0; + // search open token + int start = text.indexOf(openToken, offset); + if (start == -1) { + return text; + } + final StringBuilder builder = new StringBuilder(); + StringBuilder expression = null; + int replaceCount = 0; + while (start > -1) { + if (start > 0 && src[start - 1] == '\\') { + // this open token is escaped. remove the backslash and continue. + builder.append(src, offset, start - offset - 1).append(openToken); + offset = start + openToken.length(); + } else { + // found open token. let's search close token. + if (expression == null) { + expression = new StringBuilder(); + } else { + expression.setLength(0); + } + builder.append(src, offset, start - offset); + offset = start + openToken.length(); + int end = text.indexOf(closeToken, offset); + while (end > -1) { + if (end > offset && src[end - 1] == '\\') { + // this close token is escaped. remove the backslash and continue. + expression.append(src, offset, end - offset - 1).append(closeToken); + offset = end + closeToken.length(); + end = text.indexOf(closeToken, offset); + } else { + expression.append(src, offset, end - offset); + break; + } + } + if (end == -1) { + // close token was not found. + builder.append(src, start, src.length - start); + offset = src.length; + } else { + String value = (argsIndex <= args.length - 1) ? + (args[argsIndex] == null ? "" : args[argsIndex].toString()) : expression.toString(); + //数组数据源标识 ["${list}"] "LF1,2,3" + boolean listNum = false; + if (value.startsWith("LF")) { + if (value.charAt(2) != '"') { + //数组 纯数字 + value = value.substring(2); + listNum = true; + } else { + //数组 字符串 + value = value.substring(3, value.length() - 1); + } + } + if (value.startsWith("s^")) { + value = value.substring(2); + } + assert args[0] != null; + if (args[0].getClass().getName().startsWith("java.lang.Long") || args[0].getClass().getName().startsWith("java.lang.Double") || listNum) { + builder.deleteCharAt(builder.length() - 1); + offset = end + closeToken.length() + 1; + } else { + offset = end + closeToken.length(); + } + builder.append(value); + argsIndex++; + } + } + start = text.indexOf(openToken, offset); + replaceCount++; + if (replaceCount >= args.length) { + break; + } + } + if (offset < src.length) { + builder.append(src, offset, src.length - offset); + } + return builder.toString(); + } + + public static String parse$(String key, String text, Object... args) { + return Parser.parse("${" + key, "}", text, args); + } + + + public static String parse1(String text, Object... args) { + return Parser.parse("{", "}", text, args); + } + } + + + public static Pair getElKey(String key) { + String k = null; + String v = null; + if (null != key && key.length() > 0) { + Matcher m = EL_PATTERN.matcher(key); + + if (m.find()) { + k = m.group(1); + v = ""; + } + } + return Pair.of(k, v); + } + + /** + * 按比率判断 + * + * @param rate 0~100 + * @return + */ + public static boolean judgeByRate(int rate) { + Random random = new Random(); + return random.nextInt(100) <= rate; + } + + /** + * 按比率判断 + * + * @param rate 0~1000 + * @return + */ + public static boolean judgeByRateLog(int rate) { + Random random = new Random(); + return random.nextInt(1000) <= rate; + } + + public static int sampleRateToCnt(int n, int rate) { + return (int) Math.ceil(n * rate / 1000.0d); + } + + // fix inaccurate log rate due to low qps, so use (qps * Math.min(10, duration)) as base + public static List sampleByTimeAndQps(int duration, int qps, int rate) { + int base = Math.min(10, duration) * qps; + return sampleIndices(base, sampleRateToCnt(base, rate)); + } + + /** + * 从[0, n)随机抽取出k个数, k <= n + */ + public static List sampleIndices(int n, int k) { + List output = new ArrayList<>(); + + // will use judgeByRate() as backup + if (k <= 0 || n < k) { + return output; + } + int i, j; + + for (i = 0; i < k; i++) { + output.add(i); + } + Random rand = new Random(); + + for (j = i; j < n; j++) { + int index = rand.nextInt(j + 1); + + if (index < k) { + output.set(index, j); + } + } + return output; + } + + public static Object getListValByType(JsonArray valList, int index, String type) { + Object value; + switch (type) { + case "string" -> value = valList.get(index).getAsString(); + case "int" -> value = valList.get(index).getAsInt(); + case "double" -> value = valList.get(index).getAsDouble(); + default -> value = valList.get(index); + } + return value; + } + + public static int calculateAgentRps(int totalRps, int agentNum) { + int agentQps = totalRps / agentNum; + if (agentQps < 1) { + agentQps = 1; + } else if (agentQps > Const.AGENT_MAX_RPS) { + //单台最多给15000 rps + agentQps = Const.AGENT_MAX_RPS; + } + return agentQps; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/MibenchCmd.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/MibenchCmd.java new file mode 100644 index 000000000..3afb1fce2 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/MibenchCmd.java @@ -0,0 +1,35 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo; + +/** + * @author goodjava@qq.com + * @date 2022/5/22 + */ +public class MibenchCmd { + + + public static final int PING = 12345; + + public static final int TASK = 12445; + + + public static final int TASK_RESULT = 12446; + + public static final int MANAGER = 12545; + +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/AgentHostReq.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/AgentHostReq.java new file mode 100644 index 000000000..0be2f64cb --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/AgentHostReq.java @@ -0,0 +1,12 @@ +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class AgentHostReq implements Serializable { + String domain; + + String ip; +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/AgentInfoDTO.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/AgentInfoDTO.java new file mode 100644 index 000000000..b03239a58 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/AgentInfoDTO.java @@ -0,0 +1,54 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author goodjava@qq.com + * @date 2022/5/19 + */ +@Data +public class AgentInfoDTO implements Serializable { + + private String id; + + private String ip; + + private int port; + + private String hostname; + + private int cpu; + + private long mem; + + private int useCpu; + + private long useMem; + + private String serverName; + + private String desc; + + private Long utime; + + private int status; + +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/AgentReq.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/AgentReq.java new file mode 100644 index 000000000..5c5623754 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/AgentReq.java @@ -0,0 +1,111 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; +import run.mone.mimeter.engine.agent.bo.stat.SceneTotalCountContextDTO; +import run.mone.mimeter.engine.agent.bo.task.ChangeQpsReq; +import run.mone.mimeter.engine.agent.bo.task.Task; +import run.mone.mimeter.engine.agent.bo.task.TaskResult; +import run.mone.mimeter.engine.agent.bo.task.TaskStatusBo; + +import java.io.Serializable; +import java.util.List; + +/** + * @author goodjava@qq.com + * @date 2022/5/19 + */ +@Data +public class AgentReq implements Serializable { + + private User user; + + private String addr; + + private AgentInfoDTO agentInfoDTO; + + private List agentHostReqList; + + private String cmd; + + /** + * 修改压测 qps + */ + private ChangeQpsReq changeQpsReq; + + /** + * 任务信息 + */ + private Task task; + + /** + * 任务结果 + */ + private TaskResult taskResult; + + /** + * 打点统计 + */ + private SceneTotalCountContextDTO totalCountContextDTO; + + /** + * 状态记录 + */ + private TaskStatusBo statusBo; + + public static final String TASK_RESULT_CMD = "taskResult"; + + + public static final String TOTAL_DATA_COUNT_CMD = "totalCountContext"; + + /** + * 提交任务 + */ + public static final String SUBMIT_TASK_CMD = "submitTask"; + + /** + * 提交修改host命令 + */ + public static final String EDIT_HOST_CMD = "editHost"; + + /** + * 提交加载host文件命令 + */ + public static final String LOAD_HOST_CMD = "loadHost"; + + /** + * 提交删除host配置命令 + */ + public static final String DEL_HOST_CMD = "delHost"; + + /** + * 取消任务 + */ + public static final String CANCEL_TASK_CMD = "cancelTask"; + + /** + * 变更任务qps + */ + public static final String CHANGE_TASK_QPS = "upQpsTask"; + /** + * 更新任务状态 + */ + public static final String UP_TASK_STATUS = "updateTaskStatus"; + + +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/ApiX5InfoDTO.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/ApiX5InfoDTO.java new file mode 100644 index 000000000..c73591e1e --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/ApiX5InfoDTO.java @@ -0,0 +1,37 @@ +/* + * Copyright 2020 XiaoMi. + * + * Licensed 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 the following link. + * + * 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. + */ +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; + +import java.io.Serializable; + +/** + * Created by dongzhenxing on 2023/3/6 11:22 AM + */ +@Data +public class ApiX5InfoDTO implements Serializable { + + private boolean enableX5; + + private String appId; + + private String appKey; + + private String x5Method; + + private String x5Version; +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/Attachment.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/Attachment.java new file mode 100644 index 000000000..f59ff1d77 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/Attachment.java @@ -0,0 +1,29 @@ +/* + * Copyright 2020 XiaoMi. + * + * Licensed 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 the following link. + * + * 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. + */ +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; + +import java.io.Serializable; + +/** + * Created by dongzhenxing on 2023/6/21 4:36 PM + */ +@Data +public class Attachment implements Serializable { + private String paramKey; + private String paramValue; +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/BaseData.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/BaseData.java new file mode 100644 index 000000000..8574cdace --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/BaseData.java @@ -0,0 +1,145 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.data; + +import com.google.gson.Gson; +import common.Replacer; +import common.Util; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.math.NumberUtils; + +import java.io.Serializable; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.atomic.AtomicReference; + +/** + * @author goodjava@qq.com + * @date 2022/6/2 + */ +@Data +@Slf4j +public class BaseData implements Serializable { + + private int paramNum; + + private List types = new CopyOnWriteArrayList<>(); + + protected List params = new CopyOnWriteArrayList<>(); + + /** + * 源json参数体 + */ + private String originJsonParam = ""; + + private AtomicReference jsonParam = new AtomicReference<>(""); + + + private CopyOnWriteArrayList outputParams; + + /** + * 检查点 + */ + private CopyOnWriteArrayList checkPointInfoList; + + /** + * 过滤条件 + */ + private CopyOnWriteArrayList filterCondition; + + private static final Gson gson = Util.getGson(); + + public BaseData() { + } + + public void initTypeList(List list) { + this.types.addAll(list); + this.paramNum = this.types.size(); + + list.forEach(it -> { + //若接口入参是对象 + if (it.getTypeEnum().equals(ParamTypeEnum.pojo)) { + params.add(new ConcurrentHashMap<>()); + } + }); + } + + /** + * 用于上游节点接口动态更新本接口实际参数 + * + * @ paramIndex 参数索引位置 + * @ paramName 参数名 若paramName 为例:${name} 类型,则直接替换 + * @ value 上游传下来的实际参数值 + */ + public void updateParam(List replacerList) { + AtomicReference body = new AtomicReference<>(getOriginJsonParam()); + + replacerList.forEach(replacer -> { + if (replacer.getParamName().startsWith("${")) { + try { + //post请求 的 json参数 + String valStr = replacer.getValue().toString(); + + if (!replacer.isForceStr()) { + if (NumberUtils.isNumber(valStr)) { + if (isNumeric(valStr)) { + replacer.setValue(Long.parseLong(valStr)); + } else { + replacer.setValue(Double.parseDouble(valStr)); + } + } else { + replacer.setValue(valStr); + } + } +// log.debug("updateParam param,name:{},body:{},value:{}", paramName, body, value); + + body.set(Util.Parser.parse$(Util.getElKey(replacer.getParamName()).getKey(), body.get(), replacer.getValue())); + } catch (Exception e) { + log.error("updateParam param after,body:{},time:{},error:{}", body.get(), System.currentTimeMillis(), e); + } + log.debug("updateParam param after,body:{},time:{}", body, System.currentTimeMillis()); + } else { + ParamType type = types.get(replacer.getParamIndex()); + //对象类型 + if (type.getTypeEnum().equals(ParamTypeEnum.pojo)) { + ConcurrentHashMap params = (ConcurrentHashMap) this.params.get(replacer.getParamIndex()); + params.put(replacer.getParamName(), replacer.getValue()); + } + //基本类型 + if (type.getTypeEnum().equals(ParamTypeEnum.primary)) { + params.set(replacer.getParamIndex(), replacer.getValue()); + } + } + }); + getJsonParam().set(body.get()); + } + +// public synchronized void recoverJsonParam() { +// setJsonParam(getOriginJsonParam()); +// } + + public static boolean isNumeric(String str) { + for (int i = str.length(); --i >= 0; ) { + int chr = str.charAt(i); + if (chr < 48 || chr > 57) + return false; + } + return true; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/CheckFilterConditionRes.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/CheckFilterConditionRes.java new file mode 100644 index 000000000..f6c7a0d1f --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/CheckFilterConditionRes.java @@ -0,0 +1,11 @@ +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CheckFilterConditionRes implements Serializable { + private boolean match; + private String triggerFilterCondition; +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/CheckPointInfo.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/CheckPointInfo.java new file mode 100644 index 000000000..f908e03a4 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/CheckPointInfo.java @@ -0,0 +1,13 @@ +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; +import java.io.Serializable; + +@Data +public class CheckPointInfo implements Serializable { + private Integer id; + private Integer checkType; + private String checkObj; + private Integer checkCondition; + private String checkContent; +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/CommonReqInfo.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/CommonReqInfo.java new file mode 100644 index 000000000..76ec44615 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/CommonReqInfo.java @@ -0,0 +1,40 @@ +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +@Data +public class CommonReqInfo implements Serializable { + + /** + * 1:http get + * 2:http post form + * 3:http post json + * 4:dubbo + */ + private int paramsType; + + private String debugUrl; + + private String paramJson; + +// private List getOrFormParamsList; + + private Map queryParamMap; + + private Map headers; + + @Override + public String toString() { + return "CommonReqInfo{" + + "paramsType=" + paramsType + + ", debugUrl='" + debugUrl + '\'' + + ", paramJson='" + paramJson + '\'' + + ", queryParamMap=" + queryParamMap + + ", headers=" + headers + + '}'; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/DebugSceneApiInfoReq.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/DebugSceneApiInfoReq.java new file mode 100644 index 000000000..0f3028350 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/DebugSceneApiInfoReq.java @@ -0,0 +1,52 @@ +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author dongzhenxing + * 用于单独调试的接口信息 + */ +@Data +public class DebugSceneApiInfoReq implements Serializable { + + private Integer apiType; + + private String apiUrl; + + private Integer requestMethod; + + private Integer requestTimeout; + + private String contentType; + + private String serviceName; + + private String methodName; + + private String attachments; + + private String paramTypeList; + + private String dubboGroup; + + private String dubboVersion; + + private String dubboMavenVersion; + + private String apiHeader; + + private TspAuthInfoDTO apiTspAuth; + + private String requestParamInfo; + + private String requestBody; + + private String dubboParamJson; + + private String checkPointInfoListStr; + + private String outputParamInfosStr; + +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/DemoData.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/DemoData.java new file mode 100644 index 000000000..e1371dfa9 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/DemoData.java @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author goodjava@qq.com + * @date 2022/6/2 + */ +@Data +public class DemoData extends BaseData implements Serializable { + +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/DubboData.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/DubboData.java new file mode 100644 index 000000000..0f93d5336 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/DubboData.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; + +/** + * @author goodjava@qq.com + * @date 2022/5/23 + */ +@Data +public class DubboData extends BaseData implements Serializable,Cloneable { + + private String serviceName; + + private String methodName; + + private String group; + + private String version; + + private String mavenVersion; + + private String dubboEnv; + + private List requestParamTypeList; + + private volatile String requestBody; + + private Integer requestTimeout; + + private ConcurrentHashMap attachments = new ConcurrentHashMap<>(); + + @Override + public DubboData clone() throws CloneNotSupportedException { + return (DubboData) super.clone(); + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/ExprKey.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/ExprKey.java new file mode 100644 index 000000000..58df33003 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/ExprKey.java @@ -0,0 +1,66 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author goodjava@qq.com + * @date 2022/6/2 + */ +@Data +public class ExprKey implements Serializable { + + /** + * 从那个顶点取值 + */ + private int index; + + /** + * 类型 1 txt 2 json + */ + private int origin; + + /** + * 取完值的名字 + */ + private String name; + + /** + * 取值表达式 + */ + private String expr; + + /** + * 放入task data中的表达式规则 demoData->0->i + */ + private List putValueExpr; + + public ExprKey() { + } + + public ExprKey(int index, int origin, String name, String expr, List putValueExpr) { + this.index = index; + this.origin = origin; + this.name = name; + this.expr = expr; + this.putValueExpr = putValueExpr; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/HeaderInfo.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/HeaderInfo.java new file mode 100644 index 000000000..e8bb050fe --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/HeaderInfo.java @@ -0,0 +1,11 @@ +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class HeaderInfo implements Serializable { + private String headerName; + private String headerValue; +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/HttpData.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/HttpData.java new file mode 100644 index 000000000..9810855d2 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/HttpData.java @@ -0,0 +1,71 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.IntStream; + +/** + * @author goodjava@qq.com + * @date 2022/5/19 + */ +@Data +public class HttpData extends BaseData implements Serializable,Cloneable{ + + private String url; + + private String method; + + private String contentType; + + private int timeout; + + private ConcurrentHashMap headers = new ConcurrentHashMap<>(); + + private TspAuthInfoDTO tspAuthInfoDTO; + + private ApiX5InfoDTO apiX5InfoDTO; + + private volatile String postParamJson; + + private boolean enableTraffic; + + private int trafficConfId; + + public Map httpGetParams() { + Map map = new HashMap<>(); + IntStream.range(0, this.getParamNum()).forEach(i -> map.put(this.getTypes().get(i).getName(), this.params.get(i).toString())); + return map; + } + + public Map httpGetTmpParams(List params) { + Map map = new HashMap<>(); + IntStream.range(0, this.getParamNum()).forEach(i -> map.put(this.getTypes().get(i).getName(), params.get(i).toString())); + return map; + } + + @Override + public HttpData clone() throws CloneNotSupportedException { + return (HttpData) super.clone(); + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/HttpResult.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/HttpResult.java new file mode 100644 index 000000000..dcb0161b8 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/HttpResult.java @@ -0,0 +1,56 @@ +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; + +import java.util.Objects; + +@Data +public class HttpResult { + private int code; + + private String data; + + private String message; + + private String method; + + public HttpResult(int code, String data, String message) { + this.code = code; + this.data = data; + this.message = message; + } + + public static HttpResult fail(int errorCode, String message,String data) { + return new HttpResult(errorCode, message,data); + } + + public static HttpResult success(String data) { + return new HttpResult(200, data,"ok"); + } + + @Override + public String toString() { + return "HttpResult{" + + "code=" + code + + ", data='" + data + '\'' + + ", message='" + message + '\'' + + ", method='" + method + '\'' + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + HttpResult that = (HttpResult) o; + return code == that.code && + Objects.equals(data, that.data) && + Objects.equals(message, that.message) && + Objects.equals(method, that.method); + } + + @Override + public int hashCode() { + return Objects.hash(code, data, message, method); + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/NodeInfo.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/NodeInfo.java new file mode 100644 index 000000000..880ea21be --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/NodeInfo.java @@ -0,0 +1,41 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; +import run.mone.mimeter.engine.agent.bo.task.Task; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + + +/** + * @author goodjava@qq.com + */ +@Data +public class NodeInfo implements Serializable { + + private Integer id; + + private Task task; + + private String resultName; + + private Map exprMap = new HashMap<>(); + +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/OutputParam.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/OutputParam.java new file mode 100644 index 000000000..1c02d7001 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/OutputParam.java @@ -0,0 +1,19 @@ +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class OutputParam implements Serializable { + + private int origin; + private String paramName; + private String parseExpr; + + public OutputParam(int origin,String paramName, String parseExpr) { + this.origin = origin; + this.paramName = paramName; + this.parseExpr = parseExpr; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/ParamType.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/ParamType.java new file mode 100644 index 000000000..57db90b8d --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/ParamType.java @@ -0,0 +1,45 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; + +/** + * @author goodjava@qq.com + * @date 2022/6/5 + */ +@Data +public class ParamType { + + /** + * 入参类型 + * 对象为 pojo + * 基本类型为 primary + */ + private ParamTypeEnum typeEnum; + + /** + * 入参名 + */ + private String name; + + public ParamType(ParamTypeEnum typeEnum, String name) { + this.typeEnum = typeEnum; + this.name = name; + } + +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/ParamTypeEnum.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/ParamTypeEnum.java new file mode 100644 index 000000000..4cb15a4d8 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/ParamTypeEnum.java @@ -0,0 +1,11 @@ +package run.mone.mimeter.engine.agent.bo.data; + +/** + * @author goodjava@qq.com + * @date 2022/6/5 + */ +public enum ParamTypeEnum { + pojo, + primary, + list, +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/ReqParamType.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/ReqParamType.java new file mode 100644 index 000000000..f764664e7 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/ReqParamType.java @@ -0,0 +1,31 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.data; + +public enum ReqParamType { + + Http_Get(1), + Http_Post_Form(2), + Http_Post_Json(3), + Dubbo(4); + + public final int code; + + private ReqParamType(int code) { + this.code = code; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/Result.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/Result.java new file mode 100644 index 000000000..25648ddbd --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/Result.java @@ -0,0 +1,83 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Map; + +/** + * @author goodjava@qq.com + * @date 2022/5/19 + */ +@Data +public class Result implements Serializable { + + private int code; + + private String message; + + private D data; + + private boolean ok; + + private CommonReqInfo commonReqInfo; + + private Map respHeaders; + + private String triggerCp; + + /** + * 触发的检查点条件 + */ + private String triggerFilterCondition; + + private long rt; + + //bytes + private long size; + + public Result() { + } + + public Result(int code, String message, D data) { + this.code = code; + this.message = message; + this.data = data; + } + + public static Result cancel() { + return new Result<>(501, "cancel", "cancel"); + } + + public static Result fail(int errorCode, String message,D data) { + return new Result(errorCode, message,data); + } + + public static Result success(D data) { + return new Result(200, "ok",data); + } + + public boolean isSuccess() { + return checkSuccess(this.code); + } + + public static boolean checkSuccess(final int code) { + return code == 0 || code == 200; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/TspAuthInfoDTO.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/TspAuthInfoDTO.java new file mode 100644 index 000000000..4d3c63c57 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/TspAuthInfoDTO.java @@ -0,0 +1,16 @@ +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; + +@Data +public class TspAuthInfoDTO { + private boolean enableAuth; + private String accessKey; + private String secretKey; + + public TspAuthInfoDTO(boolean enableAuth, String accessKey, String secretKey) { + this.enableAuth = enableAuth; + this.accessKey = accessKey; + this.secretKey = secretKey; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/User.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/User.java new file mode 100644 index 000000000..8b9acd59d --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/data/User.java @@ -0,0 +1,39 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.data; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Map; + +/** + * @author goodjava@qq.com + * @date 2022/5/19 + * + * 用户信息 + */ +@Data +public class User implements Serializable { + + private String name; + + private String type; + + private Map attachments; + +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/hosts/HostBo.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/hosts/HostBo.java new file mode 100644 index 000000000..8feaec1e3 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/hosts/HostBo.java @@ -0,0 +1,18 @@ +package run.mone.mimeter.engine.agent.bo.hosts; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class HostBo implements Serializable { + /** + * 绑定的ip + */ + private String ip; + + /** + * 绑定的域名 + */ + private String domain; +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/DubboResultCheckInfo.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/DubboResultCheckInfo.java new file mode 100644 index 000000000..b3c09c784 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/DubboResultCheckInfo.java @@ -0,0 +1,10 @@ +package run.mone.mimeter.engine.agent.bo.stat; + +import lombok.Data; + +@Data +public class DubboResultCheckInfo extends ResultCheckInfo { + + private String triggerCpInfo; + +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/HttpResultCheckInfo.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/HttpResultCheckInfo.java new file mode 100644 index 000000000..afb5b9fa4 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/HttpResultCheckInfo.java @@ -0,0 +1,14 @@ +package run.mone.mimeter.engine.agent.bo.stat; + +import lombok.Data; + +@Data +public class HttpResultCheckInfo extends ResultCheckInfo { + /** + * http状态码 + */ + private String httpStatusCode; + + private String triggerCpInfo; + +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/MetricLabelEnum.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/MetricLabelEnum.java new file mode 100644 index 000000000..fffb55241 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/MetricLabelEnum.java @@ -0,0 +1,74 @@ +package run.mone.mimeter.engine.agent.bo.stat; + +import java.util.Arrays; + +import static com.google.common.base.Preconditions.checkArgument; + +/** + * @author Xirui Yang (yangxirui@xiaomi.com) + * @version 1.0 + * @since 2022/8/26 + * + * 注意:只许往后加枚举值 + */ +public enum MetricLabelEnum { + + SCENE_ID(0, "sceneid"), + REPORT_ID(1, "reportid"), + SERIAL_ID(2, "serialid"), + TYPE(3, "type"), + CODE(4, "code"), + URI(5, "uri"), + METHOD(6, "method"), + API_ID(7, "apiid"), + SUCCESS(8, "success"); + + private final int index; + + private final String name; + + private static final String[] labelNames = new String[MetricLabelEnum.values().length]; + + private static final String[] labelApiRpsNames = new String[8]; + + static { + int i = 0; + for (MetricLabelEnum label : MetricLabelEnum.values()) { + labelNames[i++] = label.getName(); + } + labelApiRpsNames[0] = SCENE_ID.name; + labelApiRpsNames[1] = REPORT_ID.name; + labelApiRpsNames[2] = SERIAL_ID.name; + labelApiRpsNames[3] = TYPE.name; + labelApiRpsNames[4] = URI.name; + labelApiRpsNames[5] = METHOD.name; + labelApiRpsNames[6] = API_ID.name; + labelApiRpsNames[7] = SUCCESS.name; + } + + public static String[] getLabelNames() { + return labelNames; + } + + public static String[] getLabelApiRpsNames() { + return labelApiRpsNames; + } + + public static String[] labelNameSlice(int len) { + checkArgument(len > 0 && len <= labelNames.length, "MetricLabelEnum labelNames invalid len " + len); + return Arrays.asList(labelNames).subList(0, len).toArray(new String[]{}); + } + + MetricLabelEnum(int index, String name) { + this.index = index; + this.name = name; + } + + public int getIndex() { + return index; + } + + public String getName() { + return name; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/ResultCheckInfo.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/ResultCheckInfo.java new file mode 100644 index 000000000..3fe9c80c8 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/ResultCheckInfo.java @@ -0,0 +1,17 @@ +package run.mone.mimeter.engine.agent.bo.stat; + +import lombok.Data; + +@Data +public class ResultCheckInfo { + /** + * 是否成功 + */ + private boolean ok; + + /** + * 对应的检查点id + */ + private Integer checkPointId; + +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/SceneErrorCountContext.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/SceneErrorCountContext.java new file mode 100644 index 000000000..006669747 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/SceneErrorCountContext.java @@ -0,0 +1,54 @@ +package run.mone.mimeter.engine.agent.bo.stat; + + +import lombok.Data; + +import java.io.Serializable; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.atomic.LongAdder; + +@Data +public class SceneErrorCountContext implements Serializable { + private String reportId; + private Integer sceneId; + + private Integer taskId; + + private Integer agentNum; + + /** + * 关联任务数 + */ + private Integer connectTaskNum; + + private boolean lastTime; + + private LongAdder tmpCount; + /** + * 全场景请求次数 + */ + private LongAdder totalReq; + + /** + * 全场景错误次数 + */ + private LongAdder totalErrReq; + + /** + * <"s_code_errorCode",> or <"cp_id_checkpointId",> + * <"s_code_404",<2342,10>> or <"cp_id_141242",<2342,10>> + */ + private ConcurrentMap> counterMap; + + public SceneErrorCountContext(String reportId, Integer sceneId, Integer taskId, Integer agentNum, Integer connectTaskNum, boolean lastTime, LongAdder totalReq, LongAdder totalErrReq, ConcurrentMap> counterMap) { + this.reportId = reportId; + this.sceneId = sceneId; + this.taskId = taskId; + this.agentNum = agentNum; + this.connectTaskNum = connectTaskNum; + this.lastTime = lastTime; + this.totalReq = totalReq; + this.totalErrReq = totalErrReq; + this.counterMap = counterMap; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/SceneTotalCountContext.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/SceneTotalCountContext.java new file mode 100644 index 000000000..0778b3ab4 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/SceneTotalCountContext.java @@ -0,0 +1,117 @@ +package run.mone.mimeter.engine.agent.bo.stat; + + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import run.mone.mimeter.engine.agent.bo.task.DagTaskRps; + +import java.io.Serializable; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.LongAdder; + +@Data +@AllArgsConstructor +@Builder +public class SceneTotalCountContext implements Serializable { + private String reportId; + private Integer sceneId; + + /** + * 场景类型,用于调用获取p99 p95 + */ + private String sceneType; + + private Integer taskId; + + private Integer agentNum; + + /** + * linkId -> dag task id and rps + */ + DagTaskRps dagTaskRps; + + /** + * 可控的场景发压比例 + */ + private Integer rpsRate; + + /** + * 关联任务数 + */ + private Integer connectTaskNum; + + private boolean lastTime; + + /** + * 全场景发压请求次数 + */ + private LongAdder totalReq; + + /** + * 丢失连接数 + */ + private LongAdder lossConnNum; + + /** + * 全场景业务处理次数 + */ + private LongAdder totalTCount; + + /** + * 全场景成功次数 + */ + private LongAdder totalSuccReq; + + /** + * 全场景错误次数 + */ + private LongAdder totalErrReq; + + + /** + * 用于临时proms打点链路tps统计,每秒清零,消耗较大 + */ + private LongAdder tmpTpsCounter; + + /** + * 用于临时proms打点链路tps统计,每秒清零,消耗较大 + */ + private LongAdder tmpRpsCounter; + + /** + * 记录接口错误统计数据 + * <"s_code_errorCode",> or <"cp_id_checkpointId",> + * <"s_code_404",<2342,10>> or <"cp_id_141242",<2342,10>> + */ + private ConcurrentMap> errCounterMap; + + /** + * 记录接口Rt数据 + *

+ * 例:> 每次调用统计 + */ + private ConcurrentHashMap>> apiRtMap; + + /** + * 记录接口请求次数,成功失败数 tps + * > + */ + private ConcurrentHashMap> apiCountMap; + + /** + * 记录接口平均rps + */ + private ConcurrentHashMap apiRpsMap; + + /** + * 记录接口平均tps + */ + private ConcurrentHashMap apiTpsMap; + + public SceneTotalCountContext() { + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/SceneTotalCountContextDTO.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/SceneTotalCountContextDTO.java new file mode 100644 index 000000000..6c2c4b4cf --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/SceneTotalCountContextDTO.java @@ -0,0 +1,104 @@ +package run.mone.mimeter.engine.agent.bo.stat; + + +import lombok.Data; +import run.mone.mimeter.engine.agent.bo.task.DagTaskRps; + +import java.io.Serializable; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; + +@Data +public class SceneTotalCountContextDTO implements Serializable { + + private String reportId; + + private Integer sceneId; + + private Integer taskId; + + /** + * 场景类型,用于调用获取p99 p95 + */ + private String sceneType; + + /** + * 使用的发压机数量 + */ + private Integer agentNum; + + /** + * 链路实际 rps + */ + DagTaskRps dagTaskRps; + + /** + * 可控的场景发压比例 + */ + private Integer rpsRate; + + /** + * 关联任务数 + */ + private Integer connectTaskNum; + + private boolean lastTime; + + /** + * 全场景请求次数 + */ + private long totalReq; + + /** + * 丢失连接数 + */ + private long lossConnNum; + + /** + * 全场景业务处理次数 + */ + private long totalTCount; + + /** + * 全场景成功次数 + */ + private long totalSuccReq; + + /** + * 全场景错误次数 + */ + private long totalErrReq; + + /** + * 记录接口错误统计 + * <"s_code_errorCode",> or <"cp_id_checkpointId",> + * <"s_code_404",<2342,10>> or <"cp_id_141242",<2342,10>> + */ + private ConcurrentHashMap> counterMap; + + + /** + * 记录接口Rt与Tps数据 + * + * 例:> 每次调用统计rt + */ + private ConcurrentHashMap>> apiRtMap; + + /** + * 记录接口请求次数,成功失败数 + * > + */ + private ConcurrentHashMap> apiCountMap; + + + /** + * 记录接口平均rps + */ + private ConcurrentHashMap apiRpsMap; + + /** + * 记录接口平均tps + */ + private ConcurrentHashMap apiTpsMap; + +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/SysMonitorType.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/SysMonitorType.java new file mode 100644 index 000000000..023e1c120 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/SysMonitorType.java @@ -0,0 +1,32 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.stat; + +public enum SysMonitorType { + Cpu_Usage("cpuUsage"), + Mem_Used("memUsage"), + Load_Avg("load_avg"), + Load_Max("load_max"), + + ; + + public final String name; + + SysMonitorType(String name) { + this.name = name; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/TotalCounterStatistic.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/TotalCounterStatistic.java new file mode 100644 index 000000000..d792322ed --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/stat/TotalCounterStatistic.java @@ -0,0 +1,127 @@ +package run.mone.mimeter.engine.agent.bo.stat; + + +import lombok.Data; +import run.mone.mimeter.engine.agent.bo.task.DagTaskRps; + +import java.io.Serializable; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.LongAdder; +@Data +public class TotalCounterStatistic implements Serializable { + + private AtomicInteger finishAgentNum; + + /** + * 可控的场景发压比例 + */ + private volatile int rpsRate; + + /** + * 全场景总请求次数 + */ + private LongAdder totalReq; + + /** + * 丢失连接数 + */ + private LongAdder lossConnNum; + + /** + * 全场景业务处理次数 + */ + private LongAdder totalTCount; + + /** + * 全场景成功次数 + */ + private LongAdder totalSuccReq; + + /** + * 全场景总错误请求次数 + */ + private LongAdder totalErrReq; + + /** + * 全场景平均rt + */ + private volatile int avgRt; + + /** + * 全场景最大rt + */ + private volatile int maxRt; + + /** + * 全场景平均tps + */ + private volatile int avgTps; + + /** + * 全场景最大tps + */ + private volatile int maxTps; + + /** + * 全场景最大rps + */ + private volatile int maxRps; + + /** + * 全场景平均rps + */ + private volatile int avgRps; + + /** + * 错误数据统计 + * <"s_code_errorCode",> or <"cp_id_checkpointId",> + * <"s_code_404",<2342,10>> or <"cp_id_141242",<2342,10>> + */ + private ConcurrentMap> counterMap; + + /** + * 记录接口Rt与Tps数据 + *

+ * 例:> + * > + * > + * > + * > + * > + * > + */ + private ConcurrentHashMap> apiRtAndTpsMap; + + /** + * 场景下每个链路的实时Rps + */ + private ConcurrentHashMap reportLinkRps; + + /** + * 记录接口请求次数,成功失败数 + * > + */ + private ConcurrentHashMap> apiCountMap; + + public TotalCounterStatistic(AtomicInteger finishAgentNum, LongAdder totalReq, + LongAdder lossConnNum, + LongAdder totalTCount,LongAdder totalSuccReq, LongAdder totalErrReq, + ConcurrentMap> counterMap, + ConcurrentHashMap> apiRtAndTpsMap, + ConcurrentHashMap> apiCountMap, + ConcurrentHashMap reportLinkRps + ) { + this.finishAgentNum = finishAgentNum; + this.totalReq = totalReq; + this.lossConnNum = lossConnNum; + this.totalTCount = totalTCount; + this.totalSuccReq = totalSuccReq; + this.totalErrReq = totalErrReq; + this.counterMap = counterMap; + this.apiRtAndTpsMap = apiRtAndTpsMap; + this.apiCountMap = apiCountMap; + this.reportLinkRps = reportLinkRps; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/CancelType.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/CancelType.java new file mode 100644 index 000000000..a00af6195 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/CancelType.java @@ -0,0 +1,28 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.task; + +public enum CancelType { + Manual(0), + BySla(1); + + public final int code; + + private CancelType(int code) { + this.code = code; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/ChangeQpsReq.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/ChangeQpsReq.java new file mode 100644 index 000000000..6f1859064 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/ChangeQpsReq.java @@ -0,0 +1,18 @@ +package run.mone.mimeter.engine.agent.bo.task; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class ChangeQpsReq implements Serializable { + + Integer rpsRate; + + List dagTaskRpsList; + + public ChangeQpsReq(List dagTaskRpsList) { + this.dagTaskRpsList = dagTaskRpsList; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/Context.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/Context.java new file mode 100644 index 000000000..c364f833c --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/Context.java @@ -0,0 +1,54 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.task; + +import lombok.Data; + +import java.io.Serializable; + +/** +* @author goodjava@qq.com +* @date 2022/5/19 +*/ +@Data +public class Context implements Serializable { + + /** + * 完成 + */ + private volatile boolean finish; + + /** + * 被取消掉 + */ + private volatile boolean cancel; + + /** + * 取消的方式 + */ + private volatile int cancelType; + + /** + * 可控的图任务qps + */ + private volatile int taskQps; + + /** + * 可控的场景发压比例 + */ + private volatile int rpsRate; +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/DagTaskRps.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/DagTaskRps.java new file mode 100644 index 000000000..5dece6634 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/DagTaskRps.java @@ -0,0 +1,20 @@ +package run.mone.mimeter.engine.agent.bo.task; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class DagTaskRps implements Serializable { + String reportId; + Integer linkId; + Integer taskId; + Integer rps; + + public DagTaskRps(String reportId, Integer linkId, Integer taskId, Integer rps) { + this.reportId = reportId; + this.linkId = linkId; + this.taskId = taskId; + this.rps = rps; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/HeraContextInfo.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/HeraContextInfo.java new file mode 100644 index 000000000..0cb7e9d6f --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/HeraContextInfo.java @@ -0,0 +1,20 @@ +package run.mone.mimeter.engine.agent.bo.task; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class HeraContextInfo implements Serializable { + private Integer sceneId; + private Integer serialLinkId; + private Integer sceneApiId; + private String taskFlag; + + public HeraContextInfo(Integer sceneId, Integer serialLinkId, Integer sceneApiId, String taskFlag) { + this.sceneId = sceneId; + this.serialLinkId = serialLinkId; + this.sceneApiId = sceneApiId; + this.taskFlag = taskFlag; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/HostsFileResult.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/HostsFileResult.java new file mode 100644 index 000000000..9100d9ac2 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/HostsFileResult.java @@ -0,0 +1,10 @@ +package run.mone.mimeter.engine.agent.bo.task; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class HostsFileResult implements Serializable { + private String hostsFile; +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/PullApiTrafficReq.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/PullApiTrafficReq.java new file mode 100644 index 000000000..315c6fb8c --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/PullApiTrafficReq.java @@ -0,0 +1,46 @@ +/* + * Copyright 2020 XiaoMi. + * + * Licensed 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 the following link. + * + * 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. + */ +package run.mone.mimeter.engine.agent.bo.task; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * Created by dongzhenxing on 2023/2/24 7:00 PM + */ +@Data +public class PullApiTrafficReq implements Serializable { + + private int trafficConfigId; + + private String url; + + private long fromTime; + + private long toTime; + + public PullApiTrafficReq() { + } + + public PullApiTrafficReq(int trafficConfigId, String url, long fromTime, long toTime) { + this.trafficConfigId = trafficConfigId; + this.url = url; + this.fromTime = fromTime; + this.toTime = toTime; + } +} \ No newline at end of file diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/PullTrafficReqBase.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/PullTrafficReqBase.java new file mode 100644 index 000000000..1ea22ce02 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/PullTrafficReqBase.java @@ -0,0 +1,39 @@ +/* + * Copyright 2020 XiaoMi. + * + * Licensed 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 the following link. + * + * 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. + */ +package run.mone.mimeter.engine.agent.bo.task; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * Created by dongzhenxing on 2023/2/24 7:00 PM + */ +@Data +public class PullTrafficReqBase implements Serializable { + +// /** +// * 开启使用流量数据的接口id列表 +// */ +// private List useTrafficApiIds; + + /** + * 每个接口所用的流量配置及筛选范围 + */ + private List apiTrafficReqList; + +} \ No newline at end of file diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/SubmitTaskRes.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/SubmitTaskRes.java new file mode 100644 index 000000000..b549041c9 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/SubmitTaskRes.java @@ -0,0 +1,27 @@ +package run.mone.mimeter.engine.agent.bo.task; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +@Data +public class SubmitTaskRes implements Serializable { + private String reportId; + private TaskResult taskResult; + + /** + * 链路id与生成的dag 任务id映射 + */ + private Map linkTaskIdMap; + + private List agentIpList; + + public SubmitTaskRes(String reportId, TaskResult taskResult, Map linkTaskIdMap, List agentIpList) { + this.reportId = reportId; + this.taskResult = taskResult; + this.linkTaskIdMap = linkTaskIdMap; + this.agentIpList = agentIpList; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/Task.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/Task.java new file mode 100644 index 000000000..e9e8cd2a2 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/Task.java @@ -0,0 +1,184 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.task; + +import com.xiaomi.data.push.schedule.task.graph.GraphTaskContext; +import lombok.Data; +import run.mone.mimeter.engine.agent.bo.data.DebugSceneApiInfoReq; +import run.mone.mimeter.engine.agent.bo.data.DemoData; +import run.mone.mimeter.engine.agent.bo.data.DubboData; +import run.mone.mimeter.engine.agent.bo.data.HttpData; +import run.mone.mimeter.engine.agent.bo.data.NodeInfo; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import java.util.concurrent.ConcurrentHashMap; + +/** + * @author goodjava@qq.com + * @date 2022/5/19 + */ +@Data +public class Task implements Serializable { + + /** + * 单接口任务id + */ + private int id; + + /** + * 用于取消任务的任务id列表 + */ + private List ids; + + /** + * 取消任务的类型 0:手动,1:由sla触发 + */ + private int cancelType; + + /** + * 由sla触发结束的规则内容 + */ + private String cancelBySlaRule; + + /** + * 场景定义id + */ + private int sceneId; + + /** + * 用于hera context 传参 + */ + private HeraContextInfo heraContextInfo; + + /** + * 0:单接口调试 + * 1:场景调试 + * 2:场景压测 + */ + private int submitTaskType; + + /** + * 用于调试的接口信息 + */ + private DebugSceneApiInfoReq apiInfo; + + private String reportId; + + private String opUser; + + //********** 以上字段由dashboard传,以下取场景数据构造// + + /** + * 是否启用流量参数 + */ + private boolean enableTraffic; + + /** + * 待拉取流量配置列表 + */ + private PullTrafficReqBase trafficToPullConfList; + + /** + * 发压机数量 + */ + private int agentNum; + + /** + * 该发压机器索引序号,从 0 开始 + */ + private int agentIndex; + + private int connectTaskNum; + + private int qps; + + private int logRate; + + /** + * 持续多少秒 + */ + private int time; + + /** + * 压力递增模式 + */ + private Integer incrementMode; + + /** + * 本任务 + */ + DagTaskRps dagTaskRps; + + /** + * 自定义成功状态码 + */ + private String successCode; + + /** + * 接口发压信息 + */ + private String apiBenchInfos; + + /** + * 超时时间(毫秒) + */ + private int timeout = 1000; + + private TaskType type; + + private TaskType sceneType; + + private String addr; + + private HttpData httpData; + + private DubboData dubboData; + + private DemoData demoData; + + /** + * 可控的场景发压比例 + */ + private Integer rpsRate; + + private ConcurrentHashMap attachments = new ConcurrentHashMap<>(); + + private TreeMap> dataMap; + + /** + * debug只会调用一次,并且需要拿到返回结果 + */ + private boolean debug; + + private GraphTaskContext dagInfo; + + /** + * 提值表达式(需要从依赖的任务里提值) + * + * dag.0.map{data}{name} + */ + private Map exprMap; + + /** + * 打点记录链路id + */ + private Integer serialLinkID; + +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/TaskContext.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/TaskContext.java new file mode 100644 index 000000000..55d826902 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/TaskContext.java @@ -0,0 +1,58 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.task; + +import lombok.Data; +import run.mone.mimeter.engine.agent.bo.stat.SceneTotalCountContext; + +import java.io.Serializable; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * @author goodjava@qq.com + * @date 2022/6/2 + */ +@Data +public class TaskContext implements Serializable { + + private int num; + + /** + * 是否发生了错误 + */ + private volatile boolean error; + + /** + * 完成任务数 + */ + private AtomicInteger finishTaskNum = new AtomicInteger(0); + + + private ConcurrentHashMap attachments = new ConcurrentHashMap<>(); + + /** + * 存储各个node的结果 + */ + private ConcurrentHashMap resultMap = new ConcurrentHashMap<>(); + + /** + * 统计错误信息 + */ + private SceneTotalCountContext sceneTotalCountContext = new SceneTotalCountContext(); + +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/TaskResult.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/TaskResult.java new file mode 100644 index 000000000..f4704c5bf --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/TaskResult.java @@ -0,0 +1,87 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.task; + +import lombok.Data; +import run.mone.mimeter.engine.agent.bo.data.CommonReqInfo; + +import java.io.Serializable; +import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; + +/** + * @author goodjava@qq.com + * @date 2022/5/19 + */ +@Data +public class TaskResult implements Serializable { + + /** + * 任务id + */ + private int id; + + private Context context; + + private String addr; + + private String opUser; + + private AtomicLong success = new AtomicLong(); + + private AtomicLong failure = new AtomicLong(); + + private int code; + + private boolean ok; + + private String result; + + private CommonReqInfo commonReqInfo; + + /** + * 返回的header + */ + private Map respHeaders; + + private String debugUrl; + + private long rt; + + //bytes + private long size; + + private String triggerCpInfo; + + /** + * 触发的检查点条件 + */ + private String triggerFilterCondition; + + private boolean debug; + + private String reportId; + + private Integer sceneId; + + private boolean quitByManual; + + private int cancelType; + + public String cancelBySlaRule; + +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/TaskStatus.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/TaskStatus.java new file mode 100644 index 000000000..e9a896e16 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/TaskStatus.java @@ -0,0 +1,33 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mimeter.engine.agent.bo.task; + +public enum TaskStatus { + Init(0), + Success(1), + Failure(2), + Retry(3), + Running(4), + + Stopped(5); + + public final int code; + + private TaskStatus(int code) { + this.code = code; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/TaskStatusBo.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/TaskStatusBo.java new file mode 100644 index 000000000..3ea5d0667 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/TaskStatusBo.java @@ -0,0 +1,16 @@ +package run.mone.mimeter.engine.agent.bo.task; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class TaskStatusBo implements Serializable { + + private int taskId; + + private int sceneId; + + private TaskStatus taskStatus; + +} diff --git a/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/TaskType.java b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/TaskType.java new file mode 100644 index 000000000..a0f36ea8e --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-api/src/main/java/run/mone/mimeter/engine/agent/bo/task/TaskType.java @@ -0,0 +1,20 @@ +package run.mone.mimeter.engine.agent.bo.task; + +/** + * @author goodjava@qq.com + * @date 2022/5/19 + */ +public enum TaskType { + + http(1), + dubbo(2), + dag(3), + demo(4); + + + public final int code; + + private TaskType(int code) { + this.code = code; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-test/pom.xml b/ozburst-all/mimeter-engine/mimeter-test/pom.xml new file mode 100644 index 000000000..3187f82be --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-test/pom.xml @@ -0,0 +1,87 @@ + + + + mimeter-engine + run.mone + 1.0-SNAPSHOT + + 4.0.0 + + mimeter-test + + + 20 + 20 + + + + + + com.xiaomi.mone + sautumn-server + 1.0.0-SNAPSHOT + + + com.xiaomi.youpin + rpc + + + com.xiaomi.youpin + docean + + + com.xiaomi.youpin + gwdash-api + + + tools + com.sun + + + com.xiaomi.youpin + struct + + + com.xiaomi.youpin + log + + + maven-pmd-plugin + org.apache.maven.plugins + + + jackson-annotations + com.fasterxml.jackson.core + + + + + + mone-tenant + mone-tenant-api + 1.0-SNAPSHOT + + + + run.mone + struct + 1.4-SNAPSHOT + + + + run.mone + docean + 1.4-SNAPSHOT + + + + ch.qos.logback + logback-classic + 1.1.2 + + + + + \ No newline at end of file diff --git a/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/Bootstrap.java b/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/Bootstrap.java new file mode 100644 index 000000000..a126d4134 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/Bootstrap.java @@ -0,0 +1,44 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mibench.test; + +import com.xiaomi.youpin.docean.Ioc; +import com.xiaomi.youpin.docean.Mvc; +import com.xiaomi.youpin.docean.config.HttpServerConfig; +import com.xiaomi.youpin.docean.mvc.DoceanHttpServer; + +/** + * @author goodjava@qq.com + * @date 2022/6/2 + */ +public class Bootstrap { + + + /** + * 起一个http服务+dubbo服务,用来测试dag任务 + * + * @param args + */ + public static void main(String[] args) throws InterruptedException { + Ioc.ins().init("run.mone.mibench.test", "com.xiaomi.youpin.docean.plugin"); + Mvc.ins(); + DoceanHttpServer server = new DoceanHttpServer(HttpServerConfig.builder().port(7777).websocket(false).build()); + server.start(); + } + + +} diff --git a/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/controller/Request.java b/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/controller/Request.java new file mode 100644 index 000000000..11de3018a --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/controller/Request.java @@ -0,0 +1,57 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mibench.test.controller; + +/** + * @author goodjava@qq.com + * @date 2022/6/2 + */ +public class Request { + + private String token; + + private String id; + + private String uuid; + + public Request() { + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/controller/Response.java b/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/controller/Response.java new file mode 100644 index 000000000..ed4cc5000 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/controller/Response.java @@ -0,0 +1,62 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mibench.test.controller; +/** + * @author goodjava@qq.com + * @date 2022/6/2 + */ +public class Response { + + private int code; + + private String message; + + private D data; + + public Response() { + } + + public Response(int code, String message, D data) { + this.code = code; + this.message = message; + this.data = data; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public D getData() { + return data; + } + + public void setData(D data) { + this.data = data; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/controller/Test.java b/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/controller/Test.java new file mode 100644 index 000000000..e2e96d2bb --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/controller/Test.java @@ -0,0 +1,30 @@ +package run.mone.mibench.test.controller; + +import com.xiaomi.youpin.docean.anno.RequestMapping; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class Test { + + /** + * //Athena:用token换id的方法注释 + * 用token换id + * + * @param request + * @return + */ + @RequestMapping(path = "/id") + //Athena:定义请求映射路径的注释 + public Response getId(Request request) { + //Athena:记录请求信息的注释 + log.info("/id req:{}", request); + //Athena:创建响应对象的注释 + Response r = new Response<>(); + //Athena:设置响应消息的注释 + r.setMessage(request.getId()); + //Athena:设置响应数据的注释 + r.setData("1"); + //Athena:返回响应对象的注释 + return r; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/controller/TestController.java b/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/controller/TestController.java new file mode 100644 index 000000000..6bdc9f468 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/controller/TestController.java @@ -0,0 +1,109 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mibench.test.controller; + +import com.xiaomi.youpin.docean.anno.Controller; +import com.xiaomi.youpin.docean.anno.RequestMapping; +import com.xiaomi.youpin.docean.anno.RequestParam; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.concurrent.TimeUnit; + +/** + * @date 2022/6/2 + */ +@Controller +public class TestController { + + private static Logger log = LoggerFactory.getLogger(TestController.class); + + /** + //Athena:获取一个token + * 换取一个token + * + * @param request + * @return + */ + //Athena:映射请求路径为/token + @RequestMapping(path = "/token") + //Athena:处理请求并返回响应 + public Response getToken(Request request) { + //Athena:打印请求信息 + log.info("/token req:{}", request); + //Athena:模拟延迟 + sleep(); + //Athena:创建响应对象 + Response r = new Response<>(); + //Athena:设置响应消息 + r.setMessage(request.getId()); + //Athena:设置响应数据 + r.setData("abcdefaaff"); + //Athena:返回响应 + return r; + } + + private void sleep() { + try { + TimeUnit.SECONDS.sleep(2); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + + + /** + * 用token换id + * + * @param request + * @return + */ + @RequestMapping(path = "/id") + public Response getId(Request request) { + log.info("/id req:{}", request); + Response r = new Response<>(); + r.setMessage(request.getId()); + r.setData("1"); + return r; + } + + /** + * 用id查年龄 + * + * @param request + * @return + */ + @RequestMapping(path = "/age") + public Response getAge(Request request) { + log.info("/age req:{}", request); + Response r = new Response<>(); + r.setMessage(request.getId()); + r.setData("22"); + return r; + } + + + @RequestMapping(path = "/sum", method = "get") + public Response sum(@RequestParam("a") int a, @RequestParam("b") int b) { + log.info("/sum req:{} {}", a, b); + Response r = new Response<>(); + r.setData("" + (a + b)); + return r; + } + + +} diff --git a/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/service/MBReq.java b/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/service/MBReq.java new file mode 100644 index 000000000..56995c0d4 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/service/MBReq.java @@ -0,0 +1,39 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mibench.test.service; + +import java.io.Serializable; + +/** + * @author goodjava@qq.com + * @date 2022/6/4 + */ +public class MBReq implements Serializable { + + private int id; + + public MBReq() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/service/MBRes.java b/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/service/MBRes.java new file mode 100644 index 000000000..20395c833 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/service/MBRes.java @@ -0,0 +1,39 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mibench.test.service; + +import java.io.Serializable; + +/** + * @author goodjava@qq.com + * @date 2022/6/4 + */ +public class MBRes implements Serializable { + + private int id; + + public MBRes() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/service/MBService.java b/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/service/MBService.java new file mode 100644 index 000000000..1959f1181 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/service/MBService.java @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mibench.test.service; + +/** + * @author goodjava@qq.com + * @date 2022/6/4 + */ +public interface MBService { + + + int sum(int a, int b); + + MBRes call(MBReq req); + +} diff --git a/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/service/MbServiceImpl.java b/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/service/MbServiceImpl.java new file mode 100644 index 000000000..1c799d411 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-test/src/main/java/run/mone/mibench/test/service/MbServiceImpl.java @@ -0,0 +1,39 @@ +/* + * Copyright 2020 Xiaomi + * + * Licensed 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. + */ + +package run.mone.mibench.test.service; + + +import com.xiaomi.youpin.docean.plugin.dubbo.anno.Service; + +/** + * @author goodjava@qq.com + * @date 2022/6/4 + */ +@Service(interfaceClass = MBService.class) +public class MbServiceImpl implements MBService{ + @Override + public int sum(int a, int b) { + return a+b; + } + + @Override + public MBRes call(MBReq req) { + MBRes res = new MBRes(); + res.setId(req.getId()); + return res; + } +} diff --git a/ozburst-all/mimeter-engine/mimeter-test/src/main/resources/config.properties b/ozburst-all/mimeter-engine/mimeter-test/src/main/resources/config.properties new file mode 100644 index 000000000..fec8e3ce9 --- /dev/null +++ b/ozburst-all/mimeter-engine/mimeter-test/src/main/resources/config.properties @@ -0,0 +1,2 @@ +dubbo_app_name=mibench_test +dubbo_reg_address=nacos://127.0.0.1:80 \ No newline at end of file diff --git a/ozburst-all/mimeter-engine/pom.xml b/ozburst-all/mimeter-engine/pom.xml new file mode 100644 index 000000000..df36d8d2b --- /dev/null +++ b/ozburst-all/mimeter-engine/pom.xml @@ -0,0 +1,95 @@ + + + 4.0.0 + + run.mone + mimeter-engine + pom + 1.0-SNAPSHOT + + mimeter-api + mimeter-agent + mimeter-agent-service + mimeter-agent-manager + mimeter-test + + + + 20 + 20 + + + + + org.projectlombok + lombok + 1.18.24 + provided + + + + com.xiaomi.youpin + docean-plugin-dubbo-serverless + 1.4-SNAPSHOT + + + run.mone + docean + + + org.apache.dubbo + dubbo + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.10.1 + + 20 + 20 + false + + --enable-preview + -J--add-opens=java.base/java.util=ALL-UNNAMED + -J--add-opens=java.base/java.lang=ALL-UNNAMED + -J--add-opens=java.base/java.math=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED + + + + + + + + + ossrh + https://s01.oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + + + \ No newline at end of file