tracing

package
v0.0.0-...-bc30bd0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootSpan = "rootSpan"

	SchedulerPendingInQueueSpan      = "scheduler::pendingInQueue"
	SchedulerScheduleSpan            = "scheduler::schedule"
	SchedulerScheduleUnitSpan        = "scheduler::scheduleUnit"
	SchedulerPreemptUnitSpan         = "scheduler::preemptUnit"
	SchedulerSchedulePodSpan         = "scheduler::schedulePod"
	SchedulerPreemptPodSpan          = "scheduler::preemptPod"
	SchedulerGetCachedNodesSpan      = "scheduler::getCachedNodes"
	SchedulerCheckPreferredNodesSpan = "scheduler::checkPreferredNodes"
	SchedulerFilterSpan              = "scheduler::filter"
	SchedulerPrioritizeSpan          = "scheduler::prioritize"
	SchedulerAssumePodSpan           = "scheduler::assume"
	SchedulerForgetPodSpan           = "scheduler::forget"
	SchedulerUpdatingPodSpan         = "scheduler::update"

	BinderPendingInQueueSpan      = "binder::pendingInQueue"
	BinderAddPodToQueueSpan       = "binder::addPodToBinderQueue"
	BinderUpdatePodToQueueSpan    = "binder::updatePodInBinderQueue"
	BinderDeletePodFromQueueSpan  = "binder::deletePodFromBinderQueue"
	BinderInitializeTaskSpan      = "binder::initializeTask"
	BinderGetReservedResourceSpan = "binder::getReservedResource"
	BinderCheckPreemptionSpan     = "binder::checkPreemption"
	BinderCheckTopologySpan       = "binder::checkTopology"
	BinderCheckConflictsSpan      = "binder::checkConflicts"
	BinderAssumeTaskSpan          = "binder::assumeTask"
	BinderDeleteVictimsSpan       = "binder::deleteVictims"
	BinderBindTaskSpan            = "binder::bindTask"
)
View Source
const (
	Cluster         = "default"
	IDC             = "lq"
	DefaultSpanType = "GodelScheduler"

	PodTag     = "pod"
	ClusterTag = "cluster"
	IDCTag     = "idc"
	ResultTag  = "result"
	QueueTag   = "queue"
)
View Source
const (
	ResultSuccess = "success"
	ResultFailure = "failure"
)

Variables

View Source
var ContextError = fmt.Errorf("unsupported span context")
View Source
var GlobalNoopTracer tracer = newNoopTracer()
View Source
var UnSupportedTracer error = errors.New("unsupported tracer")

Functions

func AsyncFinishTraceContext

func AsyncFinishTraceContext(t TraceContext, endTime time.Time)

func NewSchedulingTrace

func NewSchedulingTrace(pod *v1.Pod, options ...trace.SpanOption) *schedulingTraceImpl

func NewTracer

func NewTracer(componentName string, cfg *TracerConfiguration) io.Closer

func SetSpanContextForPod

func SetSpanContextForPod(pod *v1.Pod, spanContext SpanContext)

func TruncateErrors

func TruncateErrors(errs []error) []error

func WithBinderOption

func WithBinderOption() trace.SpanOption

func WithComponent

func WithComponent(component string) trace.SpanOption

func WithDispatcherOption

func WithDispatcherOption() trace.SpanOption

func WithE2EExcludedTag

func WithE2EExcludedTag(value bool) attribute.KeyValue

func WithE2ELatency

func WithE2ELatency(initialTime time.Time) attribute.KeyValue

func WithErrorField

func WithErrorField(err error) attribute.KeyValue

func WithErrorFields

func WithErrorFields(errs []error) []attribute.KeyValue

func WithEverScheduledTag

func WithEverScheduledTag(everScheduled bool) trace.SpanOption

func WithHitCacheTag

func WithHitCacheTag(result string) attribute.KeyValue

func WithKeyValue

func WithKeyValue(key string, value interface{}) attribute.KeyValue

func WithMessageField

func WithMessageField(message string) attribute.KeyValue

func WithNodeCircleKey

func WithNodeCircleKey(key string) attribute.KeyValue

func WithNodeGroupField

func WithNodeGroupField(nodeGroup string) attribute.KeyValue

func WithNodeNameField

func WithNodeNameField(nodeName string) attribute.KeyValue

func WithNominatedNodeField

func WithNominatedNodeField(nominatedNode string) attribute.KeyValue

func WithPlugins

func WithPlugins(plugins map[string]sets.String) []attribute.KeyValue

func WithPodKeyField

func WithPodKeyField(podKey string) attribute.KeyValue

func WithPodOwnerField

func WithPodOwnerField(podOwner string) attribute.KeyValue

func WithQueueField

func WithQueueField(queueName string) attribute.KeyValue

func WithReasonField

func WithReasonField(reason string) attribute.KeyValue

func WithResult

func WithResult(result string) trace.SpanOption

func WithResultTag

func WithResultTag(value interface{}) attribute.KeyValue

func WithScheduler

func WithScheduler(scheduler string) trace.SpanOption

