analytics

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricScanDuration       = "scan_duration"
	MetricVulnerabilityCount = "vulnerability_count"
	MetricTestCount          = "test_count"
	MetricSuccessRate        = "success_rate"
	MetricCriticalVulns      = "critical_vulnerabilities"
	MetricHighVulns          = "high_vulnerabilities"
	MetricMediumVulns        = "medium_vulnerabilities"
	MetricLowVulns           = "low_vulnerabilities"
	MetricTargetCount        = "target_count"
	MetricTemplateUsage      = "template_usage"
	MetricErrorRate          = "error_rate"
)

Constants for metric names

View Source
const (
	MetricTypeEvent   = "event"
	MetricTypeGauge   = "gauge"
	MetricTypeCounter = "counter"
	MetricTypeCustom  = "custom"
)

Constants for metric types (if needed by collector)

View Source
const (
	SeverityCritical = "critical"
	SeverityHigh     = "high"
	SeverityMedium   = "medium"
	SeverityLow      = "low"
	SeverityInfo     = "info"
)

Constants for severities

View Source
const (
	ChartTypeLine     = "line"
	ChartTypeBar      = "bar"
	ChartTypePie      = "pie"
	ChartTypeArea     = "area"
	ChartTypeDoughnut = "doughnut"
	ChartTypeScatter  = "scatter"
)

Constants for chart types

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivitySummary

type ActivitySummary struct {
	Timestamp   time.Time `json:"timestamp"`
	Type        string    `json:"type"` // scan, vulnerability, alert
	Description string    `json:"description"`
	Target      string    `json:"target,omitempty"`
	Severity    string    `json:"severity,omitempty"`
}

ActivitySummary represents recent activity summary

type AggregatedMetric

type AggregatedMetric struct {
	ID           string                 `json:"id"`
	TimeWindow   TimeWindow             `json:"time_window"`
	MetricCount  int                    `json:"metric_count"`
	Aggregations map[string]interface{} `json:"aggregations"`
	CreatedAt    time.Time              `json:"created_at"`
	Type         string                 `json:"type"`
}

AggregatedMetric represents an aggregated metric over a time window

type AggregationConfig

type AggregationConfig struct {
	Function string        `json:"function"`
	Interval time.Duration `json:"interval"`
	GroupBy  []string      `json:"group_by"`
}

AggregationConfig defines data aggregation settings

type Alert

type Alert struct {
	ID           string            `json:"id"`
	Type         string            `json:"type"`     // threshold, anomaly, trend
	Severity     string            `json:"severity"` // info, warning, error, critical
	Title        string            `json:"title"`
	Message      string            `json:"message"`
	Timestamp    time.Time         `json:"timestamp"`
	Acknowledged bool              `json:"acknowledged"`
	Tags         map[string]string `json:"tags"`
	Actions      []AlertAction     `json:"actions"`
}

Alert represents a dashboard alert

type AlertAction

type AlertAction struct {
	Type  string `json:"type"` // dismiss, acknowledge, escalate
	Label string `json:"label"`
	URL   string `json:"url,omitempty"`
}

AlertAction represents an action for an alert

type AlertWidget

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

AlertWidget displays alerts and notifications

func (*AlertWidget) GetData

func (aw *AlertWidget) GetData(ctx context.Context, config DataSourceConfig) (interface{}, error)

func (*AlertWidget) GetMetadata

func (aw *AlertWidget) GetMetadata() WidgetMetadata

func (*AlertWidget) GetType

func (aw *AlertWidget) GetType() WidgetType

func (*AlertWidget) Render

func (aw *AlertWidget) Render(data interface{}, style WidgetStyle) (string, error)

func (*AlertWidget) Validate

func (aw *AlertWidget) Validate(config map[string]interface{}) error

type AnalyticsConfig

type AnalyticsConfig struct {
	// Collection settings
	CollectionEnabled     bool          `json:"collection_enabled"`
	BufferSize            int           `json:"buffer_size"`
	BatchSize             int           `json:"batch_size"`
	FlushInterval         time.Duration `json:"flush_interval"`
	SystemMetricsInterval int           `json:"system_metrics_interval"`
	AggregationInterval   int           `json:"aggregation_interval"`
	ArchivePath           string        `json:"archive_path"`

	// Trend analysis settings
	TrendAnalysis TrendAnalysisConfig `json:"trend_analysis"`

	// Filtering settings
	FilteringEnabled bool          `json:"filtering_enabled"`
	ExcludePatterns  []string      `json:"exclude_patterns"`
	MinValue         float64       `json:"min_value"`
	MaxAge           time.Duration `json:"max_age"`
}

AnalyticsConfig holds detailed analytics configuration

type AnalyticsSummary

type AnalyticsSummary struct {
	GeneratedAt          time.Time         `json:"generated_at"`
	TotalScans           int               `json:"total_scans"`
	TotalVulnerabilities int               `json:"total_vulnerabilities"`
	AverageScanDuration  float64           `json:"average_scan_duration"`
	MedianScanDuration   float64           `json:"median_scan_duration"`
	SuccessRate          float64           `json:"success_rate"`
	TrendData            TrendSummary      `json:"trend_data"`
	StorageStats         StorageStats      `json:"storage_stats"`
	TopVulnerabilities   []VulnSummary     `json:"top_vulnerabilities"`
	TopTargets           []TargetSummary   `json:"top_targets"`
	RecentActivity       []ActivitySummary `json:"recent_activity"`
}

AnalyticsSummary represents a high-level analytics summary

type Anomaly

type Anomaly struct {
	Timestamp   time.Time `json:"timestamp"`
	Metric      string    `json:"metric"`
	Value       float64   `json:"value"`
	Expected    float64   `json:"expected"`
	Deviation   float64   `json:"deviation"`
	Severity    string    `json:"severity"`
	Description string    `json:"description"`
}

Anomaly represents an anomalous data point

type AnomalyDetector

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

AnomalyDetector detects anomalies in data

func (*AnomalyDetector) DetectTrend

func (ad *AnomalyDetector) DetectTrend(ctx context.Context, data []DataPoint) (*TrendResult, error)

func (*AnomalyDetector) GetConfidenceLevel

func (ad *AnomalyDetector) GetConfidenceLevel() float64

func (*AnomalyDetector) GetType

func (ad *AnomalyDetector) GetType() string

type AnomalyPoint

type AnomalyPoint struct {
	Timestamp     time.Time `json:"timestamp"`
	ActualValue   float64   `json:"actual_value"`
	ExpectedValue float64   `json:"expected_value"`
	Deviation     float64   `json:"deviation"`
	Severity      string    `json:"severity"`
}

AnomalyPoint represents an anomalous data point

type AnomalySummary

type AnomalySummary struct {
	Count             int    `json:"count"`
	Severity          string `json:"severity"`
	MostCommon        string `json:"most_common"`
	RecommendedAction string `json:"recommended_action"`
}

type ArchiveInfo

type ArchiveInfo struct {
	Path           string    `json:"path"`
	StartTime      time.Time `json:"start_time"`
	EndTime        time.Time `json:"end_time"`
	MetricCount    int       `json:"metric_count"`
	CompressedSize int64     `json:"compressed_size"`
	OriginalSize   int64     `json:"original_size"`
	CreatedAt      time.Time `json:"created_at"`
}

ArchiveInfo contains information about archived data

type AuditEvent

type AuditEvent struct {
	EventID   string                 `json:"event_id"`
	Timestamp time.Time              `json:"timestamp"`
	EventType string                 `json:"event_type"`
	ScanID    string                 `json:"scan_id"`
	UserID    string                 `json:"user_id,omitempty"`
	Details   map[string]interface{} `json:"details"`
	Metadata  map[string]interface{} `json:"metadata"`
}

type AuditHook

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

AuditHook maintains audit trail for compliance

func NewAuditHook

func NewAuditHook(auditLogger AuditLogger, includeData bool) *AuditHook

func (*AuditHook) OnError

func (ah *AuditHook) OnError(ctx context.Context, err error, scanID string)

func (*AuditHook) PostCollection

func (ah *AuditHook) PostCollection(ctx context.Context, scanID string, metrics []Metric) error

func (*AuditHook) PreCollection

func (ah *AuditHook) PreCollection(ctx context.Context, scanID string) error

type AuditLogger

type AuditLogger interface {
	LogAuditEvent(ctx context.Context, event AuditEvent) error
}

type AuditResult

type AuditResult struct {
	Date            time.Time `json:"date"`
	Auditor         string    `json:"auditor"`
	Outcome         string    `json:"outcome"`
	Findings        int       `json:"findings"`
	Recommendations int       `json:"recommendations"`
}

type BackgroundConfig

type BackgroundConfig struct {
	Color   string  `json:"color"`
	Pattern string  `json:"pattern"`
	Opacity float64 `json:"opacity"`
}

BackgroundConfig defines background styling

type BasicAggregator

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

BasicAggregator provides basic statistical aggregations

func (*BasicAggregator) Aggregate

func (ba *BasicAggregator) Aggregate(ctx context.Context, metrics []Metric, window TimeWindow) (AggregatedMetric, error)

func (*BasicAggregator) GetWindowSizes

func (ba *BasicAggregator) GetWindowSizes() []time.Duration

func (*BasicAggregator) Reset

func (ba *BasicAggregator) Reset()

type BasicReportGenerator

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

BasicReportGenerator implements ReportGenerator interface

func NewBasicReportGenerator

func NewBasicReportGenerator(config *Config, logger Logger) *BasicReportGenerator

NewBasicReportGenerator creates a new basic report generator

func (*BasicReportGenerator) GenerateReport

func (brg *BasicReportGenerator) GenerateReport(params *ReportParams) (*Report, error)

GenerateReport generates a basic report

type BasicStatistics

type BasicStatistics struct {
	Count             int     `json:"count"`
	Mean              float64 `json:"mean"`
	Median            float64 `json:"median"`
	StandardDeviation float64 `json:"standard_deviation"`
	Min               float64 `json:"min"`
	Max               float64 `json:"max"`
	Q1                float64 `json:"q1"`
	Q3                float64 `json:"q3"`
	Variance          float64 `json:"variance"`
	Skewness          float64 `json:"skewness"`
	Kurtosis          float64 `json:"kurtosis"`
}

BasicStatistics contains basic statistical measures

type BorderConfig

type BorderConfig struct {
	Width  int    `json:"width"`
	Style  string `json:"style"`
	Color  string `json:"color"`
	Radius int    `json:"radius"`
}

BorderConfig defines border styling

type BreakpointConfig

type BreakpointConfig struct {
	MinWidth int `json:"min_width"`
	Columns  int `json:"columns"`
	Margin   int `json:"margin"`
}

BreakpointConfig defines responsive breakpoint settings

type CSVExporter

type CSVExporter struct{}

CSVExporter exports data as CSV

func (*CSVExporter) Export

func (ce *CSVExporter) Export(ctx context.Context, data interface{}, writer io.Writer) error

func (*CSVExporter) GetContentType

func (ce *CSVExporter) GetContentType() string

func (*CSVExporter) GetFormat

func (ce *CSVExporter) GetFormat() ExportFormat

func (*CSVExporter) Validate

func (ce *CSVExporter) Validate(data interface{}) error

type CachedAnalysis

type CachedAnalysis struct {
	MetricName string                 `json:"metric_name"`
	Analysis   *TrendAnalysisResult   `json:"analysis"`
	CachedAt   time.Time              `json:"cached_at"`
	ValidUntil time.Time              `json:"valid_until"`
	Metadata   map[string]interface{} `json:"metadata"`
}

