Documentation
¶
Index ¶
- func ValidateDBName(name string) error
- type Client
- func (c *Client) Close() error
- func (c *Client) InsertEvents(ctx context.Context, batch []events.Envelope) error
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) QueryDashboardSummary(ctx context.Context) (*DashboardSummary, error)
- func (c *Client) QueryEventTypes(ctx context.Context) ([]EventTypeStat, error)
- func (c *Client) QueryEvents(ctx context.Context, limit, offset int) ([]EventRow, error)
- func (c *Client) QueryEventsFiltered(ctx context.Context, filters EventFilters) ([]EventRow, error)
- func (c *Client) QuerySources(ctx context.Context) ([]SourceStat, error)
- func (c *Client) QueryStats(ctx context.Context) (uint64, error)
- type Config
- type DashboardSummary
- type EventFilters
- type EventRow
- type EventTypeStat
- type RowScanner
- type SourceStat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateDBName ¶
ValidateDBName validates ClickHouse database name format.
Types ¶
type Client ¶
type Client struct {
Conn clickhouse.Conn
DBName string
}
Client wraps a ClickHouse connection.
func (*Client) InsertEvents ¶
InsertEvents stores a batch of Sentinel event envelopes.
func (*Client) QueryDashboardSummary ¶
func (c *Client) QueryDashboardSummary(ctx context.Context) (*DashboardSummary, error)
QueryDashboardSummary returns summary statistics for the dashboard.
func (*Client) QueryEventTypes ¶
func (c *Client) QueryEventTypes(ctx context.Context) ([]EventTypeStat, error)
QueryEventTypes returns event counts grouped by event type.
func (*Client) QueryEvents ¶
QueryEvents returns events from ClickHouse with limit and offset.
func (*Client) QueryEventsFiltered ¶
QueryEventsFiltered returns events filtered by various fields.
func (*Client) QuerySources ¶
func (c *Client) QuerySources(ctx context.Context) ([]SourceStat, error)
QuerySources returns event counts grouped by source.
type DashboardSummary ¶
type DashboardSummary struct {
TotalEvents uint64 `json:"total_events"`
ActiveServers int `json:"active_servers"`
ActiveGrants int `json:"active_grants"`
ActiveSessions int `json:"active_sessions"`
LatestSource string `json:"latest_source"`
LastEventType string `json:"last_event_type"`
LastEventTime string `json:"last_event_time,omitempty"`
}
DashboardSummary provides overview statistics for the dashboard.
type EventFilters ¶
type EventFilters struct {
TraceID string
Source string
EventType string
Server string
Namespace string
TeamID string
Cluster string
HumanID string
AgentID string
SessionID string
Decision string
ToolName string
Reason string
Limit int
Offset int
}
EventFilters provides filtering options for events.
type EventRow ¶
type EventRow struct {
Timestamp time.Time `json:"timestamp"`
TraceID string `json:"trace_id,omitempty"`
Source string `json:"source"`
EventType string `json:"event_type"`
Server string `json:"server,omitempty"`
Namespace string `json:"namespace,omitempty"`
TeamID string `json:"team_id,omitempty"`
Cluster string `json:"cluster,omitempty"`
HumanID string `json:"human_id,omitempty"`
AgentID string `json:"agent_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
Decision string `json:"decision,omitempty"`
ToolName string `json:"tool_name,omitempty"`
Payload json.RawMessage `json:"payload"`
}
EventRow represents a single event from ClickHouse.
type EventTypeStat ¶
EventTypeStat represents event counts by event type.
type RowScanner ¶
RowScanner abstracts row scanning for testability.
type SourceStat ¶
SourceStat represents event counts by source.