trace_methods needs some definition at startup or redefining later fails
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- java
调研方向
从 TraceMethodInstrumentation$TraceMethodAdvice 开始,沿着 IndyBootstrap.java 和 ElasticApmAgent.java 追踪故障,尤其关注堆栈跟踪中显示的映射查找。启动时不提供 trace_methods 来复现问题,然后在 30 秒后设置 elastic.apm.trace_methods。完成的标准是动态配置无需启动时的占位符即可工作,并且所选 package 中的方法在重新定义后开始生成事务。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- Java
- 星标
- 593
- 派生
- 338
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 13
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
elastic/apm-agent-java 的其他 Issue
-
Spring MVC View instrumentation incorrectly matches static render overloads (EasyPOI)可能已有人在做 @VelpulaGangavardhan 于 2 天前认领。 未关闭agent-java community triage
难度 2/5 1-3 小时 新手友好度 72/100
elastic/apm-agent-java#4594 · 1 条评论 ·
维护者通常 1 天内回复
-
agent-java
难度 2/5 1-2 天 新手友好度 62/100
elastic/apm-agent-java#2844 · 2 条评论 ·
维护者通常 1 天内回复
-
Improve docs and add error log related to illegal activation of transaction可能已有人在做 @AzazelSensei 于 39 天前认领。 未关闭docs good first issue
难度 2/5 1-3 小时 新手友好度 68/100
elastic/apm-agent-java#850 · 4 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
agent-java community triage
难度 3/5 1-2 天 新手友好度 55/100
elastic/apm-agent-java#4593 ·
维护者通常 1 天内回复
-
agent-java community triage
elastic/apm-agent-java#4573 · 4 条评论 ·
维护者通常 1 天内回复
查看 elastic/apm-agent-java 的全部 Issue
相似的 Issue
-
NullPointerException when a `DeserializationProblemHandler` returns `null` for `byte[]` (single value unwrapped) and `char[]` elements可能已有人在做 @Marti2203 今天认领。 未关闭
难度 2/5 半天 新手友好度 88/100
FasterXML/jackson-databind#6300 ·
维护者通常 1 天内回复
-
content good first issue
难度 1/5 1 小时以内 新手友好度 95/100
cpinitiative/usaco-guide#6699 ·
维护者通常 1 天内回复
-
BC remittance upload: a claim MSP refused (S03) is saved with a blank status instead of refused (F)未关闭type: bug
难度 2/5 1-3 小时 新手友好度 88/100
carlos-emr/carlos#4933 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
apache/rocketmq-dashboard#6925 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
Vakore/ZappierGames#147 ·