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

Support listen on vsock #202

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

jeffrey4l
Copy link

metrics can be retrive without nic between host and qemu guest through vsock.

more info check

Copy link
Member

@SuperQ SuperQ left a 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.

web/tls_config.go Outdated Show resolved Hide resolved
@SuperQ
Copy link
Member

SuperQ commented Feb 26, 2024

Please add documentation to the ListenAndServe func docs (before like 285). A link to https://wiki.qemu.org/Features/VirtioVsock would be useful there.

Copy link
Member

@SuperQ SuperQ left a 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 <zhang.lei.fly@gmail.com>
@bwplotka
Copy link
Member

👍🏽

@SuperQ
Copy link
Member

SuperQ commented Apr 22, 2024

Would you please rebase to fix the conflict?

Copy link
Member

@jesusvazquez jesusvazquez left a 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

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
Copy link

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.

web/kingpinflag/flag.go Show resolved Hide resolved
@Leonid99
Copy link

Leonid99 commented May 5, 2024

Would you please rebase to fix the conflict?

For your consideration, I rebased this branch as #220 to allow it to be merged (with original authorship of @jeffrey4l). The only conflict is go.mod.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants