Documentation
¶
Index ¶
- func Counter(name string, value float64, labels map[string]string)
- func Gauge(name string, value float64, labels map[string]string)
- func Histogram(name string, value float64, labels map[string]string)
- func Timer(name string, labels map[string]string) func()
- type CloudWatchExporter
- type Collector
- func (c *Collector) AddExporter(exporter Exporter)
- func (c *Collector) Counter(name string, value float64, labels map[string]string)
- func (c *Collector) Gauge(name string, value float64, labels map[string]string)
- func (c *Collector) Histogram(name string, value float64, labels map[string]string)
- func (c *Collector) Stop()
- func (c *Collector) Summary(name string, value float64, labels map[string]string)
- func (c *Collector) Timer(name string, labels map[string]string) func()
- type DatadogExporter
- type Exporter
- type HTTPClient
- type HistogramMetric
- type Metric
- type MetricType
- type MetricsTracker
- func (mt *MetricsTracker) DecrementActiveDetections()
- func (mt *MetricsTracker) GetAPIMetrics() (requests, errors, avgLatencyMs int64)
- func (mt *MetricsTracker) GetActiveDetections() int64
- func (mt *MetricsTracker) GetAllMetrics() map[string]interface{}
- func (mt *MetricsTracker) GetCacheEvictions() int64
- func (mt *MetricsTracker) GetCacheHits() int64
- func (mt *MetricsTracker) GetCacheMisses() int64
- func (mt *MetricsTracker) GetCompletedDetections() int64
- func (mt *MetricsTracker) GetDiscoveryMetrics() (runs, errors, resources int64, lastRun *time.Time)
- func (mt *MetricsTracker) GetFailedDetections() int64
- func (mt *MetricsTracker) GetMessagesQueued() int64
- func (mt *MetricsTracker) GetMessagesReceived() int64
- func (mt *MetricsTracker) GetMessagesSent() int64
- func (mt *MetricsTracker) GetRemediationMetrics() (runs, success, failures int64)
- func (mt *MetricsTracker) IncrementActiveDetections()
- func (mt *MetricsTracker) IncrementCacheEviction()
- func (mt *MetricsTracker) IncrementCacheHit()
- func (mt *MetricsTracker) IncrementCacheMiss()
- func (mt *MetricsTracker) IncrementCompletedDetections()
- func (mt *MetricsTracker) IncrementFailedDetections()
- func (mt *MetricsTracker) IncrementMessagesReceived()
- func (mt *MetricsTracker) IncrementMessagesSent()
- func (mt *MetricsTracker) RecordAPIRequest(latencyMs int64, isError bool)
- func (mt *MetricsTracker) RecordDiscoveryRun(resourcesFound int, isError bool)
- func (mt *MetricsTracker) RecordRemediationRun(success bool)
- func (mt *MetricsTracker) Reset()
- func (mt *MetricsTracker) SetMessagesQueued(count int64)
- type PrometheusExporter
- type RateLimitMetrics
- type ResourceMetrics
- func (r *ResourceMetrics) RecordAPICall(operation string, success bool, duration time.Duration)
- func (r *ResourceMetrics) RecordDiscovery(resourceType string, count int, duration time.Duration)
- func (r *ResourceMetrics) RecordDrift(resourceType string, driftCount int, duration time.Duration)
- func (r *ResourceMetrics) RecordRemediation(resourceType string, success bool, duration time.Duration)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CloudWatchExporter ¶
type CloudWatchExporter struct {
// contains filtered or unexported fields
}
CloudWatchExporter exports metrics to AWS CloudWatch
func (*CloudWatchExporter) Export ¶
func (c *CloudWatchExporter) Export(ctx context.Context, metrics []*Metric) error
func (*CloudWatchExporter) Name ¶
func (c *CloudWatchExporter) Name() string
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector collects and aggregates metrics
func GetGlobalCollector ¶
func GetGlobalCollector() *Collector
GetGlobalCollector returns the global metrics collector
func NewCollector ¶
NewCollector creates a new metrics collector
func (*Collector) AddExporter ¶
AddExporter adds a metric exporter
type DatadogExporter ¶
type DatadogExporter struct {
// contains filtered or unexported fields
}
DatadogExporter exports metrics to Datadog
func (*DatadogExporter) Export ¶
func (d *DatadogExporter) Export(ctx context.Context, metrics []*Metric) error
func (*DatadogExporter) Name ¶
func (d *DatadogExporter) Name() string
type HTTPClient ¶
type HistogramMetric ¶ added in v1.1.0
type HistogramMetric struct {
// contains filtered or unexported fields
}
HistogramMetric provides histogram functionality
func NewHistogramMetric ¶ added in v1.1.0
func NewHistogramMetric() *HistogramMetric
NewHistogramMetric creates a new histogram metric
func (*HistogramMetric) Percentile ¶ added in v1.1.0
func (h *HistogramMetric) Percentile(p float64) float64
Percentile calculates a percentile
func (*HistogramMetric) Record ¶ added in v1.1.0
func (h *HistogramMetric) Record(value float64)
Record records a value
type Metric ¶
type Metric struct {
Name string `json:"name"`
Type MetricType `json:"type"`
Value float64 `json:"value"`
Labels map[string]string `json:"labels,omitempty"`
Timestamp time.Time `json:"timestamp"`
Description string `json:"description,omitempty"`
Unit string `json:"unit,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
Metric represents a single metric
type MetricType ¶
type MetricType string
MetricType represents the type of metric
const ( MetricTypeCounter MetricType = "counter" MetricTypeGauge MetricType = "gauge" MetricTypeHistogram MetricType = "histogram" MetricTypeSummary MetricType = "summary" )
type MetricsTracker ¶
type MetricsTracker struct {
// contains filtered or unexported fields
}
MetricsTracker tracks various application metrics
func GetGlobalTracker ¶
func GetGlobalTracker() *MetricsTracker
GetGlobalTracker returns the global metrics tracker instance
func (*MetricsTracker) DecrementActiveDetections ¶
func (mt *MetricsTracker) DecrementActiveDetections()
DecrementActiveDetections decrements the active detections counter
func (*MetricsTracker) GetAPIMetrics ¶
func (mt *MetricsTracker) GetAPIMetrics() (requests, errors, avgLatencyMs int64)
GetAPIMetrics returns API metrics
func (*MetricsTracker) GetActiveDetections ¶
func (mt *MetricsTracker) GetActiveDetections() int64
GetActiveDetections returns the current number of active detections
func (*MetricsTracker) GetAllMetrics ¶
func (mt *MetricsTracker) GetAllMetrics() map[string]interface{}
GetAllMetrics returns all metrics as a map
func (*MetricsTracker) GetCacheEvictions ¶
func (mt *MetricsTracker) GetCacheEvictions() int64
GetCacheEvictions returns the total number of cache evictions
func (*MetricsTracker) GetCacheHits ¶
func (mt *MetricsTracker) GetCacheHits() int64
GetCacheHits returns the total number of cache hits
func (*MetricsTracker) GetCacheMisses ¶
func (mt *MetricsTracker) GetCacheMisses() int64
GetCacheMisses returns the total number of cache misses
func (*MetricsTracker) GetCompletedDetections ¶
func (mt *MetricsTracker) GetCompletedDetections() int64
GetCompletedDetections returns the total number of completed detections
func (*MetricsTracker) GetDiscoveryMetrics ¶
func (mt *MetricsTracker) GetDiscoveryMetrics() (runs, errors, resources int64, lastRun *time.Time)
GetDiscoveryMetrics returns discovery metrics
func (*MetricsTracker) GetFailedDetections ¶
func (mt *MetricsTracker) GetFailedDetections() int64
GetFailedDetections returns the total number of failed detections
func (*MetricsTracker) GetMessagesQueued ¶
func (mt *MetricsTracker) GetMessagesQueued() int64
GetMessagesQueued returns the current number of queued messages
func (*MetricsTracker) GetMessagesReceived ¶
func (mt *MetricsTracker) GetMessagesReceived() int64
GetMessagesReceived returns the total number of messages received
func (*MetricsTracker) GetMessagesSent ¶
func (mt *MetricsTracker) GetMessagesSent() int64
GetMessagesSent returns the total number of messages sent
func (*MetricsTracker) GetRemediationMetrics ¶
func (mt *MetricsTracker) GetRemediationMetrics() (runs, success, failures int64)
GetRemediationMetrics returns remediation metrics
func (*MetricsTracker) IncrementActiveDetections ¶
func (mt *MetricsTracker) IncrementActiveDetections()
IncrementActiveDetections increments the active detections counter
func (*MetricsTracker) IncrementCacheEviction ¶
func (mt *MetricsTracker) IncrementCacheEviction()
IncrementCacheEviction increments the cache eviction counter
func (*MetricsTracker) IncrementCacheHit ¶
func (mt *MetricsTracker) IncrementCacheHit()
IncrementCacheHit increments the cache hit counter
func (*MetricsTracker) IncrementCacheMiss ¶
func (mt *MetricsTracker) IncrementCacheMiss()
IncrementCacheMiss increments the cache miss counter
func (*MetricsTracker) IncrementCompletedDetections ¶
func (mt *MetricsTracker) IncrementCompletedDetections()
IncrementCompletedDetections increments the completed detections counter
func (*MetricsTracker) IncrementFailedDetections ¶
func (mt *MetricsTracker) IncrementFailedDetections()
IncrementFailedDetections increments the failed detections counter
func (*MetricsTracker) IncrementMessagesReceived ¶
func (mt *MetricsTracker) IncrementMessagesReceived()
IncrementMessagesReceived increments the messages received counter
func (*MetricsTracker) IncrementMessagesSent ¶
func (mt *MetricsTracker) IncrementMessagesSent()
IncrementMessagesSent increments the messages sent counter
func (*MetricsTracker) RecordAPIRequest ¶
func (mt *MetricsTracker) RecordAPIRequest(latencyMs int64, isError bool)
RecordAPIRequest records an API request with latency
func (*MetricsTracker) RecordDiscoveryRun ¶
func (mt *MetricsTracker) RecordDiscoveryRun(resourcesFound int, isError bool)
RecordDiscoveryRun records a discovery run
func (*MetricsTracker) RecordRemediationRun ¶
func (mt *MetricsTracker) RecordRemediationRun(success bool)
RecordRemediationRun records a remediation run
func (*MetricsTracker) Reset ¶
func (mt *MetricsTracker) Reset()
Reset resets all metrics (useful for testing)
func (*MetricsTracker) SetMessagesQueued ¶
func (mt *MetricsTracker) SetMessagesQueued(count int64)
SetMessagesQueued sets the current number of queued messages
type PrometheusExporter ¶
type PrometheusExporter struct {
// contains filtered or unexported fields
}
PrometheusExporter exports metrics in Prometheus format
func NewPrometheusExporter ¶
func NewPrometheusExporter(endpoint string, client HTTPClient) *PrometheusExporter
NewPrometheusExporter creates a Prometheus exporter
func (*PrometheusExporter) Export ¶
func (p *PrometheusExporter) Export(ctx context.Context, metrics []*Metric) error
func (*PrometheusExporter) Name ¶
func (p *PrometheusExporter) Name() string
type RateLimitMetrics ¶
type RateLimitMetrics struct {
// contains filtered or unexported fields
}
RateLimitMetrics tracks rate limiting metrics
func (*RateLimitMetrics) GetStats ¶
func (r *RateLimitMetrics) GetStats() map[string]int64
GetStats returns rate limit statistics
func (*RateLimitMetrics) RecordRequest ¶
func (r *RateLimitMetrics) RecordRequest(allowed bool, throttled bool)
RecordRequest records a rate limit request
type ResourceMetrics ¶
type ResourceMetrics struct {
// contains filtered or unexported fields
}
ResourceMetrics tracks resource-specific metrics
func NewResourceMetrics ¶
func NewResourceMetrics(provider string) *ResourceMetrics
NewResourceMetrics creates resource-specific metrics
func (*ResourceMetrics) RecordAPICall ¶
func (r *ResourceMetrics) RecordAPICall(operation string, success bool, duration time.Duration)
RecordAPICall records API call metrics
func (*ResourceMetrics) RecordDiscovery ¶
func (r *ResourceMetrics) RecordDiscovery(resourceType string, count int, duration time.Duration)
RecordDiscovery records discovery metrics
func (*ResourceMetrics) RecordDrift ¶
func (r *ResourceMetrics) RecordDrift(resourceType string, driftCount int, duration time.Duration)
RecordDrift records drift detection metrics
func (*ResourceMetrics) RecordRemediation ¶
func (r *ResourceMetrics) RecordRemediation(resourceType string, success bool, duration time.Duration)
RecordRemediation records remediation metrics