Documentation
¶
Index ¶
- Constants
- type Alert
- type AlertRequest
- type AlertSeverity
- type ConnectionInfo
- type ConnectionStatus
- type HealthCheck
- type HealthCheckRequest
- type HealthCheckResponse
- type HealthStatus
- type LogEntry
- type LogLevel
- type LogRequest
- type Metric
- type MetricRequest
- type MetricType
- type MonitoringConfig
- type MonitoringError
- type MonitoringFeature
- type MonitoringStats
- type ProviderInfo
- type QueryRequest
- type QueryResponse
- type Span
- type Trace
- type TraceRequest
Constants ¶
const ( ErrCodeConnection = "CONNECTION_ERROR" ErrCodeTimeout = "TIMEOUT" ErrCodeInvalidMetric = "INVALID_METRIC" ErrCodeInvalidLog = "INVALID_LOG" ErrCodeInvalidTrace = "INVALID_TRACE" ErrCodeInvalidAlert = "INVALID_ALERT" ErrCodeSerialization = "SERIALIZATION_ERROR" ErrCodeDeserialization = "DESERIALIZATION_ERROR" ErrCodeQuota = "QUOTA_EXCEEDED" ErrCodeRateLimit = "RATE_LIMIT_EXCEEDED" ErrCodeNotFound = "NOT_FOUND" ErrCodeForbidden = "FORBIDDEN" )
Common monitoring error codes
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Severity AlertSeverity `json:"severity"`
Status string `json:"status"` // active, resolved, acknowledged
Source string `json:"source"`
Service string `json:"service"`
Timestamp time.Time `json:"timestamp"`
ResolvedAt *time.Time `json:"resolved_at,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
Alert represents an alert
type AlertRequest ¶
type AlertRequest struct {
Alerts []Alert `json:"alerts"`
Options map[string]interface{} `json:"options,omitempty"`
}
AlertRequest represents an alert submission request
type AlertSeverity ¶
type AlertSeverity string
AlertSeverity represents the severity of an alert
const ( AlertSeverityLow AlertSeverity = "low" AlertSeverityMedium AlertSeverity = "medium" AlertSeverityHigh AlertSeverity = "high" AlertSeverityCritical AlertSeverity = "critical" )
type ConnectionInfo ¶
type ConnectionInfo struct {
Host string `json:"host"`
Port int `json:"port"`
Protocol string `json:"protocol"`
Version string `json:"version"`
Secure bool `json:"secure"`
Status ConnectionStatus `json:"status"`
Metadata map[string]string `json:"metadata"`
}
ConnectionInfo represents monitoring provider connection information
type ConnectionStatus ¶
type ConnectionStatus string
ConnectionStatus represents the connection status
const ( StatusConnected ConnectionStatus = "connected" StatusDisconnected ConnectionStatus = "disconnected" StatusConnecting ConnectionStatus = "connecting" StatusError ConnectionStatus = "error" )
type HealthCheck ¶
type HealthCheck struct {
Name string `json:"name"`
Status HealthStatus `json:"status"`
Message string `json:"message,omitempty"`
Timestamp time.Time `json:"timestamp"`
Duration time.Duration `json:"duration,omitempty"`
Details map[string]interface{} `json:"details,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
HealthCheck represents a health check
type HealthCheckRequest ¶
type HealthCheckRequest struct {
Service string `json:"service"`
Timeout time.Duration `json:"timeout,omitempty"`
}
HealthCheckRequest represents a health check request
type HealthCheckResponse ¶
type HealthCheckResponse struct {
Service string `json:"service"`
Status HealthStatus `json:"status"`
Checks []HealthCheck `json:"checks"`
Timestamp time.Time `json:"timestamp"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
HealthCheckResponse represents a health check response
type HealthStatus ¶
type HealthStatus string
HealthStatus represents the health status
const ( HealthStatusHealthy HealthStatus = "healthy" HealthStatusUnhealthy HealthStatus = "unhealthy" HealthStatusDegraded HealthStatus = "degraded" HealthStatusUnknown HealthStatus = "unknown" )
type LogEntry ¶
type LogEntry struct {
Level LogLevel `json:"level"`
Message string `json:"message"`
Timestamp time.Time `json:"timestamp"`
Source string `json:"source"`
Service string `json:"service"`
TraceID string `json:"trace_id,omitempty"`
SpanID string `json:"span_id,omitempty"`
Fields map[string]interface{} `json:"fields,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
LogEntry represents a log entry
func (*LogEntry) AddMetadata ¶
AddMetadata adds metadata to a log entry
func (*LogEntry) SetTraceInfo ¶
SetTraceInfo sets trace information for a log entry
type LogRequest ¶
type LogRequest struct {
Logs []LogEntry `json:"logs"`
Options map[string]interface{} `json:"options,omitempty"`
}
LogRequest represents a log submission request
type Metric ¶
type Metric struct {
Name string `json:"name"`
Type MetricType `json:"type"`
Value float64 `json:"value"`
Labels map[string]string `json:"labels"`
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 monitoring metric
type MetricRequest ¶
type MetricRequest struct {
Metrics []Metric `json:"metrics"`
Options map[string]interface{} `json:"options,omitempty"`
}
MetricRequest represents a metric submission request
type MetricType ¶
type MetricType string
MetricType represents the type of metric
const ( MetricTypeCounter MetricType = "counter" MetricTypeGauge MetricType = "gauge" MetricTypeHistogram MetricType = "histogram" MetricTypeSummary MetricType = "summary" MetricTypeTimer MetricType = "timer" )
type MonitoringConfig ¶
type MonitoringConfig struct {
DefaultProvider string `json:"default_provider"`
RetryAttempts int `json:"retry_attempts"`
RetryDelay time.Duration `json:"retry_delay"`
Timeout time.Duration `json:"timeout"`
BatchSize int `json:"batch_size"`
FlushInterval time.Duration `json:"flush_interval"`
BufferSize int `json:"buffer_size"`
SamplingRate float64 `json:"sampling_rate"`
EnableTracing bool `json:"enable_tracing"`
EnableMetrics bool `json:"enable_metrics"`
EnableLogging bool `json:"enable_logging"`
EnableAlerting bool `json:"enable_alerting"`
Metadata map[string]string `json:"metadata"`
}
MonitoringConfig holds general monitoring configuration
type MonitoringError ¶
type MonitoringError struct {
Code string `json:"code"`
Message string `json:"message"`
Source string `json:"source,omitempty"`
}
MonitoringError represents a monitoring-specific error
func (*MonitoringError) Error ¶
func (e *MonitoringError) Error() string
type MonitoringFeature ¶
type MonitoringFeature string
MonitoringFeature represents a monitoring feature
const ( // Basic monitoring features FeatureMetrics MonitoringFeature = "metrics" FeatureLogging MonitoringFeature = "logging" FeatureTracing MonitoringFeature = "tracing" FeatureHealthCheck MonitoringFeature = "health_check" FeatureAlerting MonitoringFeature = "alerting" // Advanced features FeatureCustomMetrics MonitoringFeature = "custom_metrics" FeatureDistributedTracing MonitoringFeature = "distributed_tracing" FeaturePerformanceMonitoring MonitoringFeature = "performance_monitoring" FeatureErrorTracking MonitoringFeature = "error_tracking" FeatureUptimeMonitoring MonitoringFeature = "uptime_monitoring" FeatureResourceMonitoring MonitoringFeature = "resource_monitoring" FeatureAPMMonitoring MonitoringFeature = "apm_monitoring" FeatureRealTimeMonitoring MonitoringFeature = "real_time_monitoring" FeatureHistoricalData MonitoringFeature = "historical_data" FeatureDashboard MonitoringFeature = "dashboard" FeatureNotification MonitoringFeature = "notification" FeatureSLA MonitoringFeature = "sla" FeatureCapacityPlanning MonitoringFeature = "capacity_planning" )
type MonitoringStats ¶
type MonitoringStats struct {
MetricsCount int64 `json:"metrics_count"`
LogsCount int64 `json:"logs_count"`
TracesCount int64 `json:"traces_count"`
AlertsCount int64 `json:"alerts_count"`
ActiveAlerts int64 `json:"active_alerts"`
Uptime time.Duration `json:"uptime"`
LastUpdate time.Time `json:"last_update"`
ProviderData map[string]interface{} `json:"provider_data"`
}
MonitoringStats represents monitoring statistics
type ProviderInfo ¶
type ProviderInfo struct {
Name string `json:"name"`
SupportedFeatures []MonitoringFeature `json:"supported_features"`
ConnectionInfo *ConnectionInfo `json:"connection_info"`
IsConnected bool `json:"is_connected"`
}
ProviderInfo holds information about a monitoring provider
type QueryRequest ¶
type QueryRequest struct {
Query string `json:"query"`
Start time.Time `json:"start"`
End time.Time `json:"end"`
Step time.Duration `json:"step,omitempty"`
Options map[string]interface{} `json:"options,omitempty"`
}
QueryRequest represents a query request
type QueryResponse ¶
type QueryResponse struct {
Data interface{} `json:"data"`
Timestamp time.Time `json:"timestamp"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
QueryResponse represents a query response
type Span ¶
type Span struct {
SpanID string `json:"span_id"`
ParentID string `json:"parent_id,omitempty"`
Operation string `json:"operation"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Duration time.Duration `json:"duration"`
Status string `json:"status"`
Tags map[string]string `json:"tags,omitempty"`
Logs []LogEntry `json:"logs,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
Span represents a span in a trace
type Trace ¶
type Trace struct {
TraceID string `json:"trace_id"`
ServiceName string `json:"service_name"`
Operation string `json:"operation"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Duration time.Duration `json:"duration"`
Status string `json:"status"`
Tags map[string]string `json:"tags,omitempty"`
Spans []Span `json:"spans,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
Trace represents a distributed trace
type TraceRequest ¶
type TraceRequest struct {
Traces []Trace `json:"traces"`
Options map[string]interface{} `json:"options,omitempty"`
}
TraceRequest represents a trace submission request