Skip to content

Latest commit

 

History

History

rxfiddle-jvm-collector

rxfiddle-jvm-collector

A collector for RxFiddle to run inside a JVM. The plugin consists of several pieces:

  • AST parser which logs the structure of in-source Observables.
  • ByteCode instrumentation (BCI) which inserts logging of the creation of, subscription on and data flow through Observables.
  • (WebSocket) server emitting all collected events

The ByteCode instrumentation appends logic before and after each method call returning an Observable. This logs the creation of the Observable sequences. Next the ClassVisitors map all subscribe, onNext, onError and onComplete calls.

Building

Create the agent jar by running:

gradle jar

Running

To run the ByteCode instrumentation as an agent start with the following JVM arguments:

-javaagent:build/libs/rxfiddle-java-collector-0.1-SNAPSHOT.jar

This JVM argument can be added to specific Gradle tasks. In samples/simple the argument is configured in build.gradle to always run:

# samples/simple/build.gradle
task(runJavaExecNormal, dependsOn: 'classes', type: JavaExec) {
    main = "rxfiddle.samples.simple.Main"
    classpath = sourceSets.main.runtimeClasspath
    jvmArgs '-javaagent:../../build/libs/rxfiddle-jvm-collector-0.1-SNAPSHOT.jar'
}

so you can just run the following and see the debug output on the command line:

cd samples/simple
gradle run

References

For references see: