zalando / skipper

An HTTP router and reverse proxy for service composition, including use cases like Kubernetes Ingress
https://opensource.zalando.com/skipper/
Other
3.08k stars 350 forks source link

Provide an option to allow custom metrics inside filters. #352

Open chandu188 opened 7 years ago

chandu188 commented 7 years ago

The current metrics doesn't provide an option to measure custom metrics inside a filter. We have set of filters which process images (resize, converTojpg) and we would like to measure how long does each step take resize or convertTojpg.

szuecs commented 7 years ago

Do I understand you correctly that you want to know the execution time of a filter? Execution time of a filter would not need to support custom metrics, that's why I ask.

chandu188 commented 7 years ago

Sorry if the above description is not clear. Let me try to explain with some examples.

Consider the following as an example of Response method in filter

func ( *articlePath) Response( filters.FilterContext) { step1: convert to jpeg step2: resize image

} currently, the default metrics provide the overall execution time of a filter. It's not possible to measure the execution time of the above 2 steps separately.

Another example could be from this https://github.com/zalando/skipper/blob/8fb107612ac6543f1c76d01bb3e8efe61dac5beb/filters/builtin/compress.go#L367. Here I don't think it's possible to measure the execution time for "encode" method. The default execution time will not be much help for this "compress" filter as it does not measure the time spent in encoding as it runs in a separate goroutine (correct me if I am wrong).

lmineiro commented 7 years ago

This was actually discussed before. There's value on exposing "some" metrics registry to filters We didn't come to a conclusion how to properly namespace that to avoid collisions in the metrics key space.

The suggestion, at the time was: