Fixed the issue of metrics for golang runtime#1126
Fixed the issue of metrics for golang runtime#1126andresmgot merged 6 commits intovmware-archive:masterfrom
Conversation
andresmgot
left a comment
There was a problem hiding this comment.
Thanks for the PR! See my comment.
Also, you have some lint errors:
./script/validate-lint
Errors from golint:
pkg/function-proxy/utils/proxy-utils.go:40:2: exported var FuncHistogram should have comment or be unexported
pkg/function-proxy/utils/proxy-utils.go:54:1: exported function PromHTTPHandler should have comment or be unexported
Please fix the above errors. You can test via "golint" and commit the result.
| func PromHTTPHandler() http.Handler{ | ||
| return promhttp.Handler() | ||
| } |
There was a problem hiding this comment.
Correct me if I am wrong but I think this is the only needed change. You can still use prometheus instead than promauto and avoid exposing FuncHistogram, FuncCalls and FuncErrors so the only change in this PR would be exposing this function. Can you try that?
There was a problem hiding this comment.
well I opted for promauto anyway because if we are to add more metrics in future we wont be needed/bothered to register them all, wherever in whichever function we define them, they will be registered automatically. It makes this metrics part a bit easier.
And FuncHistogram instead of funcHistogram for if we want to increment them in some other packages in future.
Thoughts?
There was a problem hiding this comment.
but those are different topics, the goal of this PR is to fix the current metrics so I would leave it as minimal as possible to avoid confusion in the future of what did the trick. Then we can open a different PR to modify/add more metrics if needed.
There was a problem hiding this comment.
sure, we can take this up later.
andresmgot
left a comment
There was a problem hiding this comment.
Can you also remove the changes in go.mod, go.sum and vendor? I think they are not needed either.
|
anyone looking for the fix can apply this in their cluster in the meantime while there is no new release: |
Issue Ref: #1020
Description: Removed
promhttp.Handlerfromkubeless/runtime/stable/golang/kubeless.tpl.goand put it inside thepkg/function-proxy/utils/proxy-utils.goso that it can scrape the registered metrics.This should make it possible to get the registered metrics by doing a simple curl on the http-function-port/metrics
TODOs: