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

Setup node metrics. #412

Merged
merged 7 commits into from
Jun 24, 2020
Merged

Setup node metrics. #412

merged 7 commits into from
Jun 24, 2020

Conversation

evanlinjin
Copy link
Contributor

Fixes #405

Changes:

  • Re-implemented how metrics are handled.
  • Updated .gitignore

How to test this PR:

  • Start setup-node with flag -m :2121
  • Navigate to http://localhost:2121/metrics

@jdknives
Copy link
Member

@evanlinjin binaries are still there.

Copy link
Contributor

@Darkren Darkren left a 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)
Copy link
Contributor

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?

Copy link
Contributor Author

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.

m.activeRequests.Inc()

return func(rules *routing.EdgeRules, err *error) {
var successStr string
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@jdknives jdknives merged commit 36a3530 into skycoin:develop Jun 24, 2020
jdknives added a commit that referenced this pull request Oct 19, 2020
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.

3 participants