Skip to content

Commit bf20c05

Browse files
authored
feat: use db_system,db_host tags (#82)
* db_type -> db_system * host -> db_host
1 parent 6fabb8d commit bf20c05

File tree

15 files changed

+33
-38
lines changed

15 files changed

+33
-38
lines changed

agent-core/src/main/java/cloud/erda/agent/core/utils/Constants.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ public static class Tags {
9898

9999
public static final String SPAN_LAYER_MQ = "mq";
100100

101-
public static final String HOST = "host";
101+
public static final String DB_HOST = "db_host";
102102

103103
public static final String DUBBO_SERVICE = "dubbo_service";
104104

105105
public static final String DUBBO_METHOD = "dubbo_method";
106106

107-
public static final String DB_TYPE = "db_type";
107+
public static final String DB_SYSTEM = "db_system";
108108

109109
public static final String DB_TYPE_REDIS = "Redis";
110110

agent-plugins/agent-dubbo-2.7.x-plugin/src/main/java/cloud/erda/agent/plugin/asf/dubbo/DubboInterceptor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public void beforeMethod(IMethodInterceptContext context, MethodInterceptResult
102102
.tag(Constants.Tags.SPAN_KIND, Constants.Tags.SPAN_KIND_SERVER)
103103
.tag(Constants.Tags.PEER_ADDRESS, rpcContext.getRemoteAddressString())
104104
.tag(Constants.Tags.PEER_SERVICE, invoker.getInterface().getName() + "." + invocation.getMethodName())
105-
.tag(Constants.Tags.HOST, rpcContext.getLocalAddressString())
105+
.tag(Constants.Tags.DB_HOST, rpcContext.getLocalAddressString())
106106
.tag(Constants.Tags.DUBBO_SERVICE, invoker.getInterface().getName())
107107
.tag(Constants.Tags.DUBBO_METHOD, invocation.getMethodName());
108108
}
@@ -113,7 +113,7 @@ public void beforeMethod(IMethodInterceptContext context, MethodInterceptResult
113113
span.tag(Constants.Tags.PEER_ADDRESS, rpcContext.getRemoteAddressString());
114114
span.tag(Constants.Tags.PEER_SERVICE, invoker.getInterface().getName() + "." + invocation.getMethodName());
115115
span.tag(Constants.Tags.SPAN_LAYER, Constants.Tags.SPAN_LAYER_RPC);
116-
span.tag(Constants.Tags.HOST, rpcContext.getLocalAddressString());
116+
span.tag(Constants.Tags.DB_HOST, rpcContext.getLocalAddressString());
117117
span.tag(Constants.Tags.DUBBO_SERVICE, invoker.getInterface().getName());
118118
span.tag(Constants.Tags.DUBBO_METHOD, invocation.getMethodName());
119119
}

agent-plugins/agent-dubbo-plugin/src/main/java/cloud/erda/agent/plugin/dubbo/DubboInterceptor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public void beforeMethod(IMethodInterceptContext context, MethodInterceptResult
9797
.tag(Constants.Tags.SPAN_KIND, Constants.Tags.SPAN_KIND_SERVER)
9898
.tag(Constants.Tags.PEER_ADDRESS, rpcContext.getRemoteAddressString())
9999
.tag(Constants.Tags.PEER_SERVICE, invoker.getInterface().getName() + "." + invocation.getMethodName())
100-
.tag(Constants.Tags.HOST, rpcContext.getLocalAddressString())
100+
.tag(Constants.Tags.DB_HOST, rpcContext.getLocalAddressString())
101101
.tag(Constants.Tags.DUBBO_SERVICE, invoker.getInterface().getName())
102102
.tag(Constants.Tags.DUBBO_METHOD, invocation.getMethodName());
103103
}
@@ -107,7 +107,7 @@ public void beforeMethod(IMethodInterceptContext context, MethodInterceptResult
107107
span.tag(Constants.Tags.PEER_ADDRESS, rpcContext.getRemoteAddressString());
108108
span.tag(Constants.Tags.PEER_SERVICE, invoker.getInterface().getName() + "." + invocation.getMethodName());
109109
span.tag(Constants.Tags.SPAN_LAYER, Constants.Tags.SPAN_LAYER_RPC);
110-
span.tag(Constants.Tags.HOST, rpcContext.getLocalAddressString());
110+
span.tag(Constants.Tags.DB_HOST, rpcContext.getLocalAddressString());
111111
span.tag(Constants.Tags.DUBBO_SERVICE, invoker.getInterface().getName());
112112
span.tag(Constants.Tags.DUBBO_METHOD, invocation.getMethodName());
113113
}

agent-plugins/agent-jdbc-plugins/agent-jdbc-commons/src/main/java/cloud/erda/agent/plugin/jdbc/ExecuteMethodsInterceptor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ public void beforeMethod(IMethodInterceptContext context, MethodInterceptResult
6161
span.tag(Constants.Tags.SPAN_KIND, Constants.Tags.SPAN_KIND_CLIENT);
6262
span.tag(Constants.Tags.DB_INSTANCE, connectInfo.getDatabaseName());
6363
span.tag(Constants.Tags.DB_STATEMENT, statement);
64-
span.tag(Constants.Tags.DB_TYPE, connectInfo.getDBType());
64+
span.tag(Constants.Tags.DB_SYSTEM, connectInfo.getDBType());
6565
span.tag(Constants.Tags.SPAN_LAYER, Constants.Tags.SPAN_LAYER_DB);
6666
span.tag(Constants.Tags.COMPONENT, connectInfo.getComponent());
67-
span.tag(Constants.Tags.HOST, connectInfo.getDatabasePeer());
67+
span.tag(Constants.Tags.DB_HOST, connectInfo.getDatabasePeer());
6868
span.tag(Constants.Tags.PEER_ADDRESS, connectInfo.getDatabasePeer());
6969
span.tag(Constants.Tags.PEER_SERVICE, connectInfo.getDatabasePeer());
7070
if (Strings.isEmpty(statement)) {
@@ -77,10 +77,10 @@ public void beforeMethod(IMethodInterceptContext context, MethodInterceptResult
7777
.tag(Constants.Tags.PEER_HOSTNAME, connectInfo.getDatabasePeer())
7878
.tag(Constants.Tags.PEER_ADDRESS, connectInfo.getDatabasePeer())
7979
.tag(Constants.Tags.PEER_SERVICE, connectInfo.getDatabasePeer())
80-
.tag(Constants.Tags.HOST, connectInfo.getDatabasePeer())
80+
.tag(Constants.Tags.DB_HOST, connectInfo.getDatabasePeer())
8181
.tag(Constants.Tags.DB_INSTANCE, connectInfo.getDatabaseName())
8282
.tag(Constants.Tags.DB_STATEMENT, statement)
83-
.tag(Constants.Tags.DB_TYPE, connectInfo.getDBType());
83+
.tag(Constants.Tags.DB_SYSTEM, connectInfo.getDBType());
8484
}
8585
}
8686

agent-plugins/agent-jedis-2.x-plugin/src/main/java/cloud/erda/agent/plugin/jedis/v2/JedisMethodInterceptor.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import cloud.erda.agent.plugin.app.insight.transaction.TransactionMetricUtils;
3131
import org.apache.skywalking.apm.agent.core.plugin.interceptor.context.IMethodInterceptContext;
3232
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.DynamicFieldEnhancedInstance;
33-
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
3433
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
3534
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
3635

@@ -60,12 +59,12 @@ public void beforeMethod(IMethodInterceptContext context, MethodInterceptResult
6059
SpanContext spanContext = tracer.active() != null ? tracer.active().span().getContext() : null;
6160
SpanBuilder spanBuilder = tracer.buildSpan("Jedis/" + method.getName());
6261
Span span = spanBuilder.childOf(spanContext).startActive().span();
63-
span.tag(Constants.Tags.DB_TYPE, Constants.Tags.DB_TYPE_REDIS);
62+
span.tag(Constants.Tags.DB_SYSTEM, Constants.Tags.DB_TYPE_REDIS);
6463
span.tag(Constants.Tags.COMPONENT, Constants.Tags.COMPONENT_JEDIS);
6564
span.tag(Constants.Tags.PEER_SERVICE, peer);
6665
span.tag(Constants.Tags.SPAN_LAYER, Constants.Tags.SPAN_LAYER_CACHE);
6766
span.tag(Constants.Tags.SPAN_KIND, Constants.Tags.SPAN_KIND_CLIENT);
68-
span.tag(Constants.Tags.HOST, peer);
67+
span.tag(Constants.Tags.DB_HOST, peer);
6968
span.tag(Constants.Tags.DB_STATEMENT, statement);
7069
span.tag(Constants.Tags.PEER_ADDRESS, peer);
7170
span.tag(Constants.Tags.PEER_HOSTNAME, peer);
@@ -78,9 +77,9 @@ public void beforeMethod(IMethodInterceptContext context, MethodInterceptResult
7877
.tag(Constants.Tags.PEER_SERVICE, peer)
7978
.tag(Constants.Tags.PEER_ADDRESS, peer)
8079
.tag(Constants.Tags.PEER_HOSTNAME, peer)
81-
.tag(Constants.Tags.HOST, peer)
80+
.tag(Constants.Tags.DB_HOST, peer)
8281
.tag(Constants.Tags.DB_STATEMENT, statement)
83-
.tag(Constants.Tags.DB_TYPE, Constants.Tags.DB_TYPE_REDIS);
82+
.tag(Constants.Tags.DB_SYSTEM, Constants.Tags.DB_TYPE_REDIS);
8483
}
8584

8685
@Override

agent-plugins/agent-lettuce-plugins/agent-lettuce-5.x-plugin/src/main/java/cloud/erda/agent/plugin/lettuce/v5/AsyncCommandMethodInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void beforeMethod(IMethodInterceptContext context, MethodInterceptResult
4545
SpanBuilder spanBuilder = tracer.buildSpan(operationName + "/onComplete");
4646
Span span = spanBuilder.childOf(spanContext).startActive().span();
4747
span.tag(Constants.Tags.COMPONENT, Constants.Tags.COMPONENT_LETTUCE);
48-
span.tag(Constants.Tags.DB_TYPE, Constants.Tags.DB_TYPE_REDIS);
48+
span.tag(Constants.Tags.DB_SYSTEM, Constants.Tags.DB_TYPE_REDIS);
4949
span.tag(Constants.Tags.SPAN_LAYER, Constants.Tags.SPAN_LAYER_CACHE);
5050
TracerSnapshot snapshot = TracerManager.currentTracer().capture();
5151
if (context.getArguments()[0] instanceof Consumer) {

agent-plugins/agent-lettuce-plugins/agent-lettuce-5.x-plugin/src/main/java/cloud/erda/agent/plugin/lettuce/v5/RedisChannelWriterInterceptor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ public void beforeMethod(IMethodInterceptContext context, MethodInterceptResult
6565

6666
SpanBuilder spanBuilder = tracer.buildSpan(operationName + "/" + context.getMethod().getName());
6767
Span span = spanBuilder.childOf(spanContext).startActive().span();
68-
span.tag(Constants.Tags.DB_TYPE, Constants.Tags.DB_TYPE_REDIS);
68+
span.tag(Constants.Tags.DB_SYSTEM, Constants.Tags.DB_TYPE_REDIS);
6969
span.tag(Constants.Tags.COMPONENT, Constants.Tags.COMPONENT_LETTUCE);
7070
span.tag(Constants.Tags.PEER_SERVICE, peer);
7171
span.tag(Constants.Tags.PEER_ADDRESS, peer);
7272
span.tag(Constants.Tags.PEER_HOSTNAME, peer);
7373
span.tag(Constants.Tags.SPAN_LAYER, Constants.Tags.SPAN_LAYER_CACHE);
7474
span.tag(Constants.Tags.SPAN_KIND, Constants.Tags.SPAN_KIND_CLIENT);
75-
span.tag(Constants.Tags.HOST, peer);
75+
span.tag(Constants.Tags.DB_HOST, peer);
7676
span.tag(Constants.Tags.DB_STATEMENT, dbStatement.toString());
7777

7878
if (Strings.isEmpty(dbStatement.toString())) {
@@ -84,9 +84,9 @@ public void beforeMethod(IMethodInterceptContext context, MethodInterceptResult
8484
transactionMetricBuilder.tag(Constants.Tags.COMPONENT, Constants.Tags.COMPONENT_LETTUCE)
8585
.tag(Constants.Tags.SPAN_KIND, Constants.Tags.SPAN_KIND_CLIENT)
8686
.tag(Constants.Tags.PEER_SERVICE, peer)
87-
.tag(Constants.Tags.HOST, peer)
87+
.tag(Constants.Tags.DB_HOST, peer)
8888
.tag(Constants.Tags.DB_STATEMENT, dbStatement.toString())
89-
.tag(Constants.Tags.DB_TYPE, Constants.Tags.DB_TYPE_REDIS);
89+
.tag(Constants.Tags.DB_SYSTEM, Constants.Tags.DB_TYPE_REDIS);
9090
}
9191

9292
@Override

agent-plugins/agent-lettuce-plugins/agent-lettuce-5.x-plugin/src/main/java/cloud/erda/agent/plugin/lettuce/v5/SpotBiConsumer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void accept(T t, U u) {
4444
SpanBuilder spanBuilder = tracer.buildSpan(operationName + "/accept");
4545
Scope scope = spanBuilder.childOf(snapshotScope.span().getContext()).startActive();
4646
scope.span().tag(Constants.Tags.COMPONENT, Constants.Tags.COMPONENT_LETTUCE);
47-
scope.span().tag(Constants.Tags.DB_TYPE, Constants.Tags.DB_TYPE_REDIS);
47+
scope.span().tag(Constants.Tags.DB_SYSTEM, Constants.Tags.DB_TYPE_REDIS);
4848
scope.span().tag(Constants.Tags.SPAN_LAYER, Constants.Tags.SPAN_LAYER_CACHE);
4949
scope.span().tag(Constants.Tags.SPAN_KIND, Constants.Tags.SPAN_KIND_CLIENT);
5050
try {

agent-plugins/agent-lettuce-plugins/agent-lettuce-5.x-plugin/src/main/java/cloud/erda/agent/plugin/lettuce/v5/SpotConsumer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void accept(T t) {
4444
SpanBuilder spanBuilder = tracer.buildSpan(operationName + "/accept");
4545
Scope scope = spanBuilder.childOf(snapshotScope.span().getContext()).startActive();
4646
scope.span().tag(Constants.Tags.COMPONENT, Constants.Tags.COMPONENT_LETTUCE);
47-
scope.span().tag(Constants.Tags.DB_TYPE, Constants.Tags.DB_TYPE_REDIS);
47+
scope.span().tag(Constants.Tags.DB_SYSTEM, Constants.Tags.DB_TYPE_REDIS);
4848
scope.span().tag(Constants.Tags.SPAN_LAYER, Constants.Tags.SPAN_LAYER_CACHE);
4949
scope.span().tag(Constants.Tags.SPAN_KIND, Constants.Tags.SPAN_KIND_CLIENT);
5050
try {

agent-plugins/agent-redisson-3.x-plugin/src/main/java/cloud/erda/agent/plugin/redisson/v3/CommandAsyncInterceptor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.apache.skywalking.apm.agent.core.plugin.interceptor.context.IMethodInterceptContext;
2929
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
3030
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
31-
import org.redisson.api.RFuture;
3231

3332
import java.lang.reflect.Method;
3433

@@ -47,7 +46,7 @@ public void beforeMethod(IMethodInterceptContext context, MethodInterceptResult
4746
SpanBuilder spanBuilder = tracer.buildSpan("Redisson CommandExecutor:" + context.getMethod().getName());
4847
Scope scope = spanBuilder.childOf(spanContext).startActive();
4948
Span span = scope.span();
50-
span.tag(Constants.Tags.DB_TYPE, Constants.Tags.DB_TYPE_REDIS);
49+
span.tag(Constants.Tags.DB_SYSTEM, Constants.Tags.DB_TYPE_REDIS);
5150
span.tag(Constants.Tags.COMPONENT, Constants.Tags.COMPONENT_REDISSON);
5251
span.tag(Constants.Tags.SPAN_LAYER, Constants.Tags.SPAN_LAYER_LOCAL);
5352
span.tag(Constants.Tags.SPAN_KIND, Constants.Tags.SPAN_KIND_LOCAL);

0 commit comments

Comments
 (0)