You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
5.7 KiB

  1. # ADR 011: Monitoring
  2. ## Changelog
  3. 08-06-2018: Initial draft
  4. 11-06-2018: Reorg after @xla comments
  5. 13-06-2018: Clarification about usage of labels
  6. ## Context
  7. In order to bring more visibility into Tendermint, we would like it to report
  8. metrics and, maybe later, traces of transactions and RPC queries. See
  9. https://github.com/tendermint/tendermint/issues/986.
  10. A few solutions were considered:
  11. 1. [Prometheus](https://prometheus.io)
  12. a) Prometheus API
  13. b) [go-kit metrics package](https://github.com/go-kit/kit/tree/master/metrics) as an interface plus Prometheus
  14. c) [telegraf](https://github.com/influxdata/telegraf)
  15. d) new service, which will listen to events emitted by pubsub and report metrics
  16. 5. [OpenCensus](https://opencensus.io/go/index.html)
  17. ### 1. Prometheus
  18. Prometheus seems to be the most popular product out there for monitoring. It has
  19. a Go client library, powerful queries, alerts.
  20. **a) Prometheus API**
  21. We can commit to using Prometheus in Tendermint, but I think Tendermint users
  22. should be free to choose whatever monitoring tool they feel will better suit
  23. their needs (if they don't have existing one already). So we should try to
  24. abstract interface enough so people can switch between Prometheus and other
  25. similar tools.
  26. **b) go-kit metrics package as an interface**
  27. metrics package provides a set of uniform interfaces for service
  28. instrumentation and offers adapters to popular metrics packages:
  29. https://godoc.org/github.com/go-kit/kit/metrics#pkg-subdirectories
  30. Comparing to Prometheus API, we're losing customisability and control, but gaining
  31. freedom in choosing any instrument from the above list given we will extract
  32. metrics creation into a separate function (see "providers" in node/node.go).
  33. **c) telegraf**
  34. Unlike already discussed options, telegraf does not require modifying Tendermint
  35. source code. You create something called an input plugin, which polls
  36. Tendermint RPC every second and calculates the metrics itself.
  37. While it may sound good, but some metrics we want to report are not exposed via
  38. RPC or pubsub, therefore can't be accessed externally.
  39. **d) service, listening to pubsub**
  40. Same issue as the above.
  41. ### 2. opencensus
  42. opencensus provides both metrics and tracing, which may be important in the
  43. future. It's API looks different from go-kit and Prometheus, but looks like it
  44. covers everything we need.
  45. Unfortunately, OpenCensus go client does not define any
  46. interfaces, so if we want to abstract away metrics we
  47. will need to write interfaces ourselves.
  48. ### List of metrics
  49. | | Name | Type | Labels | Description |
  50. | - | --------------------------------------- | ------- | ------------------------- | ----------------------------------------------------------------------------- |
  51. | A | height | Counter | height-X | |
  52. | A | validators | Gauge | height-X | Number of validators who signed |
  53. | A | missing_validators | Gauge | height-X | umber of validators who did not sign |
  54. | A | byzantine_validators | Gauge | height-X | Number of validators who tried to double sign |
  55. | A | block_interval | Timing | | Time between this and last block (Block.Header.Time) |
  56. | | block_time | Timing | | Time to create a block (from creating a proposal to commit) |
  57. | | time_between_blocks | Timing | | Time between committing last block and (receiving proposal creating proposal) |
  58. | A | rounds | Counter | height-X | Number of rounds |
  59. | | prevotes | Counter | height-X height-X-round-Y | |
  60. | | precommits | Counter | height-X height-X-round-Y | |
  61. | | prevotes_total_power | Counter | height-X height-X-round-Y | |
  62. | | precommits_total_power | Counter | height-X height-X-round-Y | |
  63. | A | num_txs | Counter | height-X | |
  64. | | total_txs | Counter | | |
  65. | | block_size | Gauge | height-X | In bytes |
  66. | | peers | Gauge | | Number of peers node's connected to |
  67. | | power | Gauge | | |
  68. `A` - will be implemented in the fist place.
  69. **Proposed solution**
  70. ## Status
  71. ## Consequences
  72. ### Positive
  73. ### Negative
  74. ### Neutral