errors

package
v0.19.4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package errors provides the domain service for error group management, resolution lifecycle, and impact analysis. The repository interfaces define what the service needs from data stores.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DetailResult

type DetailResult struct {
	Group  store.ErrorGroup        `json:"group"`
	Events []store.ErrorGroupEvent `json:"events"`
}

DetailResult holds the full error group with lifecycle events.

type GroupSummary

type GroupSummary struct {
	Fingerprint     string `json:"fingerprint"`
	Service         string `json:"service"`
	Environment     string `json:"environment,omitempty"`
	ExceptionClass  string `json:"exception_class,omitempty"`
	Message         string `json:"message"`
	Status          string `json:"status"`
	OccurrenceCount int    `json:"occurrence_count"`
	LastSeenAt      string `json:"last_seen_at"`
	FirstSeenAt     string `json:"first_seen_at"`
	ReopenedCount   int    `json:"reopened_count,omitempty"`
}

GroupSummary is a compact view of an error group.

type ImpactRepository

type ImpactRepository interface {
	GetImpact(ctx context.Context, fingerprint string) (*store.ErrorImpact, error)
	GetAffectedUsers(ctx context.Context, fingerprint string, limit int) ([]store.AffectedUser, error)
	GetUserErrors(ctx context.Context, userID string, since time.Time) ([]store.ErrorSummary, error)
}

ImpactRepository defines data access for error impact analysis. Implemented by internal/db.ErrorImpactStore (SQLite adapter).

type ImpactResult

type ImpactResult struct {
	Impact        *store.ErrorImpact   `json:"impact"`
	AffectedUsers []store.AffectedUser `json:"affected_users,omitempty"`
}

ImpactResult holds the impact analysis for an error group.

type ListParams

type ListParams struct {
	Status      string
	Service     string
	Environment string
	SortBy      string
	Limit       int
}

ListParams controls filtering and pagination for error group listing.

type ListResult

type ListResult struct {
	TotalUnresolved int            `json:"total_unresolved"`
	Returned        int            `json:"returned"`
	ErrorGroups     []GroupSummary `json:"error_groups"`
}

ListResult is the result of listing error groups.

type Repository

type Repository interface {
	List(ctx context.Context, params store.ListErrorGroupParams) ([]store.ErrorGroup, error)
	Get(ctx context.Context, fingerprint string) (*store.ErrorGroup, error)
	Count(ctx context.Context, status store.ErrorGroupStatus) (int, error)
	Resolve(ctx context.Context, fingerprint string, reason string) error
	Ignore(ctx context.Context, fingerprint string, reason string) error
	ListEvents(ctx context.Context, fingerprint string, limit int) ([]store.ErrorGroupEvent, error)
}

Repository defines data access for error group operations. Implemented by internal/db.ErrorGroupStore (SQLite adapter).

type Service

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

Service provides error group queries, resolution lifecycle, and impact analysis.

func NewService

func NewService(repo Repository, impact ImpactRepository) *Service

NewService creates an error service. Either dependency may be nil; methods that need them return domain.ErrNotConfigured.

func (*Service) Detail

func (s *Service) Detail(ctx context.Context, fingerprint string) (*DetailResult, error)

Detail fetches an error group and its recent lifecycle events.

func (*Service) Ignore

func (s *Service) Ignore(ctx context.Context, fingerprint, reason string) error

Ignore marks an error group as permanently ignored with the given reason.

func (*Service) Impact

func (s *Service) Impact(ctx context.Context, fingerprint string, userLimit int) (*ImpactResult, error)

Impact returns impact analysis for an error group, including affected users.

func (*Service) List

func (s *Service) List(ctx context.Context, p ListParams) (*ListResult, error)

List returns error groups matching the given params.

func (*Service) Resolve

func (s *Service) Resolve(ctx context.Context, fingerprint, reason string) error

Resolve marks an error group as resolved with the given reason.

Jump to

Keyboard shortcuts

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