nyaruka / gocommon

Common utility library for the TextIt platform.
Other
7 stars 11 forks source link

Add analytics package with librato support #15

Closed rowanseymour closed 6 years ago

rowanseymour commented 6 years ago

Few tweaks from what is currently in courier. Felt a little odd having the caller set a global, so..

librato.Default = librato.NewSender(...)
librato.Default.Start()
librato.Default.AddGauge(...)
librato.Default.AddGauge(...)
librato.Default.Stop()

becomes...

analytics.Librato(...)
analytics.Start()
analytics.Gauge(...)
analytics.Gauge(...)
analytics.Stop()

tho it's still possible to use a different instance like...

librato := analytics.NewLibrato(...)
librato.Start()
librato.Gauge(...)
librato.Gauge(...)
librato.Stop()
coveralls commented 6 years ago

Coverage Status

Coverage decreased (-18.5%) to 81.111% when pulling 43944fb249b68aafebd44706389cb8e2adfb3cd3 on analytics into bc2f2eb770fbf625b50efe550c9652b9291d8992 on master.

nicpottier commented 6 years ago

Probably good to follow the Logrus model for the exported stuff: https://github.com/sirupsen/logrus/blob/master/exported.go

Maybe have it in its own repo, this seems commonly useful beyond our stuff.

rowanseymour commented 6 years ago

Closing in favour of having this in its own repo https://github.com/nyaruka/librato