@Traced does not work under Wildfly

Kibana version:
7.10.0
Elasticsearch version:
7.10.0
APM Server version:
7.10.0
APM Agent language and version:
Java/1.19.0
Browser version:

Original install method (e.g. download page, yum, deb, from source, etc.) and version:
Docker

Fresh install or upgraded from other version?
Fresh

Is there anything special in your setup?
No

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):

I'm not able to use @Traced in my Wildfly 19 app. Ok, not exactly mine - it's a sample app from Wildfly - https://github.com/wildfly/quickstart/tree/master/ejb-in-war just added @Traced here and there (https://github.com/wildfly/quickstart/blob/master/ejb-in-war/src/main/java/org/jboss/as/quickstarts/ejbinwar/ejb/GreeterEJB.java sayHello method, to be exact).
I can see JSF traces in Kibana (splitted into JSF execute and JSF Render phase) which is fine but I don't see sayHello span, that I expected to see.

I'm able to create a span manually in the very same place which works absolutely fine but I would love to use @Traced instead.

Steps to reproduce:

  1. clone https://github.com/wildfly/quickstart/tree/master/ejb-in-war
  2. add @Traced annotation to GreeterEJB.sayHello
  3. mvn package and deploy to WF 19

My WF JAVA_OPTS:

export JAVA_OPTS="$JAVA_OPTS -javaagent:elastic-apm-agent-1.19.0.jar"
export JAVA_OPTS="$JAVA_OPTS -Delastic.apm.service_name=my-cool-service"
export JAVA_OPTS="$JAVA_OPTS -Delastic.apm.application_packages=org.jboss.as.quickstarts.ejbinwar"
export JAVA_OPTS="$JAVA_OPTS -Delastic.apm.server_urls=http://localhost:8200"

Hm, that's strange. Config looks ok at a first glance. Could you share your full debug logs from the startup until after the first invocation?

Hi,
WF startup logs and Elastic debug:

I just tried it out in a standalone application to be sure and it works for me in version 1.19.0.

Can you make sure that you're indeed using the co.elastic.apm.api.Traced annotation and that the apm-agent-api module is available on the classpath? Does the @CaptureSpan annotation work for you?

Hi,
@Traced in standalone app works for me too.

As for Wildfly - I do confirm that I use co.elastic.apm.api.Traced. Also tried @CaptureSpan and @CaptureTransaction unfortunately with no luck. Apm-agent-api is part of ear (manual span creation works fine).
Also tried to add a Wildfly's global module (http://docs.wildfly.org/19/Developer_Guide.html#global-modules) that would include apm-agent-api, to be sure that Traced is accessible, still no luck.

Hi there,
good news, or just a news - I made it work by changing package from org.jboss.as.quickstarts to org.jboss.asas.quickstarts. Is there something wrong with 'org.jboss.as' being part of a package name? Is it anyhow protected by WF?

2 Likes

Ah, right.. We're not instrumenting org.jboss.as by default to shave off a few seconds of overhead on startup.

See also

2 Likes

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.