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: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultNumWorkers is the default number of workers consuming from the processor queue
	DefaultNumWorkers = 50
	// DefaultQueueSize is the size of the processor's queue
	DefaultQueueSize = 2000
)
View Source
const (
	// JaegerFormatType is for Jaeger Spans
	JaegerFormatType = "jaeger"
	// ZipkinFormatType is for zipkin Spans
	ZipkinFormatType = "zipkin"
	// UnknownFormatType is for spans that do not have a widely defined/well-known format type
	UnknownFormatType = "unknown"
)
View Source
const (
	// UnableToReadBodyErrFormat is an error message for invalid requests
	UnableToReadBodyErrFormat = "Unable to process request body: %v"
)

Variables

View Source
var Options options

Options is a factory for all available Option's

Functions

func NormalizeServiceName

func NormalizeServiceName(serviceName string) string

NormalizeServiceName converts service name to a lowercase string that is safe to use in metrics

Types

type APIHandler

type APIHandler struct {
	// contains filtered or unexported fields
}

APIHandler用于接收client通过http发送的trace包

注意:agent processor是通过tchannel框架发送的trace包,tcp连接

func NewAPIHandler

func NewAPIHandler(
	jaegerBatchesHandler JaegerBatchesHandler,
) *APIHandler

NewAPIHandler方法创建一个APIHandler实例, 这里只接收jaeger compact协议格式

func (*APIHandler) RegisterRoutes

func (aH *APIHandler) RegisterRoutes(router *mux.Router)

RegisterRoutes方法用于路由注册 http method: post http route: /api/traces http handler: APIHandler saveSpan

type CountsBySpanType

type CountsBySpanType struct {
	// ReceivedBySvc maintain by-service metrics for a format type
	ReceivedBySvc metricsBySvc
	// RejectedBySvc is the number of spans we rejected (usually due to blacklisting) by-service
	RejectedBySvc metricsBySvc
}

CountsBySpanType measures received, rejected, and receivedByService metrics for a format type

type FilterSpan

type FilterSpan func(span *model.Span) bool

FilterSpan decides whether to allow or disallow a span

type JaegerBatchesHandler

type JaegerBatchesHandler interface {
	// SubmitBatches records a batch of spans in Jaeger Thrift format
	SubmitBatches(ctx thrift.Context, batches []*jaeger.Batch) ([]*jaeger.BatchSubmitResponse, error)
}

JaegerBatchesHandler interface用于接收和处理jaeger batches

func NewJaegerSpanHandler

func NewJaegerSpanHandler(logger *zap.Logger, modelProcessor SpanProcessor) JaegerBatchesHandler

NewJaegerSpanHandler方法用于创建一个JaegerBatchedHandler实例

type Option

type Option func(c *options)

Option is a function that sets some option on StorageBuilder.

type ProcessSpan

type ProcessSpan func(span *model.Span)

ProcessSpan processes a Domain Model Span

func ChainedProcessSpan

func ChainedProcessSpan(spanProcessors ...ProcessSpan) ProcessSpan

ChainedProcessSpan chains spanProcessors as a single ProcessSpan call

type ProcessSpans

type ProcessSpans func(spans []*model.Span)

ProcessSpans processes a batch of Domain Model Spans

type SpanProcessor

type SpanProcessor interface {
	// ProcessSpans processes model spans and return with either a list of true/false success or an error
	ProcessSpans(mSpans []*model.Span, spanFormat string) ([]bool, error)
}

SpanProcessor interface用于处理model spans, 主要是spans入channel队列,等待消费者消费并通过saveSpans方法存储model.Span

func NewSpanProcessor

func NewSpanProcessor(
	spanWriter spanstore.Writer,
	opts ...Option,
) SpanProcessor

NewSpanProcessor方法创建一个SpanProcessor,并提供5个链式处理,类似于插件形式 包括:preProcesses预处理,filters过滤,queues,sanitizes和process models

type SpanProcessorMetrics

type SpanProcessorMetrics struct {
	// SaveLatency measures how long the actual save to storage takes
	SaveLatency metrics.Timer
	// InQueueLatency measures how long the span spends in the queue
	InQueueLatency metrics.Timer
	// SpansDropped measures the number of spans we discarded because the queue was full
	SpansDropped metrics.Counter
	// BatchSize measures the span batch size
	BatchSize metrics.Gauge // size of span batch
	// QueueLength measures the size of the internal span queue
	QueueLength metrics.Gauge
	// ErrorBusy counts number of return ErrServerBusy
	ErrorBusy metrics.Counter
	// SavedBySvc contains span and trace counts by service
	SavedBySvc metricsBySvc // spans actually saved
	// contains filtered or unexported fields
}

SpanProcessorMetrics contains all the necessary metrics for the SpanProcessor

func NewSpanProcessorMetrics

func NewSpanProcessorMetrics(serviceMetrics metrics.Factory, hostMetrics metrics.Factory, otherFormatTypes []string) *SpanProcessorMetrics

NewSpanProcessorMetrics returns a SpanProcessorMetrics

func (*SpanProcessorMetrics) GetCountsForFormat

func (m *SpanProcessorMetrics) GetCountsForFormat(spanFormat string) CountsBySpanType

GetCountsForFormat gets the countsBySpanType for a given format. If none exists, we use the Unknown format.

type ZipkinSpansHandler

type ZipkinSpansHandler interface {
	// SubmitZipkinBatch records a batch of spans in Zipkin Thrift format
	SubmitZipkinBatch(ctx thrift.Context, spans []*zipkincore.Span) ([]*zipkincore.Response, error)
}

ZipkinSpansHandler interface用于接收和存储zipkin spans

func NewZipkinSpanHandler

func NewZipkinSpanHandler(logger *zap.Logger, modelHandler SpanProcessor, sanitizer zipkinS.Sanitizer) ZipkinSpansHandler

NewZipkinSpanHandler创建一个ZipkinSpansHandler实例

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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