CachedAnalysis represents cached trend analysis results

type CapacityReport

type CapacityReport struct {
	CPU     float64 `json:"cpu"`
	Memory  float64 `json:"memory"`
	Storage float64 `json:"storage"`
	Network float64 `json:"network"`
}

type ChartData

type ChartData struct {
	Labels   []string       `json:"labels"`
	Datasets []ChartDataset `json:"datasets"`
}

type ChartDataset

type ChartDataset struct {
	Label           string    `json:"label"`
	Data            []float64 `json:"data"`
	BorderColor     string    `json:"borderColor"`
	BackgroundColor string    `json:"backgroundColor"`
}

type ChartWidget

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

ChartWidget displays data in various chart formats

func (*ChartWidget) GetData

func (cw *ChartWidget) GetData(ctx context.Context, config DataSourceConfig) (interface{}, error)

func (*ChartWidget) GetMetadata

func (cw *ChartWidget) GetMetadata() WidgetMetadata

func (*ChartWidget) GetType

func (cw *ChartWidget) GetType() WidgetType

func (*ChartWidget) Render

func (cw *ChartWidget) Render(data interface{}, style WidgetStyle) (string, error)

func (*ChartWidget) Validate

func (cw *ChartWidget) Validate(config map[string]interface{}) error

type CollectionHook

type CollectionHook interface {
	PreCollection(ctx context.Context, scanID string) error
	PostCollection(ctx context.Context, scanID string, metrics []Metric) error
	OnError(ctx context.Context, err error, scanID string)
}

CollectionHook allows custom logic during metric collection

type ColorScheme

type ColorScheme struct {
	Primary    string   `json:"primary"`
	Secondary  string   `json:"secondary"`
	Success    string   `json:"success"`
	Warning    string   `json:"warning"`
	Error      string   `json:"error"`
	Info       string   `json:"info"`
	Palette    []string `json:"palette"`
	Background string   `json:"background"`
}

ColorScheme defines color configuration

type ComparativeAnalyzer

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

ComparativeAnalyzer performs comparative analysis between different metrics, time periods, or datasets

func NewComparativeAnalyzer

func NewComparativeAnalyzer(config *Config, storage DataStorage, trendAnalyzer *TrendAnalyzer, historicalData *HistoricalDataManager, logger Logger) *ComparativeAnalyzer

NewComparativeAnalyzer creates a new comparative analyzer

func (*ComparativeAnalyzer) CompareAgainstBaseline

func (ca *ComparativeAnalyzer) CompareAgainstBaseline(ctx context.Context, metricName string, currentRange TimeWindow, baselineValue float64) (*ComparisonResult, error)

CompareAgainstBaseline compares current metrics against established baselines

func (*ComparativeAnalyzer) CompareAnomalyPatterns

func (ca *ComparativeAnalyzer) CompareAnomalyPatterns(ctx context.Context, metricName string, baselineRange, comparisonRange TimeWindow) (*ComparisonResult, error)

CompareAnomalyPatterns compares anomaly patterns between different time periods

func (*ComparativeAnalyzer) CompareMetrics

func (ca *ComparativeAnalyzer) CompareMetrics(ctx context.Context, baselineMetric, comparisonMetric string, timeRange TimeWindow) (*ComparisonResult, error)

CompareMetrics compares different metrics over the same time period

func (*ComparativeAnalyzer) CompareTimePeriods

func (ca *ComparativeAnalyzer) CompareTimePeriods(ctx context.Context, metricName string, baselineRange, comparisonRange TimeWindow) (*ComparisonResult, error)

CompareTimePeriods compares metrics across different time periods

type Comparison

type Comparison struct {
	Label   string             `json:"label"`
	Metrics map[string]float64 `json:"metrics"`
	Deltas  map[string]float64 `json:"deltas,omitempty"` // percentage changes
	Rank    int                `json:"rank,omitempty"`
}

Comparison represents a single comparison

type ComparisonDataset

type ComparisonDataset struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	MetricName  string                 `json:"metric_name"`
	TimeRange   TimeWindow             `json:"time_range"`
	DataPoints  int                    `json:"data_points"`
	Statistics  BasicStatistics        `json:"statistics"`
	Metadata    map[string]interface{} `json:"metadata"`
}

ComparisonDataset represents a dataset in comparison

type ComparisonInsight

type ComparisonInsight struct {
	Type        InsightType `json:"type"`
	Severity    string      `json:"severity"`
	Title       string      `json:"title"`
	Description string      `json:"description"`
	Evidence    []string    `json:"evidence"`
	Confidence  float64     `json:"confidence"`
}

ComparisonInsight represents an insight from comparative analysis

type ComparisonParams

type ComparisonParams struct {
	Type       ComparisonType    `json:"type"`
	TimeRanges []TimeRange       `json:"time_ranges,omitempty"`
	Targets    []string          `json:"targets,omitempty"`
	Templates  []string          `json:"templates,omitempty"`
	Metrics    []string          `json:"metrics"`
	Filters    map[string]string `json:"filters"`
}

ComparisonParams represents parameters for comparative analysis

type ComparisonResult

type ComparisonResult struct {
	ComparisonType    ComparisonType       `json:"comparison_type"`
	BaselineDataset   ComparisonDataset    `json:"baseline_dataset"`
	ComparisonDataset ComparisonDataset    `json:"comparison_dataset"`
	Statistics        ComparisonStatistics `json:"statistics"`
	Insights          []ComparisonInsight  `json:"insights"`
	Recommendations   []string             `json:"recommendations"`
	Comparisons       []Comparison         `json:"comparisons"`
	Summary           ComparisonSummary    `json:"summary"`
	GeneratedAt       time.Time            `json:"generated_at"`
}

ComparisonResult represents comparison analysis results

type ComparisonStatistics

type ComparisonStatistics struct {
	MeanDifference           float64 `json:"mean_difference"`
	MeanDifferencePercent    float64 `json:"mean_difference_percent"`
	MedianDifference         float64 `json:"median_difference"`
	StandardDeviationRatio   float64 `json:"standard_deviation_ratio"`
	CorrelationCoefficient   float64 `json:"correlation_coefficient"`
	PValue                   float64 `json:"p_value"`
	StatisticalSignificance  string  `json:"statistical_significance"`
	EffectSize               float64 `json:"effect_size"`
	EffectSizeInterpretation string  `json:"effect_size_interpretation"`
}

ComparisonStatistics contains statistical comparison results

type ComparisonSummary

type ComparisonSummary struct {
	BestPerforming  string  `json:"best_performing"`
	WorstPerforming string  `json:"worst_performing"`
	AverageChange   float64 `json:"average_change"`
	MaxChange       float64 `json:"max_change"`
	MinChange       float64 `json:"min_change"`
}

ComparisonSummary represents overall comparison summary

type ComparisonType

type ComparisonType string

ComparisonType represents the type of comparison

const (
	ComparisonTypeTimeRange      ComparisonType = "time_range"
	ComparisonTypeTargets        ComparisonType = "targets"
	ComparisonTypeTemplates      ComparisonType = "templates"
	ComparisonTypeTimePeriod     ComparisonType = "time_period"
	ComparisonTypeMetrics        ComparisonType = "metrics"
	ComparisonTypeBaseline       ComparisonType = "baseline"
	ComparisonTypeAnomalyPattern ComparisonType = "anomaly_pattern"
)

type ComplianceHook

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

ComplianceHook ensures compliance with regulations

func NewComplianceHook

func NewComplianceHook(validator ComplianceValidator, regulations []string) *ComplianceHook

func (*ComplianceHook) OnError

func (ch *ComplianceHook) OnError(ctx context.Context, err error, scanID string)

func (*ComplianceHook) PostCollection

func (ch *ComplianceHook) PostCollection(ctx context.Context, scanID string, metrics []Metric) error

func (*ComplianceHook) PreCollection

func (ch *ComplianceHook) PreCollection(ctx context.Context, scanID string) error

type ComplianceReport

type ComplianceReport struct {
	OverallStatus   string                `json:"overall_status"`
	FrameworkStatus []FrameworkCompliance `json:"framework_status"`
	RecentAudits    []AuditResult         `json:"recent_audits"`
}

type ComplianceStatusReport

type ComplianceStatusReport struct {
	OverallCompliance float64 `json:"overall_compliance"`
	FailedControls    int     `json:"failed_controls"`
	PassedControls    int     `json:"passed_controls"`
}

type ComplianceValidator

type ComplianceValidator interface {
	ValidateCompliance(ctx context.Context, scanID string, metrics []Metric, regulations []string) error
}

type Config

type Config struct {
	// Storage settings
	StorageType     StorageType
	DatabaseURL     string
	RetentionPolicy RetentionPolicy

	// Collection settings
	MetricsEnabled     bool
	CollectionInterval time.Duration
	BatchSize          int
	BufferSize         int

	// Analysis settings
	TrendWindowDays  int
	AnalysisInterval time.Duration
	AnomalyThreshold float64
	BaselineWindow   time.Duration

	// Dashboard settings
	DashboardEnabled bool
	RealTimeUpdates  bool
	RefreshInterval  time.Duration
	CacheTTL         time.Duration

	// Export settings
	ExportFormats []string
	APIEnabled    bool
	WebhookURLs   []string

	// Security settings
	DataEncryption bool
	AccessControl  bool
	AuditLogging   bool

	// Analytics sub-configuration
	Analytics AnalyticsConfig
}

Config holds analytics configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns default analytics configuration

type CorrelationResult

type CorrelationResult struct {
	MetricA          string  `json:"metric_a"`
	MetricB          string  `json:"metric_b"`
	CorrelationCoeff float64 `json:"correlation_coefficient"`
	PValue           float64 `json:"p_value"`
	Significance     string  `json:"significance"`
	RelationshipType string  `json:"relationship_type"`
}

CorrelationResult represents correlation between metrics

type Dashboard

type Dashboard struct {
	ID          string                 `json:"id"`
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Layout      *Layout                `json:"layout"`
	Widgets     []WidgetConfig         `json:"widgets"`
	Theme       string                 `json:"theme"`
	Filters     map[string]interface{} `json:"filters"`
	RefreshRate time.Duration          `json:"refresh_rate"`
	CreatedAt   time.Time              `json:"created_at"`
	UpdatedAt   time.Time              `json:"updated_at"`
	CreatedBy   string                 `json:"created_by"`
	Tags        []string               `json:"tags"`
	IsPublic    bool                   `json:"is_public"`
	Metadata    map[string]interface{} `json:"metadata"`
}

Dashboard represents a complete dashboard configuration

type DashboardEngine

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

DashboardEngine manages interactive dashboard components

func NewDashboardEngine

func NewDashboardEngine(config *Config, storage DataStorage, trendAnalyzer *TrendAnalyzer, logger Logger) *DashboardEngine

NewDashboardEngine creates a new dashboard engine

func (*DashboardEngine) AddWidget

func (de *DashboardEngine) AddWidget(dashboardID string, widgetConfig WidgetConfig) error

AddWidget adds a widget to a dashboard

func (*DashboardEngine) CreateDashboard

func (de *DashboardEngine) CreateDashboard(name, description, createdBy string) (*Dashboard, error)

CreateDashboard creates a new dashboard

func (*DashboardEngine) GetDashboard

func (de *DashboardEngine) GetDashboard(dashboardID string) (*Dashboard, error)

GetDashboard retrieves a dashboard by ID

func (*DashboardEngine) GetWidgetData

func (de *DashboardEngine) GetWidgetData(ctx context.Context, widgetConfig WidgetConfig) (interface{}, error)

