diagnostics

package
v1.223.0-rc.6 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(value bool) *bool

Bool returns a pointer for optional bool event fields.

func Configure

func Configure(config schema.Diagnostics)

Configure sets the package-level diagnostics configuration.

func Emit

func Emit(event *Event) error

Emit appends one event to the package-level diagnostics sink.

func EmitWithConfig

func EmitWithConfig(config Config, event *Event) error

EmitWithConfig appends one event to the provided diagnostics sink.

func Enabled

func Enabled(config Config) bool

Enabled reports whether diagnostics should emit events for the current config.

func Int

func Int(value int) *int

Int returns a pointer for optional int event fields.

func Int64

func Int64(value int64) *int64

Int64 returns a pointer for optional int64 event fields.

func NewID

func NewID(prefix string) string

NewID returns a process-local monotonically unique diagnostics event id.

func OutputEnabled

func OutputEnabled(config Config) bool

OutputEnabled reports whether process output events should be emitted.

func SetConfig

func SetConfig(config Config)

SetConfig sets the package-level diagnostics configuration.

func Uint64

func Uint64(value uint64) *uint64

Uint64 returns a pointer for optional uint64 event fields.

Types

type Config

type Config struct {
	Enabled       bool
	File          string
	IncludeOutput bool
}

Config describes the active diagnostics sink configuration.

func FromSchema

func FromSchema(config schema.Diagnostics) Config

FromSchema converts Atmos configuration into a diagnostics package config.

func GetConfig

func GetConfig() Config

GetConfig returns the package-level diagnostics configuration.

type Event

type Event struct {
	Type           string    `json:"type"`
	Time           time.Time `json:"time"`
	ID             string    `json:"id,omitempty"`
	Command        string    `json:"command,omitempty"`
	Args           []string  `json:"args,omitempty"`
	CWD            string    `json:"cwd,omitempty"`
	DryRun         *bool     `json:"dry_run,omitempty"`
	TTY            *bool     `json:"tty,omitempty"`
	StdinTTY       *bool     `json:"stdin_tty,omitempty"`
	StdoutTTY      *bool     `json:"stdout_tty,omitempty"`
	StderrTTY      *bool     `json:"stderr_tty,omitempty"`
	RedirectStderr string    `json:"redirect_stderr,omitempty"`
	Started        *bool     `json:"started,omitempty"`
	Success        *bool     `json:"success,omitempty"`
	Canceled       *bool     `json:"canceled,omitempty"`
	ExitCode       *int      `json:"exit_code,omitempty"`
	DurationMS     *int64    `json:"duration_ms,omitempty"`
	Signaled       *bool     `json:"signaled,omitempty"`
	Signal         string    `json:"signal,omitempty"`
	SignalNumber   *int      `json:"signal_number,omitempty"`
	Error          string    `json:"error,omitempty"`
	Stream         string    `json:"stream,omitempty"`
	Data           string    `json:"data,omitempty"`
	Bytes          *int      `json:"bytes,omitempty"`
	Sequence       *uint64   `json:"sequence,omitempty"`
}

Event is a machine-readable diagnostics event. Events are intentionally flat JSON objects so JSONL artifacts are easy to inspect with jq and grep.

type OutputWriter

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

OutputWriter emits masked process.output diagnostics events for subprocess output.

func NewOutputWriter

func NewOutputWriter(config Config, id, stream string) *OutputWriter

NewOutputWriter returns a writer for opt-in subprocess output diagnostics.

func (*OutputWriter) Write

func (w *OutputWriter) Write(p []byte) (int, error)

Write emits one process.output event per write. Diagnostics writes are best-effort and never fail the subprocess stream.

Jump to

Keyboard shortcuts

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