instrumentation

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KOC_KEY       = "eppppi.github.io/koc"
	NUM_ANC_CPIDS = 10
)
View Source
const (
	CHANNEL_SIZE = 100
)
View Source
const (
	KOC_PARENTID_KEY contextKey = "eppppi.github.io/koc-parentid"
)

Variables

This section is empty.

Functions

func GetParentId

func GetParentId(ctx context.Context) string

func InitSender

func InitSender(endpoint string) (<-chan struct{}, func())

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

func SetParentId

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

func SetTraceContext

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

SetTraceContext sets trace context

Types

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)

Start starts a span. If returned span is nil, no span is started.

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

GetTraceContext returns trace context (maybe nil)

func MergeAndSendMergelog added in v0.2.0

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

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 (tc *TraceContext) GetAncCpids() []string

GetAncCpids gets ancestor cpids

func (*TraceContext) GetCpid

func (tc *TraceContext) GetCpid() string

GetCpid gets cpid

func (*TraceContext) SetAncCpids

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

SetAncCpids sets ancestor cpids

func (*TraceContext) SetCpid

func (tc *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