-
Notifications
You must be signed in to change notification settings - Fork 8
/
rcvr_base.go
47 lines (40 loc) · 1.32 KB
/
rcvr_base.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
package trace2receiver
import (
"context"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/receiver"
"go.uber.org/zap"
)
type Rcvr_Base struct {
// These fields should be set in ctor() in platform_*.go:createTraces()
// when it is called from factory.go:NewFactory().
Settings receiver.Settings
Logger *zap.Logger
TracesConsumer consumer.Traces
MetricsConsumer consumer.Metrics
LogsConsumer consumer.Logs
RcvrConfig *Config
// Component properties set in Start()
ctx context.Context
host component.Host
cancel context.CancelFunc
}
// `Start()` handles base-class portions of receiver initialization.
func (rcvr_base *Rcvr_Base) Start(unused_ctx context.Context, host component.Host) error {
rcvr_base.host = host
rcvr_base.ctx = context.Background()
rcvr_base.ctx, rcvr_base.cancel = context.WithCancel(rcvr_base.ctx)
if rcvr_base.RcvrConfig.AllowCommandControlVerbs {
rcvr_base.Logger.Info("Command verbs are enabled")
}
if rcvr_base.RcvrConfig.piiSettings != nil {
if rcvr_base.RcvrConfig.piiSettings.Include.Hostname {
rcvr_base.Logger.Info("PII: Hostname logging is enabled")
}
if rcvr_base.RcvrConfig.piiSettings.Include.Username {
rcvr_base.Logger.Info("PII: Username logging is enabled")
}
}
return nil
}