Skip to content
This repository was archived by the owner on Mar 29, 2020. It is now read-only.

Commit f93e890

Browse files
committed
system metrics moved
1 parent e10d39f commit f93e890

34 files changed

+693
-0
lines changed

.gitignore

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
*.class
2+
*.log
3+
.history
4+
*.sc
5+
.pygments-cache
6+
.DS_Store
7+
8+
# sbt specific
9+
dist/*
10+
target/
11+
lib_managed/
12+
src_managed/
13+
project/boot/
14+
project/plugins/project/
15+
.ensime
16+
.ensime_cache
17+
18+
# Scala-IDE specific
19+
.scala_dependencies
20+
.idea
21+
.idea_modules
22+
23+
# Intellij
24+
.idea/
25+
*.iml
26+
*.iws
27+
28+
# Eclipse
29+
.project
30+
.settings
31+
.classpath
32+
.cache
33+
.cache-main
34+
.cache-tests
35+
bin/
36+
37+
_site
38+
39+
# Ignore Play! working directory #
40+
db
41+
eclipse
42+
lib
43+
log
44+
logs
45+
modules
46+
precompiled
47+
project/project
48+
project/target
49+
target
50+
tmp
51+
test-result
52+
server.pid
53+
*.iml
54+
*.eml
55+
56+
# Default sigar library provision location.
57+
native/

.travis.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: scala
2+
script:
3+
- ./travis-test.sh
4+
scala:
5+
- 2.11.8
6+
jdk:
7+
- oraclejdk8
8+
before_script:
9+
- mkdir $TRAVIS_BUILD_DIR/tmp
10+
- export SBT_OPTS="-Djava.io.tmpdir=$TRAVIS_BUILD_DIR/tmp"
11+
sudo: false
12+

CONTRIBUTING.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Contributing to Kamon
2+
=====================
3+
4+
Thanks for your intention on collaborating to the Kamon Project! It doesn't matter if you want to provide a small change
5+
to our docs, are lost in configuration or want contribute a brand new feature, we value all of your contributions and
6+
the time you take to use our tool and prepare a contribution, we only ask you to follow this guidance depending on your
7+
situation:
8+
9+
If you are experiencing a bug
10+
-----------------------------
11+
12+
If you see weird exceptions in your log or something definitely is working improperly please [open an issue] and include
13+
the Kamon, Akka and Spray/Play! versions that you are using along with as many useful information you can find related
14+
to the issue. If you can provide a gist or a short way to reproduce the issue we will be more than happy!
15+
16+
If you don't know what is wrong
17+
-------------------------------
18+
19+
If you don't see any metrics at all or features are not working maybe you have a setup or configuration problem, to
20+
address this kind of problems please send us a emails to our [mailing list] and we will reply as soon as we can! Again,
21+
please include the relevant version and current setup information to speed up the process. If you are in doubt of
22+
whether you have a bug or a configuration problem, email us and we will take care of openning a issue if necessary.
23+
24+
If you want to make a code contribution to the project
25+
------------------------------------------------------
26+
27+
Awesome! First, please note that we try to follow the [commit message conventions] used by the Spray guys and we need
28+
you to electronically fill our [CLA] before accepting your contribution. Also, if your PR contains various commits,
29+
please squash them into a single commit. Let the PR rain begin!
30+
31+
32+
[open an issue]: https://github.com/kamon-io/Kamon/issues/new
33+
[mailing list]: https://groups.google.com/forum/#!forum/kamon-user
34+
[commit message conventions]: http://spray.io/project-info/contributing/
35+
[CLA]: https://docs.google.com/forms/d/1G_IDrBTFzOMwHvhxfKRBwNtpRelSa_MZ6jecH8lpTlc/viewform

LICENSE

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
This software is licensed under the Apache 2 license, quoted below.
2+
3+
Copyright © 2013-2014 the kamon project <http://kamon.io>
4+
5+
Licensed under the Apache License, Version 2.0 (the "License"); you may not
6+
use this file except in compliance with the License. You may obtain a copy of
7+
the License at
8+
9+
[http://www.apache.org/licenses/LICENSE-2.0]
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
License for the specific language governing permissions and limitations under
15+
the License.

README.md

+141
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
System Metrics ![Build Status](https://api.travis-ci.org/kamon-io/kamon-system-metrics)](https://travis-ci.org/kamon-io/kamon-scala/builds)
2+
==========================
3+
4+
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/kamon-io/Kamon?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5+
6+
***kamon-system-metrics*** [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.kamon/kamon-system-metrics_2.11/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.kamon/kamon-system-metrics.11)
7+
8+
Our `kamon-system-metrics` module registers a number of entities with the metrics module that track the performance
9+
indicators of both the host machine and the JVM where your application is running.
10+
11+
This module doesn't have any bytecode instrumentation requirement, and its only requirement to work properly is that
12+
the appropriate [Sigar] native library is correctly loaded. To do so, the `kamon-system-metrics` module makes use of the
13+
[sigar-loader] library. If your application uses Sigar for other purposes, it is advisable that you take a look at
14+
[sigar-loader] to simplify the sigar native library provisioning process.
15+
16+
As you might expect, you and any other module can subscribe to all the metrics that are reported by this module using
17+
the `system-metric` category and the entity recorder names described bellow.
18+
19+
By default the `kamon-system-metrics` module starts with Host and JVM metrics enabled, in the case that you want to **enable/disable** one of them, you can configure it this way:
20+
21+
```typesafeconfig
22+
kamon {
23+
system-metrics {
24+
#sigar is enabled by default
25+
sigar-enabled = true
26+
27+
#jmx related metrics are enabled by default
28+
jmx-enabled = true
29+
}
30+
}
31+
```
32+
Host System Metrics
33+
-------------------
34+
35+
We are using [Sigar] to gather all the host system metrics information and this requires us to have a few special
36+
considerations given that [Sigar] instances are not thread-safe and some metrics (like cpu usage metrics) do not work
37+
correctly when updated in intervals of less than a second. In the sections below, you will see histograms tracking
38+
metrics that typically should be recorded with a gauge, but that we couldn't allow because of the need to have a tight
39+
control on timings and thread-safety.
40+
41+
In the case that <b>Sigar</b> can't obtain some metric in the host, we will log a warning indicating the error and the metric name.
42+
43+
### cpu ###
44+
* __user__: a histogram tracking total percentage of system cpu user time.
45+
* __system__: a histogram tracking total percentage of system cpu kernel time.
46+
* __wait__: a histogram tracking total percentage of system cpu io wait time.
47+
* __idle__: a histogram tracking total percentage of system cpu idle time
48+
* __stolen__: a histogram tracking total percentage of system cpu involuntary wait time.
49+
50+
51+
### file-system ###
52+
* __readBytes__: a histogram tracking total number of physical disk reads in bytes.
53+
* __writesBytes__: a histogram tracking total number of physical disk writes in bytes.
54+
55+
56+
### load-average ###
57+
* __one-minute__: a histogram tracking the system load average for the last minute.
58+
* __five-minutes__: a histogram tracking the system load average for the five minutes.
59+
* __fifteen-minutes__: a histogram tracking the system load average for the fifteen minutes.
60+
61+
62+
### memory ###
63+
* __memory-used__: a histogram tracking total used system memory in bytes.
64+
* __memory-cache-and-buffer__: a histogram tracking total memory used in cache and buffers memory in bytes.
65+
* __memory-free__: a histogram tracking total free system memory in bytes.
66+
* __memory-total__: a histogram tracking total system memory capacity in bytes.
67+
* __swap-used__: a histogram tracking total used system swap in bytes.
68+
* __swap-free__: a histogram tracking total used system swap in bytes.
69+
70+
71+
### network ###
72+
73+
All network metrics represent the aggregate of all interfaces available in the host.
74+
75+
* __rx-bytes__: a histogram tracking total number of received packets in bytes.
76+
* __tx-bytes__: a histogram tracking total number of transmitted packets in bytes.
77+
* __rx-errors__: a histogram tracking total number of packets received with errors. This includes too-long-frames errors, ring-buffer overflow errors, etc.
78+
* __tx-errors__: a histogram tracking total number of errors encountered while transmitting packets. This list includes errors due to the transmission being aborted, errors due to the carrier, etc.
79+
* __rx-dropped__: a histogram tracking total number of incoming packets dropped.
80+
* __tx-dropped__: a histogram tracking total number of outgoing packets dropped.
81+
82+
83+
### process-cpu ###
84+
* __process-user-cpu__: a histogram tracking the total percentage of CPU spent by the application process in user space, relative to the overall CPU usage.
85+
* __process-system-cpu__: a histogram tracking the total percentage of CPU spent by the application process in system space, relative to the overall CPU usage.
86+
* __process-cpu__: a histogram tracking the total percentage of CPU spent by the application, relative to the overall CPU usage.
87+
88+
89+
### context-switches ###
90+
91+
The context switches metrics are special in the sense that they are not read using the [Sigar] library but rather reading
92+
the information available in the `/proc/$pid/status` file for Linux systems.
93+
94+
* __context-switches-process-voluntary__: Total number of voluntary context switches related to the current process (one
95+
thread explicitly yield the CPU to another).
96+
* __context-switches-process-non-voluntary__: Total number of involuntary context switches related to the current process
97+
(the system scheduler suspends an active thread, and switches control to a different thread).
98+
* __context-switches-global__: Total number of context switches across all CPUs.
99+
100+
JVM Metrics
101+
-----------
102+
103+
All JVM-specific metrics are gathered using JMX and all of them are using gauges to record the data. The reported JVM
104+
metrics include:
105+
106+
107+
### \*-garbage-collector ###
108+
109+
Depending on your specific instance configuration, the available garbage collectors will differ, but the same set of
110+
metrics are recorded regardless of the collector in place.
111+
112+
* __garbage-collection-count__: a gauge tracking the number of garbage collections that have ocurred.
113+
* __garbage-collection-time__: a gauge tracking the time spent in garbage collections, measured in milliseconds.
114+
115+
116+
### class-loading ###
117+
* __classes-loaded__: a gauge tracking the number of classes ever loaded by the application.
118+
* __classes-unloaded__: a gauge tracking the number of classes ever unloaded by the application.
119+
* __classes-currently-loaded__: a gauge tracking the number of classes currently loaded by the application.
120+
121+
122+
### heap-memory ###
123+
* __heap-used__: a gauge tracking the amount of heap memory currently being used in bytes.
124+
* __heap-max__: a gauge tracking the maximum amount of heap memory that can be used in bytes.
125+
* __heap-committed__: a gauge tracking the amount of memory that is committed for the JVM to use in bytes.
126+
127+
128+
### non-heap-memory ###
129+
* __non-heap-used__: a gauge tracking the amount of non-heap memory currently being used in bytes.
130+
* __non-heap-max__: a gauge tracking the maximum amount of non-heap memory that can be used in bytes.
131+
* __non-heap-committed__: a gauge tracking the amount of non-heap memory that is committed for the JVM to use in bytes.
132+
133+
134+
### threads ###
135+
* __daemon-thread-count__: a gauge tracking the total number of daemon threads running in the JVM.
136+
* __peak-thread-count__: a gauge tracking the peak number of threads running in the JVM since it started.
137+
* __thread-count__: a gauge tracking the total number of live threads in the JVM, including both daemon and non-daemon threads.
138+
139+
140+
[Sigar]: https://github.com/hyperic/sigar
141+
[sigar-loader]: https://github.com/kamon-io/sigar-loader

build.sbt

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* =========================================================================================
2+
* Copyright © 2013-2016 the kamon project <http://kamon.io/>
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
5+
* except in compliance with the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the
10+
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
11+
* either express or implied. See the License for the specific language governing permissions
12+
* and limitations under the License.
13+
* =========================================================================================
14+
*/
15+
16+
17+
import Settings._
18+
import Dependencies._
19+
20+
lazy val root = (project in file("."))
21+
.settings(name := "kamon-system-metrics")
22+
.settings(basicSettings: _*)
23+
.settings(formatSettings: _*)
24+
.settings(
25+
libraryDependencies ++=
26+
compileScope(kamonCore, sigarLoader) ++
27+
testScope(scalatest, akkaTestKit, akkaSlf4j, logback, slf4jJul))

