James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 1 | :title: Monitoring |
| 2 | |
| 3 | Monitoring |
| 4 | ========== |
Antoine Musso | a8eea7d | 2013-10-05 16:08:00 +0200 | [diff] [blame] | 5 | |
| 6 | Statsd reporting |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 7 | ---------------- |
Antoine Musso | a8eea7d | 2013-10-05 16:08:00 +0200 | [diff] [blame] | 8 | |
| 9 | Zuul comes with support for the statsd protocol, when enabled and configured |
Michael Prokop | 526926a | 2013-10-24 16:16:57 +0200 | [diff] [blame] | 10 | (see below), the Zuul scheduler will emit raw metrics to a statsd receiver |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 11 | which let you in turn generate nice graphics. |
Antoine Musso | a8eea7d | 2013-10-05 16:08:00 +0200 | [diff] [blame] | 12 | |
| 13 | Configuration |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 14 | ~~~~~~~~~~~~~ |
Antoine Musso | a8eea7d | 2013-10-05 16:08:00 +0200 | [diff] [blame] | 15 | |
| 16 | Statsd support uses the statsd python module. Note that Zuul will start without |
| 17 | the statsd python module, so an existing Zuul installation may be missing it. |
| 18 | |
Michael Prokop | 526926a | 2013-10-24 16:16:57 +0200 | [diff] [blame] | 19 | The configuration is done via environment variables STATSD_HOST and |
Antoine Musso | a8eea7d | 2013-10-05 16:08:00 +0200 | [diff] [blame] | 20 | STATSD_PORT. They are interpreted by the statsd module directly and there is no |
Michael Prokop | 526926a | 2013-10-24 16:16:57 +0200 | [diff] [blame] | 21 | such parameter in zuul.conf yet. Your init script will have to initialize both |
Paul Belanger | 174a827 | 2017-03-14 13:20:10 -0400 | [diff] [blame] | 22 | of them before executing Zuul. |
Antoine Musso | a8eea7d | 2013-10-05 16:08:00 +0200 | [diff] [blame] | 23 | |
| 24 | Your init script most probably loads a configuration file named |
| 25 | ``/etc/default/zuul`` which would contain the environment variables:: |
| 26 | |
| 27 | $ cat /etc/default/zuul |
| 28 | STATSD_HOST=10.0.0.1 |
| 29 | STATSD_PORT=8125 |
| 30 | |
| 31 | Metrics |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 32 | ~~~~~~~ |
Antoine Musso | a8eea7d | 2013-10-05 16:08:00 +0200 | [diff] [blame] | 33 | |
| 34 | The metrics are emitted by the Zuul scheduler (`zuul/scheduler.py`): |
| 35 | |
Bruno Tavares | f9af4cd | 2015-10-15 14:55:51 -0300 | [diff] [blame] | 36 | **gerrit.event.<type> (counters)** |
James E. Blair | eff5a9d | 2017-06-20 00:00:37 -0700 | [diff] [blame] | 37 | Gerrit emits different kind of message over its `stream-events` |
| 38 | interface. Zuul will report counters for each type of event it |
| 39 | receives from Gerrit. |
| 40 | |
| 41 | Some of the events emitted are: |
Antoine Musso | a8eea7d | 2013-10-05 16:08:00 +0200 | [diff] [blame] | 42 | |
| 43 | * patchset-created |
| 44 | * draft-published |
| 45 | * change-abandonned |
| 46 | * change-restored |
| 47 | * change-merged |
| 48 | * merge-failed |
| 49 | * comment-added |
| 50 | * ref-updated |
| 51 | * reviewer-added |
| 52 | |
| 53 | Refer to your Gerrit installation documentation for an exhaustive list of |
| 54 | Gerrit event types. |
| 55 | |
| 56 | **zuul.pipeline.** |
| 57 | Holds metrics specific to jobs. The hierarchy is: |
| 58 | |
| 59 | #. **<pipeline name>** as defined in your `layout.yaml` file (ex: `gate`, |
| 60 | `test`, `publish`). It contains: |
| 61 | |
| 62 | #. **all_jobs** counter of jobs triggered by the pipeline. |
| 63 | #. **current_changes** A gauge for the number of Gerrit changes being |
| 64 | processed by this pipeline. |
| 65 | #. **job** subtree detailing per jobs statistics: |
| 66 | |
| 67 | #. **<jobname>** The triggered job name. |
| 68 | #. **<build result>** Result as defined in your triggering system. For |
| 69 | Jenkins that would be SUCCESS, FAILURE, UNSTABLE, LOST. The |
Joshua Hesketh | e898716 | 2014-03-13 13:05:33 +1100 | [diff] [blame] | 70 | metrics holds both an increasing counter and a timing |
| 71 | reporting the duration of the build. Whenever the result is a |
| 72 | SUCCESS or FAILURE, Zuul will additionally report the duration |
| 73 | of the build as a timing event. |
Antoine Musso | a8eea7d | 2013-10-05 16:08:00 +0200 | [diff] [blame] | 74 | |
| 75 | #. **resident_time** timing representing how long the Change has been |
| 76 | known by Zuul (which includes build time and Zuul overhead). |
| 77 | #. **total_changes** counter of the number of change proceeding since |
| 78 | Zuul started. |
Bruno Tavares | f9af4cd | 2015-10-15 14:55:51 -0300 | [diff] [blame] | 79 | #. **wait_time** counter and timer of the wait time, with the difference |
Paul Belanger | 174a827 | 2017-03-14 13:20:10 -0400 | [diff] [blame] | 80 | of the job start time and the execute time, in milliseconds. |
Antoine Musso | a8eea7d | 2013-10-05 16:08:00 +0200 | [diff] [blame] | 81 | |
| 82 | Additionally, the `zuul.pipeline.<pipeline name>` hierarchy contains |
Bruno Tavares | f9af4cd | 2015-10-15 14:55:51 -0300 | [diff] [blame] | 83 | `current_changes` (gauge), `resident_time` (timing) and `total_changes` |
| 84 | (counter) metrics for each projects. The slash separator used in Gerrit name |
| 85 | being replaced by dots. |
Antoine Musso | a8eea7d | 2013-10-05 16:08:00 +0200 | [diff] [blame] | 86 | |
| 87 | As an example, given a job named `myjob` triggered by the `gate` pipeline |
| 88 | which took 40 seconds to build, the Zuul scheduler will emit the following |
| 89 | statsd events: |
| 90 | |
| 91 | * `zuul.pipeline.gate.job.myjob.SUCCESS` +1 |
| 92 | * `zuul.pipeline.gate.job.myjob` 40 seconds |
| 93 | * `zuul.pipeline.gate.all_jobs` +1 |