metrics-howto.rst 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. How to monitor Synapse metrics using Prometheus
  2. ===============================================
  3. 1. Install prometheus:
  4. Follow instructions at http://prometheus.io/docs/introduction/install/
  5. 2. Enable synapse metrics:
  6. Simply setting a (local) port number will enable it. Pick a port.
  7. prometheus itself defaults to 9090, so starting just above that for
  8. locally monitored services seems reasonable. E.g. 9092:
  9. Add to homeserver.yaml::
  10. metrics_port: 9092
  11. Also ensure that ``enable_metrics`` is set to ``True``.
  12. Restart synapse.
  13. 3. Add a prometheus target for synapse.
  14. It needs to set the ``metrics_path`` to a non-default value::
  15. - job_name: "synapse"
  16. metrics_path: "/_synapse/metrics"
  17. static_configs:
  18. - targets:
  19. "my.server.here:9092"
  20. If your prometheus is older than 1.5.2, you will need to replace
  21. ``static_configs`` in the above with ``target_groups``.
  22. Restart prometheus.
  23. Standard Metric Names
  24. ---------------------
  25. As of synapse version 0.18.2, the format of the process-wide metrics has been
  26. changed to fit prometheus standard naming conventions. Additionally the units
  27. have been changed to seconds, from miliseconds.
  28. ================================== =============================
  29. New name Old name
  30. ---------------------------------- -----------------------------
  31. process_cpu_user_seconds_total process_resource_utime / 1000
  32. process_cpu_system_seconds_total process_resource_stime / 1000
  33. process_open_fds (no 'type' label) process_fds
  34. ================================== =============================
  35. The python-specific counts of garbage collector performance have been renamed.
  36. =========================== ======================
  37. New name Old name
  38. --------------------------- ----------------------
  39. python_gc_time reactor_gc_time
  40. python_gc_unreachable_total reactor_gc_unreachable
  41. python_gc_counts reactor_gc_counts
  42. =========================== ======================
  43. The twisted-specific reactor metrics have been renamed.
  44. ==================================== =====================
  45. New name Old name
  46. ------------------------------------ ---------------------
  47. python_twisted_reactor_pending_calls reactor_pending_calls
  48. python_twisted_reactor_tick_time reactor_tick_time
  49. ==================================== =====================