Apply async end strategy to all kotlin coroutine flows (#11583)

This commit is contained in:
Lauri Tulmin 2024-06-13 18:20:09 +03:00 committed by GitHub
parent 9f11c4a36a
commit c6afaed015
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 2 deletions

View File

@ -5,8 +5,10 @@
package io.opentelemetry.javaagent.instrumentation.kotlinxcoroutines.flow;
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed;
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.implementsInterface;
import static net.bytebuddy.matcher.ElementMatchers.isConstructor;
import static net.bytebuddy.matcher.ElementMatchers.namedOneOf;
import static net.bytebuddy.matcher.ElementMatchers.named;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
@ -16,9 +18,14 @@ import net.bytebuddy.matcher.ElementMatcher;
public class AbstractFlowInstrumentation implements TypeInstrumentation {
@Override
public ElementMatcher<ClassLoader> classLoaderOptimization() {
return hasClassesNamed("kotlinx.coroutines.flow.Flow");
}
@Override
public ElementMatcher<TypeDescription> typeMatcher() {
return namedOneOf("kotlinx.coroutines.flow.AbstractFlow", "kotlinx.coroutines.flow.SafeFlow");
return implementsInterface(named("kotlinx.coroutines.flow.Flow"));
}
@Override