diff options
Diffstat (limited to 'site/src')
-rw-r--r-- | site/src/jekyll/assets/img/newrelic.png | bin | 0 -> 131322 bytes | |||
-rw-r--r-- | site/src/jekyll/assets/img/newrelicdifu2.png | bin | 139178 -> 0 bytes | |||
-rw-r--r-- | site/src/jekyll/newrelic/index.md | 134 |
3 files changed, 67 insertions, 67 deletions
diff --git a/site/src/jekyll/assets/img/newrelic.png b/site/src/jekyll/assets/img/newrelic.png Binary files differnew file mode 100644 index 00000000..ea5e1ec7 --- /dev/null +++ b/site/src/jekyll/assets/img/newrelic.png diff --git a/site/src/jekyll/assets/img/newrelicdifu2.png b/site/src/jekyll/assets/img/newrelicdifu2.png Binary files differdeleted file mode 100644 index 82bcc87d..00000000 --- a/site/src/jekyll/assets/img/newrelicdifu2.png +++ /dev/null diff --git a/site/src/jekyll/newrelic/index.md b/site/src/jekyll/newrelic/index.md index 3ce6d29d..be182cc4 100644 --- a/site/src/jekyll/newrelic/index.md +++ b/site/src/jekyll/newrelic/index.md @@ -7,112 +7,112 @@ NewRelic Module === A simple module to report some application metrics like External Services, Errors and Apdex. ---- -Dependencies ---- - -Apart from scala library kamon depends on: - -- aspectj -- new relic agent -- spray-io -- akka-actor - - -Installation ---- -Kamon works with SBT, so you need to add Kamon.io repository to your resolvers. - Configuration --- -Just like other products in the scala ecosystem, it relies on the typesafe configuration library. If you are a new relic user, you will requiere to add a logger to the application.conf file - -Since kamon uses the same configuration technique as [Spray](http://spray.io/documentation "Spray") / [Akka](http://akka.io/docs "Akka") you might want to check out the [Akka-Documentation-configuration](http://doc.akka.io/docs/akka/2.1.4/general/configuration.html "Akka Documentation on configuration"). +**In order to see Kamon in action you just follow this Simple Example:** -In order to see Kamon in action you need first to set up your sbt project. Add the following sbt dependencies to your project settings: -1) Add Kamon repository to resolvers +1) All Kamon libraries are available through the official Kamon repository: ```scala - "Kamon Repository" at "http://repo.kamon.io" +"Kamon Repository" at "http://repo.kamon.io" ``` -2) Add libraryDepenency +2) Add the libraries to your project: + +```scala +resolvers += "Kamon Repository" at "http://repo.kamon.io" + +"kamon" %% "kamon-core" % "0.0.12" + +"kamon" %% "kamon-spray" % "0.0.12" -```scala - "kamon" %% "kamon-spray" % "0.0.11", - "kamon" %% "kamon-newrelic" % "0.0.11" +"kamon" %% "kamon-newrelic" % "0.0.12" ``` -In addition we suggest to create aspectj.sbt file and add this content +Also you need add this lines into the build.sbt in order to configure the [sbt-aspectj](https://github.com/sbt/sbt-aspectj/) plugin: ```scala - import com.typesafe.sbt.SbtAspectj._ +import com.typesafe.sbt.SbtAspectj._ - aspectjSettings +aspectjSettings - javaOptions <++= AspectjKeys.weaverOptions in Aspectj +javaOptions <++= AspectjKeys.weaverOptions in Aspectj ``` -3) Add to your plugins.sbt in project folder (if you don't have one yet, create the file) and add the Kamon release to the resolver and the aspecj. You need to add the sbt-newrelic plugin +3) Add to your `plugins.sbt` in project folder (if you don't have one yet, create the file) and add this content: ```scala - resolvers += Resolver.url("Kamon Releases", url("http://repo.kamon.io"))(Resolver.ivyStylePatterns) +resolvers += "Kamon Releases" at "http://repo.kamon.io" - addSbtPlugin("com.ivantopo.sbt" %% "sbt-newrelic" % "0.0.1") +addSbtPlugin("com.ivantopo.sbt" %% "sbt-newrelic" % "0.0.1") - addSbtPlugin("com.typesafe.sbt" % "sbt-aspectj" % "0.9.2") +addSbtPlugin("com.typesafe.sbt" % "sbt-aspectj" % "0.9.4") ``` -In addittion, you have to provide the new relic agent and configure a logger in application.conf file. - -**application.conf** +4) Our Reactive Application: ```scala - akka { - loggers = ["akka.event.slf4j.Slf4jLogger","kamon.newrelic.NewRelicErrorLogger"] - - extensions = ["kamon.newrelic.NewRelic"] - actor { - debug { - unhandled = on - } - } - } +import akka.actor.ActorSystem +import spray.routing.SimpleRoutingApp + +object NewRelicExample extends App with SimpleRoutingApp { + + implicit val system = ActorSystem("kamon-system") + + startServer(interface = "localhost", port = 8080) { + path("helloKamon") { + get { + complete { + <h1>Say hello to Kamon</h1> + } + } + } ~ + path("helloNewRelic") { + get { + complete { + <h1>Say hello to NewRelic</h1> + } + } + } + } +} ``` -Optionally you can add the newrelic agent in the command line + +5) In addition, you have to provide some information about NewRelic configuration in the **application.conf**: ```scala --javaagent:/path-to-newrelic-agent.jar, -Dnewrelic.environment=production, -Dnewrelic.config.file=/path-to-newrelic.yml +akka { + extensions = ["kamon.newrelic.NewRelic"] +} + +kamon { + newrelic { + app-name = "KamonNewRelicExample[Development]" + license-key = <<Key>> + } +} ``` +6) Add the [NewRelic](http://newrelic.com/) Agent: -Examples ---- - -The examples will start a spray server with akka, new relic and logback configuration. Adjust it to your needs in order to see the data in your new relic service. - -Follow the steps in order to clone the repository - -1. git clone git://github.com/kamon/kamon.git - -2. cd kamon - -run - -```bash - sbt "project kamon-new-relic-uow-example" +```scala +-javaagent:/path-to-newrelic-agent.jar -Dnewrelic.environment=production -Dnewrelic.config.file=/path-to-newrelic.yml ``` +In case you want to keep the NewRelic Agent related setting, take a look at [NewRelic](https://docs.newrelic.com/docs/java/new-relic-for-java) + -In order to see how it works, you need to send a message to the rest service +7) To see how it works, you need to send a messages to the rest services ```bash - curl -v --header 'X-UOW:YOUR_TRACER_ID' -X GET 'http://0.0.0.0:6666/fibonacci' +ab -k -n 2000 http://localhost:8080/helloNewRelic ``` +### Example +This and others examples are found in the [GitHub](https://github.com/kamon-io/Kamon/tree/master/examples/) Kamon repository inside examples folder. ### Screenshot -![newrelic](/assets/img/newrelicdifu2.png "Screenshot NewRelic") +![newrelic](/assets/img/newrelic.png "NewRelic Screenshot") ## Limitations |