blob: 61b72bda6d18fb5bf444af1644a2f6767aaed7cb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
---
title: kamon | NewRelic Module | Documentation
layout: default
---
NewRelic Module
===
A simple module to report some application metrics like External Services, Errors and Apdex.
Configuration
---
**In order to see Kamon in action you just follow this Simple Example:**
**1)** All Kamon libraries are available through the official Kamon repository:
```scala
"Kamon Repository" at "http://repo.kamon.io"
```
**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"
"kamon" %% "kamon-newrelic" % "0.0.12"
```
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._
aspectjSettings
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 this content:
```scala
resolvers += "Kamon Releases" at "http://repo.kamon.io"
addSbtPlugin("com.ivantopo.sbt" %% "sbt-newrelic" % "0.0.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-aspectj" % "0.9.4")
```
**4)** Our Reactive Application:
```scala
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>
}
}
}
}
}
```
**5)** In addition, you have to provide some information about NewRelic configuration in the `application.conf`:
```scala
akka {
extensions = ["kamon.newrelic.NewRelic"]
}
kamon {
newrelic {
app-name = "KamonNewRelicExample[Development]"
license-key = <<Key>>
}
}
```
**6)** Add the [NewRelic](http://newrelic.com/) Agent:
```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)
**7)** To see how it works, you need to send a messages to the rest services
```bash
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/kamon-examples/) Kamon repository inside kamon-examples folder.
### Screenshot
![newrelic](/assets/img/newrelic.png "NewRelic Screenshot")
## Limitations
* The first implementation only supports a subset of NewRelic metrics
## Licensing
NewRelic has [its own, separate licensing](http://newrelic.com/terms).
|