go-metrics icon indicating copy to clipboard operation
go-metrics copied to clipboard

Add factory for creating DogStatsd sinks from a prexisting datadog client

Open bobbytables opened this issue 8 years ago • 3 comments

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")

bobbytables avatar Sep 14 '17 17:09 bobbytables

Any thoughts on this?

bobbytables avatar Sep 27 '17 15:09 bobbytables

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.

aantono avatar Jan 18 '18 05:01 aantono

CLA assistant check

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.

hashicorp-cla avatar Sep 30 '22 21:09 hashicorp-cla