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

hydra-notify prometheus metrics with IPv6 #1394

Open
benaryorg opened this issue Jul 20, 2024 · 1 comment · May be fixed by #1395
Open

hydra-notify prometheus metrics with IPv6 #1394

benaryorg opened this issue Jul 20, 2024 · 1 comment · May be fixed by #1395
Labels

Comments

@benaryorg
Copy link

Describe the bug

hydra-notify fails to listen on IPv6 for Prometheus metrics.

To Reproduce

  1. configure hydra-notify as follows:
<hydra_notify>
  <prometheus>
    listen_address = ::1
    port = 9199
  </prometheus>
</hydra_notify>

Expected behavior

Service listens on IPv6.

Actual behaviour

Starting the Prometheus exporter, listening on http://[::1]:9199/metrics.
failed to listen to port 9199: Invalid argument at /nix/store/vs5db18kx919dgbnz1akfq4d5wf28m5f-hydra-perl-deps/lib/perl5/site_perl/5.38.2/HTTP/Server/PSGI.pm line 103.

(using ::1 or [::1] does not make a difference)

Hydra Server:

Please fill out this data as well as you can, but don't worry if you can't -- just do your best.

  • OS and version: NixOS 24.05
  • Version of Hydra: d798622
  • Version of Nix Hydra is built against: Nix 2.22
  • Version of the Nix daemon: Lix 2.90.0

Additional context

I'm not a Perl person but upstream code looks like you need to pass an explicit ipv6 argument to the webserver to get IPv6, which hydra-notify is not doing.
Considering that this is literally the only place in which promCfg is used, why not just pass the entire promCfg uhh.… (map? table? dict? hash? object?) the entire thing to that upstream code so that users can override whatever they want including certificates or whatnot (or ipv6 = 1), though doing that as-is would definitely break downstream considering that hostlisten_address. But passing the rest of the values on would be nice.

@benaryorg benaryorg added the bug label Jul 20, 2024
@fogti
Copy link

fogti commented Jul 20, 2024

C<IO::Socket::IP> - Family-neutral IP socket supporting both IPv4 and IPv6

I think it should work to just always set ipv6 => 1.

fogti added a commit to fogti/hydra that referenced this issue Jul 20, 2024
HTTP::Server::PSGI uses the `ipv6` flag to decide between
  `IO::Socket::INET` and `IO::Socket::IP`
  (https://metacpan.org/dist/Plack/source/lib/HTTP/Server/PSGI.pm#L80-84)
and (from IO/Socket/IP.pm):
> C<IO::Socket::IP> - Family-neutral IP socket supporting both IPv4 and IPv6
so setting the `ipv6` flag makes it support both IPv4 and IPv6.

Fixes NixOS#1394
@fogti fogti linked a pull request Jul 20, 2024 that will close this issue
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 a pull request may close this issue.

2 participants