Documentation
¶
Index ¶
- type Agent
- type AgentService
- type AgentServiceImpl
- func (s *AgentServiceImpl) CreateAgent(ctx context.Context, agent *Agent) error
- func (s *AgentServiceImpl) CreateConfig(ctx context.Context, config *Config) error
- func (s *AgentServiceImpl) CreateGroup(ctx context.Context, group *Group) error
- func (s *AgentServiceImpl) DeleteAgent(ctx context.Context, id uuid.UUID) error
- func (s *AgentServiceImpl) DeleteGroup(ctx context.Context, id string) error
- func (s *AgentServiceImpl) GetAgent(ctx context.Context, id uuid.UUID) (*Agent, error)
- func (s *AgentServiceImpl) GetConfig(ctx context.Context, id string) (*Config, error)
- func (s *AgentServiceImpl) GetGroup(ctx context.Context, id string) (*Group, error)
- func (s *AgentServiceImpl) GetGroupByName(ctx context.Context, name string) (*Group, error)
- func (s *AgentServiceImpl) GetLatestConfigForAgent(ctx context.Context, agentID uuid.UUID) (*Config, error)
- func (s *AgentServiceImpl) GetLatestConfigForGroup(ctx context.Context, groupID string) (*Config, error)
- func (s *AgentServiceImpl) ListAgents(ctx context.Context) ([]*Agent, error)
- func (s *AgentServiceImpl) ListConfigs(ctx context.Context, filter ConfigFilter) ([]*Config, error)
- func (s *AgentServiceImpl) ListGroups(ctx context.Context) ([]*Group, error)
- func (s *AgentServiceImpl) StoreConfigForAgent(ctx context.Context, agentID uuid.UUID, content string) (*Config, error)
- func (s *AgentServiceImpl) UpdateAgentEffectiveConfig(ctx context.Context, id uuid.UUID, effectiveConfig string) error
- func (s *AgentServiceImpl) UpdateAgentLastSeen(ctx context.Context, id uuid.UUID, lastSeen time.Time) error
- func (s *AgentServiceImpl) UpdateAgentStatus(ctx context.Context, id uuid.UUID, status AgentStatus) error
- type AgentStatus
- type Config
- type ConfigFilter
- type Group
- type Log
- type LogQuery
- type Metric
- type MetricQuery
- type MetricType
- type Rollup
- type RollupInterval
- type RollupQuery
- type TelemetryOverview
- type TelemetryQueryService
- type TelemetryQueryServiceImpl
- func (s *TelemetryQueryServiceImpl) CleanupOldData(ctx context.Context, retention time.Duration) error
- func (s *TelemetryQueryServiceImpl) CreateRollups(ctx context.Context, window time.Time, interval RollupInterval) error
- func (s *TelemetryQueryServiceImpl) GetServices(ctx context.Context) ([]string, error)
- func (s *TelemetryQueryServiceImpl) GetTelemetryOverview(ctx context.Context) (*TelemetryOverview, error)
- func (s *TelemetryQueryServiceImpl) QueryLogs(ctx context.Context, query LogQuery) ([]Log, error)
- func (s *TelemetryQueryServiceImpl) QueryMetrics(ctx context.Context, query MetricQuery) ([]Metric, error)
- func (s *TelemetryQueryServiceImpl) QueryRaw(ctx context.Context, query string, args ...interface{}) ([]map[string]interface{}, error)
- func (s *TelemetryQueryServiceImpl) QueryRollups(ctx context.Context, query RollupQuery) ([]Rollup, error)
- func (s *TelemetryQueryServiceImpl) QueryTraces(ctx context.Context, query TraceQuery) ([]Trace, error)
- type Trace
- type TraceQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
Labels map[string]string `json:"labels"`
Status AgentStatus `json:"status"`
LastSeen time.Time `json:"last_seen"`
GroupID *string `json:"group_id,omitempty"`
GroupName *string `json:"group_name,omitempty"`
Version string `json:"version"`
Capabilities []string `json:"capabilities"`
EffectiveConfig string `json:"effective_config,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Agent represents an OpenTelemetry agent
type AgentService ¶
type AgentService interface {
// Agent operations
CreateAgent(ctx context.Context, agent *Agent) error
GetAgent(ctx context.Context, id uuid.UUID) (*Agent, error)
ListAgents(ctx context.Context) ([]*Agent, error)
UpdateAgentStatus(ctx context.Context, id uuid.UUID, status AgentStatus) error
UpdateAgentLastSeen(ctx context.Context, id uuid.UUID, lastSeen time.Time) error
UpdateAgentEffectiveConfig(ctx context.Context, id uuid.UUID, effectiveConfig string) error
DeleteAgent(ctx context.Context, id uuid.UUID) error
// Group operations
CreateGroup(ctx context.Context, group *Group) error
GetGroup(ctx context.Context, id string) (*Group, error)
GetGroupByName(ctx context.Context, name string) (*Group, error)
ListGroups(ctx context.Context) ([]*Group, error)
DeleteGroup(ctx context.Context, id string) error
// Config operations
CreateConfig(ctx context.Context, config *Config) error
GetConfig(ctx context.Context, id string) (*Config, error)
GetLatestConfigForAgent(ctx context.Context, agentID uuid.UUID) (*Config, error)
GetLatestConfigForGroup(ctx context.Context, groupID string) (*Config, error)
ListConfigs(ctx context.Context, filter ConfigFilter) ([]*Config, error)
// StoreConfigForAgent validates and stores configuration for an agent
// Returns the stored config or error if agent doesn't exist or doesn't support remote config
StoreConfigForAgent(ctx context.Context, agentID uuid.UUID, content string) (*Config, error)
}
AgentService defines the interface for agent management operations
func NewAgentService ¶
func NewAgentService(appStore applicationstore.ApplicationStore, logger *zap.Logger) AgentService
NewAgentService creates a new agent service
type AgentServiceImpl ¶
type AgentServiceImpl struct {
// contains filtered or unexported fields
}
AgentServiceImpl implements the AgentService interface
func (*AgentServiceImpl) CreateAgent ¶
func (s *AgentServiceImpl) CreateAgent(ctx context.Context, agent *Agent) error
CreateAgent creates an agent
func (*AgentServiceImpl) CreateConfig ¶
func (s *AgentServiceImpl) CreateConfig(ctx context.Context, config *Config) error
CreateConfig creates a configuration
func (*AgentServiceImpl) CreateGroup ¶
func (s *AgentServiceImpl) CreateGroup(ctx context.Context, group *Group) error
CreateGroup creates a group
func (*AgentServiceImpl) DeleteAgent ¶
DeleteAgent deletes an agent
func (*AgentServiceImpl) DeleteGroup ¶
func (s *AgentServiceImpl) DeleteGroup(ctx context.Context, id string) error
DeleteGroup deletes a group
func (*AgentServiceImpl) GetGroupByName ¶
GetGroupByName gets a group by name
func (*AgentServiceImpl) GetLatestConfigForAgent ¶
func (s *AgentServiceImpl) GetLatestConfigForAgent(ctx context.Context, agentID uuid.UUID) (*Config, error)
GetLatestConfigForAgent gets the latest configuration for an agent
func (*AgentServiceImpl) GetLatestConfigForGroup ¶
func (s *AgentServiceImpl) GetLatestConfigForGroup(ctx context.Context, groupID string) (*Config, error)
GetLatestConfigForGroup gets the latest configuration for a group
func (*AgentServiceImpl) ListAgents ¶
func (s *AgentServiceImpl) ListAgents(ctx context.Context) ([]*Agent, error)
ListAgents lists all agents
func (*AgentServiceImpl) ListConfigs ¶
func (s *AgentServiceImpl) ListConfigs(ctx context.Context, filter ConfigFilter) ([]*Config, error)
ListConfigs lists configurations with filters
func (*AgentServiceImpl) ListGroups ¶
func (s *AgentServiceImpl) ListGroups(ctx context.Context) ([]*Group, error)
ListGroups lists all groups
func (*AgentServiceImpl) StoreConfigForAgent ¶
func (s *AgentServiceImpl) StoreConfigForAgent(ctx context.Context, agentID uuid.UUID, content string) (*Config, error)
StoreConfigForAgent validates and stores configuration for an agent (storage only, no delivery)
func (*AgentServiceImpl) UpdateAgentEffectiveConfig ¶
func (s *AgentServiceImpl) UpdateAgentEffectiveConfig(ctx context.Context, id uuid.UUID, effectiveConfig string) error
UpdateAgentEffectiveConfig updates agent effective config
func (*AgentServiceImpl) UpdateAgentLastSeen ¶
func (s *AgentServiceImpl) UpdateAgentLastSeen(ctx context.Context, id uuid.UUID, lastSeen time.Time) error
UpdateAgentLastSeen updates agent last seen timestamp
func (*AgentServiceImpl) UpdateAgentStatus ¶
func (s *AgentServiceImpl) UpdateAgentStatus(ctx context.Context, id uuid.UUID, status AgentStatus) error
UpdateAgentStatus updates agent status
type AgentStatus ¶
type AgentStatus string
AgentStatus represents the status of an agent
const ( AgentStatusOnline AgentStatus = "online" AgentStatusOffline AgentStatus = "offline" AgentStatusError AgentStatus = "error" )
type Config ¶
type Config struct {
ID string `json:"id"`
Name string `json:"name"`
AgentID *uuid.UUID `json:"agent_id,omitempty"`
GroupID *string `json:"group_id,omitempty"`
ConfigHash string `json:"config_hash"`
Content string `json:"content"`
Version int `json:"version"`
CreatedAt time.Time `json:"created_at"`
}
Config represents an agent configuration
type ConfigFilter ¶
ConfigFilter represents filters for listing configs
type Group ¶
type Group struct {
ID string `json:"id"`
Name string `json:"name"`
Labels map[string]string `json:"labels"`
AgentCount int `json:"agent_count"`
ConfigName string `json:"config_name,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Group represents a group of agents
type Log ¶
type Log struct {
Timestamp time.Time `json:"timestamp"`
AgentID uuid.UUID `json:"agent_id"`
GroupID *string `json:"group_id,omitempty"`
ServiceName string `json:"service_name"`
SeverityText string `json:"severity_text"`
SeverityNumber int `json:"severity_number"`
Body string `json:"body"`
TraceID *string `json:"trace_id,omitempty"`
SpanID *string `json:"span_id,omitempty"`
LogAttributes map[string]interface{} `json:"log_attributes"`
ConfigHash *string `json:"config_hash,omitempty"`
// Deprecated: use SeverityText instead
Severity string `json:"severity,omitempty"`
// Deprecated: use LogAttributes instead
Attributes map[string]string `json:"attributes,omitempty"`
}
Log represents a log entry
type LogQuery ¶
type LogQuery struct {
AgentID *uuid.UUID
GroupID *string
Severity *string
Search *string
StartTime time.Time
EndTime time.Time
Limit int
}
LogQuery represents a query for logs
type Metric ¶
type Metric struct {
Timestamp time.Time `json:"timestamp"`
AgentID uuid.UUID `json:"agent_id"`
GroupID *string `json:"group_id,omitempty"`
ServiceName string `json:"service_name"`
Name string `json:"metric_name"`
Value float64 `json:"value"`
MetricAttributes map[string]interface{} `json:"metric_attributes"`
ConfigHash *string `json:"config_hash,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Type MetricType `json:"type,omitempty"`
}
Metric represents a metric data point
type MetricQuery ¶
type MetricQuery struct {
AgentID *uuid.UUID
GroupID *string
MetricName *string
StartTime time.Time
EndTime time.Time
Limit int
}
MetricQuery represents a query for metrics
type MetricType ¶
type MetricType string
MetricType represents the type of metric
const ( MetricTypeGauge MetricType = "gauge" MetricTypeCounter MetricType = "counter" MetricTypeHistogram MetricType = "histogram" )
type Rollup ¶
type Rollup struct {
WindowStart time.Time `json:"window_start"`
AgentID *uuid.UUID `json:"agent_id,omitempty"`
GroupID *string `json:"group_id,omitempty"`
MetricName string `json:"metric_name"`
Count int64 `json:"count"`
Sum float64 `json:"sum"`
Avg float64 `json:"avg"`
Min float64 `json:"min"`
Max float64 `json:"max"`
Interval RollupInterval `json:"interval"`
}
Rollup represents pre-aggregated data
type RollupInterval ¶
type RollupInterval string
RollupInterval represents the rollup time window
const ( RollupInterval1m RollupInterval = "1m" RollupInterval5m RollupInterval = "5m" RollupInterval1h RollupInterval = "1h" RollupInterval1d RollupInterval = "1d" )
type RollupQuery ¶
type RollupQuery struct {
AgentID *uuid.UUID
GroupID *string
MetricName *string
StartTime time.Time
EndTime time.Time
Interval RollupInterval
}
RollupQuery represents a query for rollups
type TelemetryOverview ¶
type TelemetryOverview 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"`
}
TelemetryOverview represents the telemetry overview
type TelemetryQueryService ¶
type TelemetryQueryService interface {
// Query operations
QueryMetrics(ctx context.Context, query MetricQuery) ([]Metric, error)
QueryLogs(ctx context.Context, query LogQuery) ([]Log, error)
QueryTraces(ctx context.Context, query TraceQuery) ([]Trace, error)
QueryRaw(ctx context.Context, query string, args ...interface{}) ([]map[string]interface{}, error)
// Rollup operations
CreateRollups(ctx context.Context, window time.Time, interval RollupInterval) error
QueryRollups(ctx context.Context, query RollupQuery) ([]Rollup, error)
// Cleanup operations
CleanupOldData(ctx context.Context, retention time.Duration) error
// Overview operations
GetTelemetryOverview(ctx context.Context) (*TelemetryOverview, error)
GetServices(ctx context.Context) ([]string, error)
}
TelemetryQueryService defines the interface for telemetry query operations
func NewTelemetryQueryService ¶
func NewTelemetryQueryService(telemetryReader telemetrystore.Reader, agentService AgentService, logger *zap.Logger) TelemetryQueryService
NewTelemetryQueryService creates a new telemetry query service
type TelemetryQueryServiceImpl ¶
type TelemetryQueryServiceImpl struct {
// contains filtered or unexported fields
}
TelemetryQueryServiceImpl implements the TelemetryQueryService interface
func (*TelemetryQueryServiceImpl) CleanupOldData ¶
func (s *TelemetryQueryServiceImpl) CleanupOldData(ctx context.Context, retention time.Duration) error
CleanupOldData cleans up old telemetry data
func (*TelemetryQueryServiceImpl) CreateRollups ¶
func (s *TelemetryQueryServiceImpl) CreateRollups(ctx context.Context, window time.Time, interval RollupInterval) error
CreateRollups creates rollups for the given time window
func (*TelemetryQueryServiceImpl) GetServices ¶
func (s *TelemetryQueryServiceImpl) GetServices(ctx context.Context) ([]string, error)
GetServices gets the list of unique services
func (*TelemetryQueryServiceImpl) GetTelemetryOverview ¶
func (s *TelemetryQueryServiceImpl) GetTelemetryOverview(ctx context.Context) (*TelemetryOverview, error)
GetTelemetryOverview gets the telemetry overview
func (*TelemetryQueryServiceImpl) QueryMetrics ¶
func (s *TelemetryQueryServiceImpl) QueryMetrics(ctx context.Context, query MetricQuery) ([]Metric, error)
QueryMetrics queries metrics data
func (*TelemetryQueryServiceImpl) QueryRaw ¶
func (s *TelemetryQueryServiceImpl) QueryRaw(ctx context.Context, query string, args ...interface{}) ([]map[string]interface{}, error)
QueryRaw executes a raw SQL query
func (*TelemetryQueryServiceImpl) QueryRollups ¶
func (s *TelemetryQueryServiceImpl) QueryRollups(ctx context.Context, query RollupQuery) ([]Rollup, error)
QueryRollups queries rollup data
func (*TelemetryQueryServiceImpl) QueryTraces ¶
func (s *TelemetryQueryServiceImpl) QueryTraces(ctx context.Context, query TraceQuery) ([]Trace, error)
QueryTraces queries traces data
type Trace ¶
type Trace struct {
Timestamp time.Time `json:"timestamp"`
AgentID uuid.UUID `json:"agent_id"`
ConfigHash *string `json:"config_hash,omitempty"`
TraceID string `json:"trace_id"`
SpanID string `json:"span_id"`
ParentSpanID *string `json:"parent_span_id,omitempty"`
Name string `json:"name"`
Duration int64 `json:"duration"`
StatusCode string `json:"status_code"`
StatusMessage string `json:"status_message"`
Attributes map[string]string `json:"attributes"`
}
Trace represents a trace span