metrics

package
v0.2.27 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const SchemaVersion = "dbrain.metrics.v1"

Variables

This section is empty.

Functions

func DurationMillis

func DurationMillis(d time.Duration) int64

func ErrorObject

func ErrorObject(err any) map[string]any

func NewRunID

func NewRunID(prefix string, now time.Time) string

func SubjectHash

func SubjectHash(kind string, key string) string

Types

type Config

type Config struct {
	Enabled            bool
	Path               string
	Detail             Detail
	IncludeSubjectKeys bool
	Strict             bool
}

func ResolveConfig

func ResolveConfig(rootDir string, logDir string) (Config, error)

type Detail

type Detail string
const (
	DetailStage     Detail = "stage"
	DetailItem      Detail = "item"
	DetailModelCall Detail = "model_call"
)

type Event

type Event map[string]any

func (Event) WithSubject

func (e Event) WithSubject(kind string, key string, includeKey bool) Event

type RunContext

type RunContext struct {
	RunID      string
	Command    string
	Invocation string
	Sink       Sink
}

func (RunContext) Detail

func (ctx RunContext) Detail() Detail

func (RunContext) Emit

func (ctx RunContext) Emit(event Event) error

func (RunContext) Enabled

func (ctx RunContext) Enabled() bool

func (RunContext) IncludeSubjectKeys

func (ctx RunContext) IncludeSubjectKeys() bool

type Sink

type Sink interface {
	Enabled() bool
	Detail() Detail
	IncludeSubjectKeys() bool
	Emit(Event) error
	Close() error
}

func NoopSink

func NoopSink() Sink

func Open

func Open(cfg Config) (Sink, error)

Jump to

Keyboard shortcuts

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