diagnostics

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: GPL-3.0 Imports: 11 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 MaxHTTPBodyBytes = 256 << 10

MaxHTTPBodyBytes bounds retained upstream failure bodies, before JSON encoding.

Variables

This section is empty.

Functions

func AlreadyReported

func AlreadyReported(err error) bool

AlreadyReported reports whether err carries a diagnostic ownership marker.

func FailureLevel

func FailureLevel(ctx context.Context, err error) (slog.Level, bool)

FailureLevel classifies an operation failure for diagnostic logging.

func HTTPBody added in v0.9.4

func HTTPBody(raw []byte) string

HTTPBody bounds retained error payloads without retaining response objects.

func HTTPOperation added in v0.9.4

func HTTPOperation(method, path string) string

HTTPOperation removes user-controlled path segments and query parameters.

func MarkReported

func MarkReported(err error) error

MarkReported marks err as already reported by its diagnostic owner.

func NormalCancellation added in v0.9.4

func NormalCancellation(ctx context.Context, err error) bool

NormalCancellation reports whether only cancellation caused an ended operation. It lets non-log failure callbacks retain their shutdown semantics.

func Wrap

func Wrap(api protocol.APIError, cause error) error

Wrap combines a public API error with its internal cause.

Types

type HTTPError added in v0.9.4

type HTTPError struct {
	Operation  string
	URL        string
	Phase      string
	Status     int
	Body       string
	Cause      error
	RetryDelay time.Duration
}

HTTPError retains upstream diagnostics outside the public API error. Only the logging boundary may render DiagnosticText; Error deliberately stays safe.

func HandshakeError added in v0.9.4

func HandshakeError(operation string, response *http.Response, cause error) *HTTPError

HandshakeError captures the failed websocket dial response. The websocket adapter returns a closed-network-body copy capped at 1024 bytes; mark that upstream library limit rather than claiming a complete error payload.

func (*HTTPError) DiagnosticText added in v0.9.4

func (e *HTTPError) DiagnosticText() string

DiagnosticText returns original HTTP details for the file diagnostic boundary.

func (*HTTPError) Error added in v0.9.4

func (e *HTTPError) Error() string

func (*HTTPError) RetryAfter added in v0.9.4

func (e *HTTPError) RetryAfter() time.Duration

RetryAfter exposes a parsed upstream retry delay to the provider read policy.

func (*HTTPError) Unwrap added in v0.9.4

func (e *HTTPError) Unwrap() error

type Record

type Record struct {
	Component string
	Event     string
	Level     slog.Level
	Err       error
}

Record describes one internal diagnostic event. It must not be serialized.

type Reporter

type Reporter func(context.Context, Record)

Reporter records an internal diagnostic event at an owning boundary.

Jump to

Keyboard shortcuts

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