Documentation
¶
Index ¶
- Variables
- type AlertMock
- type AlertPipelineResult
- type AuthUseCase
- func (uc *AuthUseCase) GetAuthURL(state string) string
- func (uc *AuthUseCase) HandleCallback(ctx context.Context, code string) (*auth.Token, error)
- func (uc *AuthUseCase) IsNoAuthn() bool
- func (uc *AuthUseCase) Logout(ctx context.Context, tokenID auth.TokenID) error
- func (uc *AuthUseCase) ValidateToken(ctx context.Context, tokenID auth.TokenID, tokenSecret auth.TokenSecret) (*auth.Token, error)
- type AuthUseCaseInterface
- type ClusteringSummary
- type ClusteringUseCase
- func (uc *ClusteringUseCase) GetAlertClusters(ctx context.Context, params GetClustersParams) (*ClusteringSummary, error)
- func (uc *ClusteringUseCase) GetClusterAlerts(ctx context.Context, clusterID string, keyword string, limit, offset int) ([]*alert.Alert, int, error)
- func (uc *ClusteringUseCase) GetClusterAlertsWithParams(ctx context.Context, clusterID string, keyword string, limit, offset int, ...) ([]*alert.Alert, int, error)
- type GetClustersParams
- type NoAuthnUseCase
- func (uc *NoAuthnUseCase) GetAuthURL(state string) string
- func (uc *NoAuthnUseCase) HandleCallback(ctx context.Context, code string) (*auth.Token, error)
- func (uc *NoAuthnUseCase) IsNoAuthn() bool
- func (uc *NoAuthnUseCase) Logout(ctx context.Context, tokenID auth.TokenID) error
- func (uc *NoAuthnUseCase) ValidateToken(ctx context.Context, tokenID auth.TokenID, tokenSecret auth.TokenSecret) (*auth.Token, error)
- type OpenIDConfiguration
- type Option
- func WithActionLimit(actionLimit int) Option
- func WithEmbeddingClient(embeddingClient interfaces.EmbeddingClient) Option
- func WithFindingLimit(findingLimit int) Option
- func WithLLMClient(llmClient gollem.LLMClient) Option
- func WithMemoryService(memoryService *memory.Service) Option
- func WithNoAuthorization(noAuthorization bool) Option
- func WithPolicyClient(policyClient interfaces.PolicyClient) Option
- func WithPromptService(promptService interfaces.PromptService) Option
- func WithRepository(repository interfaces.Repository) Option
- func WithSlackService(slackService *slackService.Service) Option
- func WithStorageClient(storageClient interfaces.StorageClient) Option
- func WithStoragePrefix(storagePrefix string) Option
- func WithStrictAlert(strict bool) Option
- func WithTagService(tagService *tag.Service) Option
- func WithTimeSpan(timeSpan time.Duration) Option
- func WithTools(tools []gollem.ToolSet) Option
- type SlackEventMock
- func (mock *SlackEventMock) HandleSlackAppMention(ctx context.Context, slackMsg slack.Message) error
- func (mock *SlackEventMock) HandleSlackAppMentionCalls() []struct{ ... }
- func (mock *SlackEventMock) HandleSlackMessage(ctx context.Context, slackMsg slack.Message) error
- func (mock *SlackEventMock) HandleSlackMessageCalls() []struct{ ... }
- type SlackIDToken
- type SlackInteractionMock
- func (mock *SlackInteractionMock) HandleSlackInteractionBlockActions(ctx context.Context, user slack.User, slackThread slack.Thread, ...) error
- func (mock *SlackInteractionMock) HandleSlackInteractionBlockActionsCalls() []struct{ ... }
- func (mock *SlackInteractionMock) HandleSlackInteractionViewSubmission(ctx context.Context, user slack.User, callbackID slack.CallbackID, ...) error
- func (mock *SlackInteractionMock) HandleSlackInteractionViewSubmissionCalls() []struct{ ... }
- type SlackTokenResponse
- type TagUseCase
- func (u *TagUseCase) CreateTag(ctx context.Context, name string) (*tagmodel.Tag, error)
- func (u *TagUseCase) DeleteTag(ctx context.Context, name string) error
- func (u *TagUseCase) DeleteTagByID(ctx context.Context, tagID string) error
- func (u *TagUseCase) GetAvailableColorNames() ([]string, error)
- func (u *TagUseCase) GetAvailableColors() ([]string, error)
- func (u *TagUseCase) ListTags(ctx context.Context) ([]*tagmodel.Tag, error)
- func (u *TagUseCase) UpdateAlertTags(ctx context.Context, alertID types.AlertID, tags []string) (*alert.Alert, error)
- func (u *TagUseCase) UpdateAlertTagsByID(ctx context.Context, alertID types.AlertID, tagIDs []string) (*alert.Alert, error)
- func (u *TagUseCase) UpdateTag(ctx context.Context, tagID string, name, color, description string) (*tagmodel.Tag, error)
- func (u *TagUseCase) UpdateTicketTags(ctx context.Context, ticketID types.TicketID, tags []string) (*ticket.Ticket, error)
- func (u *TagUseCase) UpdateTicketTagsByID(ctx context.Context, ticketID types.TicketID, tagIDs []string) (*ticket.Ticket, error)
- type TicketCreationOptions
- type TicketUpdateFunction
- type UseCases
- func (uc *UseCases) BindAlertsToTicket(ctx context.Context, ticketID types.TicketID, alertIDs []types.AlertID) error
- func (x *UseCases) Chat(ctx context.Context, target *ticket.Ticket, message string) error
- func (uc *UseCases) CreateManualTicket(ctx context.Context, title, description string, user *slack.User) (*ticket.Ticket, error)
- func (uc *UseCases) CreateManualTicketWithTest(ctx context.Context, title, description string, user *slack.User, isTest bool) (*ticket.Ticket, error)
- func (uc *UseCases) CreateTicketFromAlerts(ctx context.Context, alertIDs []types.AlertID, user *slack.User, ...) (*ticket.Ticket, error)
- func (uc *UseCases) CreateTicketFromConversation(ctx context.Context, thread slack.Thread, user *slack.User, userContext string) (*ticket.Ticket, error)
- func (uc *UseCases) EscalateNotice(ctx context.Context, noticeID types.NoticeID) (*alert.Alert, error)
- func (u *UseCases) GenerateTicketAlertsJSONL(ctx context.Context, ticketID types.TicketID) ([]byte, error)
- func (uc *UseCases) GetSimilarTicketsForAlert(ctx context.Context, alertID types.AlertID, threshold float64, ...) ([]*ticket.Ticket, int, error)
- func (u *UseCases) GetTagService() *tag.Service
- func (uc *UseCases) GetUnboundAlertsFiltered(ctx context.Context, threshold *float64, keyword *string, ...) ([]*alert.Alert, int, error)
- func (u *UseCases) GetUserIcon(ctx context.Context, userID string) ([]byte, string, error)
- func (u *UseCases) GetUserProfile(ctx context.Context, userID string) (string, error)
- func (uc *UseCases) HandleAlert(ctx context.Context, schema types.AlertSchema, alertData any) ([]*alert.Alert, error)
- func (uc *UseCases) HandleSalvageRefresh(ctx context.Context, user slack.User, metadata string, values slack.StateValue, ...) error
- func (uc *UseCases) HandleSlackAppMention(ctx context.Context, slackMsg slack.Message) error
- func (uc *UseCases) HandleSlackInteractionBlockActions(ctx context.Context, slackUser slack.User, slackThread slack.Thread, ...) error
- func (uc *UseCases) HandleSlackInteractionViewSubmission(ctx context.Context, slackUser slack.User, callbackID slack.CallbackID, ...) error
- func (uc *UseCases) HandleSlackMessage(ctx context.Context, slackMsg slack.Message) error
- func (u *UseCases) IsSlackEnabled() bool
- func (uc *UseCases) ProcessAlertPipeline(ctx context.Context, schema types.AlertSchema, alertData any, ...) ([]*AlertPipelineResult, error)
- func (uc *UseCases) UpdateMultipleTicketsStatus(ctx context.Context, ticketIDs []types.TicketID, status types.TicketStatus) ([]*ticket.Ticket, error)
- func (uc *UseCases) UpdateTicket(ctx context.Context, ticketID types.TicketID, title, description string, ...) (*ticket.Ticket, error)
- func (uc *UseCases) UpdateTicketConclusion(ctx context.Context, ticketID types.TicketID, conclusion types.AlertConclusion, ...) (*ticket.Ticket, error)
- func (uc *UseCases) UpdateTicketStatus(ctx context.Context, ticketID types.TicketID, status types.TicketStatus) (*ticket.Ticket, error)
Constants ¶
This section is empty.
Variables ¶
var (
ErrSlackServiceNotConfigured = goerr.New("slack service not configured")
)
Functions ¶
This section is empty.
Types ¶
type AlertMock ¶
type AlertMock struct {
// HandleAlertWithAuthFunc mocks the HandleAlertWithAuth method.
HandleAlertWithAuthFunc func(ctx context.Context, schema types.AlertSchema, alertData any) ([]*alert.Alert, error)
// contains filtered or unexported fields
}
AlertMock is a mock implementation of Alert.
func TestSomethingThatUsesAlert(t *testing.T) {
// make and configure a mocked Alert
mockedAlert := &AlertMock{
HandleAlertWithAuthFunc: func(ctx context.Context, schema types.AlertSchema, alertData any) ([]*alert.Alert, error) {
panic("mock out the HandleAlertWithAuth method")
},
}
// use mockedAlert in code that requires Alert
// and then make assertions.
}
func (*AlertMock) HandleAlertWithAuth ¶
func (mock *AlertMock) HandleAlertWithAuth(ctx context.Context, schema types.AlertSchema, alertData any) ([]*alert.Alert, error)
HandleAlertWithAuth calls HandleAlertWithAuthFunc.
func (*AlertMock) HandleAlertWithAuthCalls ¶
func (mock *AlertMock) HandleAlertWithAuthCalls() []struct { Ctx context.Context Schema types.AlertSchema AlertData any }
HandleAlertWithAuthCalls gets all the calls that were made to HandleAlertWithAuth. Check the length with:
len(mockedAlert.HandleAlertWithAuthCalls())
type AlertPipelineResult ¶ added in v0.5.0
type AlertPipelineResult struct {
Alert *alert.Alert
EnrichResult policy.EnrichResults
TriageResult *policy.TriagePolicyResult
}
AlertPipelineResult represents the result of processing a single alert through the pipeline
type AuthUseCase ¶
type AuthUseCase struct {
// contains filtered or unexported fields
}
func NewAuthUseCase ¶
func NewAuthUseCase(repo interfaces.Repository, slackSvc *slack.Service, clientID, clientSecret, callbackURL string) *AuthUseCase
func (*AuthUseCase) GetAuthURL ¶
func (uc *AuthUseCase) GetAuthURL(state string) string
GetAuthURL returns the URL for Slack OAuth
func (*AuthUseCase) HandleCallback ¶
HandleCallback processes the OAuth callback
func (*AuthUseCase) IsNoAuthn ¶ added in v0.1.0
func (uc *AuthUseCase) IsNoAuthn() bool
IsNoAuthn returns false for regular AuthUseCase
func (*AuthUseCase) ValidateToken ¶
func (uc *AuthUseCase) ValidateToken(ctx context.Context, tokenID auth.TokenID, tokenSecret auth.TokenSecret) (*auth.Token, error)
ValidateToken validates the token and returns user info
type AuthUseCaseInterface ¶
type AuthUseCaseInterface interface {
GetAuthURL(state string) string
HandleCallback(ctx context.Context, code string) (*auth.Token, error)
ValidateToken(ctx context.Context, tokenID auth.TokenID, tokenSecret auth.TokenSecret) (*auth.Token, error)
Logout(ctx context.Context, tokenID auth.TokenID) error
IsNoAuthn() bool // Added to identify NoAuthnUseCase
}
AuthUseCaseInterface defines the interface for authentication use cases
type ClusteringSummary ¶ added in v0.1.0
type ClusteringSummary struct {
Clusters []*clustering.AlertCluster
NoiseAlertIDs []types.AlertID
Parameters clustering.DBSCANParams
ComputedAt time.Time
TotalCount int
}
ClusteringSummary represents the summary of clustering results
type ClusteringUseCase ¶ added in v0.1.0
type ClusteringUseCase struct {
// contains filtered or unexported fields
}
ClusteringUseCase provides clustering-related use cases
func NewClusteringUseCase ¶ added in v0.1.0
func NewClusteringUseCase(repo interfaces.Repository) *ClusteringUseCase
NewClusteringUseCase creates a new clustering use case instance
func (*ClusteringUseCase) GetAlertClusters ¶ added in v0.1.0
func (uc *ClusteringUseCase) GetAlertClusters(ctx context.Context, params GetClustersParams) (*ClusteringSummary, error)
GetAlertClusters retrieves alert clusters
func (*ClusteringUseCase) GetClusterAlerts ¶ added in v0.1.0
func (uc *ClusteringUseCase) GetClusterAlerts(ctx context.Context, clusterID string, keyword string, limit, offset int) ([]*alert.Alert, int, error)
GetClusterAlerts retrieves alerts in a specific cluster with filtering Since we no longer cache clusters, this method now requires re-clustering to find the specific cluster
func (*ClusteringUseCase) GetClusterAlertsWithParams ¶ added in v0.1.0
func (uc *ClusteringUseCase) GetClusterAlertsWithParams(ctx context.Context, clusterID string, keyword string, limit, offset int, params clustering.DBSCANParams) ([]*alert.Alert, int, error)
GetClusterAlertsWithParams retrieves alerts in a specific cluster with filtering using specific DBSCAN parameters
type GetClustersParams ¶ added in v0.1.0
type GetClustersParams struct {
MinClusterSize int
Limit int
Offset int
Keyword string
DBSCANParams clustering.DBSCANParams
}
GetClustersParams represents parameters for getting clusters
type NoAuthnUseCase ¶ added in v0.1.0
type NoAuthnUseCase struct {
// contains filtered or unexported fields
}
NoAuthnUseCase provides a mock authentication that always returns an anonymous user
func NewNoAuthnUseCase ¶ added in v0.1.0
func NewNoAuthnUseCase(repo interfaces.Repository) *NoAuthnUseCase
NewNoAuthnUseCase creates a new NoAuthnUseCase instance
func (*NoAuthnUseCase) GetAuthURL ¶ added in v0.1.0
func (uc *NoAuthnUseCase) GetAuthURL(state string) string
GetAuthURL returns a dummy URL (should not be called in no-auth mode)
func (*NoAuthnUseCase) HandleCallback ¶ added in v0.1.0
HandleCallback handles OAuth callback (should not be called in no-auth mode)
func (*NoAuthnUseCase) IsNoAuthn ¶ added in v0.1.0
func (uc *NoAuthnUseCase) IsNoAuthn() bool
IsNoAuthn returns true for NoAuthnUseCase
func (*NoAuthnUseCase) ValidateToken ¶ added in v0.1.0
func (uc *NoAuthnUseCase) ValidateToken(ctx context.Context, tokenID auth.TokenID, tokenSecret auth.TokenSecret) (*auth.Token, error)
ValidateToken always returns an anonymous user token
type OpenIDConfiguration ¶
type OpenIDConfiguration struct {
Issuer string `json:"issuer"`
AuthorizationEndpoint string `json:"authorization_endpoint"`
TokenEndpoint string `json:"token_endpoint"`
UserinfoEndpoint string `json:"userinfo_endpoint"`
JWKSURI string `json:"jwks_uri"`
ScopesSupported []string `json:"scopes_supported"`
ResponseTypesSupported []string `json:"response_types_supported"`
ResponseModesSupported []string `json:"response_modes_supported"`
GrantTypesSupported []string `json:"grant_types_supported"`
SubjectTypesSupported []string `json:"subject_types_supported"`
IDTokenSigningAlgValuesSupported []string `json:"id_token_signing_alg_values_supported"`
ClaimsSupported []string `json:"claims_supported"`
ClaimsParameterSupported bool `json:"claims_parameter_supported"`
RequestParameterSupported bool `json:"request_parameter_supported"`
RequestURIParameterSupported bool `json:"request_uri_parameter_supported"`
TokenEndpointAuthMethodsSupported []string `json:"token_endpoint_auth_methods_supported"`
}
OpenIDConfiguration represents Slack's OpenID Connect configuration
type Option ¶
type Option func(*UseCases)
func WithActionLimit ¶
func WithEmbeddingClient ¶
func WithEmbeddingClient(embeddingClient interfaces.EmbeddingClient) Option
func WithFindingLimit ¶
func WithLLMClient ¶
func WithMemoryService ¶ added in v0.5.0
func WithNoAuthorization ¶ added in v0.7.0
func WithPolicyClient ¶
func WithPolicyClient(policyClient interfaces.PolicyClient) Option
func WithPromptService ¶ added in v0.4.0
func WithPromptService(promptService interfaces.PromptService) Option
func WithRepository ¶
func WithRepository(repository interfaces.Repository) Option
func WithSlackService ¶
func WithSlackService(slackService *slackService.Service) Option
func WithStorageClient ¶
func WithStorageClient(storageClient interfaces.StorageClient) Option
func WithStoragePrefix ¶
func WithStrictAlert ¶ added in v0.1.0
func WithTagService ¶ added in v0.2.0
func WithTimeSpan ¶
WithTimeSpan is used to set the time span for fetching alerts to search similar alerts
type SlackEventMock ¶
type SlackEventMock struct {
// HandleSlackAppMentionFunc mocks the HandleSlackAppMention method.
HandleSlackAppMentionFunc func(ctx context.Context, slackMsg slack.Message) error
// HandleSlackMessageFunc mocks the HandleSlackMessage method.
HandleSlackMessageFunc func(ctx context.Context, slackMsg slack.Message) error
// contains filtered or unexported fields
}
SlackEventMock is a mock implementation of SlackEvent.
func TestSomethingThatUsesSlackEvent(t *testing.T) {
// make and configure a mocked SlackEvent
mockedSlackEvent := &SlackEventMock{
HandleSlackAppMentionFunc: func(ctx context.Context, slackMsg slack.Message) error {
panic("mock out the HandleSlackAppMention method")
},
HandleSlackMessageFunc: func(ctx context.Context, slackMsg slack.Message) error {
panic("mock out the HandleSlackMessage method")
},
}
// use mockedSlackEvent in code that requires SlackEvent
// and then make assertions.
}
func (*SlackEventMock) HandleSlackAppMention ¶
func (mock *SlackEventMock) HandleSlackAppMention(ctx context.Context, slackMsg slack.Message) error
HandleSlackAppMention calls HandleSlackAppMentionFunc.
func (*SlackEventMock) HandleSlackAppMentionCalls ¶
func (mock *SlackEventMock) HandleSlackAppMentionCalls() []struct { Ctx context.Context SlackMsg slack.Message }
HandleSlackAppMentionCalls gets all the calls that were made to HandleSlackAppMention. Check the length with:
len(mockedSlackEvent.HandleSlackAppMentionCalls())
func (*SlackEventMock) HandleSlackMessage ¶
HandleSlackMessage calls HandleSlackMessageFunc.
func (*SlackEventMock) HandleSlackMessageCalls ¶
func (mock *SlackEventMock) HandleSlackMessageCalls() []struct { Ctx context.Context SlackMsg slack.Message }
HandleSlackMessageCalls gets all the calls that were made to HandleSlackMessage. Check the length with:
len(mockedSlackEvent.HandleSlackMessageCalls())
type SlackIDToken ¶
type SlackIDToken struct {
Sub string `json:"sub"`
Email string `json:"email"`
Name string `json:"name"`
}
SlackIDToken represents the decoded ID token from Slack
type SlackInteractionMock ¶
type SlackInteractionMock struct {
// HandleSlackInteractionBlockActionsFunc mocks the HandleSlackInteractionBlockActions method.
HandleSlackInteractionBlockActionsFunc func(ctx context.Context, user slack.User, slackThread slack.Thread, actionID slack.ActionID, value string, triggerID string) error
// HandleSlackInteractionViewSubmissionFunc mocks the HandleSlackInteractionViewSubmission method.
HandleSlackInteractionViewSubmissionFunc func(ctx context.Context, user slack.User, callbackID slack.CallbackID, metadata string, values slack.StateValue) error
// contains filtered or unexported fields
}
SlackInteractionMock is a mock implementation of SlackInteraction.
func TestSomethingThatUsesSlackInteraction(t *testing.T) {
// make and configure a mocked SlackInteraction
mockedSlackInteraction := &SlackInteractionMock{
HandleSlackInteractionBlockActionsFunc: func(ctx context.Context, user slack.User, slackThread slack.Thread, actionID slack.ActionID, value string, triggerID string) error {
panic("mock out the HandleSlackInteractionBlockActions method")
},
HandleSlackInteractionViewSubmissionFunc: func(ctx context.Context, user slack.User, callbackID slack.CallbackID, metadata string, values slack.StateValue) error {
panic("mock out the HandleSlackInteractionViewSubmission method")
},
}
// use mockedSlackInteraction in code that requires SlackInteraction
// and then make assertions.
}
func (*SlackInteractionMock) HandleSlackInteractionBlockActions ¶
func (mock *SlackInteractionMock) HandleSlackInteractionBlockActions(ctx context.Context, user slack.User, slackThread slack.Thread, actionID slack.ActionID, value string, triggerID string) error
HandleSlackInteractionBlockActions calls HandleSlackInteractionBlockActionsFunc.
func (*SlackInteractionMock) HandleSlackInteractionBlockActionsCalls ¶
func (mock *SlackInteractionMock) HandleSlackInteractionBlockActionsCalls() []struct { Ctx context.Context User slack.User SlackThread slack.Thread ActionID slack.ActionID Value string TriggerID string }
HandleSlackInteractionBlockActionsCalls gets all the calls that were made to HandleSlackInteractionBlockActions. Check the length with:
len(mockedSlackInteraction.HandleSlackInteractionBlockActionsCalls())
func (*SlackInteractionMock) HandleSlackInteractionViewSubmission ¶
func (mock *SlackInteractionMock) HandleSlackInteractionViewSubmission(ctx context.Context, user slack.User, callbackID slack.CallbackID, metadata string, values slack.StateValue) error
HandleSlackInteractionViewSubmission calls HandleSlackInteractionViewSubmissionFunc.
func (*SlackInteractionMock) HandleSlackInteractionViewSubmissionCalls ¶
func (mock *SlackInteractionMock) HandleSlackInteractionViewSubmissionCalls() []struct { Ctx context.Context User slack.User CallbackID slack.CallbackID Metadata string Values slack.StateValue }
HandleSlackInteractionViewSubmissionCalls gets all the calls that were made to HandleSlackInteractionViewSubmission. Check the length with:
len(mockedSlackInteraction.HandleSlackInteractionViewSubmissionCalls())
type SlackTokenResponse ¶
type SlackTokenResponse struct {
OK bool `json:"ok"`
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
Scope string `json:"scope"`
BotUserID string `json:"bot_user_id"`
AppID string `json:"app_id"`
Team struct {
Name string `json:"name"`
ID string `json:"id"`
} `json:"team"`
Enterprise interface{} `json:"enterprise"`
AuthedUser struct {
ID string `json:"id"`
Scope string `json:"scope"`
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
} `json:"authed_user"`
IDToken string `json:"id_token"`
Error string `json:"error"`
}
SlackTokenResponse represents the response from Slack token exchange
type TagUseCase ¶ added in v0.2.0
type TagUseCase struct {
// contains filtered or unexported fields
}
TagUseCase provides tag management use cases
func NewTagUseCase ¶ added in v0.2.0
func NewTagUseCase(tagService *tag.Service) *TagUseCase
NewTagUseCase creates a new tag use case
func (*TagUseCase) DeleteTag ¶ added in v0.2.0
func (u *TagUseCase) DeleteTag(ctx context.Context, name string) error
DeleteTag deletes a tag by name (deprecated, use DeleteTagByID)
func (*TagUseCase) DeleteTagByID ¶ added in v0.2.0
func (u *TagUseCase) DeleteTagByID(ctx context.Context, tagID string) error
DeleteTagByID deletes a tag by ID
func (*TagUseCase) GetAvailableColorNames ¶ added in v0.2.0
func (u *TagUseCase) GetAvailableColorNames() ([]string, error)
GetAvailableColorNames returns user-friendly color names for tags
func (*TagUseCase) GetAvailableColors ¶ added in v0.2.0
func (u *TagUseCase) GetAvailableColors() ([]string, error)
GetAvailableColors returns available color options for tags (Tailwind classes)
func (*TagUseCase) UpdateAlertTags ¶ added in v0.2.0
func (u *TagUseCase) UpdateAlertTags(ctx context.Context, alertID types.AlertID, tags []string) (*alert.Alert, error)
UpdateAlertTags updates tags for an alert (legacy name-based method)
func (*TagUseCase) UpdateAlertTagsByID ¶ added in v0.2.0
func (u *TagUseCase) UpdateAlertTagsByID(ctx context.Context, alertID types.AlertID, tagIDs []string) (*alert.Alert, error)
UpdateAlertTagsByID updates tags for an alert using tag IDs directly
func (*TagUseCase) UpdateTag ¶ added in v0.2.0
func (u *TagUseCase) UpdateTag(ctx context.Context, tagID string, name, color, description string) (*tagmodel.Tag, error)
UpdateTag updates tag metadata (name, color, description)
type TicketCreationOptions ¶
type TicketCreationOptions struct {
AlertIDs []types.AlertID
SlackThread *slack.Thread
Assignee *slack.User
Title string
Description string
TitleSource types.Source // Source of title
DescriptionSource types.Source // Source of description
FillMetadata bool // Whether to use LLM to fill metadata
IsTest bool // Whether this is a test ticket
ValidateAlerts bool // Whether to validate alerts exist and are unbound
UpdateAlerts bool // Whether to update alerts with ticket ID
AutoInheritFromAlert bool // Whether to auto-inherit metadata from single alert
}
TicketCreationOptions contains options for ticket creation
type TicketUpdateFunction ¶
TicketUpdateFunction defines a function that updates a ticket
type UseCases ¶
type UseCases struct {
// use cases
ClusteringUC *ClusteringUseCase
TagUC *TagUseCase
// contains filtered or unexported fields
}
func (*UseCases) BindAlertsToTicket ¶ added in v0.1.0
func (uc *UseCases) BindAlertsToTicket(ctx context.Context, ticketID types.TicketID, alertIDs []types.AlertID) error
BindAlertsToTicket binds multiple alerts to a ticket, recalculates embedding, and updates Slack display
func (*UseCases) Chat ¶
Chat processes a chat message for the specified ticket Message routing is handled via msg.Notify and msg.Trace functions in the context
func (*UseCases) CreateManualTicket ¶
func (uc *UseCases) CreateManualTicket(ctx context.Context, title, description string, user *slack.User) (*ticket.Ticket, error)
CreateManualTicket creates a ticket manually without associated alerts
func (*UseCases) CreateManualTicketWithTest ¶
func (uc *UseCases) CreateManualTicketWithTest(ctx context.Context, title, description string, user *slack.User, isTest bool) (*ticket.Ticket, error)
CreateManualTicketWithTest creates a ticket manually without associated alerts with test flag
func (*UseCases) CreateTicketFromAlerts ¶ added in v0.1.0
func (uc *UseCases) CreateTicketFromAlerts(ctx context.Context, alertIDs []types.AlertID, user *slack.User, slackThread *slack.Thread) (*ticket.Ticket, error)
CreateTicketFromAlerts creates a ticket from one or more alerts (used by both Slack and Web UI)
func (*UseCases) CreateTicketFromConversation ¶ added in v0.5.0
func (uc *UseCases) CreateTicketFromConversation( ctx context.Context, thread slack.Thread, user *slack.User, userContext string, ) (*ticket.Ticket, error)
CreateTicketFromConversation creates a ticket from Slack conversation history
func (*UseCases) EscalateNotice ¶ added in v0.4.0
func (uc *UseCases) EscalateNotice(ctx context.Context, noticeID types.NoticeID) (*alert.Alert, error)
EscalateNotice escalates a notice to a full alert
func (*UseCases) GenerateTicketAlertsJSONL ¶ added in v0.1.0
func (u *UseCases) GenerateTicketAlertsJSONL(ctx context.Context, ticketID types.TicketID) ([]byte, error)
GenerateTicketAlertsJSONL generates JSONL data for alerts associated with a ticket
func (*UseCases) GetSimilarTicketsForAlert ¶ added in v0.1.0
func (uc *UseCases) GetSimilarTicketsForAlert(ctx context.Context, alertID types.AlertID, threshold float64, offset, limit int) ([]*ticket.Ticket, int, error)
GetSimilarTicketsForAlert finds tickets similar to a given alert based on embedding similarity
func (*UseCases) GetTagService ¶ added in v0.2.0
GetTagService returns the tag service if available
func (*UseCases) GetUnboundAlertsFiltered ¶ added in v0.1.0
func (uc *UseCases) GetUnboundAlertsFiltered(ctx context.Context, threshold *float64, keyword *string, ticketID *types.TicketID, offset, limit int) ([]*alert.Alert, int, error)
GetUnboundAlertsFiltered returns unbound alerts filtered by similarity threshold and keyword
func (*UseCases) GetUserIcon ¶
GetUserIcon returns the user's icon image data and content type
func (*UseCases) GetUserProfile ¶
GetUserProfile returns the user's profile name via Slack service
func (*UseCases) HandleAlert ¶
func (*UseCases) HandleSalvageRefresh ¶
func (*UseCases) HandleSlackAppMention ¶
HandleSlackAppMention handles a slack app mention event. It will dispatch a slack action to the alert.
func (*UseCases) HandleSlackInteractionBlockActions ¶
func (uc *UseCases) HandleSlackInteractionBlockActions(ctx context.Context, slackUser slack.User, slackThread slack.Thread, actionID slack.ActionID, value, triggerID string) error
HandleSlackInteractionBlockActions handles a slack interaction block action.
func (*UseCases) HandleSlackInteractionViewSubmission ¶
func (*UseCases) HandleSlackMessage ¶
HandleSlackMessage handles a message from a slack user. It saves the message as an alert comment if the message is in the Alert thread.
func (*UseCases) IsSlackEnabled ¶ added in v0.1.0
IsSlackEnabled returns whether Slack functionality is enabled
func (*UseCases) ProcessAlertPipeline ¶ added in v0.5.0
func (uc *UseCases) ProcessAlertPipeline( ctx context.Context, schema types.AlertSchema, alertData any, notifier interfaces.Notifier, ) ([]*AlertPipelineResult, error)
ProcessAlertPipeline processes an alert through the complete pipeline. This is a pure function without side effects (no DB save, no Slack notification).
Pipeline stages: 1. Ingest Policy Evaluation - transforms raw data into Alert objects 2. Tag Conversion - converts tag names to tag IDs 3. Metadata Generation - fills missing titles/descriptions using LLM 4. Enrich Policy Evaluation - executes enrichment tasks (query/agent) 5. Triage Policy Evaluation - applies final metadata and determines publish type
All pipeline events are emitted through the notifier for real-time monitoring. The notifier receives type-safe events for each stage of processing.
func (*UseCases) UpdateMultipleTicketsStatus ¶
func (uc *UseCases) UpdateMultipleTicketsStatus(ctx context.Context, ticketIDs []types.TicketID, status types.TicketStatus) ([]*ticket.Ticket, error)
UpdateMultipleTicketsStatus updates multiple tickets' status
func (*UseCases) UpdateTicket ¶
func (uc *UseCases) UpdateTicket(ctx context.Context, ticketID types.TicketID, title, description string, user *slack.User) (*ticket.Ticket, error)
UpdateTicket updates a ticket's title and description