GetWidgetData retrieves data for a specific widget

func (*DashboardEngine) ListDashboards

func (de *DashboardEngine) ListDashboards(filters map[string]interface{}) ([]*Dashboard, error)

ListDashboards returns all dashboards (with optional filtering)

func (*DashboardEngine) RegisterTheme

func (de *DashboardEngine) RegisterTheme(theme *Theme)

RegisterTheme registers a custom theme

func (*DashboardEngine) RegisterWidget

func (de *DashboardEngine) RegisterWidget(widget Widget)

RegisterWidget registers a custom widget type

func (*DashboardEngine) RenderDashboard

func (de *DashboardEngine) RenderDashboard(ctx context.Context, dashboardID string) (string, error)

RenderDashboard renders a complete dashboard

func (*DashboardEngine) Shutdown

func (de *DashboardEngine) Shutdown()

Shutdown gracefully shuts down the dashboard engine

func (*DashboardEngine) Subscribe

func (de *DashboardEngine) Subscribe(dashboardID string, subscriber DashboardSubscriber)

Subscribe adds a subscriber for dashboard updates

func (*DashboardEngine) Unsubscribe

func (de *DashboardEngine) Unsubscribe(dashboardID string, subscriberID string)

Unsubscribe removes a subscriber

func (*DashboardEngine) UpdateWidget

func (de *DashboardEngine) UpdateWidget(dashboardID, widgetID string, updates map[string]interface{}) error

UpdateWidget updates widget configuration

type DashboardSubscriber

type DashboardSubscriber interface {
	OnDashboardUpdate(update DashboardUpdate) error
	GetSubscriptionID() string
}

DashboardSubscriber interface for real-time updates

type DashboardSummary

type DashboardSummary struct {
	TotalScans           int     `json:"total_scans"`
	TotalVulnerabilities int     `json:"total_vulnerabilities"`
	AverageScanDuration  float64 `json:"average_scan_duration"`
	SuccessRate          float64 `json:"success_rate"`
	CriticalVulns        int     `json:"critical_vulns"`
	HighVulns            int     `json:"high_vulns"`
	TrendDirection       string  `json:"trend_direction"` // up, down, stable
	TrendPercentage      float64 `json:"trend_percentage"`
}

DashboardSummary represents high-level dashboard metrics

type DashboardUpdate

type DashboardUpdate struct {
	DashboardID string                 `json:"dashboard_id"`
	WidgetID    string                 `json:"widget_id"`
	UpdateType  UpdateType             `json:"update_type"`
	Data        interface{}            `json:"data"`
	Timestamp   time.Time              `json:"timestamp"`
	Metadata    map[string]interface{} `json:"metadata"`
}

DashboardUpdate represents real-time dashboard updates

type DataArchiver

type DataArchiver interface {
	Archive(ctx context.Context, data []Metric, archivePath string) error
	Retrieve(ctx context.Context, archivePath string, timeRange TimeWindow) ([]Metric, error)
	List(ctx context.Context, pattern string) ([]ArchiveInfo, error)
	Delete(ctx context.Context, archivePath string) error
}

DataArchiver interface for archival operations

type DataCompressor

type DataCompressor interface {
	Compress(ctx context.Context, data []byte) ([]byte, error)
	Decompress(ctx context.Context, compressedData []byte) ([]byte, error)
	GetCompressionRatio() float64
}

DataCompressor interface for data compression

type DataPoint

type DataPoint struct {
	Timestamp time.Time          `json:"timestamp"`
	Values    map[string]float64 `json:"values"`
	Tags      map[string]string  `json:"tags"`
}

DataPoint represents a single data point in analytics

type DataSourceConfig

type DataSourceConfig struct {
	Type            DataSourceType         `json:"type"`
	MetricName      string                 `json:"metric_name"`
	TimeRange       TimeWindow             `json:"time_range"`
	Filters         map[string]interface{} `json:"filters"`
	Aggregation     AggregationConfig      `json:"aggregation"`
	RefreshInterval time.Duration          `json:"refresh_interval"`
}

DataSourceConfig defines how widgets fetch data

type DataSourceType

type DataSourceType string

DataSourceType represents different data source types

const (
	DataSourceTypeMetrics    DataSourceType = "metrics"
	DataSourceTypeTrends     DataSourceType = "trends"
	DataSourceTypeAggregated DataSourceType = "aggregated"
	DataSourceTypeRealTime   DataSourceType = "realtime"
	DataSourceTypeStatic     DataSourceType = "static"
)

type DataStorage

type DataStorage interface {
	// Lifecycle
	Initialize() error
	Close() error

	// Metrics operations
	StoreMetric(metric *Metric) error
	StoreScanResult(result *ScanResult) error
	QueryMetrics(query *MetricsQuery) (*MetricsResult, error)

	// Cleanup operations
	DeleteRawData(before time.Time) error
	ArchiveData(before time.Time) error

	// Statistics
	GetStorageSize() (int64, error)
	GetRecordCount() (int64, error)

	// Advanced queries
	GetAggregatedData(query *MetricsQuery) (*MetricsResult, error)
	GetTimeSeriesData(metric string, timeRange TimeRange) ([]DataPoint, error)
	GetMetricsByTimeRange(ctx context.Context, start, end time.Time) ([]Metric, error)
	GetMetricsByNameAndTimeRange(ctx context.Context, name string, start, end time.Time) ([]Metric, error)
	StoreAggregatedMetric(ctx context.Context, metric AggregatedMetric) error
	DeleteMetricsByTimeRange(ctx context.Context, start, end time.Time) error
	CountMetricsByTimeRange(ctx context.Context, start, end time.Time) (int, error)
}

DataStorage interface defines storage operations

func NewDataStorage

func NewDataStorage(config *Config, logger Logger) (DataStorage, error)

NewDataStorage creates a new data storage instance based on configuration

func NewInfluxDBStorage

func NewInfluxDBStorage(config *Config, logger Logger) (DataStorage, error)

func NewMySQLStorage

func NewMySQLStorage(config *Config, logger Logger) (DataStorage, error)

func NewPostgreSQLStorage

func NewPostgreSQLStorage(config *Config, logger Logger) (DataStorage, error)

type ElasticsearchIntegration

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

ElasticsearchIntegration sends data to Elasticsearch

func (*ElasticsearchIntegration) GetEndpoint

func (ei *ElasticsearchIntegration) GetEndpoint() string

func (*ElasticsearchIntegration) GetName

func (ei *ElasticsearchIntegration) GetName() string

func (*ElasticsearchIntegration) IsEnabled

func (ei *ElasticsearchIntegration) IsEnabled() bool

func (*ElasticsearchIntegration) Send

func (ei *ElasticsearchIntegration) Send(ctx context.Context, data interface{}) error

func (*ElasticsearchIntegration) Validate

func (ei *ElasticsearchIntegration) Validate() error

type EnrichmentProcessor

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

EnrichmentProcessor adds additional context to metrics

func (*EnrichmentProcessor) GetType

func (ep *EnrichmentProcessor) GetType() string

func (*EnrichmentProcessor) IsEnabled

func (ep *EnrichmentProcessor) IsEnabled() bool

func (*EnrichmentProcessor) Process

func (ep *EnrichmentProcessor) Process(ctx context.Context, metric Metric) (Metric, error)

type ExecutiveMetric

type ExecutiveMetric struct {
	Name           string  `json:"name"`
	CurrentValue   float64 `json:"current_value"`
	PreviousValue  float64 `json:"previous_value"`
	Target         float64 `json:"target"`
	Unit           string  `json:"unit"`
	Trend          string  `json:"trend"`  // "up", "down", "stable"
	Status         string  `json:"status"` // "good", "warning", "critical"
	ChangePercent  float64 `json:"change_percent"`
	Interpretation string  `json:"interpretation"`
}

ExecutiveMetric represents a key metric for executives

type ExecutiveRecommendation

