Documentation
¶
Index ¶
- Constants
- func GetAuditLogTTLMinId(valkeyAuditStreamExpiry time.Duration) string
- type AuditAdapter
- func (c *AuditAdapter) CreateHubEvent(relevantLabels []string, alert template.Alert) MdaiHubEvent
- func (c *AuditAdapter) CreateRestartEvent(mdaiCRName string, envMap map[string]string) map[string]string
- func (c *AuditAdapter) HandleEventsGet(ctx context.Context) ([]map[string]any, error)
- func (c *AuditAdapter) InsertAuditLogEventFromEvent(ctx context.Context, mdaiHubEvent MdaiHubEvent) error
- func (c *AuditAdapter) InsertAuditLogEventFromMap(ctx context.Context, mdaiHubEventMap map[string]string) error
- type MdaiHubAction
- type MdaiHubEventdeprecated
Constants ¶
View Source
const ( HubName = "hub_name" Expression = "expression" CurrentValue = "current_value" AlertName = "alert_name" EventTriggered = "event_triggered" VariableUpdated = "variable_updated" CollectorRestart = "collector_restart" ValkeyUpdate = "valkey_update" Evaluation = "evaluation" MdaiHubEventHistoryStreamName = "mdai_hub_event_history" )
Variables ¶
This section is empty.
Functions ¶
func GetAuditLogTTLMinId ¶ added in v0.1.3
Types ¶
type AuditAdapter ¶
type AuditAdapter struct {
// contains filtered or unexported fields
}
func NewAuditAdapter ¶
func NewAuditAdapter( logger *zap.Logger, valkeyClient valkey.Client, ) *AuditAdapter
func (*AuditAdapter) CreateHubEvent ¶
func (c *AuditAdapter) CreateHubEvent(relevantLabels []string, alert template.Alert) MdaiHubEvent
func (*AuditAdapter) CreateRestartEvent ¶
func (*AuditAdapter) HandleEventsGet ¶
func (*AuditAdapter) InsertAuditLogEventFromEvent ¶
func (c *AuditAdapter) InsertAuditLogEventFromEvent(ctx context.Context, mdaiHubEvent MdaiHubEvent) error
func (*AuditAdapter) InsertAuditLogEventFromMap ¶
type MdaiHubAction ¶
type MdaiHubAction struct {
HubName string `json:"hub_name"` // name of hub action was triggered
Event string `json:"event"` // event type (action/update_variable)
Status string `json:"status"` // status of event
Type string `json:"type"` // type of action
Operation string `json:"operation"` // operation to perform (add_element, remove_element)
Target string `json:"target"` // target of action (ex. variable/mdaihub-sample/service_list)
VariableRef string `json:"variable_ref"` // variable affected by action
Variable string `json:"variable"` // variable value
}
func (MdaiHubAction) MarshalLogObject ¶ added in v0.1.4
func (hubAction MdaiHubAction) MarshalLogObject(enc zapcore.ObjectEncoder) error
func (MdaiHubAction) ToSequence ¶
func (hubAction MdaiHubAction) ToSequence() iter.Seq2[string, string]
type MdaiHubEvent
deprecated
type MdaiHubEvent struct {
HubName string `json:"hub_name"` // name of hub event was triggered
Event string `json:"event"` // event type (evaluation/prometheus_alert)
Type string `json:"type"` // triggered event
Name string `json:"name"` // context; name of event to connect action
Expression string `json:"expression"` // context; expr used to trigger event
MetricName string `json:"metric_name"` // context; expr delta & metric measured by observer
Value string `json:"value"` // payload; value of metric when event triggered
Status string `json:"status"` // payload; status of event (active, updated)
RelevantLabelValues string `json:"relevant_label_values"` // payload; variable triggering event
}
Deprecated: With the move to the MdaiEvent type from the mdai-event-hub, this type is mostly redundant. Suggested to use a map[string]string with audit/adapter.InsertAuditLogEventFromMap instead
func (MdaiHubEvent) MarshalLogObject ¶ added in v0.1.4
func (hubEvent MdaiHubEvent) MarshalLogObject(enc zapcore.ObjectEncoder) error
func (MdaiHubEvent) ToSequence ¶
func (hubEvent MdaiHubEvent) ToSequence() iter.Seq2[string, string]
Click to show internal directories.
Click to hide internal directories.