vmware-archive / runtimes

Kubeless function runtimes: https://kubeless.io/docs/runtimes/
Apache License 2.0
81 stars 89 forks source link

Prometheus Custom metrics #55

Open zentale opened 4 years ago

zentale commented 4 years ago

Hi All! I would be interested in delivering custom metrics for my python functions, so richer data would be available for analyzing the function behaviors with their extra metrics. Should I be parsing https://github.com/kubeless/runtimes/blob/master/stable/python/kubeless.py#L84 for a specific pattern I create in the function, to create and/or update Prometheus metrics?

I am looking for design ideas, where / how to implement it so it makes the most sense.

andresmgot commented 4 years ago

Hi @zentale,

What I would try first is to forward the prom instance to the function through the function context so the function can reuse it to define its own metrics.

I am not an expert in the Python runtime so I don't know if that would work. Another possibility, as you say, is to parse the response given by the function and inspect in case there is a specific key to represent metrics but that requires certain standardization so I would first try the above or something similar.

damiennogues commented 4 years ago

Hi All ! I would be also interested by this feature for the node runtime. How do you think it could be implemented ? Would just adding the prom-client to the sandbox object be enough ?