Skip to content

Commit f9cb13a

Browse files
authored
Update sink code to latest go-metrics interface (goadesign#1338)
1 parent 01abc03 commit f9cb13a

File tree

3 files changed

+10
-25
lines changed

3 files changed

+10
-25
lines changed

.golint_exclude

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
^examples/cellar/app
33
^examples/cellar/client
44
^examples/cellar/swagger
5+
^metrics.go

metrics.go

+7-14
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,13 @@ func NewNoOpSink() metrics.MetricSink {
4545
// NoOpSink default NOOP metrics recorder
4646
type NoOpSink struct{}
4747

48-
// SetGauge method
49-
func (md *NoOpSink) SetGauge(key []string, val float32) {}
50-
51-
// EmitKey method
52-
func (md *NoOpSink) EmitKey(key []string, val float32) {}
53-
54-
// IncrCounter method
55-
func (md *NoOpSink) IncrCounter(key []string, val float32) {}
56-
57-
// AddSample method
58-
func (md *NoOpSink) AddSample(key []string, val float32) {}
59-
60-
// MeasureSince method
61-
func (md *NoOpSink) MeasureSince(key []string, start time.Time) {}
48+
func (*NoOpSink) SetGauge(key []string, val float32) {}
49+
func (*NoOpSink) SetGaugeWithLabels(key []string, val float32, labels []metrics.Label) {}
50+
func (*NoOpSink) EmitKey(key []string, val float32) {}
51+
func (*NoOpSink) IncrCounter(key []string, val float32) {}
52+
func (*NoOpSink) IncrCounterWithLabels(key []string, val float32, labels []metrics.Label) {}
53+
func (*NoOpSink) AddSample(key []string, val float32) {}
54+
func (*NoOpSink) AddSampleWithLabels(key []string, val float32, labels []metrics.Label) {}
6255

6356
// NewMetrics initializes goa's metrics instance with the supplied
6457
// configuration and metrics sink

metrics_test.go

+2-11
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,13 @@ import (
1111
"github.com/armon/go-metrics"
1212
)
1313

14-
// mock metrics
15-
type mockSink struct{}
16-
17-
func (m *mockSink) SetGauge(key []string, val float32) {}
18-
func (m *mockSink) EmitKey(key []string, val float32) {}
19-
func (m *mockSink) IncrCounter(key []string, val float32) {}
20-
func (m *mockSink) AddSample(key []string, val float32) {}
21-
func (m *mockSink) MeasureSince(key []string, start time.Time) {}
22-
2314
var _ = Describe("Metrics", func() {
2415
var keys = [6]string{}
2516
var metriks *metrics.Metrics
26-
var sink *mockSink
17+
var sink *goa.NoOpSink
2718

2819
BeforeEach(func() {
29-
sink = &mockSink{}
20+
sink = &goa.NoOpSink{}
3021

3122
var err error
3223
metriks, err = metrics.New(metrics.DefaultConfig("UnitTest Service"), sink)

0 commit comments

Comments
 (0)