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

Feature: Exposing Prometheus metrics to user-defined interface #6528

Merged
merged 3 commits into from
Jan 13, 2024

Conversation

tgerring
Copy link
Contributor

@tgerring tgerring commented Jan 12, 2024

Changes

  • Add --Metrics.ExposeHost option and pass that to NethermindKestrelMetricServer so a hostname other than localhost can be exposed. Defaults to 127.0.0.1 EDIT: to "+" since this is the current default behavior without an option.

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

I have only compiled this on my dev laptop and not run this on my production node yet. Therefore I am looking for early feedback to my commits until that can be completed. It would be good to verify the passed address matches what is printed in the logs (instead of 127.0.0.1, as it currently shows). as well as, ensuring that the hostname:port can be accessed, i.e. from dev laptop curl

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Built Nethermind.Runner, correcting all errors and verified the new CLI option was available (when spelled correctly)

Documentation

Requires documentation update

  • Yes
  • No

Metrics documentation is already marked for needing update

Requires explanation in Release Notes

  • Yes
  • No

Add Metrics.ExposeHost configuration option. Defaults to 127.0.0.1. Allows Prometheus metrics to be exposed on an interface other than localhost.

@tgerring tgerring requested a review from rubo as a code owner January 12, 2024 16:05
@rubo rubo added the metrics label Jan 12, 2024
@tgerring
Copy link
Contributor Author

tgerring commented Jan 13, 2024

Built this against .NET 8.0 on Ubuntu 22.04. Resulting binary was able to consume Metrics.ExposeHost and now correctly exposes metrics to external HTTP requests, including Prometheus directly with config like so:

  - job_name: nethermind
    metrics_path: /metrics
    static_configs:
      - targets: ['10.10.3.111:6061']

The Nethermind Grafana dashboard now loads correctly, as the data is able to be collected by Prometheus running on a separate host.

@benaadams
Copy link
Member

@tgerring thank you for your contribution

@benaadams benaadams merged commit 1709d8c into NethermindEth:master Jan 13, 2024
67 checks passed
marcindsobczak pushed a commit that referenced this pull request Feb 2, 2024
Co-authored-by: Ben Adams <thundercat@illyriad.co.uk>
(cherry picked from commit 1709d8c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants