observability

package
v0.0.0-...-016edcc Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoE

func DoE(span SpanError, f func() error) (rerr error)

func DoVE

func DoVE[T any](span SpanError, f func() (T, error)) (_ T, rerr error)

func IsDuringGen

func IsDuringGen(ctx context.Context) bool

func WorkerStageFactory

func WorkerStageFactory[S SpanError](f createSpanFunc[S]) worker2.Hook

Types

type BaseHook

type BaseHook struct{}

func (BaseHook) OnCacheDownload

func (b BaseHook) OnCacheDownload(ctx context.Context, _ *TargetArtifactCacheSpan) (context.Context, SpanHook)

func (BaseHook) OnCacheUpload

func (BaseHook) OnCollectOutput

func (b BaseHook) OnCollectOutput(ctx context.Context, _ *TargetSpan) (context.Context, SpanHook)

func (BaseHook) OnExternalCacheGet

func (b BaseHook) OnExternalCacheGet(ctx context.Context, _ *ExternalCacheGetSpan) (context.Context, SpanHook)

func (BaseHook) OnGenPass

func (b BaseHook) OnGenPass(ctx context.Context, _ *BaseSpan) (context.Context, SpanHook)

func (BaseHook) OnLocalCacheCheck

func (b BaseHook) OnLocalCacheCheck(ctx context.Context, _ *TargetArtifactCacheSpan) (context.Context, SpanHook)

func (BaseHook) OnLocalCacheStore

func (b BaseHook) OnLocalCacheStore(ctx context.Context, _ *TargetSpan) (context.Context, SpanHook)

func (BaseHook) OnLogs

func (b BaseHook) OnLogs(ctx context.Context) io.Writer

func (BaseHook) OnRoot

func (b BaseHook) OnRoot(ctx context.Context, _ *BaseSpan) (context.Context, SpanHook)

func (BaseHook) OnRun

func (BaseHook) OnRunExec

func (b BaseHook) OnRunExec(ctx context.Context, _ *TargetExecSpan) (context.Context, SpanHook)

func (BaseHook) OnRunPrepare

func (b BaseHook) OnRunPrepare(ctx context.Context, _ *TargetSpan) (context.Context, SpanHook)

type BaseSpan

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

func (*BaseSpan) End

func (s *BaseSpan) End()

func (*BaseSpan) EndError

func (s *BaseSpan) EndError(err error)

func (*BaseSpan) EndErrorState

func (s *BaseSpan) EndErrorState(err error, state State)

func (*BaseSpan) EndTime

func (s *BaseSpan) EndTime() time.Time

func (*BaseSpan) Error

func (s *BaseSpan) Error() error

func (*BaseSpan) FinalState

func (s *BaseSpan) FinalState() State

func (*BaseSpan) ID

func (s *BaseSpan) ID() uint64

func (*BaseSpan) QueuedTime

func (s *BaseSpan) QueuedTime() time.Time

func (*BaseSpan) ScheduledTime

func (s *BaseSpan) ScheduledTime() time.Time

func (*BaseSpan) SetQueuedTime

func (s *BaseSpan) SetQueuedTime(t time.Time)

func (*BaseSpan) SetScheduledTime

func (s *BaseSpan) SetScheduledTime(t time.Time)

func (*BaseSpan) SetStartTime

func (s *BaseSpan) SetStartTime(t time.Time)

func (*BaseSpan) StartTime

func (s *BaseSpan) StartTime() time.Time

type ExternalCacheGetSpan

type ExternalCacheGetSpan struct {
	TargetSpan
	Cache    string
	Outputs  []string
	OnlyMeta bool
	// contains filtered or unexported fields
}

func (*ExternalCacheGetSpan) IsCacheHit

func (s *ExternalCacheGetSpan) IsCacheHit() *bool

func (*ExternalCacheGetSpan) SetCacheHit

func (s *ExternalCacheGetSpan) SetCacheHit(v bool)

type Hook

type Hook interface {
	OnRoot(ctx context.Context, span *BaseSpan) (context.Context, SpanHook)
	OnRun(ctx context.Context, span *TargetSpan) (context.Context, SpanHook)
	OnGenPass(ctx context.Context, span *BaseSpan) (context.Context, SpanHook)
	OnCacheDownload(ctx context.Context, span *TargetArtifactCacheSpan) (context.Context, SpanHook)
	OnCacheUpload(ctx context.Context, span *TargetArtifactCacheSpan) (context.Context, SpanHook)
	OnRunPrepare(ctx context.Context, span *TargetSpan) (context.Context, SpanHook)
	OnRunExec(ctx context.Context, span *TargetExecSpan) (context.Context, SpanHook)
	OnCollectOutput(ctx context.Context, span *TargetSpan) (context.Context, SpanHook)
	OnLocalCacheStore(ctx context.Context, span *TargetSpan) (context.Context, SpanHook)
	OnLocalCacheCheck(ctx context.Context, span *TargetArtifactCacheSpan) (context.Context, SpanHook)
	OnExternalCacheGet(ctx context.Context, span *ExternalCacheGetSpan) (context.Context, SpanHook)

	OnLogs(ctx context.Context) io.Writer
}