project/Dependencies.scala

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/* =========================================================================================
2+
* Copyright © 2013-2016 the kamon project <http://kamon.io/>
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
5+
* except in compliance with the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the
10+
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
11+
* either express or implied. See the License for the specific language governing permissions
12+
* and limitations under the License.
13+
* =========================================================================================
14+
*/
15+
16+
import sbt._
17+
18+
object Dependencies {
19+
20+
val resolutionRepos = Seq(
21+
"typesafe repo" at "http://repo.typesafe.com/typesafe/releases/",
22+
"Kamon Repository Snapshots" at "http://snapshots.kamon.io"
23+
)
24+
25+
val kamonVersion = "0.6.3"
26+
val aspectjVersion = "1.8.9"
27+
val akkaVersion = "2.3.14"
28+
val slf4jVersion = "1.7.7"
29+
30+
val kamonCore = "io.kamon" %% "kamon-core" % kamonVersion
31+
val kamonTestkit = "io.kamon" %% "kamon-testkit" % kamonVersion
32+
33+
val akkaSlf4j = "com.typesafe.akka" %% "akka-slf4j" % akkaVersion
34+
val akkaTestKit = "com.typesafe.akka" %% "akka-testkit" % akkaVersion
35+
36+
val sigarLoader = "io.kamon" % "sigar-loader" % "1.6.5-rev002"
37+
38+
val scalatest = "org.scalatest" %% "scalatest" % "2.2.4"
39+
val logback = "ch.qos.logback" % "logback-classic" % "1.0.13"
40+
41+
val slf4jJul = "org.slf4j" % "jul-to-slf4j" % slf4jVersion
42+
43+
def compileScope (deps: ModuleID*): Seq[ModuleID] = deps map (_ % "compile")
44+
def testScope (deps: ModuleID*): Seq[ModuleID] = deps map (_ % "test")
45+
}

