cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

This product reached the end of support date on March 31, 2021.

Thread run inner method call not visible in AppMon

jose_colella
Inactive


Hello,


I am currently facing the following situation. My client has created a class that extends the native Java Thread class. Inside the


run()


method they are invoking a method of another class; e.g:


public void run() {
AnotherClass.method();
}


The problem is that after placing the sensor on the method that is invoked, I am not able to see the method in the purepath. I have had to change the method to active and start purepaths for the method to be seen. The problem is that we need to visualize the method call inside the parent purepath.

Any suggestions? @Andreas G.

16 REPLIES 16

Joe_Hoffman
Dynatrace Leader
Dynatrace Leader

Jose, Is it possible that your thread is marked as a daemon thread? We don't by default follow a purepath down into daemon threads.

Did you verify that the Sensor Group which contains your sensor rule is placed into the appropriate Agent Group.

The other thing to check, in the Agent Overview dashlet, select the agent where this code is running and at the bottom of the screen select the Deployed Sensors tab. Verify that your class.method is listed. If it's not listed, then you're not getting the instrumentation you want and we can take a closer look at the rule you've created.

Taking the last thing that Joseph said, if the method is not listed at the Deployed Sensor tab, it's possible it it falls in the following situation:

"There is an algorithm that will look for very small, fast, methods (these are often getters and setters, but the actual name is irrelevant). When the default option to ignore getters and setters is ON, dT will not place sensors on them. Unchecking that option (to allow these small methods) should now let dT listen to you and inject those sensors as requested.
Since this is a change to what sensors are injected, this will require a restart of the JVM."

If it's a very small and fast method, dt might be ignoring your method. You need to uncheck the Ignore getter and setter method under your Agent Group Placement Options.

The original post is here.

Regards,

Melory

Hey thanks for your comment @Melory Z. and @Joseph M. H.. The sensor is in the deployed sensors for the agent.

But it was in the deployed sensors before you set it for start purepath?

@Melory Z., yes.

Mike_L
Dynatrace Pro
Dynatrace Pro

I am guessing it wasn't a daemon thread like we discussed yesterday? Can you share the code that creates the thread?

Hey @Michael L.,

Looked at the code today, and unfortunately it seems as if it is not a daemon thread. I can share the code as soon as I am in client site tomorrow.

Joe_Hoffman
Dynatrace Leader
Dynatrace Leader

Jose: Given that the method you want shows up in Deployed Sensors, then that means you are injecting correctly, but just not seeing it in a purepath. But i re-read your original post and it appears that it IS showing up in a purepath, but you want it to show up included in the purepath of the parent thread that's invoking it? Is this correct? If so, then verify that you have the Thread Start Tagging and Executor Tagging sensors placed in both agent groups (Parent JVM and subthread JVM).

Please confirm that you are seeing the purepath, but just not attached, or did I misunderstand the problem?

Hello Joseph,

What you have said is correct. I only see the method if I put it as active and start purepaths, but not when active.

Both of those sensor packs are set as active.

Joe_Hoffman
Dynatrace Leader
Dynatrace Leader

Jose,

So this is good news, you see the purepath of the subthread, you just want it to be part of the parent thread purepath.

Try the following:

-On the java command line, add the following to your -agentpath argument. This will just be another comma seperated parameter at the end of the -agentpath line:

com.dynatrace.taggeddaemonthread=com.mycompany.MyThreadClass1

This will instruct the Dynatrace agent to not ignore the subthreads even if they are set as daemon threads. In my example above, i've shown only 1 class (MyThreadClass1). If you have multipole thread classes that need to be defined, simply separate them by a "|", such as

com.dynatrace.taggeddaemonthread=com.mycompany.MyThreadClass1|com.mycompany.MyThreadClass2

No need to change your sensor rules, they should be fine as they are.

Let us know.

joe hoffman

Thanks @Joseph M. H.,

I will try this. Just to be clear that I only saw the purepath of the subthread when set to active and start purepath. So what you are saying is that adding this configuration will allow me to visualize the thread within the parent purepath?

That is the command I told you about on Tuesday for daemon threads. If the thread is a daemon thread that attribute will indeed resolve your need to do start purepaths.

harald_berger
Dynatrace Pro
Dynatrace Pro

Hi All,

Please consider when a new thread is created it inherits the daemon status of its parent.

So even if you do not setDaemon (true) a new thread may be a daemon

Best

Harry

Hi @Jose C., how are you? Did you find a solution for this?

Hello Jonathan,

I was successful with @Joseph M. H.'s suggestion.

"-On the java command line, add the following to your -agentpath argument. This will just be another comma seperated parameter at the end of the -agentpath line:

com.dynatrace.taggeddaemonthread=com.mycompany.MyThreadClass1"

Thanks, seems my colleague already tested something like this.