app

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2019 License: Apache-2.0 Imports: 24 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 (
	// 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 handles all HTTP calls to the collector

func NewAPIHandler

func NewAPIHandler(
	jaegerBatchesHandler JaegerBatchesHandler,
) *APIHandler

NewAPIHandler returns a new APIHandler

func (*APIHandler) RegisterRoutes

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

RegisterRoutes registers routes for this handler on the given router

type FilterSpan

type FilterSpan func(span *model.Span) bool

FilterSpan decides whether to allow or disallow a span

type GRPCHandler added in v1.9.0

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

GRPCHandler implements gRPC CollectorService.

func NewGRPCHandler added in v1.9.0

func NewGRPCHandler(logger *zap.Logger, spanProcessor SpanProcessor) *GRPCHandler

NewGRPCHandler registers routes for this handler on the given router.

func (*GRPCHandler) PostSpans added in v1.9.0

PostSpans implements gRPC CollectorService.

type InboundTransport added in v1.12.0

type InboundTransport string

InboundTransport identifies the transport used to receive spans.

const (
	// GRPCTransport indicates spans received over gRPC.
	GRPCTransport InboundTransport = "grpc"
	// TChannelTransport indicates spans received over TChannel.
	TChannelTransport InboundTransport = "tchannel"
	// HTTPTransport indicates spans received over HTTP.
	HTTPTransport InboundTransport = "http"
	// UnknownTransport is the fallback/catch-all category.
	UnknownTransport InboundTransport = "unknown"
)

type JaegerBatchesHandler

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

JaegerBatchesHandler consumes and handles Jaeger batches

func NewJaegerSpanHandler

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

NewJaegerSpanHandler returns a JaegerBatchesHandler

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 ProcessSpansOptions added in v1.12.0

type ProcessSpansOptions struct {
	SpanFormat       SpanFormat
	InboundTransport InboundTransport
}

ProcessSpansOptions additional options passed to processor along with the spans.

type SpanCounts added in v1.12.0

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

SpanCounts contains counts for received and rejected spans.

type SpanCountsByFormat added in v1.12.0

type SpanCountsByFormat map[SpanFormat]SpanCountsByTransport

SpanCountsByFormat groups metrics by different span formats (thrift, proto, etc.)

type SpanCountsByTransport added in v1.12.0

type SpanCountsByTransport map[InboundTransport]SpanCounts

SpanCountsByTransport groups metrics by inbound transport (e.g http, grpc, tchannel)

type SpanFormat added in v1.12.0

type SpanFormat string

SpanFormat identifies the data format in which the span was originally received.

const (
	// JaegerSpanFormat is for Jaeger Thrift spans.
	JaegerSpanFormat SpanFormat = "jaeger"
	// ZipkinSpanFormat is for Zipkin Thrift spans.
	ZipkinSpanFormat SpanFormat = "zipkin"
	// ProtoSpanFormat is for Jaeger protobuf Spans.
	ProtoSpanFormat SpanFormat = "proto"
	// UnknownSpanFormat is the fallback/catch-all category.
	UnknownSpanFormat SpanFormat = "unknown"
)

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, options ProcessSpansOptions) ([]bool, error)
}

SpanProcessor handles model spans

func NewSpanProcessor

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

NewSpanProcessor returns a SpanProcessor that preProcesses, filters, queues, sanitizes, and processes spans

type SpanProcessorMetrics

type SpanProcessorMetrics struct {
	//TODO - initialize metrics in the traditional factory way. Initialize map afterward.
	// 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
	// SavedOkBySvc contains span and trace counts by service
	SavedOkBySvc  metricsBySvc // spans actually saved
	SavedErrBySvc metricsBySvc // spans failed to save
	// 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 []SpanFormat) *SpanProcessorMetrics

NewSpanProcessorMetrics returns a SpanProcessorMetrics

func (*SpanProcessorMetrics) GetCountsForFormat

func (m *SpanProcessorMetrics) GetCountsForFormat(spanFormat SpanFormat, transport InboundTransport) SpanCounts

GetCountsForFormat gets the SpanCounts for a given format and transport. If none exists, we use the Unknown format.

type SubmitBatchOptions added in v1.12.0

type SubmitBatchOptions struct {
	InboundTransport InboundTransport
}

SubmitBatchOptions are passed to Submit methods of the handlers.

type TChannelHandler added in v1.12.0

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

TChannelHandler implements jaeger.TChanCollector and zipkincore.TChanZipkinCollector.

func NewTChannelHandler added in v1.12.0

func NewTChannelHandler(
	jaegerHandler JaegerBatchesHandler,
	zipkinHandler ZipkinSpansHandler,
) *TChannelHandler

NewTChannelHandler creates new handler that implements both Jaeger and Zipkin endpoints.

func (*TChannelHandler) SubmitBatches added in v1.12.0

func (h *TChannelHandler) SubmitBatches(
	_ thrift.Context,
	batches []*jaeger.Batch,
) ([]*jaeger.BatchSubmitResponse, error)

SubmitBatches implements jaeger.TChanCollector.

func (*TChannelHandler) SubmitZipkinBatch added in v1.12.0

func (h *TChannelHandler) SubmitZipkinBatch(
	_ thrift.Context,
	spans []*zipkincore.Span,
) ([]*zipkincore.Response, error)

SubmitZipkinBatch implements zipkincore.TChanZipkinCollector.

type ZipkinSpansHandler

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

ZipkinSpansHandler consumes and handles zipkin spans

func NewZipkinSpanHandler

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

NewZipkinSpanHandler returns a ZipkinSpansHandler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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