project/Publish.scala

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/* =========================================================================================
2+
* Copyright © 2013-2014 the kamon project <http://kamon.io/>
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
5+
* except in compliance with the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the
10+
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
11+
* either express or implied. See the License for the specific language governing permissions
12+
* and limitations under the License.
13+
* =========================================================================================
14+
*/
15+
16+
import sbt._
17+
import sbt.Keys._
18+
19+
object Publish {
20+
21+
lazy val settings = Seq(
22+
crossPaths := true,
23+
pomExtra := kamonPomExtra,
24+
publishTo := kamonRepo,
25+
organization := "io.kamon",
26+
pomIncludeRepository := { x => false },
27+
publishMavenStyle := true,
28+
publishArtifact in Test := false
29+
)
30+
31+
def kamonRepo = Some(Resolver.sftp("Kamon Snapshots Repository", "snapshots.kamon.io", "/var/local/snapshots-repo"))
32+
33+
def kamonPomExtra = {
34+
<url>http://kamon.io</url>
35+
<licenses>
36+
<license>
37+
<name>Apache 2</name>
38+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
39+
</license>
40+
</licenses>
41+
<scm>
42+
<url>git://github.com/kamon-io/Kamon.git</url>
43+
<connection>scm:git:git@github.com:kamon-io/Kamon.git</connection>
44+
</scm>
45+
<developers>
46+
<developer><id>ivantopo</id><name>Ivan Topolnjak</name><url>https://twitter.com/ivantopo</url></developer>
47+
<developer><id>dpsoft</id><name>Diego Parra</name><url>https://twitter.com/diegolparra</url></developer>
48+
</developers>
49+
}
50+
}

0 commit comments

Comments
 (0)