Documentation
¶
Overview ¶
Package monitoring provides performance monitoring for template operations.
Index ¶
- type HistoryEntry
- type MonitorConfig
- type PerformanceMetric
- type PerformanceMonitor
- func (m *PerformanceMonitor) EnableAlerts(enable bool)
- func (m *PerformanceMonitor) GetMetric(name string) (*PerformanceMetric, bool)
- func (m *PerformanceMonitor) GetMetricAverage(name string) (float64, bool)
- func (m *PerformanceMonitor) GetMetricHistory(name string) ([]HistoryEntry, bool)
- func (m *PerformanceMonitor) GetMetricTrend(name string, duration time.Duration) (float64, bool)
- func (m *PerformanceMonitor) GetMetrics() map[string]*PerformanceMetric
- func (m *PerformanceMonitor) GetMetricsByTag(tag string, value string) map[string]*PerformanceMetric
- func (m *PerformanceMonitor) GetPerformanceSummary() map[string]interface{}
- func (m *PerformanceMonitor) GetReport() map[string]interface{}
- func (m *PerformanceMonitor) GetUptime() time.Duration
- func (m *PerformanceMonitor) RecordBenchmarkResult(result *benchmark.BenchmarkResult)
- func (m *PerformanceMonitor) RecordBenchmarkResults(results map[string]*benchmark.BenchmarkResult)
- func (m *PerformanceMonitor) RecordMetric(name string, value float64)
- func (m *PerformanceMonitor) RegisterMetric(name string, description string, unit string, tags map[string]string)
- func (m *PerformanceMonitor) RemoveMetric(name string) bool
- func (m *PerformanceMonitor) ResetAllMetrics()
- func (m *PerformanceMonitor) ResetMetric(name string) bool
- func (m *PerformanceMonitor) SetAlertThreshold(name string, threshold float64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HistoryEntry ¶
type HistoryEntry struct {
// Timestamp is the time the metric was recorded
Timestamp time.Time
// Value is the value of the metric
Value float64
}
HistoryEntry represents a historical metric value
type MonitorConfig ¶
type MonitorConfig struct {
// HistorySize is the number of historical values to keep
HistorySize int
// SamplingInterval is the interval at which to sample metrics
SamplingInterval time.Duration
// AlertThresholds is a map of metric name to alert threshold
AlertThresholds map[string]float64
// EnableAlerts enables or disables alerts
EnableAlerts bool
}
MonitorConfig contains configuration for the performance monitor
type PerformanceMetric ¶
type PerformanceMetric struct {
// Name is the name of the metric
Name string
// Description is the description of the metric
Description string
// Value is the current value of the metric
Value float64
// Count is the number of times the metric has been updated
Count int64
// Min is the minimum value of the metric
Min float64
// Max is the maximum value of the metric
Max float64
// Sum is the sum of all values of the metric
Sum float64
// LastUpdated is the time the metric was last updated
LastUpdated time.Time
// Unit is the unit of the metric
Unit string
// Tags are additional tags for the metric
Tags map[string]string
// History stores historical values for trending
History []HistoryEntry
}
PerformanceMetric represents a performance metric
type PerformanceMonitor ¶
type PerformanceMonitor struct {
// contains filtered or unexported fields
}
PerformanceMonitor tracks performance metrics for template operations
func NewPerformanceMonitor ¶
func NewPerformanceMonitor(config *MonitorConfig) *PerformanceMonitor
NewPerformanceMonitor creates a new performance monitor
func (*PerformanceMonitor) EnableAlerts ¶
func (m *PerformanceMonitor) EnableAlerts(enable bool)
EnableAlerts enables alerts
func (*PerformanceMonitor) GetMetric ¶
func (m *PerformanceMonitor) GetMetric(name string) (*PerformanceMetric, bool)
GetMetric gets a metric by name
func (*PerformanceMonitor) GetMetricAverage ¶
func (m *PerformanceMonitor) GetMetricAverage(name string) (float64, bool)
GetMetricAverage gets the average value of a metric
func (*PerformanceMonitor) GetMetricHistory ¶
func (m *PerformanceMonitor) GetMetricHistory(name string) ([]HistoryEntry, bool)
GetMetricHistory gets the history of a metric
func (*PerformanceMonitor) GetMetricTrend ¶
GetMetricTrend gets the trend of a metric over time
func (*PerformanceMonitor) GetMetrics ¶
func (m *PerformanceMonitor) GetMetrics() map[string]*PerformanceMetric
GetMetrics gets all metrics
func (*PerformanceMonitor) GetMetricsByTag ¶
func (m *PerformanceMonitor) GetMetricsByTag(tag string, value string) map[string]*PerformanceMetric
GetMetricsByTag gets metrics by tag
func (*PerformanceMonitor) GetPerformanceSummary ¶
func (m *PerformanceMonitor) GetPerformanceSummary() map[string]interface{}
GetPerformanceSummary gets a summary of performance metrics
func (*PerformanceMonitor) GetReport ¶
func (m *PerformanceMonitor) GetReport() map[string]interface{}
GetReport generates a performance report
func (*PerformanceMonitor) GetUptime ¶
func (m *PerformanceMonitor) GetUptime() time.Duration
GetUptime gets the uptime of the monitor
func (*PerformanceMonitor) RecordBenchmarkResult ¶
func (m *PerformanceMonitor) RecordBenchmarkResult(result *benchmark.BenchmarkResult)
RecordBenchmarkResult records a benchmark result as metrics
func (*PerformanceMonitor) RecordBenchmarkResults ¶
func (m *PerformanceMonitor) RecordBenchmarkResults(results map[string]*benchmark.BenchmarkResult)
RecordBenchmarkResults records multiple benchmark results
func (*PerformanceMonitor) RecordMetric ¶
func (m *PerformanceMonitor) RecordMetric(name string, value float64)
RecordMetric records a value for a metric
func (*PerformanceMonitor) RegisterMetric ¶
func (m *PerformanceMonitor) RegisterMetric(name string, description string, unit string, tags map[string]string)
RegisterMetric registers a new metric
func (*PerformanceMonitor) RemoveMetric ¶
func (m *PerformanceMonitor) RemoveMetric(name string) bool
RemoveMetric removes a metric
func (*PerformanceMonitor) ResetAllMetrics ¶
func (m *PerformanceMonitor) ResetAllMetrics()
ResetAllMetrics resets all metrics
func (*PerformanceMonitor) ResetMetric ¶
func (m *PerformanceMonitor) ResetMetric(name string) bool
ResetMetric resets a metric
func (*PerformanceMonitor) SetAlertThreshold ¶
func (m *PerformanceMonitor) SetAlertThreshold(name string, threshold float64)
SetAlertThreshold sets an alert threshold for a metric