Path: blob/main/component/otelcol/receiver/zipkin/zipkin.go
4096 views
// Package zipkin provides an otelcol.receiver.zipkin component.1package zipkin23import (4"github.com/grafana/agent/component"5"github.com/grafana/agent/component/otelcol"6"github.com/grafana/agent/component/otelcol/receiver"7"github.com/grafana/agent/pkg/river"8"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver"9otelcomponent "go.opentelemetry.io/collector/component"10otelconfig "go.opentelemetry.io/collector/config"11)1213func init() {14component.Register(component.Registration{15Name: "otelcol.receiver.zipkin",16Args: Arguments{},1718Build: func(opts component.Options, args component.Arguments) (component.Component, error) {19fact := zipkinreceiver.NewFactory()20return receiver.New(opts, fact, args.(Arguments))21},22})23}2425// Arguments configures the otelcol.receiver.zipkin component.26type Arguments struct {27ParseStringTags bool `river:"parse_string_tags,attr,optional"`2829HTTPServer otelcol.HTTPServerArguments `river:",squash"`3031// Output configures where to send received data. Required.32Output *otelcol.ConsumerArguments `river:"output,block"`33}3435var (36_ receiver.Arguments = Arguments{}37_ river.Unmarshaler = (*Arguments)(nil)38)3940// DefaultArguments holds default settings for otelcol.receiver.zipkin.41var DefaultArguments = Arguments{42HTTPServer: otelcol.HTTPServerArguments{43Endpoint: "0.0.0.0:9411",44},45}4647// UnmarshalRiver applies defaults to args before unmarshaling.48func (args *Arguments) UnmarshalRiver(f func(interface{}) error) error {49*args = DefaultArguments5051type arguments Arguments52return f((*arguments)(args))53}5455// Convert implements receiver.Arguments.56func (args Arguments) Convert() (otelconfig.Receiver, error) {57return &zipkinreceiver.Config{58ReceiverSettings: otelconfig.NewReceiverSettings(otelconfig.NewComponentID("zipkin")),5960ParseStringTags: args.ParseStringTags,61HTTPServerSettings: *args.HTTPServer.Convert(),62}, nil63}6465// Extensions implements receiver.Arguments.66func (args Arguments) Extensions() map[otelconfig.ComponentID]otelcomponent.Extension {67return nil68}6970// Exporters implements receiver.Arguments.71func (args Arguments) Exporters() map[otelconfig.DataType]map[otelconfig.ComponentID]otelcomponent.Exporter {72return nil73}7475// NextConsumers implements receiver.Arguments.76func (args Arguments) NextConsumers() *otelcol.ConsumerArguments {77return args.Output78}798081