failurereport

package
v0.11.831 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package failurereport describes why an asset failed in one machine-readable line, so that Bruin Cloud can decide whether to retry it from the error's type rather than its message.

Index

Constants

View Source
const (
	// Transient failures are usually fixed by running the asset again: server errors, rate limits.
	Transient = "transient"
	// Infra failures come from what Bruin runs on, such as the secrets backend.
	Infra = "infra"
	// MissingConnection means the asset uses a connection that doesn't exist.
	MissingConnection = "missing_connection"
	// Connection means a connection exists but its credentials are rejected.
	Connection = "connection"
	// Permission means the account lacks access in the warehouse or service.
	Permission = "permission"
	// ProviderLimits means the provider account needs action, such as enabling billing.
	ProviderLimits = "provider_limits"
	// UserCode means the asset's query or configuration has to change.
	UserCode = "user_code"
	// DataNotReady means a sensor's condition wasn't met before its timeout.
	DataNotReady = "data_not_ready"
	// AssetTimeout means the asset ran longer than its timeout.
	AssetTimeout = "asset_timeout"
	Unknown      = "unknown"
)

Classes of failures.

View Source
const Prefix = "bruin-failure: "

Prefix starts the line that carries a Report.

Variables

This section is empty.

Functions

func Line

func Line(asset string, err error) string

Line returns the report line for an asset that failed with err.

Types

type Report

type Report struct {
	Asset      string `json:"asset"`
	Class      string `json:"class"`
	Code       string `json:"code,omitempty"`
	Source     string `json:"source,omitempty"`
	Reason     string `json:"reason,omitempty"`
	HTTPStatus int    `json:"http_status,omitempty"`
	SQLState   string `json:"sqlstate,omitempty"`
	Connection string `json:"connection,omitempty"`
	// ErrorType is the Go type of the innermost error, to find failures worth classifying.
	ErrorType string `json:"error_type,omitempty"`
}

Report says why an asset failed. Class and Code are the classification; the other fields carry what it was made from, so the reader can classify differently without a new Bruin release.

func Classify

func Classify(err error) Report

Classify sorts an asset's error into a class by its type.

Jump to

Keyboard shortcuts

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