import "github.com/cloudfoundry/dropsonde/metric_sender/fake" func TestMyMetric(t *testing.T) { ms := &fake.FakeMetricSender{} counter := ms.GetCounter("my_metric_name") counter.Increment() // assert that the metric was emitted correctly }
import "github.com/cloudfoundry/dropsonde/metric_sender/fake" func main() { ms := &fake.FakeMetricSender{} counter := ms.GetCounter("login_attempts") // execute authentication logic... counter.Increment() }In this example, a FakeMetricSender instance is created for use in an application. A new CounterMetric instance is obtained via the `GetCounter` method and is then incremented to track the number of login attempts made by users of the application.