Ensures that sampler proxy gets eagerly resolved; fixes gh-2107
This commit is contained in:
@@ -151,6 +151,19 @@ class TraceFunctionAroundWrapperTests {
|
||||
assertThat(tracer.spans).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_tracing_with_message_flux_to_flux_without_message() {
|
||||
FunctionRegistration<MessageFluxToFluxFunction> registration = new FunctionRegistration<>(
|
||||
new MessageFluxToFluxFunction(), "greeter").type(FunctionType.of(MessageFluxToFluxFunction.class));
|
||||
catalog.register(registration);
|
||||
FunctionInvocationWrapper function = catalog.lookup("greeter");
|
||||
|
||||
Object result = (Object) ((Flux) wrapper.apply("hello", function)).blockFirst();
|
||||
|
||||
assertThat(result).isEqualTo("hello");
|
||||
assertThat(tracer.spans).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_tracing_with_consumer() {
|
||||
GreeterConsumer consumer = new GreeterConsumer();
|
||||
@@ -465,4 +478,18 @@ class TraceFunctionAroundWrapperTests {
|
||||
|
||||
}
|
||||
|
||||
static class MessageFluxToFluxFunction implements Function<Flux<Message<?>>, Flux<?>> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(MessageFluxToFluxFunction.class);
|
||||
|
||||
@Override
|
||||
public Flux<?> apply(Flux<Message<?>> input) {
|
||||
return input.map(s -> {
|
||||
log.info("Logging [{}] from map", s);
|
||||
return s.getPayload();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user