Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Metrics to the node #671

Merged
merged 44 commits into from
May 23, 2024
Merged

Adding Metrics to the node #671

merged 44 commits into from
May 23, 2024

Conversation

otherview
Copy link
Member

@otherview otherview commented Feb 26, 2024

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

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

How Has This Been Tested?

Unit tests in the code.

Checklist:

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

@otherview otherview requested a review from a team as a code owner February 26, 2024 15:29
@claytonneal
Copy link
Member

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

cmd/thor/flags.go Outdated Show resolved Hide resolved
@otherview
Copy link
Member Author

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 🙏

@codecov-commenter
Copy link

codecov-commenter commented Feb 26, 2024

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 ⚠️
api/utils/http.go 0.00% 23 Missing ⚠️
cmd/thor/main.go 0.00% 22 Missing ⚠️
metrics/prometheus.go 86.41% 11 Missing and 11 partials ⚠️
cmd/thor/node/node.go 0.00% 10 Missing ⚠️
cmd/thor/node/packer_loop.go 0.00% 10 Missing ⚠️
p2psrv/server.go 0.00% 5 Missing ⚠️
block/block.go 25.00% 3 Missing ⚠️
comm/handle_rpc.go 0.00% 3 Missing ⚠️
metrics/noop.go 94.44% 1 Missing ⚠️
... 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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@otherview otherview changed the title Adding OpenTelemtry Metrics Adding Metrics to the node Feb 27, 2024
api/doc/thor.yaml Outdated Show resolved Hide resolved
@nwbrettski
Copy link
Contributor

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

@darrenvechain
Copy link
Member

@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

cmd/thor/node/metrics.go Outdated Show resolved Hide resolved
cmd/thor/node/metrics.go Outdated Show resolved Hide resolved
telemetry/prometheus.go Outdated Show resolved Hide resolved
telemetry/prometheus.go Outdated Show resolved Hide resolved
telemetry/prometheus.go Outdated Show resolved Hide resolved
otherview and others added 8 commits May 16, 2024 10:08
* move metric/size to thor

* rename telemetry related flags to metrics and a refactor to start up message

* rename package telemetry to metrics

* Update cmd/thor/flags.go

Co-authored-by: Pedro Gomes <[email protected]>

---------

Co-authored-by: Pedro Gomes <[email protected]>
@otherview otherview dismissed claytonneal’s stale review May 21, 2024 21:13

Implemented already

otherview and others added 2 commits May 21, 2024 22:16
* tweak metrics in txpool and node

* move metrics in bft to seperate file

* identify block proposed/received for metrics processed tx/gas

* promote bft rejected error && pr comments
cmd/thor/node/node.go Outdated Show resolved Hide resolved
metrics/telemetry.go Outdated Show resolved Hide resolved
metrics/telemetry.go Outdated Show resolved Hide resolved
@otherview otherview force-pushed the pedro/add_metrics branch from 1b79eb1 to 8d87599 Compare May 22, 2024 11:53
cmd/thor/node/node.go Outdated Show resolved Hide resolved
@libotony libotony merged commit cfac49d into master May 23, 2024
14 checks passed
@otherview otherview deleted the pedro/add_metrics branch May 23, 2024 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants