jaeger

package
v3.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: Apache-2.0 Imports: 16 Imported by: 3

README

Jaeger

This package contains filter for generating jaeger span

Usage

Importing
import "github.com/AccelByte/go-restful-plugins/v3/pkg/jaeger"
Filter

Filter is restful.FilterFunction for generating jaeger span using zipkin headers

Example usage of filter for all endpoints
    span := GetSpanFromRestfulContext(request.Request.Context())
    
    // to add a tag
    AddTag(span, "exampleTag", "tag_value")

    //to add a baggage item
    AddBaggage(span, "exampleBaggage", "example")

    // to add a log
    AddLog(span, "exampleLog", "example")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBaggage

func AddBaggage(span opentracing.Span, key string, value string)

AddBaggage to add baggage in span if span is valid sets a key:value pair on this Span and its SpanContext that also propagates to descendants of this Span.

func AddLog

func AddLog(span opentracing.Span, key string, value string)

AddLog to add string log in span if span is valid

func AddTag

func AddTag(span opentracing.Span, key string, value string)

AddTag to add tag in span if span is valid

func ChildSpanFromRemoteSpan

func ChildSpanFromRemoteSpan(
	rootCtx context.Context,
	name string,
	spanContextStr string,
) (opentracing.Span, context.Context)

func ExtractRequestHeader

func ExtractRequestHeader(req *restful.Request) (opentracing.SpanContext, error)

ExtractRequestHeader to extract SpanContext from request header

func Filter

func Filter() restful.FilterFunction

func Finish

func Finish(span opentracing.Span)

Finish to finish span if it is exist

func GetSpanContextString

func GetSpanContextString(span opentracing.Span) string

func GetSpanFromRestfulContext

func GetSpanFromRestfulContext(ctx context.Context) opentracing.Span

GetSpanFromRestfulContext get crated by jaeger Filter span from the context

func InitGlobalTracer

func InitGlobalTracer(
	jaegerAgentHost string,
	jaegerCollectorEndpoint string,
	serviceName string,
	realm string,
) io.Closer

InitGlobalTracer initialize global tracer Must be called in main function

func InjectSpanIntoRequest

func InjectSpanIntoRequest(span opentracing.Span, req *http.Request) error

func InjectTrace

func InjectTrace(ctx context.Context, incomingReq *restful.Request,
	outgoingReq *http.Request) (*http.Request, opentracing.Span, context.Context)

InjectTrace to inject request header with context from current span Span returned here must be finished with span.finish() Any span not finished will not be sent to jaeger agent

func StartChildSpan

func StartChildSpan(span opentracing.Span, name string) opentracing.Span

func StartDBSpan

func StartDBSpan(ctx context.Context, operationName string) (opentracing.Span, context.Context)

StartDBSpan start DBSpan from context. Span returned here must be finished with span.finish() Any span not finished will not be sent to jaeger agent

func StartSpan

func StartSpan(req *restful.Request, operationName string) (opentracing.Span, context.Context)

StartSpan to start a new child span from restful.Request Span returned here must be finished with span.finish() Any span not finished will not be sent to jaeger agent

func StartSpanFromContext

func StartSpanFromContext(ctx context.Context, operationName string) (opentracing.Span, context.Context)

StartSpanFromContext start span from context if context != nil. Span returned here must be finished with span.finish() Any span not finished will not be sent to jaeger agent

func StartSpanIfParentSpanExist

func StartSpanIfParentSpanExist(req *restful.Request, operationName string) (opentracing.Span, context.Context)

StartSpanIfParentSpanExist to start a new child span from restful.Request if it contain SpanContext For example this function can be used in healthz endpoint,when we want to omit request from kubernetes liveness probe Span returned here must be finished with span.finish() Any span not finished will not be sent to jaeger agent

func TraceError

func TraceError(span opentracing.Span, err error)

TraceError sends a log and a tag with Error into tracer

func TraceSQLQuery

func TraceSQLQuery(span opentracing.Span, query string)

TraceSQLQuery sends a log with SQL query into tracer

Types

This section is empty.

Jump to

Keyboard shortcuts

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