inspectit-ocelot
inspectit-ocelot copied to clipboard
[Bug] - Exclude method also change parameter name
Describe the bug config yaml:
s_exclude_lock_scope:
type:
name: '.*((Controller|Service.*))$'
matcher-mode: MATCHES
methods:
- annotations:
- name: 'Lock'
matcher-mode: CONTAINS
s_common_code_scope:
type:
name: '.*((Controller|Service.*))$'
matcher-mode: MATCHES
methods:
- name: '^((?!lambda).)*$'
matcher-mode: MATCHES
exclude:
s_exclude_lock_scope: true
method:
@Lock(
name = "'hwkf:instance.deployment.' + #deployment.deploymentId",
nameIsSpel = true,
lockType = LockType.READ
)
public FlowModel getFlowModelByDeployment(DefDeployment deployment)
public void othermethod()...
aspect:
public LockInfo getLockInfo(JoinPoint joinPoint, Lock lock) {
Method method = this.getMethod(joinPoint);
Object[] parameterValues = joinPoint.getArgs();
EvaluationContext context = new StandardEvaluationContext();
Parameter[] parameters = method.getParameters();
Object value;
for(int i = 0; i < parameters.length; ++i) {
String name = parameters[i].getName();
value = parameterValues[i];
context.setVariable(name, value);
}
...
}
the agent log shows javaagent not add hook for lock method,but the class is redefined and i get an error in aspect because of variable name changed
Expected behavior exclude scope don't change parameter name
Desktop (please complete the following information):
- OS: Linux
- Version 2.2.0
When i try use typepool before decorate, the problem is solved
rocks.inspectit.ocelot.core.instrumentation.transformer.AbstractClassTransformer#instrumentByteCode
TypePool typePool = TypePool.Default.of(ClassFileLocator.ForClassLoader.of(typeWithLoader.getLoader()));
DynamicType.Builder<?> builder = new ByteBuddy()
.decorate(typePool.describe(typeWithLoader.getName()).resolve(), ClassFileLocator.ForClassLoader.of(typeWithLoader.getLoader()));
I'm not sure is the rigth way