-
Notifications
You must be signed in to change notification settings - Fork 486
/
zipkin.go
72 lines (59 loc) · 2.06 KB
/
zipkin.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
68
69
70
71
72
// Package zipkin provides an otelcol.receiver.zipkin component.
package zipkin
import (
"github.com/grafana/agent/component"
"github.com/grafana/agent/component/otelcol"
"github.com/grafana/agent/component/otelcol/receiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver"
otelcomponent "go.opentelemetry.io/collector/component"
otelextension "go.opentelemetry.io/collector/extension"
)
func init() {
component.Register(component.Registration{
Name: "otelcol.receiver.zipkin",
Args: Arguments{},
Build: func(opts component.Options, args component.Arguments) (component.Component, error) {
fact := zipkinreceiver.NewFactory()
return receiver.New(opts, fact, args.(Arguments))
},
})
}
// Arguments configures the otelcol.receiver.zipkin component.
type Arguments struct {
ParseStringTags bool `river:"parse_string_tags,attr,optional"`
HTTPServer otelcol.HTTPServerArguments `river:",squash"`
// Output configures where to send received data. Required.
Output *otelcol.ConsumerArguments `river:"output,block"`
}
var (
_ receiver.Arguments = Arguments{}
)
// DefaultArguments holds default settings for otelcol.receiver.zipkin.
var DefaultArguments = Arguments{
HTTPServer: otelcol.HTTPServerArguments{
Endpoint: "0.0.0.0:9411",
},
}
// SetToDefault implements river.Defaulter.
func (args *Arguments) SetToDefault() {
*args = DefaultArguments
}
// Convert implements receiver.Arguments.
func (args Arguments) Convert() (otelcomponent.Config, error) {
return &zipkinreceiver.Config{
ParseStringTags: args.ParseStringTags,
HTTPServerSettings: *args.HTTPServer.Convert(),
}, nil
}
// Extensions implements receiver.Arguments.
func (args Arguments) Extensions() map[otelcomponent.ID]otelextension.Extension {
return nil
}
// Exporters implements receiver.Arguments.
func (args Arguments) Exporters() map[otelcomponent.DataType]map[otelcomponent.ID]otelcomponent.Component {
return nil
}
// NextConsumers implements receiver.Arguments.
func (args Arguments) NextConsumers() *otelcol.ConsumerArguments {
return args.Output
}