DataDog/datadog-go

How do I check whether Client has been closed?

Opened this issue · 2 comments

It appears to be necessary to call Close() on statsd Clients to clean up cpu/memory resources.

How do I check whether a Client has been closed, so I can get a new client if needed?

I'm getting the same issue. I integrated to a custom logger and use a huge amount of events with a lot of different logger instances. The MEM resource is not able to release. But the same logic with Write to WebSocket and file (same time) are all able to close when doing GC. it did not happen half years ago I think was about version less than v2.3.0 . I didn't use go mod before so not able to tell the detail version when it was working.

I implemented a wrapper type with Close() and IsClosed() bool methods and that seems to be working well so far. I had to put a blocking Flush() call on the statsd Client in the Close() method to still get all metrics.