Documentation ¶
Index ¶
- Constants
- Variables
- func NormalizeServiceName(serviceName string) string
- type APIHandler
- type FilterSpan
- type GRPCHandler
- type InboundTransport
- type JaegerBatchesHandler
- type Option
- type ProcessSpan
- type ProcessSpans
- type ProcessSpansOptions
- type SpanCounts
- type SpanCountsByFormat
- type SpanCountsByTransport
- type SpanFormat
- type SpanProcessor
- type SpanProcessorMetrics
- type SubmitBatchOptions
- type TChannelHandler
- type ZipkinSpansHandler
Constants ¶
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 )
const (
// UnableToReadBodyErrFormat is an error message for invalid requests
UnableToReadBodyErrFormat = "Unable to process request body: %v"
)
Variables ¶
var Options options
Options is a factory for all available Option's
Functions ¶
func NormalizeServiceName ¶
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 ¶
FilterSpan decides whether to allow or disallow a span
type GRPCHandler ¶
type GRPCHandler struct {
// contains filtered or unexported fields
}
GRPCHandler implements gRPC CollectorService.
func NewGRPCHandler ¶
func NewGRPCHandler(logger *zap.Logger, spanProcessor SpanProcessor) *GRPCHandler
NewGRPCHandler registers routes for this handler on the given router.
func (*GRPCHandler) PostSpans ¶
func (g *GRPCHandler) PostSpans(ctx context.Context, r *api_v2.PostSpansRequest) (*api_v2.PostSpansResponse, error)
PostSpans implements gRPC CollectorService.
type InboundTransport ¶
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 ¶
ProcessSpan processes a Domain Model Span
func ChainedProcessSpan ¶
func ChainedProcessSpan(spanProcessors ...ProcessSpan) ProcessSpan
ChainedProcessSpan chains spanProcessors as a single ProcessSpan call
type ProcessSpans ¶
ProcessSpans processes a batch of Domain Model Spans
type ProcessSpansOptions ¶
type ProcessSpansOptions struct { SpanFormat SpanFormat InboundTransport InboundTransport }
ProcessSpansOptions additional options passed to processor along with the spans.
type SpanCounts ¶
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 countrs for received and rejected spans.
type SpanCountsByFormat ¶
type SpanCountsByFormat map[SpanFormat]SpanCountsByTransport
SpanCountsByFormat groups metrics by different span formats (thrift, proto, etc.)
type SpanCountsByTransport ¶
type SpanCountsByTransport map[InboundTransport]SpanCounts
SpanCountsByTransport groups metrics by inbound transport (e.g http, grpc, tchannel)
type SpanFormat ¶
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 ¶
type SubmitBatchOptions struct {
InboundTransport InboundTransport
}
SubmitBatchOptions are passed to Submit methods of the handlers.
type TChannelHandler ¶
type TChannelHandler struct {
// contains filtered or unexported fields
}
TChannelHandler implements jaeger.TChanCollector and zipkincore.TChanZipkinCollector.
func NewTChannelHandler ¶
func NewTChannelHandler( jaegerHandler JaegerBatchesHandler, zipkinHandler ZipkinSpansHandler, ) *TChannelHandler
NewTChannelHandler creates new handler that implements both Jaeger and Zipkin endpoints.
func (*TChannelHandler) SubmitBatches ¶
func (h *TChannelHandler) SubmitBatches( _ thrift.Context, batches []*jaeger.Batch, ) ([]*jaeger.BatchSubmitResponse, error)
SubmitBatches implements jaeger.TChanCollector.
func (*TChannelHandler) SubmitZipkinBatch ¶
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