DataDog/datadog-go

Long living client

Closed this issue · 3 comments

Hi, is it possible to call statsd.new only once and reuse that client for the whole application lifetime?

I seem to randomly run into sigsegv: segmentation violation panic on client.push after a few hour of running my application.

I'm using a singleton pattern with sync.once, if that helps

renak commented

I'm new to statsd and I'm thinking of using this package. Is this an issue I should be concerned about? I was thinking of possibly writing a wrapper around this and passing the wrapper around to different parts of my project. Would I need to periodically refresh the client instance? Or is it expected that a new client instance should be created for each metric call?

arbll commented

Hey there,

One instance can definitely be used for all your application and this library is commonly used that way. A singleton pattern would do the job.

@iarief do you have more details on your sigsegv ?

arbll commented

Going to close this one, feel free to re-open if needed.