Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Golang runtime incomplete metrics due to proxy utils #1020

Open
marlongehringer opened this issue Apr 11, 2019 · 2 comments
Open

Golang runtime incomplete metrics due to proxy utils #1020

marlongehringer opened this issue Apr 11, 2019 · 2 comments

Comments

@marlongehringer
Copy link

Is this a BUG REPORT or FEATURE REQUEST?:
FEATURE REQUEST

What happened:
Metrics like "function_calls_total" are missing in the prometheus endpoint in the golang runtime.

What you expected to happen:
Metrics in the golang runtime should be complete.

How to reproduce it (as minimally and precisely as possible):
curl http://127.0.0.1:8080/metrics

Anything else we need to know?:
https://github.com/kubeless/kubeless/blob/84fa853fa04bf69fe22326729fddfa95b0a0e9e4/pkg/function-proxy/utils/proxy-utils.go#L61

The proxy utils are executing the MustRegister only in the init() function which is not called in the golang runtime.

https://github.com/kubeless/runtimes/blob/bdee7792a6d265a719a75e886071cbc4fb5f7295/stable/golang/kubeless.tpl.go#L81

Easiest solution would be to move the MustRegister to a public function which we can call in the runtime. What do you think?

@andresmgot
Copy link
Contributor

Thanks @marlongehringer for the issue, I was able to reproduce it. Actually the init() function is always executed when you import a Go package so the issue should be a different one. I think that the problem is that the two packages are instantiating a different prometheus client (one is using prometheus and the other promhttp) so that's probably the issue.

What may fix the issue is to either use the prometheus package in the Go runtime or expose it in the proxy-utils package with a function so the Go runtime doesn't need to import it. Would you be able to give it that try?

marlongehringer pushed a commit to marlongehringer/kubeless that referenced this issue Apr 12, 2019
@marlongehringer
Copy link
Author

You are right @andresmgot. I created a Pull-Request. Thanks for your quick reply.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants