doctor

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBenchStats

func AddBenchStats(ctx context.Context, repoPath string, stats BenchStats)

AddBenchStats merges repo-local stats into the current scope, if present.

func BenchEnabled

func BenchEnabled(repoPath string) bool

BenchEnabled returns true when doctor bench recording is enabled for a repo.

func BenchLogPath

func BenchLogPath(repoPath string) string

BenchLogPath returns the per-repo JSONL output path for doctor bench.

func Diff

func Diff(after, before map[string]BenchStats) map[string]BenchStats

Diff subtracts one snapshot from another.

func EmitBenchRecord

func EmitBenchRecord(repoPath string, record BenchRecord)

EmitBenchRecord appends one JSONL record for the given repo when doctor bench is enabled.

func Milliseconds

func Milliseconds(d time.Duration) int64

Milliseconds converts a duration into integer milliseconds.

Types

type BenchRecord

type BenchRecord struct {
	TS           string `json:"ts"`
	Kind         string `json:"kind"`
	Event        string `json:"event,omitempty"`
	Tool         string `json:"tool,omitempty"`
	TurnID       string `json:"turn_id,omitempty"`
	DurationMS   int64  `json:"duration_ms,omitempty"`
	DBMS         int64  `json:"db_ms,omitempty"`
	BlobMS       int64  `json:"blob_ms,omitempty"`
	RSSMB        int64  `json:"rss_mb,omitempty"`
	CaptureMS    int64  `json:"capture_ms,omitempty"`
	PackageMS    int64  `json:"package_ms,omitempty"`
	RowsWritten  int    `json:"rows_written,omitempty"`
	BlobsWritten int    `json:"blobs_written,omitempty"`
	BytesWritten int64  `json:"bytes_written,omitempty"`
}

BenchRecord is the JSONL payload written by the doctor bench recorder.

type BenchScope

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

BenchScope aggregates per-repo stats while one hook or turn is being handled.

func WithBenchScope

func WithBenchScope(ctx context.Context) (context.Context, *BenchScope)

WithBenchScope attaches a new aggregation scope to the context.

func (*BenchScope) Snapshot

func (s *BenchScope) Snapshot() map[string]BenchStats

Snapshot returns a copy of the current per-repo stats.

type BenchStats

type BenchStats struct {
	RowsWritten  int           `json:"-"`
	BlobsWritten int           `json:"-"`
	BytesWritten int64         `json:"-"`
	DBDuration   time.Duration `json:"-"`
	BlobDuration time.Duration `json:"-"`
}

BenchStats captures lightweight write activity for one repo during a hook or turn.

Jump to

Keyboard shortcuts

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