metrics-howto.rst 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. Block and response metrics renamed for 0.27.0
  23. ---------------------------------------------
  24. Synapse 0.27.0 begins the process of rationalising the duplicate ``*:count``
  25. metrics reported for the resource tracking for code blocks and HTTP requests.
  26. At the same time, the corresponding ``*:total`` metrics are being renamed, as
  27. the ``:total`` suffix no longer makes sense in the absence of a corresponding
  28. ``:count`` metric.
  29. To enable a graceful migration path, this release just adds new names for the
  30. metrics being renamed. A future release will remove the old ones.
  31. The following table shows the new metrics, and the old metrics which they are
  32. replacing.
  33. ==================================================== ===================================================
  34. New name Old name
  35. ==================================================== ===================================================
  36. synapse_util_metrics_block_count synapse_util_metrics_block_timer:count
  37. synapse_util_metrics_block_count synapse_util_metrics_block_ru_utime:count
  38. synapse_util_metrics_block_count synapse_util_metrics_block_ru_stime:count
  39. synapse_util_metrics_block_count synapse_util_metrics_block_db_txn_count:count
  40. synapse_util_metrics_block_count synapse_util_metrics_block_db_txn_duration:count
  41. synapse_util_metrics_block_time_seconds synapse_util_metrics_block_timer:total
  42. synapse_util_metrics_block_ru_utime_seconds synapse_util_metrics_block_ru_utime:total
  43. synapse_util_metrics_block_ru_stime_seconds synapse_util_metrics_block_ru_stime:total
  44. synapse_util_metrics_block_db_txn_count synapse_util_metrics_block_db_txn_count:total
  45. synapse_util_metrics_block_db_txn_duration_seconds synapse_util_metrics_block_db_txn_duration:total
  46. synapse_http_server_response_count synapse_http_server_requests
  47. synapse_http_server_response_count synapse_http_server_response_time:count
  48. synapse_http_server_response_count synapse_http_server_response_ru_utime:count
  49. synapse_http_server_response_count synapse_http_server_response_ru_stime:count
  50. synapse_http_server_response_count synapse_http_server_response_db_txn_count:count
  51. synapse_http_server_response_count synapse_http_server_response_db_txn_duration:count
  52. synapse_http_server_response_time_seconds synapse_http_server_response_time:total
  53. synapse_http_server_response_ru_utime_seconds synapse_http_server_response_ru_utime:total
  54. synapse_http_server_response_ru_stime_seconds synapse_http_server_response_ru_stime:total
  55. synapse_http_server_response_db_txn_count synapse_http_server_response_db_txn_count:total
  56. synapse_http_server_response_db_txn_duration_seconds synapse_http_server_response_db_txn_duration:total
  57. ==================================================== ===================================================
  58. Standard Metric Names
  59. ---------------------
  60. As of synapse version 0.18.2, the format of the process-wide metrics has been
  61. changed to fit prometheus standard naming conventions. Additionally the units
  62. have been changed to seconds, from miliseconds.
  63. ================================== =============================
  64. New name Old name
  65. ================================== =============================
  66. process_cpu_user_seconds_total process_resource_utime / 1000
  67. process_cpu_system_seconds_total process_resource_stime / 1000
  68. process_open_fds (no 'type' label) process_fds
  69. ================================== =============================
  70. The python-specific counts of garbage collector performance have been renamed.
  71. =========================== ======================
  72. New name Old name
  73. =========================== ======================
  74. python_gc_time reactor_gc_time
  75. python_gc_unreachable_total reactor_gc_unreachable
  76. python_gc_counts reactor_gc_counts
  77. =========================== ======================
  78. The twisted-specific reactor metrics have been renamed.
  79. ==================================== =====================
  80. New name Old name
  81. ==================================== =====================
  82. python_twisted_reactor_pending_calls reactor_pending_calls
  83. python_twisted_reactor_tick_time reactor_tick_time
  84. ==================================== =====================