Skip to content

Commit 364a4af

Browse files
authored
Add micronauthttpclient,micronauthttpserver,memcached,ehcache,guavacache,jedis,redisson plugin config properties to agent.config (#402)
1 parent df957f9 commit 364a4af

6 files changed

Lines changed: 165 additions & 132 deletions

File tree

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ Release Notes.
1414
* [Breaking Change] Compatible with 3.x and 4.x RabbitMQ Client, rename `rabbitmq-5.x-plugin` to `rabbitmq-plugin`
1515
* Polish JDBC plugins to make DBType accurate
1616
* Report the agent version to OAP as an instance attribute
17+
* Polish jedis-4.x-plugin to change command to lowercase, which is consistent with jedis-2.x-3.x-plugin
18+
* Add micronauthttpclient,micronauthttpserver,memcached,ehcache,guavacache,jedis,redisson plugin config properties to agent.config
1719

1820
#### Documentation
1921

2022
* Update `Plugin-test.md`, support string operators `start with` and `end with`
23+
* Polish agent configurations doc to fix type error
2124

2225

2326

apm-sniffer/apm-sdk-plugin/jedis-plugins/jedis-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jedis/v4/AbstractConnectionInterceptor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
public abstract class AbstractConnectionInterceptor implements InstanceMethodsAroundInterceptor {
3737

38-
private static final String UNKNOWN = "UNKNOWN";
38+
private static final String UNKNOWN = "unknown";
3939

4040
private static final String CACHE_TYPE = "Redis";
4141

@@ -46,7 +46,9 @@ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allAr
4646
if (iterator.hasNext()) {
4747
protocolCommand = iterator.next().toString();
4848
}
49-
String cmd = protocolCommand == null ? UNKNOWN : protocolCommand;
49+
// Use lowercase to make config compatible with jedis-2.x-3.x plugin
50+
// Refer to `plugin.jedis.operation_mapping_read`, `plugin.jedis.operation_mapping_write` config item in agent.config
51+
String cmd = protocolCommand == null ? UNKNOWN : protocolCommand.toLowerCase();
5052
String peer = String.valueOf(objInst.getSkyWalkingDynamicField());
5153
AbstractSpan span = ContextManager.createExitSpan("Jedis/" + cmd, peer);
5254
span.setComponent(ComponentsDefine.JEDIS);

apm-sniffer/apm-sdk-plugin/jedis-plugins/jedis-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jedis/v4/JedisPluginConfig.java

Lines changed: 94 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -50,66 +50,66 @@ public static class Jedis {
5050
* @see AbstractConnectionInterceptor#parseOperation(String)
5151
*/
5252
public static Set<String> OPERATION_MAPPING_WRITE = new HashSet<>(Arrays.asList(
53-
"GETSET",
54-
"SET",
55-
"SETBIT",
56-
"SETEX ",
57-
"SETNX ",
58-
"SETRANGE",
59-
"STRLEN ",
60-
"MSET",
61-
"MSETNX ",
62-
"PSETEX",
63-
"INCR ",
64-
"INCRBY ",
65-
"INCRBYFLOAT",
66-
"DECR ",
67-
"DECRBY ",
68-
"APPEND ",
69-
"HMSET",
70-
"HSET",
71-
"HSETNX ",
72-
"HINCRBY",
73-
"HINCRBYFLOAT",
74-
"HDEL",
75-
"RPOPLPUSH",
76-
"RPUSH",
77-
"RPUSHX",
78-
"LPUSH",
79-
"LPUSHX",
80-
"LREM",
81-
"LTRIM",
82-
"LSET",
83-
"BRPOPLPUSH",
84-
"LINSERT",
85-
"SADD",
86-
"SDIFF",
87-
"SDIFFstore",
88-
"SINTERSTORE",
89-
"SISMEMBER",
90-
"SREM",
91-
"SUNION",
92-
"SUNIONSTORE",
93-
"SINTER",
94-
"ZADD",
95-
"ZINCRBY",
96-
"ZINTERSTORE",
97-
"ZRANGE",
98-
"ZRANGEBYLEX",
99-
"ZRANGEBYSCORE",
100-
"ZRANK",
101-
"ZREM",
102-
"ZREMRANGEBYLEX",
103-
"ZREMRANGEBYRANK",
104-
"ZREMRANGEBYSCORE",
105-
"ZREVRANGE",
106-
"ZREVRANGEBYSCORE",
107-
"ZREVRANK",
108-
"ZUNIONSTORE",
109-
"XADD",
110-
"XDEL",
111-
"DEL",
112-
"XTRIM"
53+
"getset",
54+
"set",
55+
"setbit",
56+
"setex ",
57+
"setnx ",
58+
"setrange",
59+
"strlen ",
60+
"mset",
61+
"msetnx ",
62+
"psetex",
63+
"incr ",
64+
"incrby ",
65+
"incrbyfloat",
66+
"decr ",
67+
"decrby ",
68+
"append ",
69+
"hmset",
70+
"hset",
71+
"hsetnx ",
72+
"hincrby",
73+
"hincrbyfloat",
74+
"hdel",
75+
"rpoplpush",
76+
"rpush",
77+
"rpushx",
78+
"lpush",
79+
"lpushx",
80+
"lrem",
81+
"ltrim",
82+
"lset",
83+
"brpoplpush",
84+
"linsert",
85+
"sadd",
86+
"sdiff",
87+
"sdiffstore",
88+
"sinterstore",
89+
"sismember",
90+
"srem",
91+
"sunion",
92+
"sunionstore",
93+
"sinter",
94+
"zadd",
95+
"zincrby",
96+
"zinterstore",
97+
"zrange",
98+
"zrangebylex",
99+
"zrangebyscore",
100+
"zrank",
101+
"zrem",
102+
"zremrangebylex",
103+
"zremrangebyrank",
104+
"zremrangebyscore",
105+
"zrevrange",
106+
"zrevrangebyscore",
107+
"zrevrank",
108+
"zunionstore",
109+
"xadd",
110+
"xdel",
111+
"del",
112+
"xtrim"
113113
));
114114
/**
115115
* Operation represent a cache span is "write" or "read" action , and "op"(operation) is tagged with key "cache.op" usually
@@ -118,40 +118,40 @@ public static class Jedis {
118118
* @see org.apache.skywalking.apm.agent.core.context.tag.Tags#CACHE_OP
119119
* @see AbstractConnectionInterceptor#parseOperation(String)
120120
*/
121-
public static Set<String> OPERATION_MAPPING_READ = new HashSet<>(Arrays.asList("GET",
122-
"GETRANGE",
123-
"GETBIT ",
124-
"MGET",
125-
"HVALS",
126-
"HKEYS",
127-
"HLEN",
128-
"HEXISTS",
129-
"HGET",
130-
"HGETALL",
131-
"HMGET",
132-
"BLPOP",
133-
"BRPOP",
134-
"LINDEX",
135-
"LLEN",
136-
"LPOP",
137-
"LRANGE",
138-
"RPOP",
139-
"SCARD",
140-
"SRANDMEMBER",
141-
"SPOP",
142-
"SSCAN",
143-
"SMOVE",
144-
"ZLEXCOUNT",
145-
"ZSCORE",
146-
"ZSCAN",
147-
"ZCARD",
148-
"ZCOUNT",
149-
"XGET",
150-
"GET",
151-
"XREAD",
152-
"XLEN",
153-
"XRANGE",
154-
"XREVRANGE"
121+
public static Set<String> OPERATION_MAPPING_READ = new HashSet<>(Arrays.asList("get",
122+
"getrange",
123+
"getbit ",
124+
"mget",
125+
"hvals",
126+
"hkeys",
127+
"hlen",
128+
"hexists",
129+
"hget",
130+
"hgetall",
131+
"hmget",
132+
"blpop",
133+
"brpop",
134+
"lindex",
135+
"llen",
136+
"lpop",
137+
"lrange",
138+
"rpop",
139+
"scard",
140+
"srandmember",
141+
"spop",
142+
"sscan",
143+
"smove",
144+
"zlexcount",
145+
"zscore",
146+
"zscan",
147+
"zcard",
148+
"zcount",
149+
"xget",
150+
"get",
151+
"xread",
152+
"xlen",
153+
"xrange",
154+
"xrevrange"
155155
));
156156

157157
}

apm-sniffer/config/agent.config

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,3 +272,31 @@ plugin.neo4j.cypher_parameters_max_length=${SW_PLUGIN_NEO4J_CYPHER_PARAMETERS_MA
272272
plugin.neo4j.cypher_body_max_length=${SW_PLUGIN_NEO4J_CYPHER_BODY_MAX_LENGTH:2048}
273273
# If set to a positive number and activate `trace sampler CPU policy plugin`, the trace would not be collected when agent process CPU usage percent is greater than `plugin.cpupolicy.sample_cpu_usage_percent_limit`.
274274
plugin.cpupolicy.sample_cpu_usage_percent_limit=${SW_SAMPLE_CPU_USAGE_PERCENT_LIMIT:-1}
275+
# This config item controls that whether the Micronaut http client plugin should collect the parameters of the request. Also, activate implicitly in the profiled trace.
276+
plugin.micronauthttpclient.collect_http_params=${SW_PLUGIN_MICRONAUTHTTPCLIENT_COLLECT_HTTP_PARAMS:false}
277+
# This config item controls that whether the Micronaut http server plugin should collect the parameters of the request. Also, activate implicitly in the profiled trace.
278+
plugin.micronauthttpserver.collect_http_params=${SW_PLUGIN_MICRONAUTHTTPSERVER_COLLECT_HTTP_PARAMS:false}
279+
# Specify which command should be converted to write operation
280+
plugin.memcached.operation_mapping_write=${SW_PLUGIN_MEMCACHED_OPERATION_MAPPING_WRITE:set,add,replace,append,prepend,cas,delete,touch,incr,decr}
281+
# Specify which command should be converted to read operation
282+
plugin.memcached.operation_mapping_read=${SW_PLUGIN_MEMCACHED_OPERATION_MAPPING_READ:get,gets,getAndTouch,getKeys,getKeysWithExpiryCheck,getKeysNoDuplicateCheck}
283+
# Specify which command should be converted to write operation
284+
plugin.ehcache.operation_mapping_write=${SW_PLUGIN_EHCACHE_OPERATION_MAPPING_WRITE:tryRemoveImmediately,remove,removeAndReturnElement,removeAll,removeQuiet,removeWithWriter,put,putAll,replace,removeQuiet,removeWithWriter,removeElement,removeAll,putWithWriter,putQuiet,putIfAbsent,putIfAbsent}
285+
# Specify which command should be converted to read operation
286+
plugin.ehcache.operation_mapping_read=${SW_PLUGIN_EHCACHE_OPERATION_MAPPING_READ:get,getAll,getQuiet,getKeys,getKeysWithExpiryCheck,getKeysNoDuplicateCheck,releaseRead,tryRead,getWithLoader,getAll,loadAll,getAllWithLoader}
287+
# Specify which command should be converted to write operation
288+
plugin.guavacache.operation_mapping_write=${SW_PLUGIN_GUAVACACHE_OPERATION_MAPPING_WRITE:put,putAll,invalidate,invalidateAll,invalidateAll,cleanUp}
289+
# Specify which command should be converted to read operation
290+
plugin.guavacache.operation_mapping_read=${SW_PLUGIN_GUAVACACHE_OPERATION_MAPPING_READ:getIfPresent,get,getAllPresent,size}
291+
# If set to true, the parameters of Redis commands would be collected by Jedis agent.
292+
plugin.jedis.trace_redis_parameters=${SW_PLUGIN_JEDIS_TRACE_REDIS_PARAMETERS:false}
293+
# If set to positive number and plugin.jedis.trace_redis_parameters is set to true, Redis command parameters would be collected and truncated to this length.
294+
plugin.jedis.redis_parameter_max_length=${SW_PLUGIN_JEDIS_REDIS_PARAMETER_MAX_LENGTH:128}
295+
# Specify which command should be converted to write operation
296+
plugin.jedis.operation_mapping_write=${SW_PLUGIN_JEDIS_OPERATION_MAPPING_WRITE:getset,set,setbit,setex,setnx,setrange,strlen,mset,msetnx,psetex,incr,incrby,incrbyfloat,decr,decrby,append,hmset,hset,hsetnx,hincrby,hincrbyfloat,hdel,rpoplpush,rpush,rpushx,lpush,lpushx,lrem,ltrim,lset,brpoplpush,linsert,sadd,sdiff,sdiffstore,sinterstore,sismember,srem,sunion,sunionstore,sinter,zadd,zincrby,zinterstore,zrange,zrangebylex,zrangebyscore,zrank,zrem,zremrangebylex,zremrangebyrank,zremrangebyscore,zrevrange,zrevrangebyscore,zrevrank,zunionstore,xadd,xdel,del,xtrim}
297+
# Specify which command should be converted to read operation
298+
plugin.jedis.operation_mapping_read=${SW_PLUGIN_JEDIS_OPERATION_MAPPING_READ:getrange,getbit,mget,hvals,hkeys,hlen,hexists,hget,hgetall,hmget,blpop,brpop,lindex,llen,lpop,lrange,rpop,scard,srandmember,spop,sscan,smove,zlexcount,zscore,zscan,zcard,zcount,xget,get,xread,xlen,xrange,xrevrange}
299+
# If set to true, the parameters of Redis commands would be collected by Redisson agent.
300+
plugin.redisson.trace_redis_parameters=${SW_PLUGIN_REDISSON_TRACE_REDIS_PARAMETERS:false}
301+
# If set to positive number and plugin.redisson.trace_redis_parameters is set to true, Redis command parameters would be collected and truncated to this length.
302+
plugin.redisson.redis_parameter_max_length=${SW_PLUGIN_REDISSON_REDIS_PARAMETER_MAX_LENGTH:128}

0 commit comments

Comments
 (0)