Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

trace_methods needs some definition at startup or redefining later fails

Aperta
#3,296 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Inizia da TraceMethodInstrumentation$TraceMethodAdvice e segui il guasto attraverso IndyBootstrap.java ed ElasticApmAgent.java, in particolare la ricerca della corrispondenza mostrata nello stack trace. Riproduci il problema con trace_methods assente all’avvio, quindi imposta elastic.apm.trace_methods dopo 30 secondi. Il lavoro è completato quando la configurazione dinamica funziona senza un segnaposto all’avvio e i metodi nel package selezionato iniziano a produrre transazioni dopo la ridefinizione.

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

Descrizione

agent-java

Describe the bug

trace_methods is dynamic, but it looks like it needs to be defined with SOMETHING at startup, then it can successfully be redefined. But if not defined at all at startup, the redefinition fails with mapping errors

java.lang.IllegalStateException: There's no mapping for key co.elastic.apm.agent.tracemethods.TraceMethodInstrumentation$TraceMethodAdvice

Steps to reproduce

Do NOT define trace_methods at startup (ie it should be absent from properties and config files), then sometime after startup define it, eg

        new Thread(() -> {
                try {Thread.sleep(30_000L);} catch (InterruptedException e) {}
                System.setProperty("elastic.apm.trace_methods", "somepackage.*");
        }).start();

Expected behavior

For that example, all methods in somepackage should produce no transactions until about 30 seconds after startup, when it should start producing transactions for any method executed in somepackage

Debug logs

2023-08-21 14:48:06,614 [Thread-16] ERROR co.elastic.apm.agent.bci.IndyBootstrap - There's no mapping for key co.elastic.apm.agent.tracemethods.TraceMethodInstrumentation$TraceMethodAdvice
java.lang.IllegalStateException: There's no mapping for key co.elastic.apm.agent.tracemethods.TraceMethodInstrumentation$TraceMethodAdvice
	at co.elastic.apm.agent.bci.ElasticApmAgent.getInstrumentationClassLoader(ElasticApmAgent.java:946) ~[elastic-apm-agent-1.38.1-SNAPSHOT.jar:1.38.1-SNAPSHOT]
	at co.elastic.apm.agent.bci.IndyBootstrap.internalBootstrap(IndyBootstrap.java:416) ~[elastic-apm-agent-1.38.1-SNAPSHOT.jar:1.38.1-SNAPSHOT]
	at co.elastic.apm.agent.bci.IndyBootstrap.bootstrap(IndyBootstrap.java:389) ~[elastic-apm-agent-1.38.1-SNAPSHOT.jar:1.38.1-SNAPSHOT]
	at jdk.internal.reflect.GeneratedMethodAccessor16.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at java.lang.IndyBootstrapDispatcher.bootstrap(IndyBootstrapDispatcher.java:61) ~[?:?]
	at java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:147) ~[?:?]
	at java.lang.invoke.CallSite.makeSite(CallSite.java:315) ~[?:?]
	at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:281) ~[?:?]
	at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:271) ~[?:?]
	at wimtjgf.ScoreUI.getGcTime(ScoreUI.java:215) ~[bin/:?]
	at wimtjgf.ScoreUI.lambda$2(Unknown Source) ~[bin/:?]
	at java.lang.Thread.run(Thread.java:833) [?:?]

Workaround

Add a dummy trace_methods definition at startup, eg -Delastic.apm.trace_methods=nothing.at.all then redefine dynamically as desired

Lingua principale
Java
Stelle
593
Fork
338
Merge medio
1g 9h
PR unite (30g)
13

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di elastic/apm-agent-java

Tutte le issue di elastic/apm-agent-java

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.