Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 16 13:45
    AnubhavGupta95 commented #393
  • Aug 16 12:02
    AnubhavGupta95 edited #395
  • Aug 16 11:59
    AnubhavGupta95 opened #395
  • Aug 16 11:26
    AnubhavGupta95 closed #390
  • Aug 16 11:26
    AnubhavGupta95 commented #390
  • Aug 16 10:15
    2994186010 edited #394
  • Aug 16 10:15
    2994186010 opened #394
  • Aug 15 02:10
    2994186010 commented #390
  • Aug 15 02:08
    2994186010 commented #393
  • Aug 15 01:59
    2994186010 commented #393
  • Aug 15 01:58
    2994186010 commented #393
  • Aug 15 01:57
    2994186010 commented #393
  • Aug 15 01:57
    2994186010 commented #393
  • Aug 15 01:55
    2994186010 commented #393
  • Aug 15 01:55
    2994186010 commented #393
  • Aug 15 01:13
    2994186010 opened #393
  • Aug 14 12:12
    chgitcrazy commented #391
  • Aug 14 11:20
    beijibing edited #392
  • Aug 14 11:19
    beijibing edited #392
  • Aug 14 11:19
    beijibing opened #392
Jaroslav Bachorik
@jbachorik
@lotusws You need to use directly the parent's class name.
lotusws
@lotusws
the parent is an abstract class, I tried and it failed..
Jaroslav Bachorik
@jbachorik
@lotusws Sorry for the long delay - didn't get the notification. It shouldn't matter whether the class is abstract or not - you just need to specify the exact class the field is declared in. Internally BTrace is using clz.getDeclaredField() and that method doesn't walk up the class hierarchy - that's why you need to specify the exact class to make this work :(
Joachim Haagen Skeie
@joachimhs
Is this forum still active? I am curious as to how the XML probe descriptors are used, and how the XML is formatted
Jaroslav Bachorik
@jbachorik
@joachimhs Sure, it is still active. It's just that not many people are actually using it :/ Usually going directly to the issue tracker :)
The XML descriptors can be used to abstract away the '@OnMethod' annotations. By using the descriptors you can eg. apply the same handler method to multiple 'OnMethod' declarations. Another benefit would be splitting the definition of what should be traced (descriptors) and how should it be traced (the java code).
As for syntax, it is very simple - you basically mimic the '@OnMethod' content with the annotation attributes being nested XML elements with corresponding names.
Joachim Haagen Skeie
@joachimhs
Sounds very good. I've wanted something like that for a long time with my current scripts. Some Btrace scripts are one-off, but many are just timing of methods, and being able to describe a "bunch" of them in a single file to use a single tracer method should be very handy!
Tim Käck
@TimKack
Hi all (and especially @jbachorik) - I was just curious where the NB plugin went? I guess you are still moving code from Kenai?
Jaroslav Bachorik
@jbachorik
@TimKack I'm in process of moving the project to github as well (https://github.com/btraceio/btrace.nb). Anyway, the sources at Kenai.com are mostly up-to-date - I haven't touched the IDE integration part for quite a long time, only updating the BTrace binaries for each release.
Tim Käck
@TimKack
Thanks @jbachorik, the IDE integration is really not very important but given that I use Netbeans a lot - I get lazy
Tim Käck
@TimKack
How would I go about to iterate over a java.util.Properties object that I access via Reflective.field(c,"fieldname") - casting is unsafe, right?
Tim Käck
@TimKack
never mind. I think have solved that now. printMap can be used since Properties is inheriting from Map
Joachim Haagen Skeie
@joachimhs

I am getting a NullPointerException in btracec at com.sun.btrace.compiler.Compiler.printDiagnostic(Compiler.java:303). Should there be an null pointer check there, or am I doing something strange in my scripts?

It fails on this line: println(Sys.Memory.getMemoryPoolUsage(str(sb)));

Joachim Haagen Skeie
@joachimhs
I found a few bugs (or at least some inconsistencies with the previous versions of BTrace) related to the TimeBasedRollingFileWriter. Created PR: btraceio/btrace#221
Jaroslav Bachorik
@jbachorik
@TimKack yes, 'printMap' is the correct way to print the properties
Jaroslav Bachorik
@jbachorik
@joachimhs There actually seem to be more problems here - the compiler throws NPE when trying to process the diagnostic info. The diagnostic info contains parts generated by 'btracec' but those parts don't map correctly to source. And the last thing is that BTrace compiler reports 'Sys.Memory.getMemoryPoolUsage(str(sb))' as unsafe call. I will have to investigate what is causing this misbehavior.
Joachim Haagen Skeie
@joachimhs
ok. @jbachorik in the interim I commented out the line in my script which is an OK temporary solution
Jaroslav Bachorik
@jbachorik
@joachimhs About that Sys.Memory.getMemoryPoolUsage() problem - btraceio/btrace#222
Joachim Haagen Skeie
@joachimhs
@jbachorik Looks good! Thanks. I am working on finishing Montric and releasing it in August
Jakub Dziworski
@JakubDziworski

Hi! I'd like to debug agent, but somehow I am unable to do that.

In the Client when the agent is loaded (vm.loadAgent(agentPath, agentArgs);) I added additional arguments:

agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005

The console prints:

DEBUG: agent args: agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005,port=2020,statsd=,debug=true,bootClassPath=.,systemClassPath=/opt/oracle_jdk/jre/../lib/tools.jar,probeDescPath=.

but the agent does not expose debugger port.

Did I provided args in wrong format, or is there any other problem?

@jbachorik @joachimhs
Serge Smertin
@nfx
greetings greetings
i'm trying to find any manuals on how to start actually using btrace for writing custom agent
no success so far
Jaroslav Bachorik
@jbachorik
@JakubDziworski When I need to debug the agent I just run the target application with the debugger settings - eg. I can run a java application in debug mode from an IDE and then attach btrace. When you have the sources available and you put breakpoint inside the BTrace code you can debug it.
Hi @nfx , have you tried https://github.com/btraceio/btrace/wiki ?
Jaroslav Bachorik
@jbachorik
@JakubDziworski Your approach will not work since you are trying to expose agent (debugger) from within another agent (btrace). You really need to start that JVM with debugger agent (and possibly btrace agent if you are loading btrace at JVM startup)
Tim Käck
@TimKack
@jbachorik I just wanted to say a big Thank You for the work you and A Sundararajan done with BTrace. Today it has facilitated a database connaction pool monitoring in our application (exposing it as MBeans).
With the @sampled annotation we can make sure that we are causing very little overhead as well (a connection pool is a high contention area)!
Jaroslav Bachorik
@jbachorik
@TimKack Glad to hear that! If you have any requests or ideas about BTrace, don't hesitate to speak up either here or on GitHub.
Simon
@Gikkman
Hi.
I got curious if it was possible to use VisualVM to remotely use bTrace probes (such as checking sort frequency). After a few hours of searching, I did come across an old Kenai post about it from 2014 where it was discussed, but I haven't seen anything since. Is it possible today, or was that idea abandoned?
Iwan Aucamp
@aucampia
hi
so when I search for btrace I find this at the top: https://kenai.com/projects/btrace
and that is no longer being maintained - can that somehow be removed ?
Jaroslav Bachorik
@jbachorik
@aucampia I don't know. Kenai.com has been in read-only mode for several years and it is in undead mode when no changes are allowed :/ If you know how to unindex something from google that might help ...
Tim Käck
@TimKack
Hi, is there a way to get the value from an aggregation without turning on unsafe? I.e. I have an aggregation with AggregationFunction.AVERAGE and ultimately I'd like to do a myAggregation.getValueForKey(myAggrKey)
(I can solve this case with a simple counter and add to an AtomicLong but more for complex aggregations)
Jaroslav Bachorik
@jbachorik
@TimKack Currently, only printing the whole aggregation structure is supported. Please, feel free to file an RFE for retrieving single aggregation values, it should be fairly easy to add. Until then you will need to enable unsafe mode.
Tim Käck
@TimKack
@jbachorik - thank you. I'll open a RFE or create a pull request.
But now I have another question :) - I cannot seem to understand how Kind.CATCH works. I want to catch ClassNotFoundExceptions thrown in java.net.URLClassLoader.findClass(String) but it seems to ignore the instrumentation.
I have followed traces.onmethod.Catch test case
Jaroslav Bachorik
@jbachorik
@TimKack The Kind.CATCH is for instrumenting the 'catch' block - is that the scenario. For uncaught exceptions you would use Kind.ERROR instead.
Tim Käck
@TimKack
I cannot seem to figure out how where to put arguments to my script when loaded as an agent. When using the client I access them via Sys.$(x) but how would I go about when using the btrace-agent?
Jaroslav Bachorik
@jbachorik
Currently this is not possible. The functionality is missing - the agent arguments are not forwarded to runtime.
Jaroslav Bachorik
@jbachorik
@TimKack What would be the expected behaviour - Sys.$(x) would provide access to the agent arguments, eg. -javaagent:btrace-agent.jar=arg1=val1,arg2=val2,... would make arguments 'val1' and 'val2' accessible to the probe?
@TimKack btraceio/btrace#295 - please, add there any comments about required functionality
Tim Käck
@TimKack
@jbachorik - no comments needed - you perfectly describe the enhancement. I added a comment that it would be fantastic to retrieve the value from named parameters
Tim Käck
@TimKack

But I have a somewhat basic question, consider this: I have a private variable private Context CROSS_THREAD_CONTEXT_FOR_UNIT_TEST = null; and I want to modify this variabe on a method call. Basically I have production code running

private void setCrossThreadContextForUnitTests( Context context )
  {
    CROSS_THREAD_CONTEXT_FOR_UNIT_TEST = context;
  }

I want to intercept and set context to null. How would I do that (I understand it has to be unsafe mode). Do I need to reflect on @Self somehow?

Jaroslav Bachorik
@jbachorik
Unfortunately, reflection is the only way right now. Could be interesting to consider an enhancement for FIELD_SET interception where the probe method could return a value that should be used instead of the provided one (we do something similar for method return values - of course this is enabled only in unsafe mode)
Or a generic DSL/API allowing manipulation of method arguments on method entry ...
Tim Käck
@TimKack
Cheers - reflection it is. I agree, FIELD_SET instrumentation seems to be the most logical place to put such an enhancement. This is not really hot swapping the argument though as there might be many FIELD_SETs in an instrumented method. Perhaps both? One argument DSL for Kind.ENTRY and one for FIELD_SET?