metrics-howto.rst 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 (under ``scrape_configs``)::
  15. - job_name: "synapse"
  16. metrics_path: "/_synapse/metrics"
  17. static_configs:
  18. - targets: ["my.server.here:9092"]
  19. If your prometheus is older than 1.5.2, you will need to replace
  20. ``static_configs`` in the above with ``target_groups``.
  21. Restart prometheus.
  22. Standard Metric Names
  23. ---------------------
  24. As of synapse version 0.18.2, the format of the process-wide metrics has been
  25. changed to fit prometheus standard naming conventions. Additionally the units
  26. have been changed to seconds, from miliseconds.
  27. ================================== =============================
  28. New name Old name
  29. ---------------------------------- -----------------------------
  30. process_cpu_user_seconds_total process_resource_utime / 1000
  31. process_cpu_system_seconds_total process_resource_stime / 1000
  32. process_open_fds (no 'type' label) process_fds
  33. ================================== =============================
  34. The python-specific counts of garbage collector performance have been renamed.
  35. =========================== ======================
  36. New name Old name
  37. --------------------------- ----------------------
  38. python_gc_time reactor_gc_time
  39. python_gc_unreachable_total reactor_gc_unreachable
  40. python_gc_counts reactor_gc_counts
  41. =========================== ======================
  42. The twisted-specific reactor metrics have been renamed.
  43. ==================================== =====================
  44. New name Old name
  45. ------------------------------------ ---------------------
  46. python_twisted_reactor_pending_calls reactor_pending_calls
  47. python_twisted_reactor_tick_time reactor_tick_time
  48. ==================================== =====================