AppD Archive

How to integrate PlayFramework with AppDynamics

CommunityUser
Splunk Employee
Splunk Employee

I didn't see how AppDynamics can be used with play framework applications.

1 Solution

Arun_Dasetty
Super Champion

Hi ,

Adding to Sid comments, Please find the steps to integrate java play framework with AD agent capture from internal docs:

To configure Java Play framework, add javaagent in the start-up script as follows:

java -Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -javaagent:"<$AppServerAgent-Install>/javaagent.jar" -jar "%~dp0sbt\sbt-launch.jar" %*

As per our understanding, most of the requests received by a Play application are handled by an Action. An action is basically a Java method that processes the request parameters, and produces a result to be sent to the client.

In this scenario, need to configure POJO rules to identify the Business Transactions further. Following is the sample to demonstrate the same: 

image.png

Once you have configured the POJO rule as mentioned above and access the application (especially pages that invokes ActionInvoker class), you can able to see the Business Transactions in the Dash Board.

 

Let us know that clarifies the steps to intergreate playframework with AD agent.

 

Regards,

Arun

View solution in original post

0 Karma

Arun_Dasetty
Super Champion

Hi ,

Adding to Sid comments, Please find the steps to integrate java play framework with AD agent capture from internal docs:

To configure Java Play framework, add javaagent in the start-up script as follows:

java -Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -javaagent:"<$AppServerAgent-Install>/javaagent.jar" -jar "%~dp0sbt\sbt-launch.jar" %*

As per our understanding, most of the requests received by a Play application are handled by an Action. An action is basically a Java method that processes the request parameters, and produces a result to be sent to the client.

In this scenario, need to configure POJO rules to identify the Business Transactions further. Following is the sample to demonstrate the same: 

image.png

Once you have configured the POJO rule as mentioned above and access the application (especially pages that invokes ActionInvoker class), you can able to see the Business Transactions in the Dash Board.

 

Let us know that clarifies the steps to intergreate playframework with AD agent.

 

Regards,

Arun

0 Karma

CommunityUser
Splunk Employee
Splunk Employee

Hello, I tried exactly what you said and it didn't work, so I tried being more generic: http://awesomescreenshot.com/0793l2nr95 and it would still not detect anything, I'm running play 1.2.5.3 and the api doesn't mention any "apply" method: https://www.playframework.com/documentation/1.2.5/api/play/mvc/ActionInvoker.html

0 Karma

Arun_Dasetty
Super Champion

Hi,

We see you are using option (equals) from provided screenshot, Can you update rule as follows:

Class (Contains): ActionInvoker

Method (Matches Regex):  .* 

(read as dot followed by * symbol, this matches all methods on api contains class name as ActionInvoker from any package)

Generate load and see how it goes. If issue persists please send the agent logs.

Regards,

Arun

CommunityUser
Splunk Employee
Splunk Employee

Thanks a lot, I did what you said and it worked then I fine tuned it:

http://awesomescreenshot.com/0983mhqe7d

class name equals: play.mvc.ActionInvoker

method name equals: invoke

Then on "Transaction Splitting" I configured it as:

http://awesomescreenshot.com/02f3mhqk5a

"Use a method parameter to name transactions"

"Parameter Index" : 0, "Get chain to run on method parameter": action

This way it separates the business transactions nicely (at least in my case)

0 Karma

CommunityUser
Splunk Employee
Splunk Employee

Hi

I have the following setting in my startup script for play

exec su -s /bin/bash -c 'exec "$0" "$@"' onpadm -- \
/usr/bin/java $* -cp "$APP_DIR/*" \
-Xms2048m -Xmx2048m \
-XX:PermSize=64M -XX:MaxPermSize=256m \
-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=50000 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Dconfig.file=/opt/front/conf/env.conf \
-Dlogger.file=/opt/front/conf/logger.xml \
-javaagent:/home/faridsha/AppdynamicsSaas/javaagent.jar \
play.core.server.NettyServer $APP_DIR \
&> /opt/front/logs/out.log

but when I try to start the application it fails and says this

Error opening zip file or JAR manifest missing : /home/faridsha/AppdynamicsSaas/javaagent.jar
Error occurred during initialization of VM
agent library failed to init: instrument

what could be wrong?

0 Karma

Arun_Dasetty
Super Champion

Hi,

Can you please check the following:

- user running the server/jvm have executable permissions to /home/faridsha/AppdynamicsSaas/ and its sub folders

- Does the AppServerAgent.zip is downloaded fine , does the file corrupted can you check the integrity using mdfsum with the value at download.appdynamics.com 

- check whether javaagent.jar exists at path /home/faridsha/AppdynamicsSaas/ 

- Try surrounding agent entry with quotes and see how it goes

Keep us posted how it goes.

Regards,

Arun

0 Karma

CommunityUser
Splunk Employee
Splunk Employee
Hi

folder has full write permissions and even owned by user running that application

[faridsha@411834-qui-1 ~]$ ls -lag /home/faridsha/
total 46836
drwx------ ? 6 faridsha ? ? 4096 Aug 19 22:09 .
drwxr-xr-x. 15 root ? ? ? ? 4096 Apr ?9 15:24 ..
drwxrwxrwx ? 6 onpadm ? ? ? 4096 Aug 19 23:02 AppdynamicsSaas



0 Karma

Arun_Dasetty
Super Champion

Hi,

Please send the output for "ll" command under path /home/faridsha/AppdynamicsSaas , also did you check the agent intergrity using md5sum check?

Can you check whether agent starting fine using simple java class as follows:

shell> java -javaagent:"/home/faridsha/AppdynamicsSaas/javaagent.jar" MyTest 

Regards,

Arun

0 Karma

CommunityUser
Splunk Employee
Splunk Employee

Hi

I managed to make it work eventually. I guess it was matter of permissions. i moved agent to different folder and allowed all permissions and then it is working.

How does Appdynamics show response times because response times from my load test tool is much higher than what Appdynamics is showing.

br,

Farid

0 Karma

CommunityUser
Splunk Employee
Splunk Employee

Also I cannot seem drill down much in individual requests to have more insight into individual methods.

0 Karma

Arun_Dasetty
Super Champion

Hi Farid,

Please find our response to your queries:

- Unlike test tool, Response time shown in AD for particular includes the time spent from the entry point (Servlet, Struts , WS etc) , if both the originating API from which BT is monitored in BT grid and test tool are same then the response times should match if that is the case here. Hope that clarifies product behavior

- Call graph might  not show APIs take less than 10 ms and also by default UI excluded few third party packages  to be excluded in call graph view, check if this is the case here

Regards,

Arun

0 Karma

CommunityUser
Splunk Employee
Splunk Employee

Have moved your post to the more relevant "Lite for Java" board.

Our Java Agent has built-in support to work with other JVM languages & the associated frameworks incl. Play

See here: http://docs.appdynamics.com/display/PRO14S/Supported+Environments+and+Versions+for+Java

Let us know if you have more questions.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...