Play Server Performance Testing
Set up gradle sub project
ADD
dd-java-agent/benchmark-integration/play-perftest/app/controllers/HomeController.scala
+package controllers
+
+import javax.inject._
+import play.api._
+import play.api.mvc._
+
+/**
+ * This controller creates an `Action` to handle HTTP requests to the
+ * application's home page.
+ */
+@Singleton
+class HomeController @Inject()(cc: ControllerComponents) extends AbstractController(cc) {
+
+ /**
+ * Create an Action to render an HTML page.
+ *
+ * The configuration in the `routes` file means that this method
+ * will be called when the application receives a `GET` request with
+ * a path of `/`.
+ */
+ def index() = Action { implicit request: Request[AnyContent] =>
+ Ok("SUCCESS")
+ }
+}

ADD
dd-java-agent/benchmark-integration/play-perftest/conf/application.conf
+# https://www.playframework.com/documentation/latest/Configuration
+play.http.secret.key=datadogbenchmarktest0xDEADBEEF
+http.port=8080

ADD
dd-java-agent/benchmark-integration/play-perftest/conf/logback.xml
+<!-- https://www.playframework.com/documentation/latest/SettingsLogger -->
+<configuration>
+
+ <conversionRule conversionWord="coloredLevel" converterClass="play.api.libs.logback.ColoredLevel"/>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%coloredLevel %logger{15} - %message%n%xException{10}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="ASYNCSTDOUT" class="ch.qos.logback.classic.AsyncAppender">
+ <appender-ref ref="STDOUT"/>
+ </appender>
+
+ <logger name="play" level="INFO"/>
+ <logger name="application" level="DEBUG"/>
+
+ <!-- Off these ones as they are annoying, and anyway we manage configuration ourselves -->
+ <logger name="com.avaje.ebean.config.PropertyMapLoader" level="OFF"/>
+ <logger name="com.avaje.ebeaninternal.server.core.XmlConfigLoader" level="OFF"/>
+ <logger name="com.avaje.ebeaninternal.server.lib.BackgroundThread" level="OFF"/>
+ <logger name="com.gargoylesoftware.htmlunit.javascript" level="OFF"/>
+
+ <root level="WARN">
+ <appender-ref ref="ASYNCSTDOUT"/>
+ </root>
+
+</configuration>

ADD
dd-java-agent/benchmark-integration/play-perftest/conf/messages
+# https://www.playframework.com/documentation/latest/ScalaI18N

ADD
dd-java-agent/benchmark-integration/play-perftest/conf/routes
+# Routes
+# This file defines all application routes (Higher priority routes first)
+# https://www.playframework.com/documentation/latest/ScalaRouting
+# ~~~~
+
+# An example controller showing a sample home page
+GET / controllers.HomeController.index

ADD
dd-java-agent/benchmark-integration/play-perftest/play-perftest.gradle
+plugins {
+ id 'play'
+ // id 'idea'
+}
+
+def playVersion = "2.6.20"
+def scalaVersion = System.getProperty("scala.binary.version", /* default = */ "2.12")
+
+model {
+ components {
+ play {
+ platform play: playVersion, scala: scalaVersion, java: '1.8'
+ injectedRoutesGenerator = true
+//
+// sources {
+// scala {
+// source.srcDir "play-perftest-server/app"
+// }
+// routes {
+// source.srcDir "play-perftest-server/conf"
+// }
+// }
+
+
+ }
+ }
+}
+//dist {
+// into(project.name) {
+// from 'play-perftest-server'
+// include 'conf/*'
+// }
+//}
+// EXAMPLE: How to add parameter to Scala compiler
+// Another option is documented here:
+// https://docs.gradle.org/current/userguide/play_plugin.html#sec:configuring_compiler_options
+//
+// See other configurations for ScalaCompile task here:
+// https://docs.gradle.org/current/dsl/org.gradle.api.tasks.scala.ScalaCompile.html
+//
+// tasks.withType(ScalaCompile) {
+// scalaCompileOptions.additionalParameters = [
+// "-deprecation",
+// "-verbose"
+// ]
+// }
+
+// EXAMPLE: How to add JVM parameters when running `runPlayBinary`.
+// See other configurations for PlayRun here:
+// https://docs.gradle.org/current/dsl/org.gradle.play.tasks.PlayRun.html
+//
+// tasks.withType(PlayRun) {
+// forkOptions.jvmArgs = ['-Dplay.http.secret.key=yadayada']
+// }
+
+// EXAMPLE: How to add JVM parameters to the script created by `stage`.
+// See more details here:
+// https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/application/CreateStartScripts.html
+//
+//tasks.withType(CreateStartScripts) {
+// defaultJvmOpts = ['-Dplay.http.secret.key=yadayada', '-Dhttp.port=8080']
+//}
+
+dependencies {
+ play "com.typesafe.play:play-guice_$scalaVersion:$playVersion"
+ play "com.typesafe.play:play-logback_$scalaVersion:$playVersion"
+ play "com.typesafe.play:filters-helpers_$scalaVersion:$playVersion"
+
+// playTest "org.scalatestplus.play:scalatestplus-play_$scalaVersion:3.1.2"
+}
+
+repositories {
+ jcenter()
+ maven {
+ name "lightbend-maven-releases"
+ url "https://repo.lightbend.com/lightbend/maven-release"
+ }
+ ivy {
+ name "lightbend-ivy-release"
+ url "https://repo.lightbend.com/lightbend/ivy-releases"
+ layout "ivy"
+ }
+}

MODIFY
settings.gradle
settings.gradle
@@ -73,6 +73,7 @@ include ':dd-java-agent:instrumentation:vertx'
include ':dd-java-agent:benchmark'
include ':dd-java-agent:benchmark-integration'
include ':dd-java-agent:benchmark-integration:jetty-perftest'
+include ':dd-java-agent:benchmark-integration:play-perftest'
def setBuildFile(project) {
project.buildFileName = "${project.name}.gradle"

Play Server Performance Testing

Set up gradle sub project