aggregator

package
v0.5.9-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const TimeFormat = "2006-01-02T15:04:05Z"

Variables

This section is empty.

Functions

func DiagnoseEvents

func DiagnoseEvents(aiMgr *ai.AIManager, c *server.CompletedConfig) http.HandlerFunc

DiagnoseEvents returns an HTTP handler function that performs AI diagnosis on events using SSE

@Summary Diagnose events using AI @Description This endpoint analyzes events using AI to identify issues and provide solutions @Tags insight @Accept json @Produce text/event-stream @Param request body EventDiagnoseRequest true "The events to analyze" @Success 200 {object} ai.DiagnosisEvent @Failure 400 {string} string "Bad Request" @Failure 500 {string} string "Internal Server Error" @Router /insight/aggregator/event/diagnosis/stream [post]

func DiagnosePodLogs

func DiagnosePodLogs(aiMgr *ai.AIManager, c *server.CompletedConfig) http.HandlerFunc

DiagnosePodLogs returns an HTTP handler function that performs AI diagnosis on pod logs

@Summary Diagnose pod logs using AI @Description This endpoint analyzes pod logs using AI to identify issues and provide solutions @Tags insight @Accept json @Produce text/event-stream @Param request body DiagnoseRequest true "The logs to analyze" @Success 200 {object} ai.DiagnosisEvent @Failure 400 {string} string "Bad Request" @Failure 500 {string} string "Internal Server Error" @Router /insight/aggregator/log/diagnosis/stream [post]

func GetEvents added in v0.5.7

func GetEvents(clusterMgr *cluster.ClusterManager, c *server.CompletedConfig) http.HandlerFunc

GetEvents returns an HTTP handler function that streams events for a resource using SSE

@Summary Stream resource events using Server-Sent Events @Description This endpoint streams resource events in real-time using SSE. It supports event type filtering and automatic updates. @Tags insight @Produce text/event-stream @Param cluster path string true "The cluster name" @Param namespace path string true "The namespace name" @Param name path string true "The resource name" @Param kind query string true "The resource kind" @Param apiVersion query string true "The resource API version" @Param type query string false "Event type filter (Normal or Warning)" @Success 200 {array} ai.Event @Failure 400 {string} string "Bad Request" @Failure 401 {string} string "Unauthorized" @Failure 404 {string} string "Not Found" @Router /insight/aggregator/event/{cluster}/{namespace}/{name} [get]

func GetPodLogs

func GetPodLogs(clusterMgr *cluster.ClusterManager, c *server.CompletedConfig) http.HandlerFunc

GetPodLogs returns an HTTP handler function that streams Pod logs using Server-Sent Events

@Summary Stream pod logs using Server-Sent Events @Description This endpoint streams pod logs in real-time using SSE. It supports container selection and automatic reconnection. @Tags insight @Produce text/event-stream,application/json @Param cluster path string true "The cluster name" @Param namespace path string true "The namespace name" @Param name path string true "The pod name" @Param container query string false "The container name (optional if pod has only one container)" @Param since query string false "Only return logs newer than a relative duration like 5s, 2m, or 3h" @Param sinceTime query string false "Only return logs after a specific date (RFC3339)" @Param timestamps query bool false "Include timestamps in log output" @Param tailLines query int false "Number of lines from the end of the logs to show" @Param download query bool false "Download logs as file instead of streaming" @Success 200 {object} LogEntry @Failure 400 {string} string "Bad Request" @Failure 401 {string} string "Unauthorized" @Failure 404 {string} string "Not Found" @Router /insight/aggregator/log/pod/{cluster}/{namespace}/{name} [get]

Types

type DiagnoseRequest

type DiagnoseRequest struct {
	Logs     []string `json:"logs"`
	Language string   `json:"language"` // Language code for AI response
}

DiagnoseRequest represents the request body for log diagnosis

type DiagnoseResponse

type DiagnoseResponse struct {
	Diagnosis string `json:"diagnosis"`
}

DiagnoseResponse represents the response for log diagnosis

type EventDiagnoseRequest

type EventDiagnoseRequest struct {
	Events   []ai.Event `json:"events"`
	Language string     `json:"language"`
}

EventDiagnoseRequest represents the request body for event diagnosis

type LogEntry

type LogEntry struct {
	Timestamp string `json:"timestamp,omitempty"`
	Content   string `json:"content"`
	Error     string `json:"error,omitempty"`
}

LogEntry represents a single log entry with timestamp and content

Jump to

Keyboard shortcuts

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