interfaces

package
v1.0.100 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: MIT Imports: 7 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultAllowLogging = []string{
	"application/grpc",
	"application/grpc-web",
	"application/grpc-web-text",
	"application/json",
	"application/xml",
	"application/rabbitmq",
	"application/kafka",
}
View Source
var TracingConfigManual = map[string]string{
	"tracing:jaeger:enable":   `enable jaeger tracing`,
	"tracing:jaeger:url":      `like 10.10.10.10:6831`,
	"tracing:jaeger:endpoint": `like http://10.10.10.10:14268/api/traces`,
}

Functions

func ErrorStack

func ErrorStack(msg interface{}, stack interface{}) []byte

func GetInteractionError

func GetInteractionError(opts []InteractionOption) (name error)

func GetInteractionKind added in v1.0.0

func GetInteractionKind(opts []InteractionOption) (kind trace.SpanKind)

func GetInteractionName

func GetInteractionName(opts []InteractionOption) (name string)

func GetInteractionRequest

func GetInteractionRequest(opts []InteractionOption) (value *http.Request)

func GetInteractionTypeType

func GetInteractionTypeType(opts []InteractionOption) (name string)

func InteractionKindServerToString added in v1.0.0

func InteractionKindServerToString(kind trace.SpanKind) string

func SetManual

func SetManual(man map[string]string) map[string]string

Types

type ContextSpan

type ContextSpan string
const ContextRootSpan ContextSpan = "rootSpan"

type DefaultLogSpanSave added in v1.0.0

type DefaultLogSpanSave struct {
	RequestHeader  bool
	RequestBody    bool
	ResponseHeader bool
	ResponseBody   bool
}

type DefaultMsgFormat added in v0.0.9

type DefaultMsgFormat struct {
	File string      `json:"file"`
	Line int         `json:"line"`
	Data interface{} `json:"data"`
}

type EncryptionProvider added in v1.0.0

type EncryptionProvider interface {
	Encrypt(data []byte) (meta string, res []byte, err error)
	Decrypt(meta string, data []byte) (res []byte, err error)
}

type ErrorDetails

type ErrorDetails struct {
	Msg   interface{} `json:"msg"`
	Stack interface{} `json:"stack"`
}

type Interaction

type Interaction interface {
	OutgoingContext() context.Context
	IncomingContext() context.Context
	SetLog(key string, val interface{})
	SetTagString(key, value string)
	SetTagBool(key string, value bool)
	SetTagInt(key string, value int)
	Error(error)
	Fatal()
	StatusOK(des string)
	Finish()
}

type InteractionError

type InteractionError struct {
	// contains filtered or unexported fields
}

func (*InteractionError) Type

func (*InteractionError) Value

func (c *InteractionError) Value() interface{}

type InteractionKind added in v1.0.0

type InteractionKind struct {
	// contains filtered or unexported fields
}

func (*InteractionKind) Type added in v1.0.0

func (*InteractionKind) Value added in v1.0.0

func (c *InteractionKind) Value() interface{}

type InteractionName

type InteractionName struct {
	// contains filtered or unexported fields
}

func (*InteractionName) Type

func (*InteractionName) Value

func (c *InteractionName) Value() interface{}

type InteractionOption

type InteractionOption interface {
	Type() InteractionOptionType
	Value() interface{}
}

func NewInteractionError

func NewInteractionError(name error) InteractionOption

func NewInteractionKind added in v1.0.0

func NewInteractionKind(kind SpanKind) InteractionOption

func NewInteractionName

func NewInteractionName(name string) InteractionOption

func NewInteractionRequest

func NewInteractionRequest(request *http.Request) InteractionOption

func NewInteractionTypeType

func NewInteractionTypeType(name string) InteractionOption

type InteractionOptionType

type InteractionOptionType int
const (
	InteractionOptionTypeName InteractionOptionType = iota + 1
	InteractionOptionTypeRequest
	InteractionOptionTypeType
	InteractionOptionTypeError
	InteractionOptionTypeKind
)

type InteractionRequest

type InteractionRequest struct {
	// contains filtered or unexported fields
}

func (*InteractionRequest) Type

func (*InteractionRequest) Value

func (c *InteractionRequest) Value() interface{}

type InteractionTypeType

type InteractionTypeType struct {
	// contains filtered or unexported fields
}

func (*InteractionTypeType) Type

func (*InteractionTypeType) Value

func (c *InteractionTypeType) Value() interface{}

type Jaeger

type Jaeger struct {
	Url      string `yaml:"url" json:"url" desc:"tracing:jaeger:url" default:"127.0.0.1:6831"`
	Endpoint string `yaml:"endpoint" json:"endpoint" desc:"tracing:jaeger:endpoint"`
}

type ModulesTraceId

type ModulesTraceId struct {
	Jaeger string
	Apm    string
}

type Option

type Option struct {
	Name               string             `yaml:"-" json:"-"`
	Config             TracingConfig      `yaml:"config" json:"config"`
	AllowLogging       []string           `yaml:"allowLogging" json:"allowLogging"`
	Logger             interfaces.Logger  `yaml:"-" json:"-"`
	IsValid            func(string) bool  `yaml:"-" json:"-"`
	PrintOperation     bool               `yaml:"printOperation" json:"printOperation"`
	Provider           Provider           `yaml:"-" json:"-"`
	EncryptSpanLog     bool               `yaml:"encryptSpanLog" json:"encryptSpanLog"`
	EncryptionProvider EncryptionProvider `yaml:"-" json:"-"`
}

func ParsingConfigCli added in v1.0.100

func ParsingConfigCli(logger interfaces.Logger, name string, opt TracingConfigCli) Option

type Provider added in v1.0.0

type Provider int
const (
	ProviderJaeger Provider = iota + 1
	ProviderDatadog
)

func GetProviderFromString added in v1.0.0

func GetProviderFromString(pr string) Provider

type SpanKind added in v1.0.0

type SpanKind int
const (
	SpanKindDefault SpanKind = iota
	SpanKindInternal
	SpanKindServer
	SpanKindClient
	SpanKindProducer
	SpanKindConsumer
)

type Tracing

type Tracing interface {
	New() Tracing
	Init(Option)
	GetConfig() Option
	Closing() (err error)
	GetFormattedTraceID(ctx context.Context) (id string)
	InjectRootData(ctx context.Context, key string, data interface{}, opts ...InteractionOption)
	Operation(ctx context.Context, opts ...InteractionOption) Interaction
	GrpcOperation(ctx context.Context, metadata map[string]string, opts ...InteractionOption) Interaction
}

Tracing modules interface, using for dynamic modules

type TracingConfig

type TracingConfig struct {
	Jaeger Jaeger `yaml:"jaeger" json:"jaeger"`
}

type TracingConfigCli added in v1.0.100

type TracingConfigCli struct {
	Provider string `yaml:"provider" default:"jaeger"`
	Option   Option `yaml:",inline"`
}

type TracingMessage

type TracingMessage struct {
	SpanName string
}

type TracingProvider added in v1.0.0

type TracingProvider interface {
	Setup() error
	Closing() error
	InjectRootData(ctx context.Context, key string, data interface{}, opts ...InteractionOption)
	Operation(ctx context.Context, opts ...InteractionOption) Interaction
	GetFormattedTraceID(ctx context.Context) (id string)
}

Jump to

Keyboard shortcuts

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