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

nixos/prometheus-lnd-exporter: init #89449

Merged
merged 2 commits into from Jun 11, 2020
Merged

Conversation

mmilata
Copy link
Member

@mmilata mmilata commented Jun 3, 2020

Motivation for this change

fort-nix/nix-bitcoin#186 + would like to take advantage of the nice prometheus exporters infrastructure that nixpkgs has

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@mdlayher
Copy link
Member

@GrahamcOfBorg test prometheus-exporters

Copy link
Member

@mdlayher mdlayher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a test nit.

wait_for_open_port(10009)
wait_for_unit("prometheus-lnd-exporter.service")
wait_for_open_port(9092)
succeed("curl -sSf localhost:9092/metrics | grep -q '^promhttp_metric_handler'")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible for you to check a metric exported by the exporter rather than the client library?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that in order for an actual metric to be exported the lnd daemon needs to be synced with bitcoind and have wallet generated. Although it should be possible to test this without internet access by running both daemons in "regtest" mode, the setup is quite non-trivial:(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is too much overhead to actually bootstrap an environment for the exporter to work as intended, I think it is fine to only check if the module is compatible with the current exporter package. This should make it less likely that someone updates the exporter package without touching the module and thereby unknowingly causing incompatibilities, which has happened before :).

Copy link
Member

@WilliButz WilliButz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think running the exporter as root in the test or as a normal user anywhere else can be avoided by giving it access to the needed files specifying ReadOnlyPaths (or if necessary ReadWritePaths) in the service configuration.
(See systemd.exec(5))

Otherwise this looks good to me 👍

nixos/tests/prometheus-exporters.nix Outdated Show resolved Hide resolved
@mmilata
Copy link
Member Author

mmilata commented Jun 11, 2020

Thanks @WilliButz, I've applied your suggestions and rebased on master to resolve conflicts.

@WilliButz
Copy link
Member

@GrahamcOfBorg test prometheus-exporters.lnd

Copy link
Member

@WilliButz WilliButz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me 👍

@WilliButz WilliButz merged commit efd8f66 into NixOS:master Jun 11, 2020
@mmilata
Copy link
Member Author

mmilata commented Jun 11, 2020

Thanks @WilliButz and @mdlayher!

@mmilata mmilata deleted the lnd-exporter branch June 11, 2020 17:03
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.

None yet

3 participants