Git Product home page Git Product logo

java-reactor's Introduction

OpenTracing Reactor Instrumentation

OpenTracing instrumentation for Reactor. This instrumentation library is based on spring-cloud-sleuth's reactor instrumentation.

OpenTracing Agents

When using a runtime agent like java-specialagent TracedSubscribers will be automatically added using Hook.onEachOperator and Hooks.onLastOperator.

Refer to the agent documentation for how to include this library as an instrumentation plugin.

Non-Agent Configuration

When not using any of the OpenTracing Agents the Hooks must be added directly:

Hooks.onEachOperator(TracedSubscriber.asOperator(tracer));
Hooks.onLastOperator(TracedSubscriber.asOperator(tracer));

...

java-reactor's People

Contributors

aerfus avatar jam01 avatar nhebrard avatar safris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

java-reactor's Issues

No active span within Mono.create

Hi,

I'm using a library which tries to log to the active span from within a Mono.create block.
The TracerSubscriber does not seem to set the active span for this case.

        Span foo = tracer.buildSpan("foo").start();

        Mono.create(sink -> {
            tracer.activeSpan().log("hoho");
            sink.success("asdas");
        })
            .subscriberContext(c -> c.put(Span.class, foo))
            .doOnTerminate(() -> foo.finish())
            .block();

No active span with onError and onComplete

Hello!

Is there any reason to not wrap TracedSubscriber.onError() and TracedSubscriber.onComplete() within the active span?

I would like to access the span in both cases in order to have a clean log correlation.

Happy to contribute if needed!
Thanks.

Can't use TracedSubscriber with r2dbc

We are using ProjectReactor and grpc, as well as using reactive drivers for postgres r2dbc-postgresql.
There are 3 microservices.
A grpc request is made from the pvi-adapter application, to the ed-server application, then a transaction is opened, some kind of business logic is executed, then a grpc call to the dicts server is made.
When you start the application for the first time and receive the first grpc request from pvi-adapter, all spans are appended in the correct sequence and to the correct trace.
But all subsequent requests received via grpc from pvi-adpater are also bound to the span that was formed at the first request.
To pass the span in the reactor, we use
Hooks.onEachOperator (TracedSubscriber.asOperator (tracer));
Hooks.onLastOperator (TracedSubscriber.asOperator (tracer));
as you have written about it https://github.com/opentracing-contrib/java-reactor

To pass the span through grpc, we use
TracingServerInterceptor and TracingClientInterceptor from repository
https://github.com/opentracing-contrib/java-grpc

After a long debugging, I came to the conclusion that the problem is that the postgres r2dbc driver keeps the context passed through TracedSubscriber until the connection to the database is interrupted io.r2dbc.postgresql.client.ReactorNettyClient

https://github.com/pgjdbc/r2dbc-postgresql/blob/main/src/main/java/io/r2dbc/postgresql/client/ReactorNettyClient.java

The question is who faced such a problem and how to get around it? Now it turns out that using TracedSubscriber in a fully reactive environment with reactive drivers for postgres is not possible.

TracedSubscriber changes threading

Hi,

We ran into an issue where the Java SpecialAgent broke a Reactor application. Apparently the application is using a block() call (we know this is probably an anti-pattern and are looking to fix it) that works fine using the FluxElapsed.ElapsedSubscriber, but fails when the TracedSubscriber wrapper is added.

It looks like this is due to the fact that the threading can change since TracedSubscriber implements the SpanSubscription interface which always returns Fuseable.NONE for Fuseable.QueueSubscription.requestFusion.

Would it be possible to preserve the fusion mode from the wrapped subscriber instead of always returning NONE?

Publish to Maven Central

Please publish opentracing-reactor to Maven Central so that it can be imported from other projects.

(In particular, I'm planning to add a Spring Boot starter for it in java-spring-cloud).

Thank you!

subscribeOn supported?

Quick question: are traces propagated also in reactive chains where subscribeOn is used? I don't seem to get this to work properly and traces disappear when for example .subscribeOn(Schedulers.elastic()) is used. Thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.