4
0

prometheus.adoc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. [#prometheus]
  2. = Prometheus
  3. OliveTin supports basic Prometheus metrics, and the project is interested to hear about what more metrics people would find useful, as well!
  4. To enable Prometheus support;
  5. .`config.yaml`
  6. [source,yaml]
  7. ----
  8. logLevel: INFO
  9. prometheus:
  10. enabled: true
  11. defaultGoMetrics: false
  12. ----
  13. It is required to restart OliveTin after changing the `prometheus` configuration.
  14. The `defaultGoMetrics` option will enable the default Go metrics, which expose metrics like go_memstats_alloc_bytes, or go_memstats_heap_alloc_bytes,
  15. and generally most people don't need these.
  16. This will give you metrics available at http://yourserver:1337/metrics. The page should look something like this;
  17. [source]
  18. ----
  19. # HELP olivetin_actions_requested_count The actions requested count
  20. # TYPE olivetin_actions_requested_count counter
  21. olivetin_actions_requested_count 0
  22. # HELP olivetin_action_executions_total Total number of finished action executions grouped by result.
  23. # TYPE olivetin_action_executions_total counter
  24. olivetin_action_executions_total{result="success"} 0
  25. olivetin_action_executions_total{result="failed"} 0
  26. olivetin_action_executions_total{result="blocked"} 0
  27. olivetin_action_executions_total{result="timeout"} 0
  28. olivetin_action_executions_total{result="error"} 0
  29. # HELP olivetin_action_execution_duration_seconds Action execution duration in seconds from start to finish.
  30. # TYPE olivetin_action_execution_duration_seconds histogram
  31. olivetin_action_execution_duration_seconds_bucket{le="0.1"} 0
  32. # HELP olivetin_config_action_count Then number of actions in the config file
  33. # TYPE olivetin_config_action_count gauge
  34. olivetin_config_action_count 18
  35. # HELP olivetin_config_reloaded_count The number of times the config has been reloaded
  36. # TYPE olivetin_config_reloaded_count counter
  37. olivetin_config_reloaded_count 1
  38. ----
  39. === Failed job monitoring
  40. Finished action executions are counted in `olivetin_action_executions_total` with a `result` label:
  41. [cols="1,2"]
  42. |===
  43. | `success` | Command finished with exit code 0
  44. | `failed` | Command ran but exited with a non-zero code
  45. | `timeout` | Command exceeded its configured timeout
  46. | `blocked` | Execution was blocked (ACL, rate limit, concurrency, or queue limit)
  47. | `error` | Execution failed before the command ran (for example, invalid arguments)
  48. |===
  49. `olivetin_action_execution_duration_seconds` records how long each finished execution took.
  50. Example Prometheus alert rules:
  51. [source,yaml]
  52. ----
  53. groups:
  54. - name: olivetin
  55. rules:
  56. - alert: OliveTinActionFailed
  57. expr: increase(olivetin_action_executions_total{result="failed"}[15m]) > 0
  58. labels:
  59. severity: warning
  60. annotations:
  61. summary: OliveTin action failed with non-zero exit code
  62. - alert: OliveTinActionTimedOut
  63. expr: increase(olivetin_action_executions_total{result="timeout"}[15m]) > 0
  64. labels:
  65. severity: warning
  66. annotations:
  67. summary: OliveTin action timed out
  68. ----