Search code examples
btrace

BTrace failing to instantiate legal properties


I am trying to run btrace v.1.3 (20150516) using Java 1.8 on Windows 7 Enterprise and having many issues.

In my btrace script I am creating an Aggregation using:

private static Aggregation methodDuration = Aggregations
   .newAggregation(AggregationFunction.AVERAGE);

The aggregation creation is failing silently and subsequent calls are throwing a NullPointerException trying to access it.

I am having almost the same issue when I run the stock Profiling example https://github.com/jbachorik/btrace/blob/master/samples/Profiling.java

This time however I am getting an error message: BTraceScript.java:131:instance variables are not allowed.

My btrace code for that example looks like this

@BTrace
public class BTraceScript {
. . .
131 @Property 
132 Profiler profiler = BTraceUtils.Profiling.newProfiler(); 
133 
134 @OnMethod(clazz="com.vgrazi.btrace.SynchronizationExample", method="/.*/") 
135    void entry(@ProbeMethodName(fqn=true) String probeMethod) { 
136    BTraceUtils.Profiling.recordEntry(profiler, probeMethod); 
137 }

FYI, I am also trying on Mac also using Java 8, and although it gets slightly further, it is still not really behaving properly.


Solution

  • This is caused by https://github.com/jbachorik/btrace/issues/129

    Please, use the latest BTrace (1.3.3 at the time)