Fix ArrayIndexOutOfBoundsException (#2284)

* Fix ArrayIndexOutOfBoundsException when intercepting net.spy.memcached.MemcachedClient.getStats()

* revert format
This commit is contained in:
刘正阳 2019-02-22 23:44:22 +08:00 committed by 吴晟 Wu Sheng
parent 8f866fecd9
commit a95e15fb8d
1 changed files with 9 additions and 1 deletions

View File

@ -41,7 +41,15 @@ public class MemcachedMethodInterceptor implements InstanceMethodsAroundIntercep
span.setComponent(ComponentsDefine.SPYMEMCACHED);
Tags.DB_TYPE.set(span, ComponentsDefine.SPYMEMCACHED.getName());
SpanLayer.asCache(span);
Tags.DB_STATEMENT.set(span, method.getName() + " " + allArguments[0]);
Tags.DB_STATEMENT.set(span, getStatement(method, allArguments));
}
private String getStatement(Method method, Object[] allArguments) {
if (allArguments != null && allArguments.length > 0) {
return method.getName() + ' ' + allArguments[0];
} else {
return method.getName();
}
}
@Override