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

Collecting Information about Deployment Units for Servlets/EJBs in Java EE Environments

brunnert
Inactive

Hi,

is there any chance to get the deployment unit (WAR/EAR/JAR) of a Servlet/EJB as part of a purepath? Within a running Java EE application you can usually get it using JNDI calls such as:

final InitialContext initialContext = new InitialContext();
APP_NAME = (String) initialContext.lookup("java:app/AppName");
MODULE_NAME = (String) initialContext.lookup("java:module/ModuleName");

Is there any default Sensor available that can collect this information? Or is it possible to develop a custom sensor to associate this information with a purepath of a transaction?

Thanks in advance!

Andreas

 

4 REPLIES 4

wolfgang_gottes
Dynatrace Helper
Dynatrace Helper

Hi,

After checking with our R&D team the answer is that we show the application ID for web apps as part of the PurePath details (or, for example, in the web request dashlet and also as an available measure for business transactions). For other metadata, you'd need to call some dummy method to pass in the values you want to record as string parameters - however I would be a bit reluctant to do that on every request, as creating the initial content also takes some ms.

Hope that helps,
-Wolfgang

brunnert
Inactive

Hi Wolfgang,

Thanks for your feedback! I saw the application ID parameter for web applications in the pure path details but I am not quite sure where this value comes from - is it the value specified in the application.xml file of an EAR?:

Or is it the displayname specified in the web.xml (e.g., if a web application is not packaged in an EAR)?:

<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd" version=?2.5?>

<display-name>A Web Application</display-name>

If dynatrace uses the web.xml data we just need a solution for EJBs and I think that using an EJBInterceptor that sets this information as string parameters for every request might be work around for now. However, I think if you are using the application ID from an EAR you might be able to specify it in the pure path details for EJB invocations as well.

 

Cheers,

Andreas

 

sandeep_palava2
Newcomer

Hi Andreas,

Even i have the same question, were you able to figure out, where this Web Application ID comes from?

-Sandeep.

 

 

brunnert
Inactive

Hi Sandeep,

we did a test with a simple web application and the web application id seems to come from the display-name element in the web.xml (in this case SpecjInsuranceJSF):

We also found that on the top-level of a purepath there is an application attribute - that seems to denote the application id of an EAR file:

However, the semantics of this top level element are unclear to me as a purepath might span multiple tiers and the application id might change for each tier. I would have expected this attribute to be more local to the actual classes/methods instrumented by dynatrace. Maybe someone from dynatrace could shed some light on this.

 

Cheers,

Andreas