-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Issue tracker is used for reporting bugs and discussing new features. Please use
stackoverflow for supporting issues.
Expected Behavior
When closing a redis client the open telemetry should stop observing it. Another option is to provide a way to unregister the listener
Current Behavior
Currently when instrumenting a redis client there is no way to stop observing it using the otel metrics. This also creates a hanging pointer to the redis client instance which can create memory leaks if the application creates many redis client instances.
Possible Solution
- Automatically stop observing the client when it's closed / destroyed in any way. (Prefferred option)
- Provide a way for manual stoping of the instrumentation
Steps to Reproduce
https://gist.github.com/rokn/8939cf0be0a70f873801f030218709a3
The gist provided is a minimal example which can demonstrate the issue.
- Run the above gist
- check localhost:8080/metrics
curl localhost:8080/metrics | grep db_client_connections_usage
It has metrics for both clients.
3. Wait 10 secs
After the clients are closed the connections are 0 as expected but the metrics are still there(and the clients that provide those metrics)
Context (Environment)
We are creating many redis connections (1000+) and are sometimes closing them and need to cleanly discard these instances from memory and the metrics they "provide"