-
Notifications
You must be signed in to change notification settings - Fork 45
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
Setup node metrics. #412
Setup node metrics. #412
Conversation
@evanlinjin binaries are still there. |
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.
Few minor questions, but otherwise - great job! Also, could you please remove transport logs?
} | ||
|
||
// Execute executes root CLI command. | ||
func Execute() { | ||
if err := rootCmd.Execute(); err != nil { | ||
log.Fatal(err) | ||
panic(err) |
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.
Why do you think this change is necessary?
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.
log.Fatal
logs the error and then panics. However, when a cobra.Command
fails, it already logs the error. So we only need to panic here.
pkg/setup/setupmetrics/metrics.go
Outdated
m.activeRequests.Inc() | ||
|
||
return func(rules *routing.EdgeRules, err *error) { | ||
var successStr string |
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.
we may simplify this part a bit with something like this:
successStr := "true"
if *err != nil {
successStr = "false"
}
btw, is it neccessary to have interface pointer in the func signature, wouldn't just error
be enough here?
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.
That code looks cleaner. I'll get it done.
The pointer of an error
is needed. We need to get the pointer of the error, as the error value will change.
Setup node metrics. Former-commit-id: 36a3530
Fixes #405
Changes:
How to test this PR:
setup-node
with flag-m :2121
http://localhost:2121/metrics