app

package
v0.0.0-...-132f1c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2018 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFlags

func AddFlags(flags *flag.FlagSet)

AddFlags方法在main.go中以多配置集合的方式使用 config.AddFlags(...app.AddFlags...) 默认配置: zipkin/jaeger compact/binary 以及形成各个processor的服务端口号

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.

func (*Agent) HTTPAddr

func (a *Agent) HTTPAddr() string

HTTPAddr returns the address that HTTP server is listening on

func (*Agent) Run

func (a *Agent) Run() error

Run方法启动tcp server,同时启动worker goroutines

func (*Agent) Stop

func (a *Agent) Stop()

Stop forces all agent go routines to exit.

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

func (b *Builder) CreateAgent(logger *zap.Logger) (*Agent, error)

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

func (b *Builder) InitFromViper(v *viper.Viper) *Builder

InitFromViper方法从processors中获取配置,并把获取到的配置存储到Builder实例中

包括:Processor数量, Server接收的队列长度、每次接收的最大packet大小、以及httpServer collector server peers

func (*Builder) WithMetricsFactory

func (b *Builder) WithMetricsFactory(mf metrics.Factory) *Builder

WithMetricsFactory sets an externally initialized metrics factory.

func (*Builder) WithReporter

func (b *Builder) WithReporter(r reporter.Reporter) *Builder

WithReporter adds auxiliary reporters.

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 Model

type Model string

Model 数据传输方式:jaeger、zipkin

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 Protocol

type Protocol string

Protocol 数据传入协议:compact、binary

type ServerConfiguration

type ServerConfiguration struct {
	QueueSize     int    `yaml:"queueSize"`
	MaxPacketSize int    `yaml:"maxPacketSize"`
	HostPort      string `yaml:"hostPort" validate:"nonzero"`
}

ServerConfiguration用于上面的ProcessorConfiguration属性 Queue队列大小、Packet包大小

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL