-
Notifications
You must be signed in to change notification settings - Fork 244
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
metrics: add an interface to get the metrics definitions #155
Conversation
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, thanks. 🙇
err := dec.Decode(&definitions) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return definitions, 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.
NIT: This could be simplified:
err := dec.Decode(&definitions) | |
if err != nil { | |
return nil, err | |
} | |
return definitions, nil | |
return definitions, dec.Decode(&definitions) |
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.
IIUC, unfortunately this linter rule disallows this: https://go-critic.com/overview.html#evalorder
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 -- thank you!
Fixes #149
This will enable profilers using the ebpf profiler as a library to export some of the internal metrics of the profiler. For example, this should allow getting more data on unwinding errors for interpreted languages.
For the interface, I added a
GetDefinitions()
method in the metrics package, which would require exposing themetrics
package in #132, happy to move this elsewhere though if we think this is not the best place / API for this.