forked from stripe/veneur
/
blackhole.go
67 lines (51 loc) · 1.63 KB
/
blackhole.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package blackhole
import (
"context"
"github.com/stripe/veneur/samplers"
"github.com/stripe/veneur/sinks"
"github.com/stripe/veneur/ssf"
"github.com/stripe/veneur/trace"
)
type blackholeMetricSink struct {
}
var _ sinks.MetricSink = &blackholeMetricSink{}
// NewBlackholeMetricSink creates a new blackholeMetricSink. This sink does
// nothing at flush time, effectively "black holing" any metrics that are flushed.
// It is useful for tests that do not require any inspect of flushed metrics.
func NewBlackholeMetricSink() (*blackholeMetricSink, error) {
return &blackholeMetricSink{}, nil
}
func (b *blackholeMetricSink) Name() string {
return "blackhole"
}
func (b *blackholeMetricSink) Start(*trace.Client) error {
return nil
}
func (b *blackholeMetricSink) Flush(context.Context, []samplers.InterMetric) error {
return nil
}
func (b *blackholeMetricSink) FlushOtherSamples(ctx context.Context, samples []ssf.SSFSample) {
return
}
type blackholeSpanSink struct {
}
var _ sinks.SpanSink = &blackholeSpanSink{}
// NewBlackholeSpanSink creates a new blackholeSpanSink. This sink does
// nothing at flush time, effectively "black holing" any spans that are flushed.
// It is useful for tests that do not require any inspect of flushed spans.
func NewBlackholeSpanSink() (*blackholeSpanSink, error) {
return &blackholeSpanSink{}, nil
}
func (b *blackholeSpanSink) Name() string {
return "blackhole"
}
// Start performs final adjustments on the sink.
func (b *blackholeSpanSink) Start(*trace.Client) error {
return nil
}
func (b *blackholeSpanSink) Ingest(*ssf.SSFSpan) error {
return nil
}
func (b *blackholeSpanSink) Flush() {
return
}