go-metrics
go-metrics copied to clipboard
Add factory for creating DogStatsd sinks from a prexisting datadog client
As of right now, the datadog metric sink does not use buffered flushes, which can cause a noticeable slowdown in emitting metrics. The DogStatsd package offers a buffered version of their client, but because the client is not exported from this sink, it's not possible to set it. This change allows you to pass in a client that you initialize.
For example, it would be nice to be able to use the buffered client like so:
package foo
import (
"github.com/DataDog/datadog-go/statsd"
"github.com/armon/go-metrics/datadog"
)
client, err := statsd.NewBuffered("localhost:8125", 1024)
if err != nil {
panic(err)
}
sink := datadog.NewDogStatsdSinkFromClient(client, "hostname")
Any thoughts on this?
Would it be possible, as part of this PR, to also add a getter to the DogStatsD sync to expose the Client? Since the DogStatsD client also provides ability to send events, it would be nice to be able to just instantiate a single client instance, as part of the DogStatsD sync and reuse it externally for Event emitting purposes as well.
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement
Learn more about why HashiCorp requires a CLA and what the CLA includes
Have you signed the CLA already but the status is still pending? Recheck it.