Documentation
¶
Overview ¶
Package monitoring provides performance monitoring and metrics collection for DataFrame operations.
Index ¶
- func ClearGlobalMetrics()
- func DisableGlobalMonitoring()
- func EnableGlobalMonitoring()
- func IsGlobalMonitoringEnabled() bool
- func RecordGlobalOperation(operation string, fn func() error) error
- func SetGlobalCollector(collector *MetricsCollector)
- type BenchmarkResult
- type BenchmarkScenario
- type BenchmarkSuite
- func (bs *BenchmarkSuite) AddQuickScenario(name, description string, operation func() error)
- func (bs *BenchmarkSuite) AddScenario(scenario BenchmarkScenario)
- func (bs *BenchmarkSuite) Clear()
- func (bs *BenchmarkSuite) GenerateReport() string
- func (bs *BenchmarkSuite) GetResults() []BenchmarkResult
- func (bs *BenchmarkSuite) Run() []BenchmarkResult
- type MetricsCollector
- func (mc *MetricsCollector) Clear()
- func (mc *MetricsCollector) GetMetrics() []OperationMetrics
- func (mc *MetricsCollector) GetSummary() MetricsSummary
- func (mc *MetricsCollector) IsEnabled() bool
- func (mc *MetricsCollector) RecordOperation(operation string, fn func() error) error
- func (mc *MetricsCollector) SetEnabled(enabled bool)
- type MetricsSummary
- type OperationMetrics
- type PlanBuilder
- func (pb *PlanBuilder) AddOperation(opType, description string, cost int64) *PlanBuilder
- func (pb *PlanBuilder) AddOperationWithChildren(opType, description string, cost int64, children []PlanNode) *PlanBuilder
- func (pb *PlanBuilder) Build() QueryPlan
- func (pb *PlanBuilder) SetActual(metrics PlanMetrics) *PlanBuilder
- func (pb *PlanBuilder) SetEstimated(metrics PlanMetrics) *PlanBuilder
- type PlanMetrics
- type PlanNode
- type QueryPlan
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearGlobalMetrics ¶
func ClearGlobalMetrics()
ClearGlobalMetrics clears all metrics from the global collector.
func DisableGlobalMonitoring ¶
func DisableGlobalMonitoring()
DisableGlobalMonitoring disables the global metrics collector.
func EnableGlobalMonitoring ¶
func EnableGlobalMonitoring()
EnableGlobalMonitoring creates and sets a global metrics collector.
func IsGlobalMonitoringEnabled ¶
func IsGlobalMonitoringEnabled() bool
IsGlobalMonitoringEnabled returns true if global monitoring is enabled.
func RecordGlobalOperation ¶
RecordGlobalOperation records an operation using the global collector. If no global collector is set, the operation is executed without recording metrics.
func SetGlobalCollector ¶
func SetGlobalCollector(collector *MetricsCollector)
SetGlobalCollector sets the global metrics collector.
Types ¶
type BenchmarkResult ¶
type BenchmarkResult struct {
Scenario BenchmarkScenario `json:"scenario"`
Duration time.Duration `json:"duration"`
AverageDuration time.Duration `json:"average_duration"`
MinDuration time.Duration `json:"min_duration"`
MaxDuration time.Duration `json:"max_duration"`
MemoryAllocated int64 `json:"memory_allocated"`
MemoryAllocations int64 `json:"memory_allocations"`
OperationsPerSec float64 `json:"operations_per_sec"`
Success bool `json:"success"`
ErrorMessage string `json:"error_message,omitempty"`
}
BenchmarkResult contains the results of running a benchmark scenario.
type BenchmarkScenario ¶
type BenchmarkScenario struct {
Name string
Description string
DataSize int
Operation func() error
Iterations int
Parallel bool
}
BenchmarkScenario represents a single performance benchmark scenario.
type BenchmarkSuite ¶
type BenchmarkSuite struct {
// contains filtered or unexported fields
}
BenchmarkSuite manages and executes a collection of benchmark scenarios.
func NewBenchmarkSuite ¶
func NewBenchmarkSuite() *BenchmarkSuite
NewBenchmarkSuite creates a new benchmark suite.
func (*BenchmarkSuite) AddQuickScenario ¶
func (bs *BenchmarkSuite) AddQuickScenario(name, description string, operation func() error)
AddQuickScenario adds a simple benchmark scenario with default parameters.
func (*BenchmarkSuite) AddScenario ¶
func (bs *BenchmarkSuite) AddScenario(scenario BenchmarkScenario)
AddScenario adds a benchmark scenario to the suite.
func (*BenchmarkSuite) Clear ¶
func (bs *BenchmarkSuite) Clear()
Clear removes all scenarios and results from the suite.
func (*BenchmarkSuite) GenerateReport ¶
func (bs *BenchmarkSuite) GenerateReport() string
func (*BenchmarkSuite) GetResults ¶
func (bs *BenchmarkSuite) GetResults() []BenchmarkResult
GetResults returns the benchmark results.
func (*BenchmarkSuite) Run ¶
func (bs *BenchmarkSuite) Run() []BenchmarkResult
Run executes all benchmark scenarios and returns the results.
type MetricsCollector ¶
type MetricsCollector struct {
// contains filtered or unexported fields
}
MetricsCollector collects and stores performance metrics for DataFrame operations.
func GetGlobalCollector ¶
func GetGlobalCollector() *MetricsCollector
GetGlobalCollector returns the global metrics collector. Returns nil if no global collector has been set.
func NewMetricsCollector ¶
func NewMetricsCollector(enabled bool) *MetricsCollector
NewMetricsCollector creates a new metrics collector.
func (*MetricsCollector) Clear ¶
func (mc *MetricsCollector) Clear()
Clear removes all collected metrics.
func (*MetricsCollector) GetMetrics ¶
func (mc *MetricsCollector) GetMetrics() []OperationMetrics
GetMetrics returns a copy of all collected metrics.
func (*MetricsCollector) GetSummary ¶
func (mc *MetricsCollector) GetSummary() MetricsSummary
GetSummary returns a summary of collected metrics.
func (*MetricsCollector) IsEnabled ¶
func (mc *MetricsCollector) IsEnabled() bool
IsEnabled returns whether metrics collection is enabled.
func (*MetricsCollector) RecordOperation ¶
func (mc *MetricsCollector) RecordOperation(operation string, fn func() error) error
RecordOperation executes the given function and records performance metrics.
func (*MetricsCollector) SetEnabled ¶
func (mc *MetricsCollector) SetEnabled(enabled bool)
SetEnabled enables or disables metrics collection.
type MetricsSummary ¶
type MetricsSummary struct {
TotalOperations int `json:"total_operations"`
TotalDuration time.Duration `json:"total_duration"`
TotalMemory int64 `json:"total_memory"`
TotalRows int64 `json:"total_rows"`
OperationCounts map[string]int `json:"operation_counts"`
AverageDuration time.Duration `json:"average_duration"`
}
MetricsSummary provides aggregate statistics for collected metrics.
func GetGlobalSummary ¶
func GetGlobalSummary() MetricsSummary
GetGlobalSummary returns a summary from the global collector.
type OperationMetrics ¶
type OperationMetrics struct {
Duration time.Duration `json:"duration"`
RowsProcessed int64 `json:"rows_processed"`
MemoryUsed int64 `json:"memory_used"`
CPUTime time.Duration `json:"cpu_time"`
Operation string `json:"operation"`
Parallel bool `json:"parallel"`
}
OperationMetrics represents performance metrics for a single DataFrame operation.
func GetGlobalMetrics ¶
func GetGlobalMetrics() []OperationMetrics
GetGlobalMetrics returns metrics from the global collector.
type PlanBuilder ¶
type PlanBuilder struct {
// contains filtered or unexported fields
}
PlanBuilder helps construct query execution plans.
func (*PlanBuilder) AddOperation ¶
func (pb *PlanBuilder) AddOperation(opType, description string, cost int64) *PlanBuilder
AddOperation adds an operation to the query plan.
func (*PlanBuilder) AddOperationWithChildren ¶
func (pb *PlanBuilder) AddOperationWithChildren(opType, description string, cost int64, children []PlanNode) *PlanBuilder
AddOperationWithChildren adds an operation with child operations.
func (*PlanBuilder) Build ¶
func (pb *PlanBuilder) Build() QueryPlan
Build constructs and returns the final query plan.
func (*PlanBuilder) SetActual ¶
func (pb *PlanBuilder) SetActual(metrics PlanMetrics) *PlanBuilder
SetActual sets the actual metrics for the query plan.
func (*PlanBuilder) SetEstimated ¶
func (pb *PlanBuilder) SetEstimated(metrics PlanMetrics) *PlanBuilder
SetEstimated sets the estimated metrics for the query plan.
type PlanMetrics ¶
type PlanMetrics struct {
TotalCost int64 `json:"total_cost"`
RowsProcessed int64 `json:"rows_processed"`
MemoryUsed int64 `json:"memory_used"`
}
PlanMetrics contains performance metrics for a query plan.
type PlanNode ¶
type PlanNode struct {
Type string `json:"type"`
Description string `json:"description"`
Children []PlanNode `json:"children,omitempty"`
Cost int64 `json:"cost"`
}
PlanNode represents a single operation in a query execution plan.
type QueryPlan ¶
type QueryPlan struct {
Operations []PlanNode `json:"operations"`
Estimated PlanMetrics `json:"estimated"`
Actual PlanMetrics `json:"actual,omitempty"`
}
QueryPlan represents a complete query execution plan with metrics.
func (*QueryPlan) CalculateTotalCost ¶
CalculateTotalCost calculates the total cost of all operations in the plan.
func (*QueryPlan) GetOperationCount ¶
GetOperationCount returns the total number of operations in the plan.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server provides HTTP endpoints for monitoring DataFrame operations.
func NewMonitoringServer ¶
func NewMonitoringServer(collector *MetricsCollector, port int) *Server
NewMonitoringServer creates a new monitoring server.