|
| 1 | +System Metrics ](https://travis-ci.org/kamon-io/kamon-scala/builds) |
| 2 | +========================== |
| 3 | + |
| 4 | +[](https://gitter.im/kamon-io/Kamon?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) |
| 5 | + |
| 6 | +***kamon-system-metrics*** [](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 |
0 commit comments