Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Build Status Coverage Status Released Version Apache-2.0 license

OpenTracing RxJava Instrumentation

OpenTracing instrumentation for RxJava.

Installation

RxJava 1

pom.xml

<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-rxjava-1</artifactId>
    <version>VERSION</version>
</dependency>

RxJava 2

pom.xml

<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-rxjava-2</artifactId>
    <version>VERSION</version>
</dependency>

RxJava 3

pom.xml

<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-rxjava-3</artifactId>
    <version>VERSION</version>
</dependency>

Usage

// Instantiate tracer
Tracer tracer = ...

// Optionally register tracer with GlobalTracer
GlobalTracer.register(tracer);

RxJava 1

// Enable Tracing via TracingRxJavaUtils
TracingRxJavaUtils.enableTracing(tracer);

Subscriber

// Decorate RxJava Subscriber  with TracingSubscriber
Subscriber<Integer> subscriber = ...
Subscriber<Integer> tracingSubscriber = new TracingSubscriber<>(subscriber, "subscriber", tracer);

// Subscribe Observable to TracingSubscriber
observable.subscribe(tracingSubscriber);

Action

// Decorate RxJava Action with TracingActionSubscriber
Action1<Integer> onNext = ...
TracingActionSubscriber<Integer> tracingSubscriber = new TracingActionSubscriber<>(onNext,
        "action", tracer);

// Subscribe Observable to TracingActionSubscriber
observable.subscribe(tracingSubscriber);

Observer

// Decorate RxJava Observer with TracingObserverSubscriber
Observer<Integer> observer = ...
TracingObserverSubscriber<Integer> tracingSubscriber = new TracingObserverSubscriber(observer, 
        "observer", tracer);

//  Subscribe Observable to TracingObserverSubscriber
observable.subscribe(tracingSubscriber);

RxJava 2 / RxJava 3

// Enable Tracing via TracingRxJava2Utils

// For RxJava 2:
TracingRxJava2Utils.enableTracing(tracer);

// For RxJava 3:
TracingRxJava3Utils.enableTracing(tracer);

Observer

// Decorate RxJava Observer with TracingObserver
Observer<Integer> observer = ...
Observer<Integer> tracingObserver = new TracingObserver<>(observer, "observer", tracer);

// Subscribe Observable to TracingObserver
observable.subscribe(tracingObserver);

Consumer

// Decorate RxJava Consumer with TracingConsumer
Consumer<Integer> onNext = ...
TracingConsumer<Integer> tracingConsumer = new TracingConsumer(onNext, "consumer", tracer);

// Subscribe Observable to TracingConsumer
observable.subscribe(tracingConsumer);

License

Apache 2.0 License.

About

OpenTracing Instrumentation for RxJava

Topics

Resources

License

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •