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
base: master
Are you sure you want to change the base?
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 <zhang.lei.fly@gmail.com>
👍🏽 |
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 |
metrics can be retrive without nic between host and qemu guest through vsock.
more info check