tracing

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SpanTagTenant    = "tenant"
	SpanTagUserId    = "user-id"
	SpanTagUserEmail = "user-email"
	SpanTagEntityId  = "entity-id"
	SpanTagComponent = "component"
)
View Source
const (
	SpanTagComponentPostgresRepository = "postgresRepository"
	SpanTagComponentRest               = "rest"
	SpanTagComponentGraphQL            = "graphql"
	SpanTagComponentCronJob            = "cronJob"
	SpanTagComponentService            = "service"
	SpanTagComponentListener           = "listener"
)

Variables

This section is empty.

Functions

func ExtractTextMapCarrier

func ExtractTextMapCarrier(spanCtx opentracing.SpanContext) opentracing.TextMapCarrier

func InjectTextMapCarrier

func InjectTextMapCarrier(spanCtx opentracing.SpanContext) (opentracing.TextMapCarrier, error)

func LogObjectAsJson

func LogObjectAsJson(span opentracing.Span, name string, object any)

func NewJaegerTracer

func NewJaegerTracer(jaegerConfig *JaegerConfig, log logger.Logger) (opentracing.Tracer, io.Closer, error)

func RecoverAndLogToJaeger

func RecoverAndLogToJaeger(appLogger logger.Logger)

func RecoveryWithJaeger

func RecoveryWithJaeger(tracer opentracing.Tracer) gin.HandlerFunc

func SetDefaultSpanTags added in v0.2.1

func SetDefaultSpanTags(ctx context.Context, span opentracing.Span)

func StartHttpServerTracerSpanWithHeader

func StartHttpServerTracerSpanWithHeader(ctx context.Context, operationName string, headers http.Header) (context.Context, opentracing.Span)

func StartRabbitMQMessageTracerSpanWithHeader

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

func StartTracerSpan

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

func TagComponentCronJob

func TagComponentCronJob(span opentracing.Span)

func TagComponentGraphql added in v0.1.2

func TagComponentGraphql(span opentracing.Span)

func TagComponentListener

func TagComponentListener(span opentracing.Span)

func TagComponentPostgresRepository

func TagComponentPostgresRepository(span opentracing.Span)

func TagComponentRest

func TagComponentRest(span opentracing.Span)

func TagComponentService

func TagComponentService(span opentracing.Span)

func TagEntity

func TagEntity(span opentracing.Span, entityId string)

func TagTenant

func TagTenant(span opentracing.Span, tenant string)

func TraceErr

func TraceErr(span opentracing.Span, err error, fields ...log.Field)

Types

type JaegerConfig

type JaegerConfig struct {
	Endpoint     string  `env:"JAEGER_ENDPOINT"`
	ServiceName  string  `env:"JAEGER_SERVICE_NAME" validate:"required"`
	AgentHost    string  `env:"JAEGER_AGENT_HOST" envDefault:"localhost" validate:"required"`
	AgentPort    string  `env:"JAEGER_AGENT_PORT" envDefault:"6831" validate:"required"`
	Enabled      bool    `env:"JAEGER_ENABLED" envDefault:"true"`
	LogSpans     bool    `env:"JAEGER_REPORTER_LOG_SPANS" envDefault:"false" `
	SamplerType  string  `env:"JAEGER_SAMPLER_TYPE" envDefault:"const" validate:"required"`
	SamplerParam float64 `env:"JAEGER_SAMPLER_PARAM" envDefault:"1" validate:"required"`
}

Jump to

Keyboard shortcuts

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