handlers

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentCommander

type AgentCommander interface {
	SendConfigToAgent(agentId uuid.UUID, configContent string) error
	RestartAgent(agentId uuid.UUID) error
	RestartAgentsInGroup(groupId string) ([]uuid.UUID, []error)
	SendConfigToAgentsInGroup(groupId string, configContent string) ([]uuid.UUID, []error)
}

AgentCommander defines the interface for sending commands to agents

type AgentHandlers

type AgentHandlers struct {
	// contains filtered or unexported fields
}

AgentHandlers handles agent-related API endpoints

func NewAgentHandlers

func NewAgentHandlers(agentService services.AgentService, commander AgentCommander, logger *zap.Logger) *AgentHandlers

NewAgentHandlers creates a new agent handlers instance

func (*AgentHandlers) HandleGetAgent

func (h *AgentHandlers) HandleGetAgent(c *gin.Context)

handleGetAgent handles GET /api/v1/agents/:id

func (*AgentHandlers) HandleGetAgentStats

func (h *AgentHandlers) HandleGetAgentStats(c *gin.Context)

handleGetAgentStats handles GET /api/v1/agents/stats

func (*AgentHandlers) HandleGetAgents

func (h *AgentHandlers) HandleGetAgents(c *gin.Context)

handleGetAgents handles GET /api/v1/agents

func (*AgentHandlers) HandleRestartAgent

func (h *AgentHandlers) HandleRestartAgent(c *gin.Context)

HandleRestartAgent handles POST /api/v1/agents/:id/restart

func (*AgentHandlers) HandleSendConfigToAgent

func (h *AgentHandlers) HandleSendConfigToAgent(c *gin.Context)

HandleSendConfigToAgent handles POST /api/v1/agents/:id/config Orchestrates config storage (via AgentService) and delivery (via ConfigSender)

func (*AgentHandlers) HandleUpdateAgentGroup

func (h *AgentHandlers) HandleUpdateAgentGroup(c *gin.Context)

handleUpdateAgentGroup handles PATCH /api/v1/agents/:id/group

type AgentTopologyRequest

type AgentTopologyRequest struct {
	AgentID   *string    `json:"agent_id"`
	GroupID   *string    `json:"group_id"`
	StartTime *time.Time `json:"start_time"`
	EndTime   *time.Time `json:"end_time"`
}

AgentTopologyRequest represents request for agent topology

type AssignConfigRequest

type AssignConfigRequest struct {
	ConfigID string `json:"config_id" binding:"required"`
}

AssignConfigRequest represents the request to assign a config to a group

type ConfigHandlers

type ConfigHandlers struct {
	// contains filtered or unexported fields
}

ConfigHandlers handles config-related API endpoints

func NewConfigHandlers

func NewConfigHandlers(agentService services.AgentService, commander AgentCommander, logger *zap.Logger) *ConfigHandlers

NewConfigHandlers creates a new config handlers instance

func (*ConfigHandlers) HandleCreateConfig

func (h *ConfigHandlers) HandleCreateConfig(c *gin.Context)

handleCreateConfig handles POST /api/v1/configs

func (*ConfigHandlers) HandleDeleteConfig

func (h *ConfigHandlers) HandleDeleteConfig(c *gin.Context)

handleDeleteConfig handles DELETE /api/v1/configs/:id

func (*ConfigHandlers) HandleGetConfig

func (h *ConfigHandlers) HandleGetConfig(c *gin.Context)

handleGetConfig handles GET /api/v1/configs/:id

func (*ConfigHandlers) HandleGetConfigVersions

func (h *ConfigHandlers) HandleGetConfigVersions(c *gin.Context)

handleGetConfigVersions handles GET /api/v1/configs/:id/versions

func (*ConfigHandlers) HandleGetConfigs

func (h *ConfigHandlers) HandleGetConfigs(c *gin.Context)

handleGetConfigs handles GET /api/v1/configs

func (*ConfigHandlers) HandleUpdateConfig

func (h *ConfigHandlers) HandleUpdateConfig(c *gin.Context)

handleUpdateConfig handles PUT /api/v1/configs/:id

func (*ConfigHandlers) HandleValidateConfig

func (h *ConfigHandlers) HandleValidateConfig(c *gin.Context)

handleValidateConfig handles POST /api/v1/configs/validate

type CreateConfigRequest

type CreateConfigRequest struct {
	Name       string     `json:"name,omitempty"`
	AgentID    *uuid.UUID `json:"agent_id,omitempty"`
	GroupID    *string    `json:"group_id,omitempty"`
	ConfigHash string     `json:"config_hash" binding:"required"`
	Content    string     `json:"content" binding:"required"`
	Version    int        `json:"version" binding:"required"`
}

CreateConfigRequest represents the request for creating a config

type CreateGroupRequest

type CreateGroupRequest struct {
	Name   string            `json:"name" binding:"required"`
	Labels map[string]string `json:"labels,omitempty"`
}

CreateGroupRequest represents the request for creating a group

type FunctionInfo

type FunctionInfo struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Example     string `json:"example"`
}

FunctionInfo represents a function description

type FunctionsResponse

type FunctionsResponse struct {
	Functions []FunctionInfo `json:"functions"`
}

FunctionsResponse represents available functions response

type GetAgentStatsResponse

type GetAgentStatsResponse struct {
	TotalAgents   int `json:"totalAgents"`
	OnlineAgents  int `json:"onlineAgents"`
	OfflineAgents int `json:"offlineAgents"`
	ErrorAgents   int `json:"errorAgents"`
	GroupsCount   int `json:"groupsCount"`
}

GetAgentStatsResponse represents agent statistics

type GetAgentsRequest

type GetAgentsRequest struct {
}

GetAgentsRequest represents the request for getting agents

type GetAgentsResponse

type GetAgentsResponse struct {
	Agents        map[string]*services.Agent `json:"agents"`
	TotalCount    int                        `json:"totalCount"`
	ActiveCount   int                        `json:"activeCount"`
	InactiveCount int                        `json:"inactiveCount"`
}

GetAgentsResponse represents the response for getting agents

type GroupHandlers

type GroupHandlers struct {
	// contains filtered or unexported fields
}

GroupHandlers handles group-related API endpoints

func NewGroupHandlers

func NewGroupHandlers(agentService services.AgentService, commander AgentCommander, logger *zap.Logger) *GroupHandlers

NewGroupHandlers creates a new group handlers instance

func (*GroupHandlers) HandleAssignConfig

func (h *GroupHandlers) HandleAssignConfig(c *gin.Context)

handleAssignConfig handles POST /api/v1/groups/:id/config

func (*GroupHandlers) HandleCreateGroup

func (h *GroupHandlers) HandleCreateGroup(c *gin.Context)

handleCreateGroup handles POST /api/v1/groups

func (*GroupHandlers) HandleDeleteGroup

func (h *GroupHandlers) HandleDeleteGroup(c *gin.Context)

handleDeleteGroup handles DELETE /api/v1/groups/:id

func (*GroupHandlers) HandleGetGroup

func (h *GroupHandlers) HandleGetGroup(c *gin.Context)

handleGetGroup handles GET /api/v1/groups/:id

func (*GroupHandlers) HandleGetGroupAgents

func (h *GroupHandlers) HandleGetGroupAgents(c *gin.Context)

handleGetGroupAgents handles GET /api/v1/groups/:id/agents

func (*GroupHandlers) HandleGetGroupConfig

func (h *GroupHandlers) HandleGetGroupConfig(c *gin.Context)

handleGetGroupConfig handles GET /api/v1/groups/:id/config

func (*GroupHandlers) HandleGetGroups

func (h *GroupHandlers) HandleGetGroups(c *gin.Context)

handleGetGroups handles GET /api/v1/groups

func (*GroupHandlers) HandleRestartGroup

func (h *GroupHandlers) HandleRestartGroup(c *gin.Context)

HandleRestartGroup handles POST /api/v1/groups/:id/restart

func (*GroupHandlers) HandleUpdateGroup

func (h *GroupHandlers) HandleUpdateGroup(c *gin.Context)

handleUpdateGroup handles PUT /api/v1/groups/:id

type GroupSummary

type GroupSummary struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	AgentCount int    `json:"agent_count"`
	Status     string `json:"status"`
}

GroupSummary represents a group with agent count

type HealthHandlers

type HealthHandlers struct {
	// contains filtered or unexported fields
}

HealthHandlers handles health check endpoints

func NewHealthHandlers

func NewHealthHandlers(agentService services.AgentService, telemetryService services.TelemetryQueryService, logger *zap.Logger) *HealthHandlers

NewHealthHandlers creates a new health handlers instance

func (*HealthHandlers) HandleHealth

func (h *HealthHandlers) HandleHealth(c *gin.Context)

handleHealth handles GET /health

type HealthResponse

type HealthResponse struct {
	Status    string            `json:"status"`
	Timestamp time.Time         `json:"timestamp"`
	Version   string            `json:"version"`
	Services  map[string]string `json:"services"`
}

HealthResponse represents the health check response

type LawrenceQLHandlers

type LawrenceQLHandlers struct {
	// contains filtered or unexported fields
}

LawrenceQLHandlers handles Lawrence QL query endpoints

func NewLawrenceQLHandlers

func NewLawrenceQLHandlers(telemetryService services.TelemetryQueryService, logger *zap.Logger) *LawrenceQLHandlers

NewLawrenceQLHandlers creates a new Lawrence QL handlers instance

func (*LawrenceQLHandlers) HandleGetFunctions

func (h *LawrenceQLHandlers) HandleGetFunctions(c *gin.Context)

HandleGetFunctions handles GET /api/v1/telemetry/query/functions

func (*LawrenceQLHandlers) HandleGetSuggestions

func (h *LawrenceQLHandlers) HandleGetSuggestions(c *gin.Context)

HandleGetSuggestions handles POST /api/v1/telemetry/query/suggestions

func (*LawrenceQLHandlers) HandleGetTemplates

func (h *LawrenceQLHandlers) HandleGetTemplates(c *gin.Context)

HandleGetTemplates handles GET /api/v1/telemetry/query/templates

func (*LawrenceQLHandlers) HandleLawrenceQLQuery

func (h *LawrenceQLHandlers) HandleLawrenceQLQuery(c *gin.Context)

HandleLawrenceQLQuery handles POST /api/v1/telemetry/query

func (*LawrenceQLHandlers) HandleValidateQuery

func (h *LawrenceQLHandlers) HandleValidateQuery(c *gin.Context)

HandleValidateQuery handles POST /api/v1/telemetry/query/validate

type LawrenceQLRequest

type LawrenceQLRequest struct {
	Query     string     `json:"query" binding:"required"`
	StartTime *time.Time `json:"start_time,omitempty"`
	EndTime   *time.Time `json:"end_time,omitempty"`
	Limit     int        `json:"limit,omitempty"`
	AgentID   *string    `json:"agent_id,omitempty"`
	GroupID   *string    `json:"group_id,omitempty"`
}

LawrenceQLRequest represents a Lawrence QL query request

type LawrenceQLResponse

type LawrenceQLResponse struct {
	Results []query.QueryResult `json:"results"`
	Meta    query.QueryMeta     `json:"meta"`
}

LawrenceQLResponse represents a Lawrence QL query response

type NodeMetrics

type NodeMetrics struct {
	MetricCount   int64   `json:"metric_count"`
	LogCount      int64   `json:"log_count"`
	TraceCount    int64   `json:"trace_count"`
	ErrorRate     float64 `json:"error_rate"`
	Latency       float64 `json:"latency"`
	ThroughputRPS float64 `json:"throughput_rps"`
}

NodeMetrics represents metrics for a topology node

type QueryLogsRequest

type QueryLogsRequest struct {
	AgentID   *string   `json:"agent_id" binding:"omitempty,uuid"`
	GroupID   *string   `json:"group_id" binding:"omitempty,uuid"`
	Severity  *string   `json:"severity"`
	Search    *string   `json:"search"`
	StartTime time.Time `json:"start_time" binding:"required"`
	EndTime   time.Time `json:"end_time" binding:"required"`
	Limit     int       `json:"limit"`
}

