-
Notifications
You must be signed in to change notification settings - Fork 83
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
Support listen on vsock #202
Conversation
322c7e8
to
cc3c96a
Compare
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.
Interesting idea. This also needs to be added to the Go documentation and probably the flag help string in web/kingpinflag/flag.go
.
Please add documentation to the |
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.
Thanks, looks good.
With this patch, node_exporter can run with `--web.listen-address=vsock: //:9100` to listen on vsock in qemu guest. Then host can get the metrics. Signed-off-by: Jeffrey Zhang <[email protected]>
👍🏽 |
Would you please rebase to fix the conflict? |
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
I'd like some testing for ListenAndServe here
exporter-toolkit/web/tls_config_test.go
Lines 479 to 492 in 48431d7
go func() { | |
defer func() { | |
if recover() != nil { | |
recordConnectionError(errors.New("Panic starting server")) | |
} | |
}() | |
flags := FlagConfig{ | |
WebListenAddresses: &([]string{port}), | |
WebSystemdSocket: OfBool(false), | |
WebConfigFile: &test.YAMLConfigPath, | |
} | |
err := ListenAndServe(server, &flags, testlogger) | |
recordConnectionError(err) | |
}() |
To make sure it listens both on tcp and vsock if specified.
But I won't block on this if other people don't think this is necessary 👍
} else { | ||
listener, err = net.Listen("tcp", address) | ||
if err != nil { | ||
return nil |
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.
Shouldn't this be return err
? It silently swallows an error condition.
For your consideration, I rebased this branch as #220 to allow it to be merged (with original authorship of @jeffrey4l). The only conflict is |
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.
This behavior can already be archived using the existing systemd socket use case as those are not only able to listen on TCP/IP (AF_INET/AF_INET6) and Unix Domain Sockets (AF_UNIX), but also on Vsock (AF_VSOCK) - among some others.
Interesting, so you're saying that this isn't needed? Do we just need to update the documentation? |
Yes, at least for systems using systemd (or a compatible implementation of the listener interface). See
|
@SuperQ Also, another reminder that a rebased version of this PR exists as #220. (I am not trying to claim credit, I'm just interested in having this merged). |
Closing in favor of #220 |
metrics can be retrive without nic between host and qemu guest through vsock.
more info check