diagnostics

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const Capacity = 2000
View Source
const Retention = 30 * time.Minute

Variables

This section is empty.

Functions

func Begin

func Begin(ctx context.Context, id string) context.Context

func Outcome

func Outcome(ctx context.Context, outcome, reason string)

func Result

func Result(ctx context.Context, outcome string) string

func Update

func Update(ctx context.Context, change func(*Record))

Types

type Page

type Page struct {
	Persisted       bool       `json:"persisted"`
	StorageFailures uint64     `json:"storage_failures"`
	RetentionDays   int        `json:"retention_days"`
	WindowEnd       time.Time  `json:"window_end"`
	Records         []Record   `json:"requests"`
	NextCursor      uint64     `json:"next_cursor"`
	Statistics      Statistics `json:"statistics"`
	WindowStart     time.Time  `json:"window_start"`
	Capacity        int        `json:"capacity"`
}

type Query

type Query struct {
	RequestID, Subject, ClientID, Endpoint, Tool, Outcome string
	Since, Until                                          time.Time
	Before                                                uint64
	Limit                                                 int
}

type Record

type Record struct {
	CredentialID    string    `json:"credential_id,omitempty"`
	UpstreamAccount string    `json:"upstream_account,omitempty"`
	Sequence        uint64    `json:"sequence"`
	RequestID       string    `json:"request_id"`
	StartedAt       time.Time `json:"started_at"`
	CompletedAt     time.Time `json:"completed_at"`
	DurationMS      int64     `json:"duration_ms"`
	Method          string    `json:"method"`
	Endpoint        string    `json:"endpoint"`
	Tool            string    `json:"tool"`
	Subject         string    `json:"subject"`
	ClientID        string    `json:"client_id"`
	GrantID         string    `json:"grant_id"`
	Outcome         string    `json:"outcome"`
	Reason          string    `json:"reason,omitempty"`
	HTTPStatus      int       `json:"http_status"`
	ApprovalID      string    `json:"approval_id,omitempty"`
	ApprovalWaitMS  int64     `json:"approval_wait_ms,omitempty"`
}

Records contain routing and outcome metadata only. Never add arguments, resource values, response bodies, tokens or arbitrary error strings here.

type Recorder

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

func (*Recorder) Finish

func (r *Recorder) Finish(ctx context.Context, status int) (Record, bool)

func (*Recorder) Query

func (r *Recorder) Query(q Query) Page

type Statistics

type Statistics struct {
	Total           int            `json:"total"`
	Outcomes        map[string]int `json:"outcomes"`
	P95MS           int64          `json:"p95_ms"`
	AverageMS       int64          `json:"average_ms"`
	ApprovalResumes int            `json:"approval_resumes"`
	ApprovalWaitMS  int64          `json:"average_approval_wait_ms"`
}

Jump to

Keyboard shortcuts

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