QueryLogsRequest represents the request for querying logs

type QueryMetricsRequest

type QueryMetricsRequest struct {
	AgentID    *string   `json:"agent_id" binding:"omitempty,uuid"`
	GroupID    *string   `json:"group_id" binding:"omitempty,uuid"`
	MetricName *string   `json:"metric_name"`
	StartTime  time.Time `json:"start_time" binding:"required"`
	EndTime    time.Time `json:"end_time" binding:"required"`
	Limit      int       `json:"limit"`
	UseRollups bool      `json:"use_rollups"`
}

QueryMetricsRequest represents the request for querying metrics

type QueryTracesRequest

type QueryTracesRequest struct {
	AgentID     *string   `json:"agent_id" binding:"omitempty,uuid"`
	GroupID     *string   `json:"group_id" binding:"omitempty,uuid"`
	TraceID     *string   `json:"trace_id"`
	ServiceName *string   `json:"service_name"`
	StartTime   time.Time `json:"start_time" binding:"required"`
	EndTime     time.Time `json:"end_time" binding:"required"`
	Limit       int       `json:"limit"`
}

QueryTracesRequest represents the request for querying traces

type RestartAgentResponse

type RestartAgentResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

RestartAgentResponse represents the response after restarting an agent

type RestartGroupResponse

type RestartGroupResponse struct {
	Success        bool   `json:"success"`
	Message        string `json:"message"`
	RestartedCount int    `json:"restarted_count"`
	FailedCount    int    `json:"failed_count"`
}

RestartGroupResponse represents the response after restarting agents in a group

type SendConfigRequest

type SendConfigRequest struct {
	Content string `json:"content" binding:"required"`
}

SendConfigRequest represents the request to send config to an agent

type SendConfigResponse

type SendConfigResponse struct {
	Success  bool   `json:"success"`
	Message  string `json:"message"`
	ConfigID string `json:"config_id,omitempty"`
}

SendConfigResponse represents the response after sending config to an agent

type ServicesResponse

type ServicesResponse struct {
	Services []string `json:"services"`
	Count    int      `json:"count"`
}

ServicesResponse represents the services list

type SuggestionsRequest

type SuggestionsRequest struct {
	Query     string `json:"query"`
	CursorPos int    `json:"cursor_pos"`
}

SuggestionsRequest represents a request for query suggestions

type SuggestionsResponse

type SuggestionsResponse struct {
	Suggestions []string `json:"suggestions"`
}

SuggestionsResponse represents query suggestions response

type TelemetryHandlers

type TelemetryHandlers struct {
	// contains filtered or unexported fields
}

TelemetryHandlers handles telemetry-related API endpoints

func NewTelemetryHandlers

func NewTelemetryHandlers(telemetryService services.TelemetryQueryService, logger *zap.Logger) *TelemetryHandlers

NewTelemetryHandlers creates a new telemetry handlers instance

func (*TelemetryHandlers) HandleGetServices

func (h *TelemetryHandlers) HandleGetServices(c *gin.Context)

handleGetServices handles GET /api/v1/telemetry/services

func (*TelemetryHandlers) HandleGetTelemetryOverview

func (h *TelemetryHandlers) HandleGetTelemetryOverview(c *gin.Context)

handleGetTelemetryOverview handles GET /api/v1/telemetry/overview

func (*TelemetryHandlers) HandleQueryLogs

func (h *TelemetryHandlers) HandleQueryLogs(c *gin.Context)

handleQueryLogs handles POST /api/v1/telemetry/logs/query

func (*TelemetryHandlers) HandleQueryMetrics

func (h *TelemetryHandlers) HandleQueryMetrics(c *gin.Context)

handleQueryMetrics handles POST /api/v1/telemetry/metrics/query

func (*TelemetryHandlers) HandleQueryTraces

func (h *TelemetryHandlers) HandleQueryTraces(c *gin.Context)

