trace

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

View Source
const (
	PIPELINE    = "pipeline"
	DATABASE    = "database"
	HTTP_CLIENT = "http_client"
	GRPC_CLIENT = "grpc_client"
	HTTP_SERVER = "http_server"
	GRPC_SERVER = "grpc_server"
	INTERNAL    = "internal"
	EXTERNAL    = "external"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DatabaseTraceFinishFunc

type DatabaseTraceFinishFunc func(context.Context, ...DatabaseTraceFinishOption)

type DatabaseTraceFinishOption

type DatabaseTraceFinishOption func(*DatabaseTraceFinishOptions)

func WithDBError

func WithDBError(err error) DatabaseTraceFinishOption

type DatabaseTraceFinishOptions

type DatabaseTraceFinishOptions struct {
	Error error
}

type DatabaseTraceOption

type DatabaseTraceOption func(*DatabaseTraceOptions)

Database trace options

func WithDBName

func WithDBName(dbName string) DatabaseTraceOption

func WithDBSql

func WithDBSql(sql string) DatabaseTraceOption

func WithDBTableName

func WithDBTableName(tableName string) DatabaseTraceOption

type DatabaseTraceOptions

type DatabaseTraceOptions struct {
	DBName      string
	DBTableName string
	DBSql       string
}

type ExternalTraceFinishFunc

type ExternalTraceFinishFunc func(context.Context, ...ExternalTraceFinishOption)

type ExternalTraceFinishOption

type ExternalTraceFinishOption func(*ExternalTraceFinishOptions)

func WithExternalResponse

func WithExternalResponse(res interface{}) ExternalTraceFinishOption

type ExternalTraceFinishOptions

type ExternalTraceFinishOptions struct {
	Response interface{}
}

type ExternalTraceOption

type ExternalTraceOption func(*ExternalTraceOptions)

External trace options

func WithExternalEndpoint

func WithExternalEndpoint(endpoint string) ExternalTraceOption

func WithExternalServiceName

func WithExternalServiceName(serviceName string) ExternalTraceOption

type ExternalTraceOptions

type ExternalTraceOptions struct {
	DestServiceName string
	Endpoint        string
	Request         interface{}
}

type GrpcTraceFinishFunc

type GrpcTraceFinishFunc func(context.Context, ...GrpcTraceFinishOption)

type GrpcTraceFinishOption

type GrpcTraceFinishOption func(*GrpcTraceFinishOptions)

func WithGrpcError

func WithGrpcError(err error) GrpcTraceFinishOption

type GrpcTraceFinishOptions

type GrpcTraceFinishOptions struct {
	Error error
}

type GrpcTraceOption

type GrpcTraceOption func(*GrpcTraceOptions)

GRPC trace options

type GrpcTraceOptions

type GrpcTraceOptions struct{}

type HttpClientTraceFinishFunc

type HttpClientTraceFinishFunc func(context.Context, ...HttpClientTraceFinishOption)

type HttpClientTraceFinishOption

type HttpClientTraceFinishOption func(*HttpClientTraceFinishOptions)

func WithHttpResponse

func WithHttpResponse(response *http.Response) HttpClientTraceFinishOption

type HttpClientTraceFinishOptions

type HttpClientTraceFinishOptions struct {
	Response *http.Response
}

type HttpClientTraceOption

type HttpClientTraceOption func(*HttpClientTraceOptions)

HTTP trace options

func WithHttpRequest

func WithHttpRequest(request *http.Request) HttpClientTraceOption

type HttpClientTraceOptions

type HttpClientTraceOptions struct {
	Request *http.Request
}

type InternalTraceFinishFunc

type InternalTraceFinishFunc func(context.Context, ...InternalTraceFinishOption)

type InternalTraceFinishOption

type InternalTraceFinishOption func(*InternalTraceFinishOptions)

func WithErrorResponse

func WithErrorResponse(err error) InternalTraceFinishOption

func WithInternalResponse

func WithInternalResponse(response interface{}) InternalTraceFinishOption

type InternalTraceFinishOptions

type InternalTraceFinishOptions struct {
	Response interface{}
	Error    error
}

type InternalTraceOption

type InternalTraceOption func(*InternalTraceOptions)

Internal trace options

func WithInternalRequest

func WithInternalRequest(request interface{}) InternalTraceOption

type InternalTraceOptions

type InternalTraceOptions struct {
	Request interface{}
}

type SpanFinishFunc

type SpanFinishFunc func(context.Context, interface{})

type SpanInfo

type SpanInfo struct {
	TraceID string
	SpanID  string
}

type Tracer

type Tracer interface {
	// Extract span info from the context
	ExtractSpanInfo(context.Context) *SpanInfo

	// Used for tracing HTTP Client Call
	StartHttpClientTrace(ctx context.Context, spanName string, opts ...HttpClientTraceOption) (context.Context, HttpClientTraceFinishFunc)

	// Used for tracing GRPC Client Call
	StartGrpcClientTrace(ctx context.Context, spanName string, opts ...GrpcTraceOption) (context.Context, GrpcTraceFinishFunc)

	// Used for tracing DATABASE call
	StartDatabaseTrace(ctx context.Context, spanName string, opts ...DatabaseTraceOption) (context.Context, DatabaseTraceFinishFunc)

	// Used for tracing other external services (queue, cache,...)
	StartExternalTrace(ctx context.Context, spanName string, opts ...ExternalTraceOption) (context.Context, ExternalTraceFinishFunc)

	// Used for tracing interal functions
	StartInternalTrace(ctx context.Context, spanName string, opts ...InternalTraceOption) (context.Context, InternalTraceFinishFunc)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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