Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
*/
package co.elastic.apm.agent.vertx.v3.web;

import co.elastic.apm.agent.collections.WeakConcurrentProviderImpl;
import co.elastic.apm.agent.impl.ElasticApmTracer;
import co.elastic.apm.agent.impl.GlobalTracer;
import co.elastic.apm.agent.impl.transaction.Transaction;
import co.elastic.apm.agent.sdk.weakconcurrent.WeakConcurrent;
import co.elastic.apm.agent.sdk.weakconcurrent.WeakMap;
import co.elastic.apm.agent.vertx.AbstractVertxWebHelper;
import io.vertx.core.Handler;
Expand All @@ -34,7 +34,7 @@ public class WebHelper extends AbstractVertxWebHelper {

private static final WebHelper INSTANCE = new WebHelper(GlobalTracer.requireTracerImpl());

static final WeakMap<HttpServerRequest, Transaction> requestTransactionMap = WeakConcurrent.buildMap();
static final WeakMap<HttpServerRequest, Transaction> requestTransactionMap = WeakConcurrentProviderImpl.createWeakSpanMap();

public static WebHelper getInstance() {
return INSTANCE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public ElementMatcher<? super TypeDescription> getTypeMatcher() {

@Override
public ElementMatcher<? super MethodDescription> getMethodMatcher() {
return named("doEnd").and(takesNoArguments());
return named("doEnd").or(named("onEnd")).and(takesNoArguments());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did we miss this initially? onEnd is available in 3.9 but not in 3.6.
How did you notice this?
Maybe we need a unit test for making sure context gets cleaned up properly, WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exactly what this map migration does- it triggers our existing global recycling test assertions, thus uncovering such cases.
What we had before is a map that holds references to spans without counting these references, so the Vert.x API could change, causing spans to remain in the map and still get recycled. Now that we count these map references, if you don't properly remove them from the map, the recycling assertion causes the v3-latest tests to fail, which is how I found that.

}

@Override
Expand Down