Documentation
¶
Overview ¶
Package loganalyst queries structured logs and produces AI-powered or fallback natural-language summaries of agent sessions, issues, failures, and arbitrary time ranges.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Analyst ¶
type Analyst struct {
// contains filtered or unexported fields
}
Analyst coordinates log querying, AI summarization, and caching.
func New ¶
func New(logs LogQuerier, ollama OllamaClient, logger *zap.Logger) *Analyst
New creates an Analyst. If ollama is nil the analyst produces structured fallback summaries instead of AI-generated text.
type LogQuerier ¶
type LogQuerier interface {
Query(ctx context.Context, f logstore.QueryFilter) ([]logstore.LogEntry, error)
}
LogQuerier abstracts the logstore for testing.
type OllamaAnalystHTTP ¶
type OllamaAnalystHTTP struct {
// contains filtered or unexported fields
}
OllamaAnalystHTTP is a minimal HTTP client for the Ollama /api/generate endpoint. It does not stream; it waits for the full response.
func NewOllamaAnalystClient ¶
func NewOllamaAnalystClient(url, model string, timeout time.Duration) *OllamaAnalystHTTP
NewOllamaAnalystClient creates a client that calls the Ollama generate API.
type OllamaClient ¶
OllamaClient abstracts the Ollama generate API for testing.
type ScopeFilter ¶
type ScopeFilter struct {
Type ScopeType `json:"type"`
ID string `json:"id"` // session ID or issue number as string
Since time.Time `json:"since"` // for timerange/failures
Until time.Time `json:"until"` // for timerange
}
ScopeFilter selects which logs to analyze.
type ScopeType ¶
type ScopeType string
ScopeType identifies what dimension of logs to summarize.
const ( // ScopeSession summarizes logs for a single agent session. ScopeSession ScopeType = "session" // ScopeIssue summarizes logs related to a specific issue number. ScopeIssue ScopeType = "issue" // ScopeTimeRange summarizes logs within an explicit time window. ScopeTimeRange ScopeType = "timerange" // ScopeFailures summarizes only error-level logs since a given time. ScopeFailures ScopeType = "failures" )
type Summary ¶
type Summary struct {
Scope ScopeFilter `json:"scope"`
Text string `json:"text"`
TotalEntries int `json:"total_entries"`
ErrorCount int `json:"error_count"`
WarnCount int `json:"warn_count"`
Components []string `json:"components"`
AIGenerated bool `json:"ai_generated"`
GeneratedAt time.Time `json:"generated_at"`
}
Summary is the result of a log analysis.