|
@@ -23,6 +23,7 @@ func translateTimerAttributes(d time.Duration) (attrs map[string]interface{}) {
|
|
|
|
|
|
|
|
type Reporter struct {
|
|
type Reporter struct {
|
|
|
Email, Token string
|
|
Email, Token string
|
|
|
|
|
+ Namespace string
|
|
|
Source string
|
|
Source string
|
|
|
Interval time.Duration
|
|
Interval time.Duration
|
|
|
Registry metrics.Registry
|
|
Registry metrics.Registry
|
|
@@ -32,7 +33,7 @@ type Reporter struct {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func NewReporter(r metrics.Registry, d time.Duration, e string, t string, s string, p []float64, u time.Duration) *Reporter {
|
|
func NewReporter(r metrics.Registry, d time.Duration, e string, t string, s string, p []float64, u time.Duration) *Reporter {
|
|
|
- return &Reporter{e, t, s, d, r, p, translateTimerAttributes(u), int64(d / time.Second)}
|
|
|
|
|
|
|
+ return &Reporter{e, t, "", s, d, r, p, translateTimerAttributes(u), int64(d / time.Second)}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func Librato(r metrics.Registry, d time.Duration, e string, t string, s string, p []float64, u time.Duration) {
|
|
func Librato(r metrics.Registry, d time.Duration, e string, t string, s string, p []float64, u time.Duration) {
|
|
@@ -88,6 +89,9 @@ func (self *Reporter) BuildRequest(now time.Time, r metrics.Registry) (snapshot
|
|
|
snapshot.Counters = make([]Measurement, 0)
|
|
snapshot.Counters = make([]Measurement, 0)
|
|
|
histogramGaugeCount := 1 + len(self.Percentiles)
|
|
histogramGaugeCount := 1 + len(self.Percentiles)
|
|
|
r.Each(func(name string, metric interface{}) {
|
|
r.Each(func(name string, metric interface{}) {
|
|
|
|
|
+ if self.Namespace != "" {
|
|
|
|
|
+ name = fmt.Sprintf("%s.%s", self.Namespace, name)
|
|
|
|
|
+ }
|
|
|
measurement := Measurement{}
|
|
measurement := Measurement{}
|
|
|
measurement[Period] = self.Interval.Seconds()
|
|
measurement[Period] = self.Interval.Seconds()
|
|
|
switch m := metric.(type) {
|
|
switch m := metric.(type) {
|