Skip to content

Commit

Permalink
✨ add metrics test (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
songxiaosheng committed Apr 24, 2023
1 parent 3e53a99 commit 2af8f4d
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 0 deletions.
48 changes: 48 additions & 0 deletions dubbo-metrics-client/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>dubbo-benchmark</artifactId>
<groupId>org.apache.dubbo</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>dubbo-metrics-client</artifactId>
<properties>
<dubbo.version>3.2.0-beta.6</dubbo.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>client-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-metrics-prometheus</artifactId>
<version>${dubbo.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>org.apache.dubbo.benchmark.Client</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
15 changes: 15 additions & 0 deletions dubbo-metrics-client/src/main/resources/consumer.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:property-placeholder location="classpath:benchmark.properties" system-properties-mode="OVERRIDE"/>
<dubbo:application name="dubbo-metrics-client"/>
<dubbo:reference id="userService" check="false"
interface="org.apache.dubbo.benchmark.service.UserService"
url="dubbo://${server.host}:${server.port}"/>
<dubbo:consumer client="netty4" filter="-default"/>
<dubbo:metrics protocol="prometheus">
<dubbo:aggregation enabled="true"/>
</dubbo:metrics>
</beans>
47 changes: 47 additions & 0 deletions dubbo-metrics-server/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>dubbo-benchmark</artifactId>
<groupId>org.apache.dubbo</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>dubbo-metrics-server</artifactId>

<dependencies>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>server-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-metrics-prometheus</artifactId>
<version>${dubbo.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>org.apache.dubbo.benchmark.Server</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
17 changes: 17 additions & 0 deletions dubbo-metrics-server/src/main/resources/provider.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:property-placeholder location="classpath:benchmark.properties" system-properties-mode="OVERRIDE"/>
<dubbo:application name="dubbo-metrics-server"/>
<dubbo:protocol name="dubbo" host="${server.host}" server="netty4" port="${server.port}"/>
<dubbo:registry address="N/A"/>
<dubbo:service interface="org.apache.dubbo.benchmark.service.UserService" ref="userService" filter="-default"/>
<bean id="userService" class="org.apache.dubbo.benchmark.service.UserServiceServerImpl"/>

<dubbo:metrics protocol="prometheus" enable-jvm-metrics="true">
<dubbo:aggregation enabled="true"/>
</dubbo:metrics>

</beans>
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
<module>dubbo-grpc-client</module>
<module>dubbo-triple-server</module>
<module>dubbo-triple-client</module>
<module>dubbo-metrics-client</module>
<module>dubbo-metrics-server</module>

</modules>

Expand Down

0 comments on commit 2af8f4d

Please sign in to comment.