instrumentation

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CHANNEL_SIZE = 100
)
View Source
const (
	KOC_KEY = "eppppi.github.io/koc"
)

Variables

This section is empty.

Functions

func AddTraceContextToContext added in v0.4.7

func AddTraceContextToContext(ctx context.Context, tctx *TraceContext) context.Context

func GetParentIdFromContext added in v0.4.0

func GetParentIdFromContext(ctx context.Context) string

func InitSender

func InitSender(endpoint string, timeout time.Duration, _numAncCpids int) (<-chan error, func())

InitSender initializes a sender (gRPC client). If wait is true, this func waits until setup is done.

func SetParentIdToContext added in v0.4.0

func SetParentIdToContext(ctx context.Context, parentId string) context.Context

func SetTraceContext

func SetTraceContext(objInterface interface{}, traceCtx *TraceContext) error

REFACTOR: from interface{} to runtime.Object SetTraceContext sets trace context

func SetTraceContextsToContext added in v0.4.0

func SetTraceContextsToContext(ctx context.Context, tctxs []*TraceContext) context.Context

func SetupTraceServerClient added in v0.4.6

func SetupTraceServerClient(endpoint string, _numAncCpids int) func()

func WriteResolvconf added in v0.4.6

func WriteResolvconf()

Types

type KeyWithTraceContexts added in v0.4.7

type KeyWithTraceContexts struct {
	Key       interface{}
	TraceCtxs []*TraceContext
}

type Span

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

Span is a span that is to be converted to the Span struct of protobuf

func Start

func Start(ctx context.Context, cpid, service, objKind, objName, msg string) (context.Context, *Span, error)

Start starts a span. If cpid == "" and ctx has no trace context, returns an error.

func (*Span) End

func (s *Span) End()

End ends a span

func (*Span) ToProtoSpan

func (s *Span) ToProtoSpan() *mergelogpb.Span

ToProtoSpan converts a span to the Span struct of protobuf

type TraceContext

type TraceContext struct {
	Cpid     string   `json:"cpid"`
	AncCpids []string `json:"ancCpids"`
}

func GetTraceContext

func GetTraceContext(objInterface interface{}) *TraceContext

REFACTOR: from interface{} to runtime.Object GetTraceContext returns trace context (maybe nil)

func GetTraceContextsFromContext added in v0.4.0

func GetTraceContextsFromContext(ctx context.Context) []*TraceContext

GetTraceContextsFromContext returns trace contexts from ctx. If ctx is nil, returns nil. If there are any nil tctxs, they are ignored. (non-nil tctxs are returned, and len() of returned slice is the number of non-nil tctxs)

func MergeAndSendMergelog added in v0.2.0

func MergeAndSendMergelog(sourceTctxs []*TraceContext, causeMsg, by string) *TraceContext

GenerateNewTctxAndSendMergelog generates a new trace context. if retTctx is nil, no mergelog is sent.

func NewRootTraceContextAndSendMergelog added in v0.2.0

func NewRootTraceContextAndSendMergelog(message, by string) *TraceContext

NewRootTraceContext creates a new root trace context and send mergelog of it

func (*TraceContext) DeepCopyTraceContext added in v0.2.0

func (tctx *TraceContext) DeepCopyTraceContext() *TraceContext

DeepCopyTraceContext deep copies a trace context

func (*TraceContext) GetAncCpids

func (tctx *TraceContext) GetAncCpids() []string

GetAncCpids gets ancestor cpids

func (*TraceContext) GetCpid

func (tctx *TraceContext) GetCpid() string

GetCpid gets cpid

func (*TraceContext) SetAncCpids

func (tctx *TraceContext) SetAncCpids(ancCpids []string)

SetAncCpids sets ancestor cpids

func (*TraceContext) SetCpid

func (tctx *TraceContext) SetCpid(cpid string)

SetCpid sets cpid

Jump to

Keyboard shortcuts

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