Skip to content

Commit

Permalink
feat: Add SOFARPC Framework Plugin Support (#308)
Browse files Browse the repository at this point in the history
* feat: Add SOFARPC Framework Plugin Support

- Support for collecting client-to-server traces
- Supports collection of the following metrics in the method dimension: number of calls, number of failures, minimum, average, maximum execution time, etc.

* fix: Unit test cases that did not pass

- Comment meter type and timer type metric assertions

* fix: SOFARPC plugin unit test

- Modify check errors
- Add comments to the methods in the `SofaRpcCtxUtil` class

* fix: Change SOFARPC metrics label name

- Change `method` label name to `interface` label name
- Change related metrics docs

* Update plugins/sofarpc/src/test/java/com/megaease/easeagent/plugin/sofarpc/interceptor/trace/callback/SofaRpcResponseCallbackTraceInterceptorTest.java

Co-authored-by: yufu.deng <[email protected]>

* Update plugins/sofarpc/src/test/java/com/megaease/easeagent/plugin/sofarpc/interceptor/trace/future/SofaRpcResponseFutureTraceInterceptorTest.java

Co-authored-by: yufu.deng <[email protected]>

---------

Co-authored-by: yufu.deng <[email protected]>
  • Loading branch information
oewang and observeralone authored Feb 25, 2023
1 parent feb3653 commit 6902838
Show file tree
Hide file tree
Showing 48 changed files with 2,781 additions and 49 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ A lightweight & opening Java Agent for Cloud-Native and APM system
* `Jedis 3.5.x``Lettuce 5.3.x (sync、async)`
* `ElasticSearch Client >= 7.x (sync、async)`
* `Mongodb Client >=4.0.x (sync、async)`
* `Motan >= 1.2.0`
* `Motan`
* `Dubbo`
* `SofaRpc >= 5.3.0`
* Collecting Access Logs.
* `HTTP Servlet``HTTP Filter`
* `Spring Cloud Gateway`
Expand Down
13 changes: 13 additions & 0 deletions build/src/main/resources/agent.properties
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,19 @@ plugin.observability.motan.metric.url=/platform-metrics
#plugin.observability.dubbo.metric.url=/platform-metrics
# plugin.observability.dubbo.metric.appendType=kafka

# -------------------- sofarpc ---------------------
# sofarpc tracing
# plugin.observability.sofarpc.tracing.enabled=true
## sofarpc args collect switch
# plugin.observability.sofarpc.tracing.args.collect.enabled=false
## sofarpc result collect switch
# plugin.observability.sofarpc.tracing.result.collect.enabled=false
# sofarpc metric
# plugin.observability.sofarpc.metric.enabled=true
# plugin.observability.sofarpc.metric.interval=30
plugin.observability.sofarpc.metric.topic=platform-metrics
plugin.observability.sofarpc.metric.url=/platform-metrics
# plugin.observability.sofarpc.metric.appendType=kafka

# -------------- output ------------------
## http/kafka/zipkin server host and port for tracing and metric
Expand Down
122 changes: 87 additions & 35 deletions doc/prometheus-metric-schedule.md

Large diffs are not rendered by default.

79 changes: 66 additions & 13 deletions doc/user-manual.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ interface Namespace {
// ------------ rpc ----------------------
String DUBBO = "dubbo";
String MOTAN = "motan";
String SOFARPC = "sofarpc";


// ------------- request ------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,15 @@ public static Long getDuration(Context context, Object startKey) {
public static <T> T getFromContext(Context context, Object key) {
return context.get(key);
}

/**
* Remove data from context
* @param context data store
* @param key key is the type of data.
* @return
* @param <T> the type of data
*/
public static <T> T removeFromContext(Context context, Object key) {
return context.remove(key);
}
}
1 change: 1 addition & 0 deletions plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<module>log4j2-log-plugin</module>
<module>dubbo</module>
<module>motan</module>
<module>sofarpc</module>
</modules>

<dependencyManagement>
Expand Down
51 changes: 51 additions & 0 deletions plugins/sofarpc/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?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>plugins</artifactId>
<groupId>com.megaease.easeagent</groupId>
<version>2.2.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>sofarpc</artifactId>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sofa-rpc-all.version>5.3.0</sofa-rpc-all.version>
</properties>

<dependencies>
<dependency>
<groupId>com.megaease.easeagent</groupId>
<artifactId>plugin-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.megaease.easeagent</groupId>
<artifactId>plugin-api-mock</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-rpc-all</artifactId>
<version>${sofa-rpc-all.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.megaease.easeagent</groupId>
<artifactId>log4j2-api</artifactId>
</dependency>
</dependencies>

</project>
Loading

0 comments on commit 6902838

Please sign in to comment.