thor icon indicating copy to clipboard operation
thor copied to clipboard

Adding Metrics to the node

Open otherview opened this issue 1 year ago • 5 comments

Description

  • Adds ~~OpenTelemetry Metrics ~~ / Prometheus Metrics to thor
  • The API can now serve the /node/metrics endpoint with metrics for the node
  • Metrics can be enabled with the enable-telemetry flag set to true (defaults to false)
  • All API endpoints now have a histogram and a count of requests
  • Swagger updated

Type of change

  • [x] New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Unit tests in the code.

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [x] New and existing unit tests pass locally with my changes
  • [x] New and existing E2E tests pass locally with my changes
  • [x] Any dependent changes have been merged and published in downstream modules
  • [x] I have not added any vulnerable dependencies to my code

otherview avatar Feb 26 '24 15:02 otherview

Hiya, can the swagger docs be updated and the README updated about that also? cheers What data is collected? thanks

claytonneal avatar Feb 26 '24 15:02 claytonneal

Hiya, can the swagger docs be updated and the README updated about that also? cheers What data is collected? thanks

Updated ! Also, upon review of the swagger I think it becomes clear that this endpoint should live under the node endpoint 🙏

otherview avatar Feb 26 '24 16:02 otherview

Codecov Report

Attention: Patch coverage is 61.20092% with 168 lines in your changes are missing coverage. Please review.

Project coverage is 61.89%. Comparing base (e39091e) to head (8ca08ff).

Files Patch % Lines
cmd/thor/utils.go 0.00% 68 Missing :warning:
api/utils/http.go 0.00% 23 Missing :warning:
cmd/thor/main.go 0.00% 22 Missing :warning:
metrics/prometheus.go 86.41% 11 Missing and 11 partials :warning:
cmd/thor/node/node.go 0.00% 10 Missing :warning:
cmd/thor/node/packer_loop.go 0.00% 10 Missing :warning:
p2psrv/server.go 0.00% 5 Missing :warning:
block/block.go 25.00% 3 Missing :warning:
comm/handle_rpc.go 0.00% 3 Missing :warning:
metrics/noop.go 94.44% 1 Missing :warning:
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #671      +/-   ##
==========================================
+ Coverage   61.87%   61.89%   +0.01%     
==========================================
  Files         199      202       +3     
  Lines       18318    18696     +378     
==========================================
+ Hits        11335    11572     +237     
- Misses       5880     6013     +133     
- Partials     1103     1111       +8     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Feb 26 '24 16:02 codecov-commenter

@darrenvechain does anything need to be done in order to support this via stoplight?

nwbrettski avatar Feb 27 '24 19:02 nwbrettski

@darrenvechain does anything need to be done in order to support this via stoplight?

Nope, it's all configured via Open API spec, which is compatible with swagger and stoplight

darrenvechain avatar Feb 27 '24 20:02 darrenvechain