coralogix / zio-k8s

An idiomatic ZIO client for the Kubernetes API.
Apache License 2.0
97 stars 19 forks source link

watcher reconnection metrics #222

Open joprice opened 3 years ago

joprice commented 3 years ago

I'd like to swap a client with custom watcher reconnection handling with this one, but the custom client has metrics around connection failures and reconnection attempts. Any recommendation for intercepting those calls for collecting metrics?

vigoo commented 3 years ago

Right now I think you can only do this by writing a custom STTP backend wrapping the real one, like described here: https://sttp.softwaremill.com/en/latest/backends/wrappers/custom.html#example-metrics-backend-wrapper

I think it wold be nice to introduce a concept of K8sCallAspects similar to what I did in zio-aws (https://vigoo.github.io/zio-aws/docs/aspects.html) that can be simply applied to any K8s client layer to attach custom logging/metrics functionality.