Documentation
¶
Index ¶
- func GetEnvOrDefault(key, defaultValue string) string
- type ArtifactMetrics
- type ArtifactType
- type Config
- type MetricsAggregator
- func (m *MetricsAggregator) Flush() error
- func (m *MetricsAggregator) GetAggregatedMetrics() map[ArtifactType]ArtifactMetrics
- func (m *MetricsAggregator) TrackWrite(event WriteEvent) error
- func (m *MetricsAggregator) TrackWriteFromReader(artifactType ArtifactType, key string, r io.Reader) (io.Reader, error)
- type WriteEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetEnvOrDefault ¶
GetEnvOrDefault gets an environment variable or returns the default
Types ¶
type ArtifactMetrics ¶
type ArtifactMetrics struct {
TotalBytes int64 `json:"total_bytes"`
WriteCount int `json:"write_count"`
SuccessCount int `json:"success_count"`
FailureCount int `json:"failure_count"`
FirstWrite time.Time `json:"first_write"`
LastWrite time.Time `json:"last_write"`
}
ArtifactMetrics represents aggregated metrics for a single artifact type
type ArtifactType ¶
type ArtifactType string
ArtifactType represents the three ARMOR artifact types for commitgraph
const ( ArtifactTypeParquet ArtifactType = "parquet" // Per-repo commit history ArtifactTypeWarmstart ArtifactType = "warmstart" // Warm-start pack files ArtifactTypeSnapshot ArtifactType = "snapshot" // Leaderboard snapshot )
type Config ¶
type Config struct {
Cluster string
Namespace string
Prefix string // ARMOR prefix for separating commitgraph artifacts
LogEndpoint string
}
Config holds the tracker configuration
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default configuration from environment variables
type MetricsAggregator ¶
type MetricsAggregator struct {
// contains filtered or unexported fields
}
MetricsAggregator tracks ARMOR write metrics
func NewMetricsAggregator ¶
func NewMetricsAggregator(cfg Config) *MetricsAggregator
NewMetricsAggregator creates a new ARMOR metrics aggregator
func (*MetricsAggregator) Flush ¶
func (m *MetricsAggregator) Flush() error
Flush forces logging of all accumulated events to VictoriaLogs
func (*MetricsAggregator) GetAggregatedMetrics ¶
func (m *MetricsAggregator) GetAggregatedMetrics() map[ArtifactType]ArtifactMetrics
GetAggregatedMetrics returns aggregated metrics for all tracked writes
func (*MetricsAggregator) TrackWrite ¶
func (m *MetricsAggregator) TrackWrite(event WriteEvent) error
TrackWrite tracks a single ARMOR write operation
func (*MetricsAggregator) TrackWriteFromReader ¶
func (m *MetricsAggregator) TrackWriteFromReader(artifactType ArtifactType, key string, r io.Reader) (io.Reader, error)
TrackWriteFromReader tracks a write operation by reading the content and measuring size
type WriteEvent ¶
type WriteEvent struct {
Timestamp time.Time `json:"timestamp"`
ArtifactType ArtifactType `json:"artifact_type"`
BytesWritten int64 `json:"bytes_written"`
Key string `json:"key"`
Provider string `json:"provider,omitempty"`
Repo string `json:"repo,omitempty"`
Success bool `json:"success"`
ErrorMsg string `json:"error_msg,omitempty"`
}
WriteEvent represents a single ARMOR write operation