-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
Conversation
@GrahamcOfBorg test prometheus-exporters |
There was a problem hiding this 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'") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:(
There was a problem hiding this comment.
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 :).
There was a problem hiding this 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 👍
Thanks @WilliButz, I've applied your suggestions and rebased on master to resolve conflicts. |
@GrahamcOfBorg test prometheus-exporters.lnd |
There was a problem hiding this 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 👍
Thanks @WilliButz and @mdlayher! |
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
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)