[APM AGENT][JAVA] TIBCO custom transactions issue

Hi guys,
I have succesfully used APM Agent so far, using it with different TIBCO products (BE, BW, OMS). It works fine (except for body characters limit) with BW (BusinessWorks) and BE (BusinessEvents) applications, collecting metrics and http request transactions. It works very well with FOM, moreover, gathering transactions and spans too.

Currently I would like to improve transactions/spans definition in BW so I have developed a simple test application in which:

  • I set APM dependecies inside application pom file
  • I defined a custom transaction, via startTransaction() method
  • I set its name and type, via setName() & setType() methods
  • I set transaction end, via end() method

I used 4 different "JAVA invoke" activities (BusinessWorks uses out of the box activities to perform actions) and deployed the application in a test environment.
It correctly starts and run, but it fails once I restart it and make it uses the apm agent.

This is the error I get in test application log:

java.lang.IllegalArgumentException: Invalid resource. The argument 'serializableResource' must be an instance of 'java.io.Serializable'

Additional info:

  • BusinessWorks v6.5
  • Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
  • APM Agent 1.8.0
  • no errors are reported inside APM agent logs

It seems that there is something wrong once the APM agent tries to serialize data in order to send them to the APM server.. but, of course, it's just a suspect.

Thank you!

Hi :wave: and thanks for the feedback and question.

In order for us to be able to assist, please provide the followings:

  • The full application log, or at least the entire section around this error (stack trace at least, but more is better). This small piece is not informative enough.
  • Your exact setup - how you did the API jar dependency and how you installed the agent itself.
  • The configuration you use for the agent.
  • Your code using the API

In addition, some clarifications: do you experience this failure with the manual tracing (ie API usage), where the automatic tracing (ie only agent, no API usage) worked before?

Hi Koren,

  1. Application log attached (NB: don't care about AmiException)
  2. I imported agent api inside the application (it is stored inside the lib folder). NB: BW application starts correctly without setting elastic-apm-agent inside JVM properties
  3. What kind of configuration you mean?
  4. Attached 2 screenshots:
  • BW_invoke: in which you can see in detail how I use api methods using the proper BW activity (JAVA invoke)
  • BW_app_overview: in which you can see
    If you want I can share the BW application, but I guess you should have BW (which is not free) installed somewhere :slight_smile:

Yes, I'm experiencing this failure with the manual tracing, the automatic one is working fine (but I would like to improve it). In order to clarify my intents, I attached 2 APM screenshots:

  • FOM automatic tracing: it works very well and I can get the whole transaction details
  • BW automatic tracing: it works fine, but no other transactions/spans are captured. My aim is to create custom transactions/spans and get confidence in using the api

You can find all files here

NB: If you want we can have a zoom to speed up the troubleshooting :wink:

Thank you

Andrea,

I am not familiar with these frameworks, but it looks like you are trying to invoke the agent API remotely, is that correct? If so, I assume the invoked classes need to conform to some requirements, eg implement java.io.Serializable, can that be the problem?

This doesn't seem like a proper use of the API. It is designed to be used from within the code- accepting all kind of instances and returning all kinds of instances, and used within the context of JVM threads. I am not even talking about all the efforts we constantly make to keep the agent performant, not being relevant with such usage.

If you can modify your application code, this is where you should incorporate the API invocations.

I hope it makes sense, let me know if I totally got this wrong and we can think about further steps :slight_smile:

Hi Eyal,
the agent API resides in the same application module (TIBCO BW uses OSGI framework) and, according to logs, it seems to be used within the context of JVM threads (what you mean with this statement?)
Unfortunately I don't think I can modify application code, TIBCO BW uses out of the box activities in order to implement its functionalities. Eg. code describing a process is just an xml code which refers to different activities.
What I wonder is: do APM agent user java.io.Serializable interface? This is due to the fact that the application seems to work fine without attaching the APM agent to it.
Thanks

Andrea,

The API and agent classes are not implementing the Serializable interface.
What I asked is- could this error be related to the attempt to use the Java invoke stuff with non-serializable types?

Unfortunately I don't own these kind of informations. I have to get in contact with TIBCO engineers and explain them the case.
Anyway, I think this can really be an interesting case for Elastic, since it seems that nobody has already faced this kind of customization on TIBCO (at least according to what I see in the forum)
I will keep you updated about this, even if I will be in vacation in few days :wink:
Thanks

I think there is no feasible way to make it work with our agent, but let us know if you find out some interesting info :slight_smile:

Hi,
we finally tested succesfully our BW application with no errors in serializing code between jvm and agent.
Unfortunatelly, despite our jvm is succesfully connected with the APM agent (we can see all the metrics passed by our application to Elastic on Kibana), we do not see any of our transactions.
The behaviour of our application is the following:

  1. We wrote a custom java class, defined as follow:
    import co.elastic.apm.api.ElasticApm;
    import co.elastic.apm.api.Transaction;
    public class MyImportantBusinessLogic {
    public static void myVeryImportantMethod(String Name, String Type) {
    Transaction transaction = ElasticApm.startTransaction();
    try {
    transaction.setName(Name);
    transaction.setType(Type);
    // do your thing...
    } catch (Exception e) {
    transaction.captureException(e);
    throw e;
    } finally {
    transaction.end();
    }
    }
    }

  2. Our application simply calls this class every 5 seconds passing name and type for the new custom transaction.

Can you help us finding what is missing in our code?