-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
consumer.go
42 lines (33 loc) · 1.09 KB
/
consumer.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
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package internal // import "go.opentelemetry.io/collector/consumer/internal"
// Capabilities describes the capabilities of a Processor.
type Capabilities struct {
// MutatesData is set to true if Consume* function of the
// processor modifies the input Traces, Logs or Metrics argument.
// Processors which modify the input data MUST set this flag to true. If the processor
// does not modify the data it MUST set this flag to false. If the processor creates
// a copy of the data before modifying then this flag can be safely set to false.
MutatesData bool
}
type BaseConsumer interface {
Capabilities() Capabilities
}
type BaseImpl struct {
Cap Capabilities
}
// Option to construct new consumers.
type Option func(*BaseImpl)
// Capabilities returns the capabilities of the component
func (bs BaseImpl) Capabilities() Capabilities {
return bs.Cap
}
func NewBaseImpl(options ...Option) *BaseImpl {
bs := &BaseImpl{
Cap: Capabilities{MutatesData: false},
}
for _, op := range options {
op(bs)
}
return bs
}