handleQueryTraces handles POST /api/v1/telemetry/traces/query

type TelemetryOverviewResponse

type TelemetryOverviewResponse struct {
	TotalMetrics int64     `json:"totalMetrics"`
	TotalLogs    int64     `json:"totalLogs"`
	TotalTraces  int64     `json:"totalTraces"`
	ActiveAgents int       `json:"activeAgents"`
	Services     []string  `json:"services"`
	LastUpdated  time.Time `json:"lastUpdated"`
}

TelemetryOverviewResponse represents the telemetry overview

type TemplateInfo

type TemplateInfo struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Query       string `json:"query"`
	Category    string `json:"category"`
}

TemplateInfo represents a query template

type TemplatesResponse

type TemplatesResponse struct {
	Templates []TemplateInfo `json:"templates"`
}

TemplatesResponse represents query templates response

type TopologyEdge

type TopologyEdge struct {
	Source string `json:"source"`
	Target string `json:"target"`
	Type   string `json:"type"` // "belongs_to", "sends_to", etc.
	Label  string `json:"label,omitempty"`
}

TopologyEdge represents a connection between nodes

type TopologyHandlers

type TopologyHandlers struct {
	// contains filtered or unexported fields
}

TopologyHandlers handles topology-related API endpoints

func NewTopologyHandlers

func NewTopologyHandlers(agentService services.AgentService, telemetryService services.TelemetryQueryService, logger *zap.Logger) *TopologyHandlers

NewTopologyHandlers creates a new topology handlers instance

func (*TopologyHandlers) HandleGetAgentTopology

func (h *TopologyHandlers) HandleGetAgentTopology(c *gin.Context)

HandleGetAgentTopology handles GET /api/v1/topology/agent/:id

func (*TopologyHandlers) HandleGetGroupTopology

func (h *TopologyHandlers) HandleGetGroupTopology(c *gin.Context)

HandleGetGroupTopology handles GET /api/v1/topology/group/:id

func (*TopologyHandlers) HandleGetTopology

func (h *TopologyHandlers) HandleGetTopology(c *gin.Context)

HandleGetTopology handles GET /api/v1/topology

type TopologyNode

type TopologyNode struct {
	ID        string                 `json:"id"`
	Type      string                 `json:"type"` // "agent", "group", "service"
	Name      string                 `json:"name"`
	Status    string                 `json:"status"`
	GroupID   *string                `json:"group_id,omitempty"`
	GroupName *string                `json:"group_name,omitempty"`
	Labels    map[string]string      `json:"labels"`
	Metrics   *NodeMetrics           `json:"metrics,omitempty"`
	LastSeen  *time.Time             `json:"last_seen,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

TopologyNode represents a node in the topology graph

type TopologyResponse

type TopologyResponse struct {
	Nodes     []TopologyNode `json:"nodes"`
	Edges     []TopologyEdge `json:"edges"`
	Groups    []GroupSummary `json:"groups"`
	Services  []string       `json:"services"`
	UpdatedAt time.Time      `json:"updated_at"`
}

TopologyResponse represents the complete topology graph

type UpdateAgentGroupRequest

type UpdateAgentGroupRequest struct {
	GroupID *string `json:"group_id" binding:"omitempty,uuid"`
}

UpdateAgentGroupRequest represents the request to update agent group

type UpdateConfigRequest

type UpdateConfigRequest struct {
	Name    string `json:"name,omitempty"`
	Content string `json:"content" binding:"required"`
	Version int    `json:"version" binding:"required"`
}

UpdateConfigRequest represents the request for updating a config

type ValidateQueryRequest

type ValidateQueryRequest struct {
	Query string `json:"query" binding:"required"`
}

ValidateQueryRequest represents a query validation request

type ValidateQueryResponse

type ValidateQueryResponse struct {
	Valid   bool   `json:"valid"`
	Error   string `json:"error,omitempty"`
	Message string `json:"message,omitempty"`
}

ValidateQueryResponse represents a query validation response

Jump to

Keyboard shortcuts

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