diagnostics

package
v0.9.4-dev.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: GPL-3.0 Imports: 10 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

This section is empty.

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, secret string) 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 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
	Phase      string
	Status     int
	Body       string
	Cause      error
	CauseText  string
	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, secret string) *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 error text for a redacting, bounded logger.

func (*HTTPError) Error added in v0.9.4

func (e *HTTPError) Error() string

func (*HTTPError) HideSecret

func (e *HTTPError) HideSecret(secret string) *HTTPError

HideSecret removes a known controller credential from the rendered copy while retaining the original cause for errors.Is/As. Call after adding all causes.

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