elastic / elastic/apm-agent-java
Inferred spans from loop don't seem to correlate correctly
- Dominant language
- Java
- Stars
- 594
- Forks
- 338
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 25
Description
Recently to investigate tail latencies for our `knn` search in Elasticsearch, we've added the capability to profile the path of execution in a search transaction, yielding traces that look like this:

What's strange is the termination of `HnswGraphSearcher#search` with the first iteration of `searchLevel`. See the expected code here:
https://github.com/apache/lucene/blob/728936eb7cbb91bfa624686007b02b086d10cf41/lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphSearcher.java#L155-L157
I would expect rather something that looks like this:

We see in the stack trace info for each subsequent `searchLevel` invocation that `HnswGraphSearcher#search` is detected, but for some reason it's not visualized:
Contributor guide
Assessment
This issue has not been assessed yet.