func WithSchedulerOption

func WithSchedulerOption() trace.SpanOption

func WithStartTime

func WithStartTime(startTime time.Time) trace.SpanOption

func WithTemplateKeyField

func WithTemplateKeyField(templateKey string) attribute.KeyValue

func WithVictimPodsField

func WithVictimPodsField(victims string) attribute.KeyValue

Types

type NoopSchedulingTrace

type NoopSchedulingTrace struct{}

func (*NoopSchedulingTrace) GetRootSpanContext

func (n *NoopSchedulingTrace) GetRootSpanContext() SpanContext

func (*NoopSchedulingTrace) GetTraceContext

func (n *NoopSchedulingTrace) GetTraceContext(name string) TraceContext

func (*NoopSchedulingTrace) NewTraceContext

func (n *NoopSchedulingTrace) NewTraceContext(parentSpanName, name string, options ...trace.SpanOption) TraceContext

type NoopTracer

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

func (*NoopTracer) Close

func (tracer *NoopTracer) Close() error

func (*NoopTracer) Init

func (tracer *NoopTracer) Init(componentName, idc, cluster string) error

func (*NoopTracer) InjectContext

func (tracer *NoopTracer) InjectContext(ctx context.Context, span trace.Span, spanContext SpanContext) error

func (*NoopTracer) StartSpan

func (tracer *NoopTracer) StartSpan(ctx context.Context, spanType, spanName string, spanContext SpanContext, opts ...trace.SpanOption) (trace.Span, context.Context, error)

type SchedulingTrace

type SchedulingTrace interface {
	GetRootSpanContext() SpanContext
	NewTraceContext(parentSpanName, name string, options ...trace.SpanOption) TraceContext
	GetTraceContext(name string) TraceContext
}

type SpanContext

type SpanContext interface {
	Marshal() string
	Carrier() map[string]string
	IsEmpty() bool
}

func GetSpanContextFromPod

func GetSpanContextFromPod(pod *v1.Pod) SpanContext

func NewEmptySpanContext

func NewEmptySpanContext() SpanContext

func NewSpanContextFromString

func NewSpanContextFromString(str string) SpanContext

type SpanInfo

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

func NewSpanInfo

func NewSpanInfo(startOptions ...trace.SpanOption) *SpanInfo

func (*SpanInfo) FinishSpan

func (s *SpanInfo) FinishSpan(name string, parentSpanContext SpanContext, startTime time.Time)

func (*SpanInfo) WithFields

func (s *SpanInfo) WithFields(fields ...attribute.KeyValue)

func (*SpanInfo) WithTags

func (s *SpanInfo) WithTags(tags ...trace.SpanOption)

type TraceContext

type TraceContext interface {
	Span() trace.Span
	SpanContext() SpanContext
	RootSpanContext() SpanContext
	WithTags(tags ...attribute.KeyValue)
	WithFields(fields ...attribute.KeyValue)
	Finish()
	FinishWithOptions(opts ...trace.SpanOption)
}

func NewEmptyTraceContext

func NewEmptyTraceContext() TraceContext

func NewTraceContext

func NewTraceContext(ctx context.Context, parentSpanContext SpanContext, span trace.Span) TraceContext

func StartSpanForPod

func StartSpanForPod(podKey, spanName string, options ...trace.SpanOption) (TraceContext, error)

func StartSpanForPodWithParentSpan

func StartSpanForPodWithParentSpan(podKey, spanName string, parentSpanContext SpanContext, options ...trace.SpanOption) (TraceContext, error)

StartSpanForPodWithParentSpan creates a span and tracing context of related pod. The new span will be based on spanCtx if it is not empty. If both spanCtx is empty, a root span is created for the pod and return the new tracing context as spanCtx value. The returned value will include the new created span and spanCtx. If root span is created, spanCtx from root span is returned, otherwise returned empty.

type TraceContextMap

type TraceContextMap map[string]string

type TraceContextVal

type TraceContextVal string

type TracerConfig

type TracerConfig string
const (
	NoopConfig TracerConfig = "noop"
)

type TracerConfiguration

type TracerConfiguration struct {
	// IDCName specifies the name of idc to deploy godel dispatcher
	IDCName *string

	// ClusterName specifies the name of cluster to serve
	ClusterName *string

	// Tracer defines to enable tracing or not
	Tracer *string
}

func DefaultNoopOptions

func DefaultNoopOptions() *TracerConfiguration

func (*TracerConfiguration) AddFlags

func (opt *TracerConfiguration) AddFlags(fs *pflag.FlagSet)

func (*TracerConfiguration) ApplyTo

func (opt *TracerConfiguration) ApplyTo(options *TracerConfiguration)

func (*TracerConfiguration) DeepCopy

func (opt *TracerConfiguration) DeepCopy() (out *TracerConfiguration)

func (*TracerConfiguration) DeepCopyInto

func (opt *TracerConfiguration) DeepCopyInto(out *TracerConfiguration)

func (*TracerConfiguration) Validate

func (opt *TracerConfiguration) Validate() error

Jump to

Keyboard shortcuts

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