type ExecutiveRecommendation struct {
	Priority    string `json:"priority"`
	Category    string `json:"category"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Impact      string `json:"impact"`
	Effort      string `json:"effort"`
	Timeline    string `json:"timeline"`
	Owner       string `json:"owner"`
}

type ExecutiveReport

type ExecutiveReport struct {
	ID               string                    `json:"id"`
	Title            string                    `json:"title"`
	Period           TimeWindow                `json:"period"`
	ExecutiveSummary ExecutiveSummary          `json:"executive_summary"`
	KeyMetrics       []ExecutiveMetric         `json:"key_metrics"`
	SecurityPosture  SecurityPostureReport     `json:"security_posture"`
	Performance      PerformanceReport         `json:"performance"`
	Trends           TrendsReport              `json:"trends"`
	Recommendations  []ExecutiveRecommendation `json:"recommendations"`
	RiskAssessment   RiskAssessment            `json:"risk_assessment"`
	Compliance       ComplianceReport          `json:"compliance"`
	GeneratedAt      time.Time                 `json:"generated_at"`
	GeneratedBy      string                    `json:"generated_by"`
}

ExecutiveReport represents a comprehensive executive summary

type ExecutiveReportGenerator

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

ExecutiveReportGenerator creates high-level executive reports and summaries

func NewExecutiveReportGenerator

func NewExecutiveReportGenerator(config *Config, storage DataStorage, trendAnalyzer *TrendAnalyzer, comparativeAnalyzer *ComparativeAnalyzer, logger Logger) *ExecutiveReportGenerator

NewExecutiveReportGenerator creates a new executive report generator

func (*ExecutiveReportGenerator) GenerateCustomReport

func (erg *ExecutiveReportGenerator) GenerateCustomReport(ctx context.Context, title string, period TimeWindow, generatedBy string) (*ExecutiveReport, error)

GenerateCustomReport generates a report for a custom time period

func (*ExecutiveReportGenerator) GenerateMonthlyReport

func (erg *ExecutiveReportGenerator) GenerateMonthlyReport(ctx context.Context, generatedBy string) (*ExecutiveReport, error)

GenerateMonthlyReport generates a monthly executive report

func (*ExecutiveReportGenerator) GenerateWeeklyReport

func (erg *ExecutiveReportGenerator) GenerateWeeklyReport(ctx context.Context, generatedBy string) (*ExecutiveReport, error)

GenerateWeeklyReport generates a weekly executive report

type ExecutiveSummary

type ExecutiveSummary struct {
	OverallStatus     string   `json:"overall_status"`
	KeyHighlights     []string `json:"key_highlights"`
	CriticalIssues    []string `json:"critical_issues"`
	SuccessStories    []string `json:"success_stories"`
	NextStepsPriority []string `json:"next_steps_priority"`
}

ExecutiveSummary provides a high-level overview

type ExportFormat

type ExportFormat string

ExportFormat represents different export formats

const (
	ExportFormatJSON       ExportFormat = "json"
	ExportFormatCSV        ExportFormat = "csv"
	ExportFormatXML        ExportFormat = "xml"
	ExportFormatPDF        ExportFormat = "pdf"
	ExportFormatExcel      ExportFormat = "xlsx"
	ExportFormatPrometheus ExportFormat = "prometheus"
	ExportFormatSplunk     ExportFormat = "splunk"
	ExportFormatElastic    ExportFormat = "elasticsearch"
)

type ExportManager

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

ExportManager handles data export and integration APIs

func NewExportManager

func NewExportManager(config *Config, storage DataStorage, reportGenerator *ExecutiveReportGenerator, logger Logger) *ExportManager

NewExportManager creates a new export manager

func (*ExportManager) ExportData

func (em *ExportManager) ExportData(ctx context.Context, request ExportRequest, writer io.Writer) (*ExportResult, error)

ExportData exports data in the specified format

func (*ExportManager) ExportReport

func (em *ExportManager) ExportReport(ctx context.Context, reportID string, format ExportFormat, writer io.Writer) error

ExportReport exports an executive report

func (*ExportManager) GetAvailableIntegrations

func (em *ExportManager) GetAvailableIntegrations() []string

GetAvailableIntegrations returns list of available integrations

func (*ExportManager) GetSupportedFormats

func (em *ExportManager) GetSupportedFormats() []ExportFormat

GetSupportedFormats returns list of supported export formats

func (*ExportManager) RegisterExporter

func (em *ExportManager) RegisterExporter(exporter Exporter)

RegisterExporter adds a custom exporter

func (*ExportManager) RegisterIntegration

func (em *ExportManager) RegisterIntegration(integration Integration)

RegisterIntegration adds a custom integration

func (*ExportManager) SendToIntegration

func (em *ExportManager) SendToIntegration(ctx context.Context, integrationName string, data interface{}) error

SendToIntegration sends data to an external integration

type ExportOptions

type ExportOptions struct {
	IncludeMetadata bool                   `json:"include_metadata"`
	CompressOutput  bool                   `json:"compress_output"`
	ChunkSize       int                    `json:"chunk_size"`
	FieldSelection  []string               `json:"field_selection"`
	CustomFormat    map[string]interface{} `json:"custom_format"`
	Aggregation     AggregationConfig      `json:"aggregation"`
}

ExportOptions configures export behavior

type ExportParams

type ExportParams struct {
	Format    string            `json:"format"`    // json, csv, excel, xml
	DataType  string            `json:"data_type"` // metrics, trends, reports
	TimeRange TimeRange         `json:"time_range"`
	Metrics   []string          `json:"metrics"`
	Filters   map[string]string `json:"filters"`
	Filename  string            `json:"filename,omitempty"`
}

ExportParams represents parameters for data export

type ExportRequest

type ExportRequest struct {
	ID          string                 `json:"id"`
	Format      ExportFormat           `json:"format"`
	DataType    string                 `json:"data_type"`
	TimeRange   TimeWindow             `json:"time_range"`
	Filters     map[string]interface{} `json:"filters"`
	Options     ExportOptions          `json:"options"`
	RequestedBy string                 `json:"requested_by"`
	RequestedAt time.Time              `json:"requested_at"`
}

ExportRequest represents a data export request

type ExportResult

type ExportResult struct {
	ID          string        `json:"id"`
	Status      ExportStatus  `json:"status"`
	Format      ExportFormat  `json:"format"`
	Size        int64         `json:"size"`
	RecordCount int           `json:"record_count"`
	Duration    time.Duration `json:"duration"`
	DownloadURL string        `json:"download_url"`
	ExpiresAt   time.Time     `json:"expires_at"`
	Error       string        `json:"error,omitempty"`
	CompletedAt time.Time     `json:"completed_at"`
}

ExportResult contains export operation results

type ExportStatus

type ExportStatus string

ExportStatus represents export operation status

const (
	ExportStatusPending    ExportStatus = "pending"
	ExportStatusProcessing ExportStatus = "processing"
	ExportStatusCompleted  ExportStatus = "completed"
	ExportStatusFailed     ExportStatus = "failed"
	ExportStatusExpired    ExportStatus = "expired"
)

type Exporter

type Exporter interface {
	Export(ctx context.Context, data interface{}, writer io.Writer) error
	GetFormat() ExportFormat
	GetContentType() string
	Validate(data interface{}) error
}

Exporter interface for different export formats

type FileSystemArchiver

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

FileSystemArchiver implements DataArchiver for filesystem storage

func (*FileSystemArchiver) Archive

func (fsa *FileSystemArchiver) Archive(ctx context.Context, data []Metric, archivePath string) error

func (*FileSystemArchiver) Delete

func (fsa *FileSystemArchiver) Delete(ctx context.Context, archivePath string) error

func (*FileSystemArchiver) List

func (fsa *FileSystemArchiver) List(ctx context.Context, pattern string) ([]ArchiveInfo, error)

func (*FileSystemArchiver) Retrieve

func (fsa *FileSystemArchiver) Retrieve(ctx context.Context, archivePath string, timeRange TimeWindow) ([]Metric, error)

type FilteringProcessor

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

FilteringProcessor filters metrics based on configuration

func (*FilteringProcessor) GetType

func (fp *FilteringProcessor) GetType() string

func (*FilteringProcessor) IsEnabled

func (fp *FilteringProcessor) IsEnabled() bool

func (*FilteringProcessor) Process

func (fp *FilteringProcessor) Process(ctx context.Context, metric Metric) (Metric, error)

type FontConfig

type FontConfig struct {
	Family string `json:"family"`
	Size   int    `json:"size"`
	Weight string `json:"weight"`
	Color  string `json:"color"`
}

FontConfig defines font styling

type ForecastAccuracy

type ForecastAccuracy struct {
	MAE  float64 `json:"mae"`  // Mean Absolute Error
	RMSE float64 `json:"rmse"` // Root Mean Square Error
	MAPE float64 `json:"mape"` // Mean Absolute Percentage Error
}

ForecastAccuracy represents forecast accuracy metrics

type ForecastPoint

type ForecastPoint struct {
	Timestamp  time.Time `json:"timestamp"`
	Value      float64   `json:"value"`
	Confidence float64   `json:"confidence"`
	Lower      float64   `json:"lower_bound"`
	Upper      float64   `json:"upper_bound"`
}

ForecastPoint represents a forecasted data point

type ForecastResult

type ForecastResult struct {
	Method       string            `json:"method"`
	HorizonHours int               `json:"horizon_hours"`
	Predictions  []PredictionPoint `json:"predictions"`
	Accuracy     ForecastAccuracy  `json:"accuracy"`
	Confidence   float64           `json:"confidence"`
}

ForecastResult represents forecast predictions

type ForecastSummary

type ForecastSummary struct {
	Metric     string  `json:"metric"`
	Horizon    string  `json:"horizon"`
	Prediction string  `json:"prediction"`
	Confidence float64 `json:"confidence"`
	Reasoning  string  `json:"reasoning"`
}

type FrameworkCompliance

type FrameworkCompliance struct {
	Framework  string  `json:"framework"`
	Status     string  `json:"status"`
	Score      float64 `json:"score"`
	Violations int     `json:"violations"`
}

type GaugeData

type GaugeData struct {
	Value float64 `json:"value"`
	Min   float64 `json:"min"`
	Max   float64 `json:"max"`
	Label string  `json:"label"`
	Unit  string  `json:"unit"`
}

type GaugeWidget

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

GaugeWidget displays metrics as a gauge/dial

func (*GaugeWidget) GetData

func (gw *GaugeWidget) GetData(ctx context.Context, config DataSourceConfig) (interface{}, error)

func (*GaugeWidget) GetMetadata

func (gw *GaugeWidget) GetMetadata() WidgetMetadata

func (*GaugeWidget) GetType

func (gw *GaugeWidget) GetType() WidgetType

func (*GaugeWidget) Render

func (gw *GaugeWidget) Render(data interface{}, style WidgetStyle) (string, error)

func (*GaugeWidget) Validate

func (gw *GaugeWidget) Validate(config map[string]interface{}) error

type GridSize

type GridSize struct {
	Width  int `json:"width"`
	Height int `json:"height"`
}

GridSize defines grid dimensions

type GzipCompressor

type GzipCompressor struct{}

GzipCompressor implements DataCompressor using gzip

func (*GzipCompressor) Compress

func (gc *GzipCompressor) Compress(ctx context.Context, data []byte) ([]byte, error)

func (*GzipCompressor) Decompress

func (gc *GzipCompressor) Decompress(ctx context.Context, compressedData []byte) ([]byte, error)

func (*GzipCompressor) GetCompressionRatio

func (gc *GzipCompressor) GetCompressionRatio() float64

type HeatmapWidget

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

HeatmapWidget displays data as a heatmap

func (*HeatmapWidget) GetData

func (hw *HeatmapWidget) GetData(ctx context.Context, config DataSourceConfig) (interface{}, error)

func (*HeatmapWidget) GetMetadata

func (hw *HeatmapWidget) GetMetadata() WidgetMetadata

func (*HeatmapWidget) GetType

func (hw *HeatmapWidget) GetType() WidgetType

func (*HeatmapWidget) Render

func (hw *HeatmapWidget) Render(data interface{}, style WidgetStyle) (string, error)

func (*HeatmapWidget) Validate

func (hw *HeatmapWidget) Validate(config map[string]interface{}) error

type HistoricalDataManager

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

HistoricalDataManager manages long-term data retention and archival

func NewHistoricalDataManager

func NewHistoricalDataManager(config *Config, storage DataStorage, logger Logger) *HistoricalDataManager

NewHistoricalDataManager creates a new historical data manager

func (*HistoricalDataManager) Archive

func (hdm *HistoricalDataManager) Archive(ctx context.Context) error

Archive moves old data to archive storage

func (*HistoricalDataManager) Cleanup

func (hdm *HistoricalDataManager) Cleanup(ctx context.Context) error

Cleanup removes expired data according to retention policies

func (*HistoricalDataManager) GetHistoricalData

func (hdm *HistoricalDataManager) GetHistoricalData(ctx context.Context, metricName string, timeRange TimeWindow) ([]Metric, error)

GetHistoricalData retrieves historical data across storage tiers

func (*HistoricalDataManager) GetRetentionStatus

func (hdm *HistoricalDataManager) GetRetentionStatus(ctx context.Context) (map[string]RetentionStatus, error)

GetRetentionStatus returns current retention status

func (*HistoricalDataManager) SetRetentionPolicy

func (hdm *HistoricalDataManager) SetRetentionPolicy(dataType string, policy RetentionPolicy)

SetRetentionPolicy sets a custom retention policy

type IncidentSummaryReport

type IncidentSummaryReport struct {
	TotalIncidents     int     `json:"total_incidents"`
	ResolvedIncidents  int     `json:"resolved_incidents"`
	MeanResolutionTime float64 `json:"mean_resolution_time"`
}

type InsightType

type InsightType string

InsightType represents different types of insights

const (
	InsightTypeTrend       InsightType = "trend"
	InsightTypeAnomaly     InsightType = "anomaly"
	InsightTypePattern     InsightType = "pattern"
	InsightTypePerformance InsightType = "performance"
	InsightTypeSecurity    InsightType = "security"
	InsightTypeCapacity    InsightType = "capacity"
)

type Integration

type Integration interface {
	Send(ctx context.Context, data interface{}) error
	GetName() string
	GetEndpoint() string
	IsEnabled() bool
	Validate() error
}

Integration interface for external system integrations

type IntegrationConfig

type IntegrationConfig struct {
	Name        string                 `json:"name"`
	Type        IntegrationType        `json:"type"`
	Endpoint    string                 `json:"endpoint"`
	Credentials map[string]string      `json:"credentials"`
	Settings    map[string]interface{} `json:"settings"`
	Enabled     bool                   `json:"enabled"`
	Schedule    string                 `json:"schedule"`
}

IntegrationConfig configures external integrations

type IntegrationType

type IntegrationType string

IntegrationType represents different integration types

const (
	IntegrationTypeSIEM       IntegrationType = "siem"
	IntegrationTypeTicketing  IntegrationType = "ticketing"
	IntegrationTypeMonitoring IntegrationType = "monitoring"
	IntegrationTypeBI         IntegrationType = "business_intelligence"
	IntegrationTypeWebhook    IntegrationType = "webhook"
	IntegrationTypeAPI        IntegrationType = "api"
)

type JSONExporter

type JSONExporter struct{}

JSONExporter exports data as JSON

func (*JSONExporter) Export

func (je *JSONExporter) Export(ctx context.Context, data interface{}, writer io.Writer) error

func (*JSONExporter) GetContentType

func (je *JSONExporter) GetContentType() string

func (*JSONExporter) GetFormat

func (je *JSONExporter) GetFormat() ExportFormat

func (*JSONExporter) Validate

func (je *JSONExporter) Validate(data interface{}) error

type Layout

type Layout struct {
	Type        LayoutType                  `json:"type"`
	Columns     int                         `json:"columns"`
	Rows        int                         `json:"rows"`
	GridSize    GridSize                    `json:"grid_size"`
	Responsive  bool                        `json:"responsive"`
	Breakpoints map[string]BreakpointConfig `json:"breakpoints"`
}

Layout defines dashboard layout configuration

type LayoutType

type LayoutType string

LayoutType represents different layout types

const (
	LayoutTypeGrid      LayoutType = "grid"
	LayoutTypeFlexible  LayoutType = "flexible"
	LayoutTypeMasonry   LayoutType = "masonry"
	LayoutTypeDashboard LayoutType = "dashboard"
)

type LinearTrendDetector

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

LinearTrendDetector detects linear trends using regression analysis

func (*LinearTrendDetector) DetectTrend

func (ltd *LinearTrendDetector) DetectTrend(ctx context.Context, data []DataPoint) (*TrendResult, error)

func (*LinearTrendDetector) GetConfidenceLevel

func (ltd *LinearTrendDetector) GetConfidenceLevel() float64

func (*LinearTrendDetector) GetType

func (ltd *LinearTrendDetector) GetType() string

type Logger

type Logger interface {
	Info(msg string, keysAndValues ...interface{})
	Error(msg string, keysAndValues ...interface{})
	Debug(msg string, keysAndValues ...interface{})
	Warn(msg string, keysAndValues ...interface{})
}

Logger interface for analytics logging

type LoggingHook

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

LoggingHook logs collection events

func NewLoggingHook

func NewLoggingHook(logger Logger) *LoggingHook

func (*LoggingHook) OnError

func (lh *LoggingHook) OnError(ctx context.Context, err error, scanID string)

func (*LoggingHook) PostCollection

func (lh *LoggingHook) PostCollection(ctx context.Context, scanID string, metrics []Metric) error

func (*LoggingHook) PreCollection

func (lh *LoggingHook) PreCollection(ctx context.Context, scanID string) error

type Manager

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

Manager orchestrates all analytics operations

func NewManager

func NewManager(config *Config, logger Logger) (*Manager, error)

NewManager creates a new analytics manager

func (*Manager) ExportData

func (m *Manager) ExportData(params *ExportParams) ([]byte, error)

ExportData exports analytics data in specified format

func (*Manager) GetAnalyticsSummary

func (m *Manager) GetAnalyticsSummary() (*AnalyticsSummary, error)

GetAnalyticsSummary returns a high-level analytics summary

func (*Manager) GetComparisonAnalysis

func (m *Manager) GetComparisonAnalysis(params *ComparisonParams) (*ComparisonResult, error)

GetComparisonAnalysis performs comparative analysis

func (*Manager) GetDashboard

func (m *Manager) GetDashboard(timeRange TimeRange) (*Dashboard, error)

GetDashboard returns dashboard data

func (*Manager) GetMetrics

func (m *Manager) GetMetrics(query *MetricsQuery) (*MetricsResult, error)

GetMetrics retrieves metrics data

func (*Manager) GetReport

func (m *Manager) GetReport(params *ReportParams) (*Report, error)

GetReport generates an analytics report

func (*Manager) GetTrends

func (m *Manager) GetTrends(params *TrendParams) (*TrendAnalysis, error)

GetTrends returns trend analysis data

func (*Manager) RecordMetric

func (m *Manager) RecordMetric(metric *Metric) error

RecordMetric records a custom metric

func (*Manager) RecordScanResult

func (m *Manager) RecordScanResult(result *ScanResult) error

RecordScanResult records a scan result for analytics

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start initializes and starts analytics collection

func (*Manager) Stop

func (m *Manager) Stop() error

Stop gracefully shuts down analytics components

type MemoryStorage

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

MemoryStorage implements DataStorage interface using in-memory storage

func NewMemoryStorage

func NewMemoryStorage(config *Config, logger Logger) *MemoryStorage

NewMemoryStorage creates a new in-memory storage instance

func (*MemoryStorage) ArchiveData

func (m *MemoryStorage) ArchiveData(before time.Time) error

ArchiveData is a no-op for memory storage

func (*MemoryStorage) Close

func (m *MemoryStorage) Close() error

Close closes the memory storage (no-op for memory)

func (*MemoryStorage) CountMetricsByTimeRange

func (m *MemoryStorage) CountMetricsByTimeRange(ctx context.Context, start, end time.Time) (int, error)

func (*MemoryStorage) DeleteMetricsByTimeRange

func (m *MemoryStorage) DeleteMetricsByTimeRange(ctx context.Context, start, end time.Time) error

func (*MemoryStorage) DeleteRawData

func (m *MemoryStorage) DeleteRawData(before time.Time) error

DeleteRawData deletes old metrics from memory

func (*MemoryStorage) GetAggregatedData

func (m *MemoryStorage) GetAggregatedData(query *MetricsQuery) (*MetricsResult, error)

GetAggregatedData returns aggregated data from memory

func (*MemoryStorage) GetMetricsByNameAndTimeRange

func (m *MemoryStorage) GetMetricsByNameAndTimeRange(ctx context.Context, name string, start, end time.Time) ([]Metric, error)

func (*MemoryStorage) GetMetricsByTimeRange

func (m *MemoryStorage) GetMetricsByTimeRange(ctx context.Context, start, end time.Time) ([]Metric, error)

func (*MemoryStorage) GetRecordCount

func (m *MemoryStorage) GetRecordCount() (int64, error)

GetRecordCount returns the total number of records in memory

func (*MemoryStorage) GetStorageSize

func (m *MemoryStorage) GetStorageSize() (int64, error)

GetStorageSize returns approximate memory usage

func (*MemoryStorage) GetTimeSeriesData

func (m *MemoryStorage) GetTimeSeriesData(metric string, timeRange TimeRange) ([]DataPoint, error)

GetTimeSeriesData returns time series data from memory

func (*MemoryStorage) Initialize

func (m *MemoryStorage) Initialize() error

Initialize initializes the memory storage

func (*MemoryStorage) QueryMetrics

func (m *MemoryStorage) QueryMetrics(query *MetricsQuery) (*MetricsResult, error)

QueryMetrics queries metrics from memory

func (*MemoryStorage) StoreAggregatedMetric

func (m *MemoryStorage) StoreAggregatedMetric(ctx context.Context, metric AggregatedMetric) error

func (*MemoryStorage) StoreMetric

func (m *MemoryStorage) StoreMetric(metric *Metric) error

StoreMetric stores a metric in memory

func (*MemoryStorage) StoreScanResult

func (m *MemoryStorage) StoreScanResult(result *ScanResult) error

StoreScanResult stores a scan result in memory

type Metric

type Metric struct {
	Name      string            `json:"name"`
	Value     float64           `json:"value"`
	Unit      string            `json:"unit"`
	Tags      map[string]string `json:"tags"`
	Timestamp time.Time         `json:"timestamp"`
	Source    string            `json:"source"`
}

Metric represents a custom metric data point

type MetricAggregator

type MetricAggregator interface {
	Aggregate(ctx context.Context, metrics []Metric, window TimeWindow) (AggregatedMetric, error)
	GetWindowSizes() []time.Duration
	Reset()
}

MetricAggregator interface for aggregating metrics over time windows

type MetricData

type MetricData struct {
	Value         float64   `json:"value"`
	Label         string    `json:"label"`
	Change        float64   `json:"change"`
	ChangePercent float64   `json:"change_percent"`
	Timestamp     time.Time `json:"timestamp"`
}

type MetricProcessor

type MetricProcessor interface {
	Process(ctx context.Context, metric Metric) (Metric, error)
	GetType() string
	IsEnabled() bool
}

MetricProcessor interface for processing individual metrics

type MetricWidget

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

MetricWidget displays a single metric value

func (*MetricWidget) GetData

func (mw *MetricWidget) GetData(ctx context.Context, config DataSourceConfig) (interface{}, error)

func (*MetricWidget) GetMetadata

func (mw *MetricWidget) GetMetadata() WidgetMetadata

func (*MetricWidget) GetType

func (mw *MetricWidget) GetType() WidgetType

func (*MetricWidget) Render

func (mw *MetricWidget) Render(data interface{}, style WidgetStyle) (string, error)

func (*MetricWidget) Validate

func (mw *MetricWidget) Validate(config map[string]interface{}) error

type MetricsCollector

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

MetricsCollector handles the collection and processing of various metrics

func NewMetricsCollector

func NewMetricsCollector(config *Config, storage DataStorage, logger Logger) *MetricsCollector

NewMetricsCollector creates a new metrics collector

func (*MetricsCollector) CollectCustomMetric

func (mc *MetricsCollector) CollectCustomMetric(name string, value float64, labels map[string]string, metadata map[string]interface{}) error

CollectCustomMetric allows collection of custom metrics

func (*MetricsCollector) FinishScanTracking

func (mc *MetricsCollector) FinishScanTracking(scanID string, result *ScanResult) error

FinishScanTracking completes tracking for a scan

func (*MetricsCollector) GetActiveScans

func (mc *MetricsCollector) GetActiveScans() map[string]*ScanTracker

GetActiveScans returns information about currently active scans

func (*MetricsCollector) GetSystemMetrics

func (mc *MetricsCollector) GetSystemMetrics() *SystemMetrics

GetSystemMetrics returns current system metrics

func (*MetricsCollector) RegisterAggregator

func (mc *MetricsCollector) RegisterAggregator(name string, aggregator MetricAggregator)

RegisterAggregator adds a custom metric aggregator

func (*MetricsCollector) RegisterHook

func (mc *MetricsCollector) RegisterHook(hook CollectionHook)

RegisterHook adds a collection hook

func (*MetricsCollector) RegisterProcessor

func (mc *MetricsCollector) RegisterProcessor(processor MetricProcessor)

RegisterProcessor adds a custom metric processor

func (*MetricsCollector) Shutdown

func (mc *MetricsCollector) Shutdown(timeout time.Duration) error

Shutdown gracefully shuts down the metrics collector

func (*MetricsCollector) StartScanTracking

func (mc *MetricsCollector) StartScanTracking(scanID, target string, templates []string) error

StartScanTracking begins tracking metrics for a new scan

func (*MetricsCollector) UpdateScanProgress

func (mc *MetricsCollector) UpdateScanProgress(scanID string, phase string, testsRun, testsPassed, testsFailed int) error

UpdateScanProgress updates the progress of an active scan

type MetricsQuery

type MetricsQuery struct {
	TimeRange   TimeRange         `json:"time_range"`
	Metrics     []string          `json:"metrics"`
	GroupBy     []string          `json:"group_by"`
	Filters     map[string]string `json:"filters"`
	Aggregation string            `json:"aggregation"` // sum, avg, count, max, min
	Interval    string            `json:"interval"`    // 1h, 1d, 1w, 1m
	Limit       int               `json:"limit"`
	Offset      int               `json:"offset"`
}

MetricsQuery represents a query for metrics data

func (*MetricsQuery) Validate

func (mq *MetricsQuery) Validate() error

Validate validates MetricsQuery

type MetricsResult

type MetricsResult struct {
	Query     *MetricsQuery `json:"query"`
	Data      []DataPoint   `json:"data"`
	Total     int           `json:"total"`
	Cached    bool          `json:"cached"`
	QueryTime time.Duration `json:"query_time"`
}

MetricsResult represents query results

type MetricsValidationHook

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

MetricsValidationHook validates metrics quality

func NewMetricsValidationHook

func NewMetricsValidationHook(validator QualityValidator) *MetricsValidationHook

func (*MetricsValidationHook) OnError

func (mvh *MetricsValidationHook) OnError(ctx context.Context, err error, scanID string)

func (*MetricsValidationHook) PostCollection

func (mvh *MetricsValidationHook) PostCollection(ctx context.Context, scanID string, metrics []Metric) error

func (*MetricsValidationHook) PreCollection

func (mvh *MetricsValidationHook) PreCollection(ctx context.Context, scanID string) error

type NetworkStats

type NetworkStats struct {
	BytesSent       int64
	BytesReceived   int64
	PacketsSent     int64
	PacketsReceived int64
	Connections     int
}

NetworkStats tracks network I/O statistics

type NotificationHook

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

NotificationHook sends notifications for important events

func NewNotificationHook

func NewNotificationHook(notifier Notifier, thresholds map[string]float64) *NotificationHook

func (*NotificationHook) OnError

func (nh *NotificationHook) OnError(ctx context.Context, err error, scanID string)

func (*NotificationHook) PostCollection

func (nh *NotificationHook) PostCollection(ctx context.Context, scanID string, metrics []Metric) error

func (*NotificationHook) PreCollection

func (nh *NotificationHook) PreCollection(ctx context.Context, scanID string) error

type Notifier

type Notifier interface {
	SendNotification(ctx context.Context, message string, severity string) error
}

type PerformanceAggregator

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

PerformanceAggregator focuses on performance-related metrics

func (*PerformanceAggregator) Aggregate

func (pa *PerformanceAggregator) Aggregate(ctx context.Context, metrics []Metric, window TimeWindow) (AggregatedMetric, error)

func (*PerformanceAggregator) GetWindowSizes

func (pa *PerformanceAggregator) GetWindowSizes() []time.Duration

func (*PerformanceAggregator) Reset

func (pa *PerformanceAggregator) Reset()

type PerformanceHook

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

PerformanceHook monitors collection performance

func NewPerformanceHook

func NewPerformanceHook(logger Logger, slowThreshold time.Duration) *PerformanceHook

func (*PerformanceHook) OnError

func (ph *PerformanceHook) OnError(ctx context.Context, err error, scanID string)

func (*PerformanceHook) PostCollection

func (ph *PerformanceHook) PostCollection(ctx context.Context, scanID string, metrics []Metric) error

func (*PerformanceHook) PreCollection

func (ph *PerformanceHook) PreCollection(ctx context.Context, scanID string) error

type PerformanceMetric

type PerformanceMetric struct {
	Name        string  `json:"name"`
	Value       float64 `json:"value"`
	Unit        string  `json:"unit"`
	Trend       string  `json:"trend"`
	TargetValue float64 `json:"target_value"`
	Status      string  `json:"status"`
}

type PerformanceReport

type PerformanceReport struct {
	SystemHealth        SystemHealthReport  `json:"system_health"`
	PerformanceMetrics  []PerformanceMetric `json:"performance_metrics"`
	CapacityUtilization CapacityReport      `json:"capacity_utilization"`
	SLACompliance       SLAComplianceReport `json:"sla_compliance"`
}

PerformanceReport summarizes system performance

type Position

type Position struct {
	X      int `json:"x"`
	Y      int `json:"y"`
	Width  int `json:"width"`
	Height int `json:"height"`
}

Position represents widget position on dashboard

type PredictionPoint

type PredictionPoint struct {
	Timestamp          time.Time `json:"timestamp"`
	PredictedValue     float64   `json:"predicted_value"`
	ConfidenceInterval struct {
		Lower float64 `json:"lower"`
		Upper float64 `json:"upper"`
	} `json:"confidence_interval"`
}

PredictionPoint represents a future prediction

type ProgressWidget

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

ProgressWidget displays progress bars

func (*ProgressWidget) GetData

func (pw *ProgressWidget) GetData(ctx context.Context, config DataSourceConfig) (interface{}, error)

func (*ProgressWidget) GetMetadata

func (pw *ProgressWidget) GetMetadata() WidgetMetadata

func (*ProgressWidget) GetType

func (pw *ProgressWidget) GetType() WidgetType

func (*ProgressWidget) Render

func (pw *ProgressWidget) Render(data interface{}, style WidgetStyle) (string, error)

func (*ProgressWidget) Validate

func (pw *ProgressWidget) Validate(config map[string]interface{}) error

type PrometheusExporter

type PrometheusExporter struct{}

PrometheusExporter exports data in Prometheus format

func (*PrometheusExporter) Export

func (pe *PrometheusExporter) Export(ctx context.Context, data interface{}, writer io.Writer) error

func (*PrometheusExporter) GetContentType

func (pe *PrometheusExporter) GetContentType() string

func (*PrometheusExporter) GetFormat

func (pe *PrometheusExporter) GetFormat() ExportFormat

func (*PrometheusExporter) Validate

func (pe *PrometheusExporter) Validate(data interface{}) error

type QualityValidator

type QualityValidator interface {
	ValidateQuality(ctx context.Context, metrics []Metric) []ValidationIssue
}

type Report

type Report struct {
	ID          string            `json:"id"`
	Type        string            `json:"type"`
	Title       string            `json:"title"`
	GeneratedAt time.Time         `json:"generated_at"`
	GeneratedBy string            `json:"generated_by"`
	Params      *ReportParams     `json:"params"`
	Sections    []ReportSection   `json:"sections"`
	Metadata    map[string]string `json:"metadata"`
	Size        int64             `json:"size"`
	Format      string            `json:"format"`
	FilePath    string            `json:"file_path,omitempty"`
}

Report represents a generated analytics report

type ReportGenerator

type ReportGenerator interface {
	GenerateReport(params *ReportParams) (*Report, error)
}

ReportGenerator interface for generating reports

type ReportParams

type ReportParams struct {
	Type       string            `json:"type"` // summary, detailed, executive, compliance
	TimeRange  TimeRange         `json:"time_range"`
	Targets    []string          `json:"targets"`
	Templates  []string          `json:"templates"`
	Format     string            `json:"format"` // pdf, html, docx, md
	Filters    map[string]string `json:"filters"`
	Sections   []string          `json:"sections"`
	Template   string            `json:"template_name,omitempty"`
	Recipients []string          `json:"recipients,omitempty"`
	Schedule   string            `json:"schedule,omitempty"` // for recurring reports
}

ReportParams represents parameters for report generation

type ReportSection

type ReportSection struct {
	ID        string      `json:"id"`
	Title     string      `json:"title"`
	Type      string      `json:"type"` // text, chart, table, summary
	Content   interface{} `json:"content"`
	Order     int         `json:"order"`
	PageBreak bool        `json:"page_break"`
}

ReportSection represents a section within a report

type RetentionPolicy

type RetentionPolicy struct {
	RawDataDays       int
	AggregatedDays    int
	TrendDataDays     int
	CompressAfterDays int
	ArchiveAfterDays  int
}

RetentionPolicy defines data retention rules

type RetentionStatus

type RetentionStatus struct {
	DataType     string    `json:"data_type"`
	HotCount     int       `json:"hot_count"`
	WarmCount    int       `json:"warm_count"`
	ColdCount    int       `json:"cold_count"`
	LastArchival time.Time `json:"last_archival"`
	NextArchival time.Time `json:"next_archival"`
}

RetentionStatus represents current retention status

type Risk

type Risk struct {
	Category    string `json:"category"`
	Level       string `json:"level"`
	Description string `json:"description"`
	Impact      string `json:"impact"`
	Mitigation  string `json:"mitigation"`
}

type RiskAssessment

type RiskAssessment struct {
	OverallRiskLevel string   `json:"overall_risk_level"`
	Risks            []Risk   `json:"risks"`
	KeyConcerns      []string `json:"key_concerns"`
	MitigationStatus string   `json:"mitigation_status"`
}

type SLAComplianceReport

type SLAComplianceReport struct {
	OverallCompliance float64  `json:"overall_compliance"`
	Violations        int      `json:"violations"`
	AffectedServices  []string `json:"affected_services"`
}

type SQLiteStorage

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

SQLiteStorage implements DataStorage interface using SQLite

func NewSQLiteStorage

func NewSQLiteStorage(config *Config, logger Logger) (*SQLiteStorage, error)

NewSQLiteStorage creates a new SQLite storage instance

func (*SQLiteStorage) ArchiveData

func (s *SQLiteStorage) ArchiveData(before time.Time) error

ArchiveData archives data older than the specified time

func (*SQLiteStorage) Close

func (s *SQLiteStorage) Close() error

Close closes the SQLite database connection

func (*SQLiteStorage) CountMetricsByTimeRange

func (s *SQLiteStorage) CountMetricsByTimeRange(ctx context.Context, start, end time.Time) (int, error)

func (*SQLiteStorage) DeleteMetricsByTimeRange

func (s *SQLiteStorage) DeleteMetricsByTimeRange(ctx context.Context, start, end time.Time) error

func (*SQLiteStorage) DeleteRawData

func (s *SQLiteStorage) DeleteRawData(before time.Time) error

DeleteRawData deletes raw data older than the specified time

func (*SQLiteStorage) GetAggregatedData

func (s *SQLiteStorage) GetAggregatedData(query *MetricsQuery) (*MetricsResult, error)

GetAggregatedData returns aggregated metrics data

func (*SQLiteStorage) GetMetricsByNameAndTimeRange

func (s *SQLiteStorage) GetMetricsByNameAndTimeRange(ctx context.Context, name string, start, end time.Time) ([]Metric, error)

func (*SQLiteStorage) GetMetricsByTimeRange

func (s *SQLiteStorage) GetMetricsByTimeRange(ctx context.Context, start, end time.Time) ([]Metric, error)

func (*SQLiteStorage) GetRecordCount

func (s *SQLiteStorage) GetRecordCount() (int64, error)

GetRecordCount returns the total number of records

func (*SQLiteStorage) GetStorageSize

func (s *SQLiteStorage) GetStorageSize() (int64, error)

GetStorageSize returns the storage size in bytes

func (*SQLiteStorage) GetTimeSeriesData

func (s *SQLiteStorage) GetTimeSeriesData(metric string, timeRange TimeRange) ([]DataPoint, error)

GetTimeSeriesData returns time series data for a specific metric

func (*SQLiteStorage) Initialize

func (s *SQLiteStorage) Initialize() error

Initialize initializes the SQLite storage

func (*SQLiteStorage) QueryMetrics

func (s *SQLiteStorage) QueryMetrics(query *MetricsQuery) (*MetricsResult, error)

QueryMetrics queries metrics from the database

func (*SQLiteStorage) StoreAggregatedMetric

func (s *SQLiteStorage) StoreAggregatedMetric(ctx context.Context, metric AggregatedMetric) error

func (*SQLiteStorage) StoreMetric

func (s *SQLiteStorage) StoreMetric(metric *Metric) error

StoreMetric stores a metric in the database

func (*SQLiteStorage) StoreScanResult

func (s *SQLiteStorage) StoreScanResult(result *ScanResult) error

StoreScanResult stores a scan result in the database

type ScanResult

type ScanResult struct {
	ID              string            `json:"id"`
	Timestamp       time.Time         `json:"timestamp"`
	Duration        time.Duration     `json:"duration"`
	Target          string            `json:"target"`
	TemplatesUsed   []string          `json:"templates_used"`
	TotalTests      int               `json:"total_tests"`
	PassedTests     int               `json:"passed_tests"`
	FailedTests     int               `json:"failed_tests"`
	Vulnerabilities []Vulnerability   `json:"vulnerabilities"`
	Metadata        map[string]string `json:"metadata"`
	Success         bool              `json:"success"`
	ErrorMessage    string            `json:"error_message,omitempty"`
}

ScanResult represents a scan result for analytics processing

type ScanTracker

type ScanTracker struct {
	ScanID        string
	StartTime     time.Time
	LastUpdate    time.Time
	TestsRun      int
	TestsPassed   int
	TestsFailed   int
	TemplatesUsed []string
	CurrentPhase  string
	Metrics       []Metric
	// contains filtered or unexported fields
}

ScanTracker tracks metrics for an active scan

type SeasonalPattern

type SeasonalPattern struct {
	Pattern    string        `json:"pattern"`
	Period     time.Duration `json:"period"`
	Amplitude  float64       `json:"amplitude"`
	Phase      float64       `json:"phase"`
	Confidence float64       `json:"confidence"`
	Examples   []time.Time   `json:"examples"`
}

SeasonalPattern represents recurring patterns

type SeasonalSummary

type SeasonalSummary struct {
	Pattern        string `json:"pattern"`
	Description    string `json:"description"`
	Impact         string `json:"impact"`
	Recommendation string `json:"recommendation"`
}

type SeasonalTrendDetector

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

SeasonalTrendDetector detects seasonal patterns

func (*SeasonalTrendDetector) DetectTrend

func (std *SeasonalTrendDetector) DetectTrend(ctx context.Context, data []DataPoint) (*TrendResult, error)

func (*SeasonalTrendDetector) GetConfidenceLevel

func (std *SeasonalTrendDetector) GetConfidenceLevel() float64

func (*SeasonalTrendDetector) GetType

func (std *SeasonalTrendDetector) GetType() string

type SecurityAggregator

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

SecurityAggregator focuses on security-related metrics

func (*SecurityAggregator) Aggregate

func (sa *SecurityAggregator) Aggregate(ctx context.Context, metrics []Metric, window TimeWindow) (AggregatedMetric, error)

func (*SecurityAggregator) GetWindowSizes

func (sa *SecurityAggregator) GetWindowSizes() []time.Duration

func (*SecurityAggregator) Reset

func (sa *SecurityAggregator) Reset()

type SecurityImprovement

type SecurityImprovement struct {
	Area        string `json:"area"`
	Improvement string `json:"improvement"`
	Impact      string `json:"impact"`
}

type SecurityPostureReport

type SecurityPostureReport struct {
	OverallScore       float64                 `json:"overall_score"`
	VulnerabilityStats VulnerabilityStatistics `json:"vulnerability_stats"`
	ThreatLandscape    ThreatLandscapeReport   `json:"threat_landscape"`
	ComplianceStatus   ComplianceStatusReport  `json:"compliance_status"`
	IncidentSummary    IncidentSummaryReport   `json:"incident_summary"`
	Improvements       []SecurityImprovement   `json:"improvements"`
}

SecurityPostureReport summarizes security status

type SimpleAuditLogger

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

SimpleAuditLogger is a basic implementation of the AuditLogger interface

func NewSimpleAuditLogger

func NewSimpleAuditLogger(logger Logger) *SimpleAuditLogger

func (*SimpleAuditLogger) LogAuditEvent

func (sal *SimpleAuditLogger) LogAuditEvent(ctx context.Context, event AuditEvent) error

type SimpleComplianceValidator

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

SimpleComplianceValidator is a basic implementation of the ComplianceValidator interface

func NewSimpleComplianceValidator

func NewSimpleComplianceValidator(logger Logger) *SimpleComplianceValidator

func (*SimpleComplianceValidator) ValidateCompliance

func (scv *SimpleComplianceValidator) ValidateCompliance(ctx context.Context, scanID string, metrics []Metric, regulations []string) error

type SimpleNotifier

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

SimpleNotifier is a basic implementation of the Notifier interface

func NewSimpleNotifier

func NewSimpleNotifier(logger Logger) *SimpleNotifier

func (*SimpleNotifier) SendNotification

func (sn *SimpleNotifier) SendNotification(ctx context.Context, message string, severity string) error

type SimpleQualityValidator

type SimpleQualityValidator struct{}

SimpleQualityValidator is a basic implementation of the QualityValidator interface

func NewSimpleQualityValidator

func NewSimpleQualityValidator() *SimpleQualityValidator

func (*SimpleQualityValidator) ValidateQuality

func (sqv *SimpleQualityValidator) ValidateQuality(ctx context.Context, metrics []Metric) []ValidationIssue

type SplunkExporter

type SplunkExporter struct{}

SplunkExporter exports data in Splunk format

func (*SplunkExporter) Export

func (se *SplunkExporter) Export(ctx context.Context, data interface{}, writer io.Writer) error

func (*SplunkExporter) GetContentType

func (se *SplunkExporter) GetContentType() string

func (*SplunkExporter) GetFormat

func (se *SplunkExporter) GetFormat() ExportFormat

func (*SplunkExporter) Validate

func (se *SplunkExporter) Validate(data interface{}) error

type SplunkIntegration

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

SplunkIntegration sends data to Splunk

func (*SplunkIntegration) GetEndpoint

func (si *SplunkIntegration) GetEndpoint() string

func (*SplunkIntegration) GetName

func (si *SplunkIntegration) GetName() string

func (*SplunkIntegration) IsEnabled

func (si *SplunkIntegration) IsEnabled() bool

func (*SplunkIntegration) Send

func (si *SplunkIntegration) Send(ctx context.Context, data interface{}) error

func (*SplunkIntegration) Validate

func (si *SplunkIntegration) Validate() error

type StorageStats

type StorageStats struct {
	TotalSize      int64 `json:"total_size"`
	TotalRecords   int64 `json:"total_records"`
	CompressedSize int64 `json:"compressed_size,omitempty"`
	IndexSize      int64 `json:"index_size,omitempty"`
}

StorageStats represents storage statistics

type StorageType

type StorageType string

StorageType represents different storage backends

const (
	StorageTypeMemory     StorageType = "memory"
	StorageTypeSQLite     StorageType = "sqlite"
	StorageTypePostgreSQL StorageType = "postgresql"
	StorageTypeMySQL      StorageType = "mysql"
	StorageTypeInfluxDB   StorageType = "influxdb"
)

type SystemHealthReport

type SystemHealthReport struct {
	OverallHealth float64 `json:"overall_health"`
	Uptime        float64 `json:"uptime"`
	ErrorRate     float64 `json:"error_rate"`
}

type SystemMetrics

type SystemMetrics struct {
	CPUUsage     float64
	MemoryUsage  int64
	DiskUsage    int64
	NetworkIO    NetworkStats
	ProcessCount int
	ThreadCount  int
	LastUpdated  time.Time
	// contains filtered or unexported fields
}

SystemMetrics tracks system-level performance metrics

type TableData

type TableData struct {
	Headers []string        `json:"headers"`
	Rows    [][]interface{} `json:"rows"`
}

type TableWidget

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

TableWidget displays data in tabular format

func (*TableWidget) GetData

func (tw *TableWidget) GetData(ctx context.Context, config DataSourceConfig) (interface{}, error)

func (*TableWidget) GetMetadata

func (tw *TableWidget) GetMetadata() WidgetMetadata

func (*TableWidget) GetType

func (tw *TableWidget) GetType() WidgetType

func (*TableWidget) Render

func (tw *TableWidget) Render(data interface{}, style WidgetStyle) (string, error)

func (*TableWidget) Validate

func (tw *TableWidget) Validate(config map[string]interface{}) error

type TargetSummary

type TargetSummary struct {
	Target    string    `json:"target"`
	ScanCount int       `json:"scan_count"`
	VulnCount int       `json:"vuln_count"`
	LastScan  time.Time `json:"last_scan"`
	RiskScore float64   `json:"risk_score"`
}

TargetSummary represents a target summary

type TextWidget

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

TextWidget displays static text content

func (*TextWidget) GetData

func (tw *TextWidget) GetData(ctx context.Context, config DataSourceConfig) (interface{}, error)

func (*TextWidget) GetMetadata

func (tw *TextWidget) GetMetadata() WidgetMetadata

func (*TextWidget) GetType

func (tw *TextWidget) GetType() WidgetType

func (*TextWidget) Render

func (tw *TextWidget) Render(data interface{}, style WidgetStyle) (string, error)

func (*TextWidget) Validate

func (tw *TextWidget) Validate(config map[string]interface{}) error

type Theme

type Theme struct {
	ID         string                 `json:"id"`
	Name       string                 `json:"name"`
	Colors     ColorScheme            `json:"colors"`
	Fonts      FontConfig             `json:"fonts"`
	Layout     ThemeLayoutConfig      `json:"layout"`
	Components map[string]interface{} `json:"components"`
}

Theme defines dashboard theming

type ThemeLayoutConfig

type ThemeLayoutConfig struct {
	Spacing    int `json:"spacing"`
	Padding    int `json:"padding"`
	Margin     int `json:"margin"`
	GridGutter int `json:"grid_gutter"`
}

ThemeLayoutConfig defines theme layout settings

type ThreatLandscapeReport

type ThreatLandscapeReport struct {
	EmergingThreats  int      `json:"emerging_threats"`
	ActiveCampaigns  int      `json:"active_campaigns"`
	BlockedAttempts  int      `json:"blocked_attempts"`
	ThreatCategories []string `json:"threat_categories"`
}

type TimeRange

type TimeRange struct {
	Start time.Time `json:"start"`
	End   time.Time `json:"end"`
}

TimeRange represents a time period for analytics queries

func (TimeRange) Contains

func (tr TimeRange) Contains(t time.Time) bool

Contains checks if a time is within the range

func (TimeRange) Duration

func (tr TimeRange) Duration() time.Duration

Duration returns the duration of the time range

func (TimeRange) Validate

func (tr TimeRange) Validate() error

Validate validates a TimeRange

type TimeWindow

type TimeWindow struct {
	Start    time.Time     `json:"start"`
	End      time.Time     `json:"end"`
	Duration time.Duration `json:"duration"`
}

TimeWindow represents a time window for analysis

type TimelineWidget

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

TimelineWidget displays events on a timeline

func (*TimelineWidget) GetData

func (tw *TimelineWidget) GetData(ctx context.Context, config DataSourceConfig) (interface{}, error)

func (*TimelineWidget) GetMetadata

func (tw *TimelineWidget) GetMetadata() WidgetMetadata

func (*TimelineWidget) GetType

func (tw *TimelineWidget) GetType() WidgetType

func (*TimelineWidget) Render

func (tw *TimelineWidget) Render(data interface{}, style WidgetStyle) (string, error)

func (*TimelineWidget) Validate

func (tw *TimelineWidget) Validate(config map[string]interface{}) error

type Trend

type Trend struct {
	Metric     string      `json:"metric"`
	Direction  string      `json:"direction"` // increasing, decreasing, stable
	Strength   float64     `json:"strength"`  // 0-1, how strong the trend is
	Change     float64     `json:"change"`    // percentage change
	DataPoints []DataPoint `json:"data_points"`
	RSquared   float64     `json:"r_squared"` // correlation coefficient
	Slope      float64     `json:"slope"`
	Confidence float64     `json:"confidence"`
}

Trend represents a single metric trend

type TrendAnalysis

type TrendAnalysis struct {
	Params      *TrendParams    `json:"params"`
	Trends      []Trend         `json:"trends"`
	Summary     TrendSummary    `json:"summary"`
	Forecast    []ForecastPoint `json:"forecast,omitempty"`
	Anomalies   []Anomaly       `json:"anomalies"`
	GeneratedAt time.Time       `json:"generated_at"`
}

TrendAnalysis represents trend analysis results

type TrendAnalysisConfig

type TrendAnalysisConfig struct {
	LookbackDays            int     `json:"lookback_days"`
	AnalysisIntervalMinutes int     `json:"analysis_interval_minutes"`
	ConfidenceLevel         float64 `json:"confidence_level"`
	SignificanceLevel       float64 `json:"significance_level"`
}

TrendAnalysisConfig holds trend analysis specific configuration

type TrendAnalysisResult

type TrendAnalysisResult struct {
	MetricName       string              `json:"metric_name"`
	TimeRange        TimeWindow          `json:"time_range"`
	OverallTrend     *TrendResult        `json:"overall_trend"`
	SegmentTrends    []*TrendResult      `json:"segment_trends"`
	SeasonalPatterns []SeasonalPattern   `json:"seasonal_patterns"`
	Correlations     []CorrelationResult `json:"correlations"`
	Forecasts        []ForecastResult    `json:"forecasts"`
	Summary          TrendSummary        `json:"summary"`
	GeneratedAt      time.Time           `json:"generated_at"`
}

TrendAnalysisResult represents comprehensive trend analysis

type TrendAnalyzer

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

TrendAnalyzer analyzes patterns and trends in metrics data

func NewTrendAnalyzer

func NewTrendAnalyzer(config *Config, storage DataStorage, logger Logger) *TrendAnalyzer

NewTrendAnalyzer creates a new trend analyzer

func (*TrendAnalyzer) AnalyzeTrends

func (ta *TrendAnalyzer) AnalyzeTrends(ctx context.Context, metricName string, timeRange TimeWindow) (*TrendAnalysisResult, error)

AnalyzeTrends performs comprehensive trend analysis for a metric

func (*TrendAnalyzer) DetectAnomalies

func (ta *TrendAnalyzer) DetectAnomalies(ctx context.Context, metricName string, timeRange TimeWindow) ([]AnomalyPoint, error)

DetectAnomalies identifies anomalous patterns in metrics

func (*TrendAnalyzer) GetTrendSummary

func (ta *TrendAnalyzer) GetTrendSummary(ctx context.Context, metricNames []string, timeRange TimeWindow) (map[string]*TrendSummary, error)

GetTrendSummary returns a summary of trends for multiple metrics

func (*TrendAnalyzer) PredictFuture

func (ta *TrendAnalyzer) PredictFuture(ctx context.Context, metricName string, hoursAhead int) ([]PredictionPoint, error)

PredictFuture generates predictions for future values

func (*TrendAnalyzer) RegisterDetector

func (ta *TrendAnalyzer) RegisterDetector(name string, detector TrendDetector)

RegisterDetector adds a custom trend detector

type TrendDetector

type TrendDetector interface {
	DetectTrend(ctx context.Context, data []DataPoint) (*TrendResult, error)
	GetType() string
	GetConfidenceLevel() float64
}

TrendDetector interface for different trend detection algorithms

type TrendDirection

type TrendDirection string

TrendDirection represents trend direction

const (
	TrendDirectionUp          TrendDirection = "up"
	TrendDirectionDown        TrendDirection = "down"
	TrendDirectionFlat        TrendDirection = "flat"
	TrendDirectionOscillating TrendDirection = "oscillating"
)

type TrendParams

type TrendParams struct {
	TimeRange    TimeRange `json:"time_range"`
	Metrics      []string  `json:"metrics"`
	Granularity  string    `json:"granularity"` // hour, day, week, month
	Smoothing    bool      `json:"smoothing"`
	ForecastDays int       `json:"forecast_days"`
}

TrendParams represents parameters for trend analysis

type TrendResult

type TrendResult struct {
	TrendType   TrendType              `json:"trend_type"`
	Direction   TrendDirection         `json:"direction"`
	Strength    float64                `json:"strength"`
	Confidence  float64                `json:"confidence"`
	Slope       float64                `json:"slope"`
	RSquared    float64                `json:"r_squared"`
	StartTime   time.Time              `json:"start_time"`
	EndTime     time.Time              `json:"end_time"`
	DataPoints  int                    `json:"data_points"`
	Predictions []PredictionPoint      `json:"predictions"`
	Anomalies   []AnomalyPoint         `json:"anomalies"`
	Metadata    map[string]interface{} `json:"metadata"`
}

TrendResult contains the result of trend analysis

type TrendSummary

type TrendSummary struct {
	OverallDirection string  `json:"overall_direction"`
	StrongestTrend   string  `json:"strongest_trend"`
	WeakestTrend     string  `json:"weakest_trend"`
	AverageChange    float64 `json:"average_change"`
	Volatility       float64 `json:"volatility"`
}

TrendSummary represents overall trend summary

type TrendType

type TrendType string

TrendType represents different types of trends

const (
	TrendTypeLinear      TrendType = "linear"
	TrendTypeExponential TrendType = "exponential"
	TrendTypeSeasonal    TrendType = "seasonal"
	TrendTypeCyclic      TrendType = "cyclic"
	TrendTypeVolatile    TrendType = "volatile"
	TrendTypeStable      TrendType = "stable"
	TrendTypeAnomalous   TrendType = "anomalous"
)

type TrendsReport

type TrendsReport struct {
	SignificantTrends []TrendSummary    `json:"significant_trends"`
	Forecasts         []ForecastSummary `json:"forecasts"`
	Anomalies         AnomalySummary    `json:"anomalies"`
	SeasonalPatterns  []SeasonalSummary `json:"seasonal_patterns"`
}

TrendsReport analyzes trends and patterns

type UpdateType

type UpdateType string

UpdateType represents different update types

const (
	UpdateTypeData   UpdateType = "data"
	UpdateTypeConfig UpdateType = "config"
	UpdateTypeStyle  UpdateType = "style"
	UpdateTypeLayout UpdateType = "layout"
	UpdateTypeWidget UpdateType = "widget"
)

type ValidationIssue

type ValidationIssue struct {
	MetricID   string `json:"metric_id"`
	Issue      string `json:"issue"`
	Severity   string `json:"severity"`
	Suggestion string `json:"suggestion"`
}

type ValidationProcessor

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

ValidationProcessor validates metrics before storage

func (*ValidationProcessor) GetType

func (vp *ValidationProcessor) GetType() string

func (*ValidationProcessor) IsEnabled

func (vp *ValidationProcessor) IsEnabled() bool

func (*ValidationProcessor) Process

func (vp *ValidationProcessor) Process(ctx context.Context, metric Metric) (Metric, error)

type VulnSummary

type VulnSummary struct {
	Type       string  `json:"type"`
	Count      int     `json:"count"`
	Severity   string  `json:"severity"`
	Percentage float64 `json:"percentage"`
	Trend      string  `json:"trend"`
}

VulnSummary represents a vulnerability summary

type Vulnerability

type Vulnerability struct {
	ID          string            `json:"id"`
	Type        string            `json:"type"`
	Severity    string            `json:"severity"`
	Category    string            `json:"category"`
	Template    string            `json:"template"`
	Description string            `json:"description"`
	Confidence  float64           `json:"confidence"`
	CVSS        float64           `json:"cvss,omitempty"`
	CWE         string            `json:"cwe,omitempty"`
	OWASP       string            `json:"owasp,omitempty"`
	Evidence    map[string]string `json:"evidence"`
	Remediation string            `json:"remediation,omitempty"`
}

Vulnerability represents a discovered vulnerability

type VulnerabilityStatistics

type VulnerabilityStatistics struct {
	Critical int `json:"critical"`
	High     int `json:"high"`
	Medium   int `json:"medium"`
	Low      int `json:"low"`
	Total    int `json:"total"`
}

Additional supporting types with mock data structures

type WebhookIntegration

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

WebhookIntegration sends data to a webhook endpoint

func (*WebhookIntegration) GetEndpoint

func (wi *WebhookIntegration) GetEndpoint() string

func (*WebhookIntegration) GetName

func (wi *WebhookIntegration) GetName() string

func (*WebhookIntegration) IsEnabled

func (wi *WebhookIntegration) IsEnabled() bool

func (*WebhookIntegration) Send

func (wi *WebhookIntegration) Send(ctx context.Context, data interface{}) error

func (*WebhookIntegration) Validate

func (wi *WebhookIntegration) Validate() error

type Widget

type Widget interface {
	GetType() WidgetType
	GetData(ctx context.Context, config DataSourceConfig) (interface{}, error)
	Render(data interface{}, style WidgetStyle) (string, error)
	Validate(config map[string]interface{}) error
	GetMetadata() WidgetMetadata
}

Widget interface for all dashboard widgets

type WidgetConfig

type WidgetConfig struct {
	ID         string                 `json:"id"`
	Type       WidgetType             `json:"type"`
	Title      string                 `json:"title"`
	Position   WidgetPosition         `json:"position"`
	Size       WidgetSize             `json:"size"`
	Config     map[string]interface{} `json:"config"`
	DataSource DataSourceConfig       `json:"data_source"`
	Style      WidgetStyle            `json:"style"`
}

WidgetConfig defines widget configuration within a dashboard

type WidgetMetadata

type WidgetMetadata struct {
	Name        string     `json:"name"`
	Description string     `json:"description"`
	Version     string     `json:"version"`
	Author      string     `json:"author"`
	Tags        []string   `json:"tags"`
	MinSize     WidgetSize `json:"min_size"`
	MaxSize     WidgetSize `json:"max_size"`
}

WidgetMetadata contains widget metadata

type WidgetPosition

type WidgetPosition struct {
	X int `json:"x"`
	Y int `json:"y"`
}

WidgetPosition defines widget position in layout

type WidgetSize

type WidgetSize struct {
	Width  int `json:"width"`
	Height int `json:"height"`
}

WidgetSize defines widget dimensions

type WidgetStyle

type WidgetStyle struct {
	Colors     ColorScheme            `json:"colors"`
	Fonts      FontConfig             `json:"fonts"`
	Borders    BorderConfig           `json:"borders"`
	Background BackgroundConfig       `json:"background"`
	Custom     map[string]interface{} `json:"custom"`
}

WidgetStyle defines widget styling

type WidgetType

type WidgetType string

WidgetType represents different widget types

const (
	WidgetTypeChart    WidgetType = "chart"
	WidgetTypeTable    WidgetType = "table"
	WidgetTypeMetric   WidgetType = "metric"
	WidgetTypeGauge    WidgetType = "gauge"
	WidgetTypeHeatmap  WidgetType = "heatmap"
	WidgetTypeTimeline WidgetType = "timeline"
	WidgetTypeAlert    WidgetType = "alert"
	WidgetTypeProgress WidgetType = "progress"
	WidgetTypeText     WidgetType = "text"
	WidgetTypeIframe   WidgetType = "iframe"
)

Jump to

Keyboard shortcuts

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