tracecapture

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package tracecapture owns bounded, run-aligned runtime execution traces.

Index

Constants

View Source
const (
	SchemaV1               = "isutools.runtime-trace/v1"
	DefaultDuration        = 5 * time.Second
	MaxDuration            = 30 * time.Second
	DefaultMaxBytes int64  = 64 << 20
	MaxBytes        int64  = 256 << 20
	MinFreeReserve  uint64 = 16 << 20

	StateCapturing = "capturing"
	StateReplayed  = "replayed"
	StateStopping  = "stopping"
	StatePublished = "published"
	StateSkipped   = "skipped"
	StateFailed    = "failed"
	StateAborted   = "aborted"

	CodeRunInvalid       = "run-invalid"
	CodeProfilerBusy     = "profiler-busy"
	CodeDiskBudget       = "disk-budget"
	CodeArtifactFailed   = "artifact-create-failed"
	CodeStartFailed      = "start-failed"
	CodeOutputTooLarge   = "output-too-large"
	CodeStopFailed       = "stop-failed"
	CodePublishFailed    = "publish-failed"
	CodeDurationComplete = "duration-complete"
	CodeAborted          = "aborted"
	CodeNoCapture        = "no-active-capture"
	CodeDurability       = "durability-unknown"

	ReasonMaxDuration = "max-duration"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Start(io.Writer) error
	Stop()
}

type Manager

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

func New

func New(options Options) (*Manager, error)

func (*Manager) Await

func (m *Manager) Await(ticket StopTicket, ctx context.Context) Status

func (*Manager) Close

func (m *Manager) Close()

func (*Manager) RequestStop

func (m *Manager) RequestStop(request StopRequest) StopTicket

func (*Manager) Start

func (m *Manager) Start(request StartRequest) StartResult

func (*Manager) Status

func (m *Manager) Status(runID string, epoch uint64) (Status, bool)

type Options

type Options struct {
	Root     *safefs.Root
	Backend  Backend
	Owner    Owner
	Duration time.Duration
	MaxBytes int64
	MinFree  uint64
	Now      func() time.Time
	ID       func() string
}

type Owner

type Owner interface {
	Acquire(string) bool
	Release(string) bool
}

type RuntimeBackend

type RuntimeBackend struct{}

func (RuntimeBackend) Start

func (RuntimeBackend) Start(writer io.Writer) error

func (RuntimeBackend) Stop

func (RuntimeBackend) Stop()

type StartRequest

type StartRequest struct {
	RunID      string
	Epoch      uint64
	State      string
	Validity   string
	BoundaryAt time.Time
}

type StartResult

type StartResult struct {
	RunID     string `json:"run_id"`
	Epoch     uint64 `json:"epoch"`
	CaptureID string `json:"capture_id,omitempty"`
	State     string `json:"state"`
	Code      string `json:"code,omitempty"`
}

type Status

type Status struct {
	Schema         string        `json:"schema"`
	RunID          string        `json:"run_id"`
	Epoch          uint64        `json:"epoch"`
	CaptureID      string        `json:"capture_id"`
	State          string        `json:"state"`
	Code           string        `json:"code,omitempty"`
	File           string        `json:"file,omitempty"`
	SHA256         string        `json:"sha256,omitempty"`
	Bytes          int64         `json:"bytes,omitempty"`
	Sidecar        string        `json:"sidecar,omitempty"`
	SidecarSHA256  string        `json:"-"`
	BoundaryStart  time.Time     `json:"boundary_start,omitzero"`
	BoundaryFinish time.Time     `json:"boundary_finish,omitzero"`
	StartRequested time.Time     `json:"start_requested_at,omitzero"`
	StartCompleted time.Time     `json:"start_completed_at,omitzero"`
	StopRequested  time.Time     `json:"stop_requested_at,omitzero"`
	StopCompleted  time.Time     `json:"stop_completed_at,omitzero"`
	StopReason     string        `json:"stop_reason,omitempty"`
	RequestedSpan  time.Duration `json:"requested_span_ns"`
	CaptureSpan    time.Duration `json:"capture_span_ns"`
	HeadLoss       time.Duration `json:"head_loss_ns"`
	TailExcess     time.Duration `json:"tail_excess_ns"`
	Complete       bool          `json:"complete"`
}

type StopRequest

type StopRequest struct {
	RunID      string
	Epoch      uint64
	Reason     string
	BoundaryAt time.Time
	Abort      bool
}

type StopTicket

type StopTicket struct {
	RunID     string
	Epoch     uint64
	CaptureID string
	State     string
	Code      string
}

Jump to

Keyboard shortcuts

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