ticket

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertRepository

type AlertRepository interface {
	BatchGetAlerts(ctx context.Context, alertIDs []types.AlertID) (alert.Alerts, error)
	GetKnowledges(ctx context.Context, topic types.KnowledgeTopic) ([]*knowledge.Knowledge, error)
}

type Comment

type Comment struct {
	ID             types.CommentID `json:"id"`
	TicketID       types.TicketID  `json:"ticket_id"`
	CreatedAt      time.Time       `json:"created_at"`
	Comment        string          `json:"comment"`
	User           *slack.User     `json:"user"`
	SlackMessageID string          `json:"slack_message_id"`
	Prompted       bool            `json:"prompted"`
}

type Finding

type Finding struct {
	Severity       types.AlertSeverity `json:"severity"`
	Summary        string              `json:"summary"`
	Reason         string              `json:"reason"`
	Recommendation string              `json:"recommendation"`
}

Finding is the conclusion of the alert. This is set by the AI.

func (*Finding) Validate

func (x *Finding) Validate() error

type History

type History struct {
	ID        types.HistoryID `json:"id"`
	TicketID  types.TicketID  `json:"ticket_id"`
	CreatedAt time.Time       `json:"created_at"`
}

func NewHistory

func NewHistory(ctx context.Context, ticketID types.TicketID) History

type Metadata

type Metadata struct {
	// Title is the title of the ticket for human readability.
	Title string `json:"title" required:"true" maxLength:"255"`
	// Description is the description of the ticket for human readability.
	Description string `json:"description" required:"true" maxLength:"1024"`
	// Summary is the summary of the ticket for AI analysis.
	Summary string `json:"summary" maxLength:"4096"`
	// TitleSource indicates the source of the title (human, ai, inherited)
	TitleSource types.Source `json:"title_source" maxLength:"255"`
	// DescriptionSource indicates the source of the description (human, ai, inherited)
	DescriptionSource types.Source `json:"description_source" maxLength:"1024"`
}

func (*Metadata) Validate

func (x *Metadata) Validate() error

type Ticket

type Ticket struct {
	ID             types.TicketID  `json:"id"`
	AlertIDs       []types.AlertID `json:"-"`
	SlackThread    *slack.Thread   `json:"slack_thread"`
	SlackMessageID string          `json:"slack_message_id"`
	CreatedAt      time.Time       `json:"created_at"`
	UpdatedAt      time.Time       `json:"updated_at"`

	// Topic is inherited from the first alert and never changes
	Topic types.KnowledgeTopic `json:"topic"`

	Metadata

	Status     types.TicketStatus    `json:"status"`
	Conclusion types.AlertConclusion `json:"conclusion"`
	Reason     string                `json:"reason"`

	ResolvedAt *time.Time `json:"resolved_at"`
	ArchivedAt *time.Time `json:"archived_at"`

	Finding  *Finding    `json:"finding"`
	Assignee *slack.User `json:"assignee"`

	IsTest bool `json:"is_test"`

	Embedding firestore.Vector32 `json:"-"`
	TagIDs    map[string]bool    `json:"tag_ids"`
}

func New

func New(ctx context.Context, alertIDs []types.AlertID, slackThread *slack.Thread) Ticket

func (*Ticket) CalculateEmbedding

func (x *Ticket) CalculateEmbedding(ctx context.Context, llmClient gollem.LLMClient, alertRepo AlertRepository) error

CalculateEmbedding calculates the ticket embedding using a weighted average approach. It combines embeddings from title/description (weight 0.3) and alerts (weight 0.7).

func (*Ticket) FillMetadata

func (x *Ticket) FillMetadata(ctx context.Context, llmClient gollem.LLMClient, alertRepo AlertRepository) error

func (*Ticket) GetTagNames added in v0.2.0

func (t *Ticket) GetTagNames(ctx context.Context, tagGetter func(context.Context, []string) ([]*tag.Tag, error)) ([]string, error)

GetTagNames returns tag names for external API compatibility

func (*Ticket) HasSlackThread added in v0.1.0

func (t *Ticket) HasSlackThread() bool

HasSlackThread returns true if the ticket has a valid Slack thread

func (*Ticket) NewComment

func (x *Ticket) NewComment(ctx context.Context, message string, user *slack.User, slackMessageID string) Comment

func (*Ticket) NormalizeLegacyStatus added in v0.10.0

func (t *Ticket) NormalizeLegacyStatus()

NormalizeLegacyStatus migrates legacy "pending" status to "open" for backward compatibility. This handles existing Firestore data created before the pending status was removed.

func (*Ticket) Validate

func (x *Ticket) Validate() error

Jump to

Keyboard shortcuts

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