monitoring

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: 4 Imported by: 0

Documentation

Overview

Package monitoring provides performance monitoring for template operations.

Index

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

func (m *PerformanceMonitor) GetMetricTrend(name string, duration time.Duration) (float64, bool)

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

Jump to

Keyboard shortcuts

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