contract

package
v0.0.0-...-9728e72 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOXASpecVersion      = "v1"
	LOXAEventVersion     = "v1"
	LOXAIngestAPIVersion = "v1"
	MaxEventBytes        = 1000
)

Variables

View Source
var AllowedEventStates = set("created", "active", "finished", "emitting", "emitted", "failed_validation", "delivery_failed")
View Source
var AllowedKinds = set("event", "http", "job", "queue", "cli", "cron", "log", "checkpoint")
View Source
var AllowedLevels = set("debug", "info", "warn", "error", "fatal")
View Source
var AllowedOutcomes = set("success", "error", "timeout", "cancelled", "rejected", "abandoned", "partial", "unknown")
View Source
var AllowedPartialReasons = set("not_finished", "process_exit", "timeout", "panic", "collector_unavailable")
View Source
var AllowedSourceSDKs = set("loxa-go", "loxa-py", "loxa-rs", "loxa-cli")
View Source
var AllowedTopLevelFields = set("attrs", "delivery_attempts", "deployment", "duration_ms", "environment", "error", "event", "event_id", "event_state", "event_version", "http", "kind", "level", "message", "method", "organization", "outcome", "partial", "partial_reason", "path", "pii", "request_id", "resource", "route", "schema_version", "service", "source", "span_id", "status_code", "tenant", "timestamp", "trace_id", "user", "version", "workspace")
View Source
var CanonicalFieldSet = AllowedTopLevelFields

Functions

func IsCanonical

func IsCanonical(key string) bool

func LooksLikeLoxaEventMap

func LooksLikeLoxaEventMap(payload map[string]any) bool

func MarshalIngestEnvelope

func MarshalIngestEnvelope(sdk, version, service string, events []json.RawMessage) ([]byte, error)

func NormalizeEventAliasesCopyMap

func NormalizeEventAliasesCopyMap(payload map[string]any) (map[string]any, bool)

func NormalizeEventAliasesMap

func NormalizeEventAliasesMap(payload map[string]any) bool

func ValidateCollectorResponseMap

func ValidateCollectorResponseMap(payload map[string]any) error

func ValidateEventBytes

func ValidateEventBytes(raw []byte, strict bool) error

func ValidateEventMap

func ValidateEventMap(payload map[string]any, strict bool) error

func ValidateFlexibleJSONBytes

func ValidateFlexibleJSONBytes(raw []byte, strict bool) error

Types

type CollectorResponse

type CollectorResponse struct {
	RequestID string       `json:"request_id,omitempty"`
	Status    string       `json:"status,omitempty"`
	Accepted  int          `json:"accepted,omitempty"`
	Rejected  int          `json:"rejected,omitempty"`
	Invalid   int          `json:"invalid,omitempty"`
	Deduped   int          `json:"deduped,omitempty"`
	Reason    string       `json:"reason,omitempty"`
	Error     string       `json:"error,omitempty"`
	Acks      []EventAck   `json:"acks,omitempty"`
	Errors    []EventError `json:"errors,omitempty"`
}

func ParseCollectorResponse

func ParseCollectorResponse(raw []byte) (CollectorResponse, error)

func (CollectorResponse) PermanentFailure

func (r CollectorResponse) PermanentFailure() (bool, string)

func (CollectorResponse) RetryableError

func (r CollectorResponse) RetryableError() (bool, string)

type EventAck

type EventAck struct {
	EventID   string `json:"event_id,omitempty"`
	Status    string `json:"status,omitempty"`
	Retryable bool   `json:"retryable,omitempty"`
	Reason    string `json:"reason,omitempty"`
	Message   string `json:"message,omitempty"`
}

type EventError

type EventError struct {
	Code      string `json:"code,omitempty"`
	Message   string `json:"message,omitempty"`
	Retryable bool   `json:"retryable,omitempty"`
	Field     string `json:"field,omitempty"`
	EventID   string `json:"event_id,omitempty"`
}

type IngestEnvelope

type IngestEnvelope struct {
	APIVersion string            `json:"api_version"`
	Source     SourceInfo        `json:"source"`
	Events     []json.RawMessage `json:"events"`
}

func BuildIngestEnvelope

func BuildIngestEnvelope(sdk, version, service string, events []json.RawMessage) IngestEnvelope

type SourceInfo

type SourceInfo struct {
	SDK     string `json:"sdk"`
	Version string `json:"version"`
	Service string `json:"service"`
}

type ValidationError

type ValidationError struct {
	Field     string `json:"field"`
	Code      string `json:"code"`
	Message   string `json:"message"`
	EventID   string `json:"event_id,omitempty"`
	Retryable bool   `json:"retryable,omitempty"`
}

type ValidationErrors

type ValidationErrors []ValidationError

func ValidateEventMapDetailed

func ValidateEventMapDetailed(payload map[string]any, strict bool) ValidationErrors

func (ValidationErrors) Error

func (errs ValidationErrors) Error() string

Jump to

Keyboard shortcuts

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