tyber

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: Apache-2.0, MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NewSessionID = newID
	NewTraceID   = newID
)

Functions

func ContextWithConstantTraceID

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

func ContextWithTraceID

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

func ContextWithoutTraceID

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

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

func FormatTraceLogFields

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

func GetTraceIDFromContext

func GetTraceIDFromContext(ctx context.Context) string

func LogError

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

func LogFatalError

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

func LogStep

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

func LogTraceEnd

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

func LogTraceStart

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

func Section

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

func SimpleSection

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

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

func ZapFieldsToDetails

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

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

func EndTrace(s Step) Step

func Fatal

func Fatal(s Step) Step

func ForceReopen

func ForceReopen(s Step) Step

type StepMutator

type StepMutator = func(Step) Step

func Status

func Status(st StatusType) StepMutator

func UpdateTraceName

func UpdateTraceName(newTitle string) StepMutator

func WithCIDDetail

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

func WithDetail

func WithDetail(name string, description string) StepMutator

func WithError

func WithError(err error) StepMutator

func WithJSONDetail

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

type Subscribe

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