elastic / elastic/apm-agent-java

Why can't I get the method‘s real parameter name when i use apm-agent?

Aperta
#3,237 16 commenti 0 reazioni 0 assegnatari Vedi su GitHub
agent-java community
Lingua principale
Java
Stelle
594
Fork
338
Merge medio
1g 13h
PR unite (30g)
25

Descrizione

Why can't I get the method‘s real parameter name by reflect?
i can get the method‘s real parameter name When the program first started,but i can‘t get the method's real parameter name after printing this log.

```
2023-07-14 13:58:27,588 [http-nio-8081-exec-4] INFO co.elastic.apm.agent.servlet.ServletVersionInstrumentation - Servlet container info = Apache Tomcat/9.0.60

2023-07-14 13:58:27,710 [Attach Listener] INFO co.elastic.apm.agent.impl.ElasticApmTracer - Tracer switched to RUNNING state
```

**my code like this**
```
@GetMapping("/test01")
public String test01() throws NoSuchMethodException {
Method testMethod = HelloController.class.getDeclaredMethod("test", int.class);
for (Parameter parameter : testMethod.getParameters()) {
System.out.println("param name is" + parameter.getName());
}
return "ok";
}

private static void test(int num) {

}
```

**and log info like this**
```
param name isnum

2023-07-14 13:58:27,588 [http-nio-8081-exec-4] INFO co.elastic.apm.agent.servlet.ServletVersionInstrumentation - Servlet container info = Apache Tomcat/9.0.60

2023-07-14 13:58:27,710 [Attach Listener] INFO co.elastic.apm.agent.impl.ElasticApmTracer - Tracer switched to RUNNING state

param name isarg0
```

**first result is “param name isnum” but the second result is “param name isarg0”,the expected result is “param name isnum”,how can i fix it?**

**my runtime environment is jdk8 and apm-agent-attach 1.39.0**

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start with the supplied HelloController.test01 reflection example and run it on JDK 8 with apm-agent-attach 1.39.0. Compare the parameter metadata before and after the agent switches to RUNNING, then trace which agent instrumentation affects HelloController.test; done means documenting the cause and a verified fix or limitation.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
observability-sre
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.