app

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: Apache-2.0 Imports: 21 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 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 CountsBySpanType

type CountsBySpanType struct {
	// Received is the actual number of spans received from upstream
	Received metrics.Counter
	// Rejected is the number of spans we rejected (usually due to blacklisting)
	Rejected metrics.Counter
	// ReceivedBySvc maintain by-service metrics for a format type
	ReceivedBySvc 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 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 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 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 {
	// 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 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
sampling

Jump to

Keyboard shortcuts

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