Created
March 30, 2016 13:31
-
-
Save gonzaloserrano/ae0b606916254d7b07f64274df3cb25f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package metrics | |
type dummyMetrics struct{} | |
func NewDummy() Metrics { | |
return &dummyMetrics{} | |
} | |
func (d *dummyMetrics) Counter(name string, tags ...Tag) Counter { | |
return &dummyCounter{Name: name, tags: tags} | |
} | |
func (d *dummyMetrics) Gauge(name string, tags ...Tag) Gauge { | |
return &dummyGauge{name: name, tags: tags} | |
} | |
func (d *dummyMetrics) Event(title string, tags ...Tag) Event { | |
return &dummyEvent{title: title, tags: tags} | |
} | |
func (d *dummyMetrics) Flush() { | |
} | |
type dummyCounter struct { | |
Name string | |
tags Tags | |
value uint64 | |
} | |
func (c *dummyCounter) Add(delta uint64) { | |
c.value += delta | |
} | |
func (c *dummyCounter) Inc() { | |
c.value += 1 | |
} | |
type dummyGauge struct { | |
name string | |
tags Tags | |
value interface{} | |
} | |
func (g *dummyGauge) Update(value interface{}) { | |
g.value = value | |
} | |
type dummyEvent struct { | |
title string | |
text string | |
tags Tags | |
} | |
func (g *dummyEvent) Send() { | |
} | |
func (g *dummyEvent) SendWithText(text string) { | |
g.text = text | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment