notificationtroubleshooting

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderStaleThresholdSeconds = 600
	SourceStaleThresholdSeconds   = 1800

	StatusPass    = "pass"
	StatusWarning = "warning"
	StatusFail    = "fail"
)

Variables

View Source
var (
	ErrInvalidJobsQuery            = errors.New("invalid notification troubleshooting jobs query")
	ErrUnsupportedNotificationName = errors.New("unsupported notification name")
)

Functions

func IsInvalidJobsQuery

func IsInvalidJobsQuery(err error) bool

func IsUnsupportedNotificationName

func IsUnsupportedNotificationName(err error) bool

Types

type ConfiguredSystemDestinationResponse

type ConfiguredSystemDestinationResponse struct {
	ProviderType      string `json:"providerType"`
	DestinationTarget string `json:"destinationTarget"`
}

type DiagnosticCheck

type DiagnosticCheck struct {
	Code    string `json:"code"`
	Label   string `json:"label"`
	Status  string `json:"status"`
	Message string `json:"message"`
	JobID   int64  `json:"jobId,omitempty"`
}

type DiagnosticsResponse

type DiagnosticsResponse struct {
	NotificationName       string                                `json:"notificationName"`
	Status                 string                                `json:"status"`
	Checks                 []DiagnosticCheck                     `json:"checks"`
	RecommendedActions     []string                              `json:"recommendedActions"`
	SubscriberCounts       SubscriberCounts                      `json:"subscriberCounts"`
	ConfiguredDestinations []ConfiguredSystemDestinationResponse `json:"configuredDestinations"`
}

type HealthResponse

type HealthResponse struct {
	Worker        WorkerHealth             `json:"worker"`
	Providers     []ProviderStatus         `json:"providers"`
	Notifications []NotificationHealth     `json:"notifications"`
	Schedules     []ScheduleHealth         `json:"schedules"`
	Warnings      []TroubleshootingWarning `json:"warnings"`
}

type JobDetail

type JobDetail struct {
	JobListItem
	Metadata map[string]string       `json:"metadata"`
	Args     map[string]any          `json:"args"`
	Errors   []SanitizedAttemptError `json:"errors"`
}

type JobListItem

type JobListItem struct {
	ID               int64      `json:"id"`
	State            string     `json:"state"`
	Queue            string     `json:"queue"`
	Kind             string     `json:"kind"`
	Attempt          int        `json:"attempt"`
	MaxAttempts      int        `json:"maxAttempts"`
	CreatedAt        time.Time  `json:"createdAt" format:"date-time"`
	ScheduledAt      time.Time  `json:"scheduledAt" format:"date-time"`
	AttemptedAt      *time.Time `json:"attemptedAt" format:"date-time"`
	FinalizedAt      *time.Time `json:"finalizedAt" format:"date-time"`
	NotificationKind string     `json:"notificationKind,omitempty"`
	Provider         string     `json:"provider,omitempty"`
	Target           string     `json:"target,omitempty"`
	CorrelationID    string     `json:"correlationId,omitempty"`
	SourceJobKind    string     `json:"sourceJobKind,omitempty"`
	SourceJobID      string     `json:"sourceJobId,omitempty"`
	LastError        *string    `json:"lastError"`
	Stale            bool       `json:"stale"`
}

type JobSummary

type JobSummary struct {
	ID          int64      `json:"id"`
	State       string     `json:"state"`
	CreatedAt   time.Time  `json:"createdAt" format:"date-time"`
	FinalizedAt *time.Time `json:"finalizedAt" format:"date-time"`
}

type JobsListResponse

type JobsListResponse struct {
	Data       []JobListItem `json:"data"`
	Pagination Pagination    `json:"pagination"`
}

type JobsQuery

type JobsQuery struct {
	Queues           []string
	Provider         string
	NotificationKind string
	States           []string
	Since            *time.Time
	Limit            int
	Cursor           string
}

type NotificationHealth

type NotificationHealth struct {
	Name                   string                                `json:"name"`
	ConfiguredDestinations []ConfiguredSystemDestinationResponse `json:"configuredDestinations"`
	SubscriberCounts       SubscriberCounts                      `json:"subscriberCounts"`
	Warnings               []TroubleshootingWarning              `json:"warnings"`
}

type Pagination

type Pagination struct {
	NextCursor string `json:"nextCursor,omitempty"`
}

type ProviderStatus

type ProviderStatus struct {
	ProviderType string            `json:"providerType"`
	Enabled      bool              `json:"enabled"`
	DisplayName  string            `json:"displayName"`
	Description  string            `json:"description"`
	Metadata     map[string]string `json:"metadata,omitempty"`
}

type QueueSummary

type QueueSummary struct {
	Name                  string     `json:"name"`
	MaxWorkers            int        `json:"maxWorkers"`
	Available             int64      `json:"available"`
	Retryable             int64      `json:"retryable"`
	Running               int64      `json:"running"`
	Scheduled             int64      `json:"scheduled"`
	Completed24h          int64      `json:"completed24h"`
	Discarded24h          int64      `json:"discarded24h"`
	OldestAvailableAt     *time.Time `json:"oldestAvailableAt"`
	StaleCount            int64      `json:"staleCount"`
	StaleThresholdSeconds int64      `json:"staleThresholdSeconds"`
}

type SanitizedAttemptError

type SanitizedAttemptError struct {
	Attempt int       `json:"attempt"`
	At      time.Time `json:"at"`
	Error   string    `json:"error"`
}

type ScheduleHealth

type ScheduleHealth struct {
	Name         string      `json:"name"`
	JobKind      string      `json:"jobKind"`
	DeliveryKind string      `json:"deliveryKind,omitempty"`
	Queue        string      `json:"queue"`
	Enabled      bool        `json:"enabled"`
	Schedule     string      `json:"schedule"`
	NextRunAt    *time.Time  `json:"nextRunAt"`
	LastJob      *JobSummary `json:"lastJob,omitempty"`
}

type Service

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

func New

func New(db *gorm.DB, cfg *config.Config) *Service

func (*Service) Diagnostics

func (s *Service) Diagnostics(ctx context.Context, rawName string) (DiagnosticsResponse, error)

func (*Service) Health

func (s *Service) Health(ctx context.Context) (HealthResponse, error)

func (*Service) Job

func (s *Service) Job(ctx context.Context, id int64) (JobDetail, bool, error)

func (*Service) Jobs

func (s *Service) Jobs(ctx context.Context, query JobsQuery) (JobsListResponse, error)

type SubscriberCounts

type SubscriberCounts struct {
	Email      int64 `json:"email"`
	Slack      int64 `json:"slack"`
	TotalUsers int64 `json:"totalUsers"`
}

type TroubleshootingWarning

type TroubleshootingWarning struct {
	Code     string `json:"code"`
	Severity string `json:"severity"`
	Message  string `json:"message"`
	Target   string `json:"target,omitempty"`
}

type WorkerHealth

type WorkerHealth struct {
	Enabled  bool           `json:"enabled"`
	Mode     string         `json:"mode"`
	PollOnly bool           `json:"pollOnly"`
	Queues   []QueueSummary `json:"queues"`
}

Jump to

Keyboard shortcuts

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