tyber

package
v2.417.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: Apache-2.0, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NewSessionID = newID
	NewTraceID   = newID
)

Functions

func ContextWithConstantTraceID added in v2.285.0

func ContextWithConstantTraceID(ctx context.Context, traceID string) context.Context

func ContextWithTraceID

func ContextWithTraceID(ctx context.Context) (context.Context, bool)

func ContextWithoutTraceID added in v2.285.0

func ContextWithoutTraceID(ctx context.Context) context.Context

func FormatEventLogFields

func FormatEventLogFields(ctx context.Context, details []Detail) []zapcore.Field

func FormatStepLogFields

func FormatStepLogFields(ctx context.Context, details []Detail, mutators ...StepMutator) []zapcore.Field

func FormatSubscribeLogFields added in v2.285.0

func FormatSubscribeLogFields(ctx context.Context, targetName string, targetDetails []Detail, stepToAddMutators ...StepMutator) []zapcore.Field

func FormatTraceLogFields

func FormatTraceLogFields(ctx context.Context) []zapcore.Field

func GetTraceIDFromContext added in v2.285.0

func GetTraceIDFromContext(ctx context.Context) string

func LogError added in v2.285.0

func LogError(ctx context.Context, logger *zap.Logger, text string, err error, mutators ...StepMutator) error

func LogFatalError added in v2.285.0

func LogFatalError(ctx context.Context, logger *zap.Logger, text string, err error, mutators ...StepMutator) error

func LogStep added in v2.285.0

func LogStep(ctx context.Context, logger *zap.Logger, text string, mutators ...StepMutator)

func LogTraceEnd added in v2.285.0

func LogTraceEnd(ctx context.Context, logger *zap.Logger, text string, mutators ...StepMutator)

func LogTraceStart added in v2.285.0

func LogTraceStart(ctx context.Context, logger *zap.Logger, text string)

func Section added in v2.285.0

func Section(ctx context.Context, logger *zap.Logger, name string) (context.Context, bool, func(error, string, ...StepMutator))

func SimpleSection added in v2.285.0

func SimpleSection(ctx context.Context, logger *zap.Logger, name string) func(error, ...StepMutator)

Types

type Detail

type Detail struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

func JSONDetail added in v2.285.0

func JSONDetail(name string, val interface{}) Detail

func ZapFieldsToDetails added in v2.285.0

func ZapFieldsToDetails(fields ...zap.Field) []Detail

type Event

type Event struct {
	Details []Detail `json:"details"`
}

type LogType

type LogType string
const (
	TraceType     LogType = "trace"
	StepType      LogType = "step"
	EventType     LogType = "event"
	SubscribeType LogType = "subcribe"
)

func (LogType) IsKnown added in v2.285.0

func (lt LogType) IsKnown() bool

type StatusType

type StatusType string
const (
	Running   StatusType = "running"
	Succeeded StatusType = "succeeded"
	Failed    StatusType = "failed"
)

type Step

type Step struct {
	ParentTraceID   string     `json:"parentTraceID"`
	Details         []Detail   `json:"details"`
	Status          StatusType `json:"status"`
	EndTrace        bool       `json:"endTrace"`
	UpdateTraceName string     `json:"updateTraceName"`
	ForceReopen     bool       `json:"forceReopen"`
}

func EndTrace added in v2.285.0

func EndTrace(s Step) Step

func Fatal added in v2.285.0

func Fatal(s Step) Step

func ForceReopen added in v2.285.0

func ForceReopen(s Step) Step

type StepMutator added in v2.285.0

type StepMutator = func(Step) Step

func Status added in v2.285.0

func Status(st StatusType) StepMutator

func UpdateTraceName added in v2.285.0

func UpdateTraceName(newTitle string) StepMutator

func WithCIDDetail added in v2.285.0

func WithCIDDetail(name string, cidBytes []byte) StepMutator

func WithDetail added in v2.285.0

func WithDetail(name string, description string) StepMutator

func WithError added in v2.285.0

func WithError(err error) StepMutator

func WithJSONDetail added in v2.285.0

func WithJSONDetail(name string, val interface{}) StepMutator

type Subscribe added in v2.285.0

type Subscribe struct {
	TargetStepName string   `json:"targetStepName"`
	TargetDetails  []Detail `json:"targetDetails"`
	StepToAdd      Step     `json:"stepToAdd"`
}

type Trace

type Trace struct {
	TraceID string `json:"traceID"`
}

Jump to

Keyboard shortcuts

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