type Observability

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

func NewTelemetry

func NewTelemetry() *Observability

func (*Observability) LogsWriter

func (t *Observability) LogsWriter(ctx context.Context) io.Writer

func (*Observability) RegisterHook

func (t *Observability) RegisterHook(h Hook)

func (*Observability) SpanCacheDownload

func (t *Observability) SpanCacheDownload(ctx context.Context, target *graph.Target, cache string, artifact artifacts.Artifact) (context.Context, *TargetArtifactCacheSpan)

func (*Observability) SpanCacheUpload

func (t *Observability) SpanCacheUpload(ctx context.Context, target *graph.Target, cache string, artifact artifacts.Artifact) (context.Context, *TargetArtifactCacheSpan)

func (*Observability) SpanCollectOutput

func (t *Observability) SpanCollectOutput(ctx context.Context, target *graph.Target) (context.Context, *TargetSpan)

func (*Observability) SpanExternalCacheGet

func (t *Observability) SpanExternalCacheGet(ctx context.Context, target *graph.Target, cache string, outputs []string, onlyMeta bool) (context.Context, *ExternalCacheGetSpan)

func (*Observability) SpanGenPass

func (t *Observability) SpanGenPass(ctx context.Context) (context.Context, *BaseSpan)

func (*Observability) SpanLocalCacheCheck

func (t *Observability) SpanLocalCacheCheck(ctx context.Context, target *graph.Target, artifact artifacts.Artifact) (context.Context, *TargetArtifactCacheSpan)

func (*Observability) SpanLocalCacheStore

func (t *Observability) SpanLocalCacheStore(ctx context.Context, target *graph.Target) (context.Context, *TargetSpan)

func (*Observability) SpanRoot

func (t *Observability) SpanRoot(ctx context.Context) (context.Context, *BaseSpan)

func (*Observability) SpanRun

func (t *Observability) SpanRun(ctx context.Context, target *graph.Target) (context.Context, *TargetSpan)

func (*Observability) SpanRunExec

func (t *Observability) SpanRunExec(ctx context.Context, target *graph.Target) (context.Context, *TargetExecSpan)

func (*Observability) SpanRunPrepare

func (t *Observability) SpanRunPrepare(ctx context.Context, target *graph.Target) (context.Context, *TargetSpan)

type Span

type Span interface {
	ID() uint64
	End()
	ScheduledTime() time.Time
	QueuedTime() time.Time
	StartTime() time.Time
	EndTime() time.Time

	SetScheduledTime(time.Time)
	SetQueuedTime(time.Time)
	SetStartTime(time.Time)
}

type SpanCacheHit

type SpanCacheHit interface {
	IsCacheHit() *bool
}

type SpanError

type SpanError interface {
	Span
	EndError(err error)
	EndErrorState(err error, state State)
	FinalState() State
	Error() error
}

type SpanHook

type SpanHook interface {
	OnSchedule()
	OnQueued()
	OnStart()
	OnEnd()
}

func AllSpanHook

func AllSpanHook(f func()) SpanHook

func FinalizerSpanHook

func FinalizerSpanHook(f func()) SpanHook

type SpanHookFunc

type SpanHookFunc struct {
	OnScheduleFunc func()
	OnQueuedFunc   func()
	OnStartFunc    func()
	OnEndFunc      func()
}

func (SpanHookFunc) OnEnd

func (s SpanHookFunc) OnEnd()

func (SpanHookFunc) OnQueued

func (s SpanHookFunc) OnQueued()

func (SpanHookFunc) OnSchedule

func (s SpanHookFunc) OnSchedule()

func (SpanHookFunc) OnStart

func (s SpanHookFunc) OnStart()

type SpanTarget

type SpanTarget interface {
	Span
	Target() *graph.Target
}

type SpanTargetArtifact

type SpanTargetArtifact interface {
	SpanTarget
	Artifact() artifacts.Artifact
}

type State

type State int8
const (
	StateUnknown State = iota
	StateSuccess
	StateFailed
	StateSkipped
)

type TargetArtifactCacheSpan

type TargetArtifactCacheSpan struct {
	TargetArtifactSpan
	Cache string
	// contains filtered or unexported fields
}

func (*TargetArtifactCacheSpan) IsCacheHit

func (s *TargetArtifactCacheSpan) IsCacheHit() *bool

func (*TargetArtifactCacheSpan) SetCacheHit

func (s *TargetArtifactCacheSpan) SetCacheHit(v bool)

type TargetArtifactSpan

type TargetArtifactSpan struct {
	TargetSpan
	// contains filtered or unexported fields
}

func (*TargetArtifactSpan) Artifact

func (s *TargetArtifactSpan) Artifact() artifacts.Artifact

type TargetExecSpan

type TargetExecSpan struct {
	TargetSpan
	ExecId uuid.UUID
}

type TargetSpan

type TargetSpan struct {
	BaseSpan
	// contains filtered or unexported fields
}

func (*TargetSpan) Target

func (s *TargetSpan) Target() *graph.Target

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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