Documentation ¶
Index ¶
- func AddFlags(flags *flag.FlagSet)
- type Agent
- type Builder
- func (b *Builder) CreateAgent(logger *zap.Logger) (*Agent, error)
- func (b *Builder) GetProcessors(rep reporter.Reporter, mFactory metrics.Factory, logger *zap.Logger) ([]processors.Processor, error)
- func (b *Builder) InitFromViper(v *viper.Viper) *Builder
- func (b *Builder) WithMetricsFactory(mf metrics.Factory) *Builder
- func (b *Builder) WithReporter(r reporter.Reporter) *Builder
- type HTTPServerConfiguration
- type Model
- type ProcessorConfiguration
- type Protocol
- type ServerConfiguration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent服务包括两个作用: 1. Sampling Server, 获取采样策略 2. workers goroutine,当udp server获取到本地host上的client发送的trace包后,作为生产者把trace包发送到channel队列, 然后再workers作为消费者,从channel队列上抢占trace包, 最后通过handle的Process把trace包push给Collector server
func NewAgent ¶
func NewAgent( processors []processors.Processor, httpServer *http.Server, logger *zap.Logger, ) *Agent
NewAgent creates the new Agent.
type Builder ¶
type Builder struct { Processors []ProcessorConfiguration `yaml:"processors"` HTTPServer HTTPServerConfiguration `yaml:"httpServer"` Metrics jmetrics.Builder `yaml:"metrics"` tchreporter.Builder `yaml:",inline"` // contains filtered or unexported fields }
Builder用于构建Processors、HTTPServer等服务所需要的配置解析和创建相关服务
func (*Builder) CreateAgent ¶
CreateAgent方法用于创建agent,包括collector client、processors和httpServer
func (*Builder) GetProcessors ¶
func (b *Builder) GetProcessors(rep reporter.Reporter, mFactory metrics.Factory, logger *zap.Logger) ([]processors.Processor, error)
GetProcessors方法用于创建多个processors worker,并在每个processor中带有collector client(reporter) 每个processor server通过udp port监听微服务发过来的trace包, 并通过collector peers发送给collect server
func (*Builder) InitFromViper ¶
InitFromViper方法从processors中获取配置,并把获取到的配置存储到Builder实例中
包括:Processor数量, Server接收的队列长度、每次接收的最大packet大小、以及httpServer collector server peers
func (*Builder) WithMetricsFactory ¶
WithMetricsFactory sets an externally initialized metrics factory.
type HTTPServerConfiguration ¶
type HTTPServerConfiguration struct {
HostPort string `yaml:"hostPort" validate:"nonzero"`
}
HTTPServerConfiguration用于HTTPServer的服务端口
func (HTTPServerConfiguration) GetHTTPServer ¶
func (c HTTPServerConfiguration) GetHTTPServer(svc string, channel *tchannel.Channel, mFactory metrics.Factory) *http.Server
GetHTTPServer方法作为agent http server接收业务微服务的请求,用于获取采样策略、Baggage携带字段列表 agent http server的采样策略和Baggage携带字段列表,是通过CollectProxy获取collector server的采样策略和Baggage携带字段列表 route: / , /sampling 和 /baggageRestrictions
type ProcessorConfiguration ¶
type ProcessorConfiguration struct { Workers int `yaml:"workers"` Model Model `yaml:"model"` Protocol Protocol `yaml:"protocol"` Server ServerConfiguration `yaml:"server"` }
ProcessorConfiguration用于jaeger、zipkin的配置, 包括端口
func (*ProcessorConfiguration) GetThriftProcessor ¶
func (c *ProcessorConfiguration) GetThriftProcessor( mFactory metrics.Factory, factory thrift.TProtocolFactory, handler processors.AgentProcessor, logger *zap.Logger, ) (processors.Processor, error)
GetThriftProcessor方法通过Process配置,获取udp transport,以及初始化Processor
type ServerConfiguration ¶
type ServerConfiguration struct { QueueSize int `yaml:"queueSize"` MaxPacketSize int `yaml:"maxPacketSize"` HostPort string `yaml:"hostPort" validate:"nonzero"` }
ServerConfiguration用于上面的ProcessorConfiguration属性 Queue队列大小、Packet包大小