Skip to content

Commit

Permalink
add dubbo plugin support (#292)
Browse files Browse the repository at this point in the history
* feat: add dubbo plugin

* fix: add dubbo plugin

- add return values collect switch

* fix:
- Resolve bug in asynchronous call trace and metrics
- Remove redundant configurations
- Additional unit tests
- Fix the problem that the local cache `configs` in the `AutoRefreshPluginConfigRegistry` class has no value

* fix:
- Close the `scope` in the `after` method of the interceptor.
- Add a note about the json library used for parameters and return values.

* fix:
- `Scope` is not turned off in dubbo's asynchronous request.
- Error getting parameter type in `name` method of dubbo tool class.

Co-authored-by: wangzeying <wangzeying@wsecar.com>
Co-authored-by: yufu.deng <observeralone@gmail.com>
  • Loading branch information
3 people authored Nov 19, 2022
1 parent 50015b3 commit 9ce54df
Show file tree
Hide file tree
Showing 41 changed files with 2,659 additions and 8 deletions.
15 changes: 15 additions & 0 deletions build/src/main/resources/agent.properties
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,21 @@ plugin.observability.motan.metric.topic=platform-metrics
plugin.observability.motan.metric.url=/platform-metrics
# plugin.observability.motan.metric.appendType=kafka

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


# -------------- output ------------------
## http/kafka/zipkin server host and port for tracing and metric
Expand Down
33 changes: 33 additions & 0 deletions doc/prometheus-metric-schedule.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,39 @@ MongoDB schema describes key metrics of MongoDB client invoking, which include:
| application_mongodbclient_p98 | double | TP98: The MongoDB execution duration in milliseconds for 98% user. |
| application_mongodbclient_p99 | double | TP99: The MongoDB execution duration in milliseconds for 99% user. |

### Dubbo
Dubbo schema describes key metrics of Dubbo client invoking, which include:
* Total execution count (cnt, errcnt, m1cnt, m5cnt, m15cnt)
* Throughput (m1, m5, m15, mean_rate)
* Error throughput (m1err, m5err, m15err)
* Execution duration (min, mean, max)
* Latency (p25, p50, p75, p95, p98, p99, p999)

| Metric Name | Type | Description |
|:------------------------------------| :-----: |:----------------------------------------------------------------------------------------------------------|
| application_dubbo_cnt | integer | The total count of the Dubbo method executed |
| application_dubbo_errcnt | integer | The total error count of the Dubbo method executed |
| application_dubbo_m1cnt | integer | The total count of the Dubbo method executed in last 1 minute |
| application_dubbo_m5cnt | integer | The total count of the Dubbo method executed in last 5 minute |
| application_dubbo_m15cnt | integer | The total count of the Dubbo method executed in last 15 minute |
| application_dubbo_m1 | double | The Dubbo method executions per second (exponentially-weighted moving average) in last 1 minute |
| application_dubbo_m5 | double | The Dubbo method executions per second (exponentially-weighted moving average) in last 5 minute. |
| application_dubbo_m15 | double | The Dubbo method executions per second (exponentially-weighted moving average) in last 15 minute. |
| application_dubbo_mean_rate | double | The Dubbo method executions per second (exponentially-weighted moving average) in last 15 minute. |
| application_dubbo_m1err | double | The Dubbo method error executions per second (exponentially-weighted moving average) in last 1 minute |
| application_dubbo_m5err | double | The Dubbo method error executions per second (exponentially-weighted moving average) in last 5 minute. |
| application_dubbo_m15err | double | The Dubbo method error executions per second (exponentially-weighted moving average) in last 15 minute |
| application_dubbo_min | double | The Dubbo method minimal execution duration in milliseconds. |
| application_dubbo_max | double | The Dubbo method maximal execution duration in milliseconds. |
| application_dubbo_mean | double | The Dubbo method mean execution duration in milliseconds. |
| application_dubbo_p25 | double | TP25: The Dubbo method execution duration in milliseconds for 25% user. |
| application_dubbo_p50 | double | TP50: The Dubbo method execution duration in milliseconds for 50% user. |
| application_dubbo_p75 | double | TP75: The Dubbo method execution duration in milliseconds for 75% user. |
| application_dubbo_p95 | double | TP95: The Dubbo method execution duration in milliseconds for 95% user. |
| application_dubbo_p98 | double | TP98: The Dubbo method execution duration in milliseconds for 98% user. |
| application_dubbo_p99 | double | TP99: The Dubbo method execution duration in milliseconds for 99% user. |
| application_dubbo_p999 | double | TP999: The Dubbo method execution duration in milliseconds for 99.9% user. |

#### Dedicated label
| Label Name | Essential | Value Example | Description |
|:-----------|:---------:|:-------------:|:---------------------------------------------------------------------------------------------------------------------------------------|
Expand Down
55 changes: 50 additions & 5 deletions doc/user-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ Supported components and corresponding namespaces:
| rabbitmq | `rabbitmq` | RabbitMQ Metric |
| jvmGc | `jvmGc` | JVM GC Metric |
| JVM Memory | `jvmMemory` | JVM Memory Metric |
| dubbo | `dubbo` | dubbo Metric |
| motan | `motan` | Motan Metric |

#### Application Log
Expand Down Expand Up @@ -414,11 +415,6 @@ EaseAgent use [brave](https://github.com/openzipkin/brave) to collect tracing lo
| Logging | `Log4j2``Logback` | [brave-context-log4j2](https://github.com/openzipkin/brave/tree/master/context/log4j2)[brave-context-slf4j](https://github.com/openzipkin/brave/tree/master/context/slf4j) |
| RPC | `AlibabaDubbo``ApacheDubbo``Motan` | [brave-instrumentation-dubbo](https://github.com/openzipkin/brave/tree/master/instrumentation/dubbo)[brave-instrumentation-dubbo-rpc](https://github.com/openzipkin/brave/tree/master/instrumentation/dubbo-rpc)[brave-instrumentation-rpc](https://github.com/openzipkin/brave/tree/master/instrumentation/rpc) |

### Tracing Component Config Description
| Component Type | Component | Description |
| -------------- |-------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| RPC | `Motan` | The motan plugin adds a dynamic switch to collect interface parameters and return values for troubleshooting purposes. The display format is json (Notes: The library used is [Jackson](https://github.com/FasterXML/jackson.git)), which is disabled by default. You can enable the parameter collection switch with this configuration: `plugin.observability.motan.tracing.args.collect.enabled=ture`, and the return values collection switch with this configuration: `plugin.observability.motan.tracing.result.collect.enabled=ture`. |

### Custom Span Tag

#### JDBC
Expand Down Expand Up @@ -448,6 +444,19 @@ EaseAgent use [brave](https://github.com/openzipkin/brave) to collect tracing lo
| kafka.topic | Kafka topic |
| kafka.broker | Kafka url |


#### Dubbo Client and Server
| Tag | Description |
|--------------------------|-----------------------------------|
| dubbo.args | dubbo interface arguments |
| dubbo.result | dubbo interface return value |
| dubbo.group | dubbo client group name |
| dubbo.service | dubbo service interface full name |
| dubbo.method | dubbo service method signature |
| dubbo.service.version | dubbo service interface version |
| dubbo.client.application | dubbo client application name |
| dubbo.server.application | dubbo server application name |

#### Motan Client and Server
| Tag | Description |
|-----------------------|-----------------------------------|
Expand All @@ -460,6 +469,7 @@ EaseAgent use [brave](https://github.com/openzipkin/brave) to collect tracing lo
| motan.module | motan server module name |
| motan.group | motan client group name |


## Metric
EaseAgent use [io.dropwizard.metrics](https://github.com/dropwizard/metrics) to collect metric information.

Expand Down Expand Up @@ -827,6 +837,41 @@ MongoDB schema describes key metrics of MongoDB client invoking, which include:
| p98 | double | TP98: The MongoDB execution duration in milliseconds for 98% user. |
| p99 | double | TP99: The MongoDB execution duration in milliseconds for 99% user. |


#### Dubbo
Dubbo schema describes key metrics of Dubbo client invoking, which include:
* Total execution count (cnt, errcnt, m1cnt, m5cnt, m15cnt)
* Throughput (m1, m5, m15, mean_rate)
* Error throughput (m1err, m5err, m15err)
* Execution duration (min, mean, max)
* Latency (p25, p50, p75, p95, p98, p99, p999)

| Field | Type | Description |
|:----------| :-----: |:-------------------------------------------------------------------------------------------------------|
| service | string | Dubbo method signature. |
| cnt | integer | The total count of the Dubbo method executed |
| errcnt | integer | The total error count of the Dubbo method executed |
| m1cnt | integer | The total count of the Dubbo method executed in last 1 minute |
| m5cnt | integer | The total count of the Dubbo method executed in last 5 minute |
| m15cnt | integer | The total count of the Dubbo method executed in last 15 minute |
| m1 | double | The Dubbo method executions per second (exponentially-weighted moving average) in last 1 minute |
| m5 | double | The Dubbo method executions per second (exponentially-weighted moving average) in last 5 minute. |
| m15 | double | The Dubbo method executions per second (exponentially-weighted moving average) in last 15 minute. |
| mean_rate | double | The Dubbo method executions per second (exponentially-weighted moving average) in last 15 minute. |
| m1err | double | The Dubbo method error executions per second (exponentially-weighted moving average) in last 1 minute |
| m5err | double | The Dubbo method error executions per second (exponentially-weighted moving average) in last 5 minute. |
| m15err | double | The Dubbo method error executions per second (exponentially-weighted moving average) in last 15 minute |
| min | double | The Dubbo method minimal execution duration in milliseconds. |
| max | double | The Dubbo method maximal execution duration in milliseconds. |
| mean | double | The Dubbo method mean execution duration in milliseconds. |
| p25 | double | TP25: The Dubbo method execution duration in milliseconds for 25% user. |
| p50 | double | TP50: The Dubbo method execution duration in milliseconds for 50% user. |
| p75 | double | TP75: The Dubbo method execution duration in milliseconds for 75% user. |
| p95 | double | TP95: The Dubbo method execution duration in milliseconds for 95% user. |
| p98 | double | TP98: The Dubbo method execution duration in milliseconds for 98% user. |
| p99 | double | TP99: The Dubbo method execution duration in milliseconds for 99% user. |
| p999 | double | TP999: The Dubbo method execution duration in milliseconds for 99.9% user. |

#### Motan
Motan schema describes key metrics of Motan client invoking, which include:
* Total execution count (cnt, errcnt, m1cnt, m5cnt, m15cnt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,28 @@ public static <C extends AutoRefreshPluginConfig> C getOrCreate(String domain, S
Key key = new Key(domain, namespace, id, supplier.getType());
AutoRefreshPluginConfig autoRefreshConfig = configs.get(key);
if (autoRefreshConfig != null) {
triggerChange(domain,namespace,id,autoRefreshConfig);
return (C) autoRefreshConfig;
}
synchronized (configs) {
autoRefreshConfig = configs.get(key);
if (autoRefreshConfig != null) {
triggerChange(domain,namespace,id,autoRefreshConfig);
return (C) autoRefreshConfig;
}
C newConfig = supplier.newInstance();
IPluginConfig config = EaseAgent.getConfig(domain, namespace, id);
newConfig.onChange(null, config);
config.addChangeListener(newConfig);
triggerChange(domain, namespace, id, newConfig);
configs.put(key, newConfig);
return newConfig;
}
}

private static <C extends AutoRefreshPluginConfig> void triggerChange(String domain, String namespace, String id, C newConfig) {
IPluginConfig config = EaseAgent.getConfig(domain, namespace, id);
newConfig.onChange(null, config);
config.addChangeListener(newConfig);
}

static class Key {
private final String domain;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ interface Namespace {
String MD5_DICTIONARY = "md5Dictionary";

// ------------ rpc ----------------------
String DUBBO = "dubbo";
String MOTAN = "motan";


// ------------- request ------------------
String HTTPCLIENT = "httpclient";
String OK_HTTP = "okHttp";
Expand Down
53 changes: 53 additions & 0 deletions plugins/dubbo/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?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.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>dubbo</artifactId>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<alibaba-dubbo.version>2.5.0</alibaba-dubbo.version>
<apache-dubbo.version>2.7.3</apache-dubbo.version>
</properties>

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

<dependency>
<groupId>com.megaease.easeagent</groupId>
<artifactId>plugin-api-mock</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>${alibaba-dubbo.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
<version>${apache-dubbo.version}</version>
<scope>provided</scope>
</dependency>

</dependencies>
</project>
Loading

0 comments on commit 9ce54df

Please sign in to comment.