armor_tracker

package
v0.0.0-...-75bd8b2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnvOrDefault

func GetEnvOrDefault(key, defaultValue string) string

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

Jump to

Keyboard shortcuts

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