Documentation
¶
Index ¶
- func HTTPMiddleware(next http.Handler) http.Handler
- func Handler() http.Handler
- func RecordBranchesIndexed(branchCount int, success bool)
- func RecordCodeHostRequest(hostType, endpoint string, duration time.Duration, success bool)
- func RecordError(category, errorType string)
- func RecordGitClone(duration time.Duration, success bool)
- func RecordGitFetch(duration time.Duration, success bool)
- func RecordIndexFailure(reason string)
- func RecordJob(jobType string, duration time.Duration, success bool)
- func RecordOrphanedActiveMarkerRecovered()
- func RecordRateLimit(allowed bool)
- func RecordReplace(filesModified int, success bool)
- func RecordRepoIndex(duration time.Duration, success bool)
- func RecordRepoSize(sizeBytes int64, success bool)
- func RecordRepoSync(duration time.Duration, success bool)
- func RecordSearch(searchType string, duration time.Duration, resultCount int)
- func SetActiveIndexRepos(count int)
- func SetCodeHostRateLimit(hostType string, remaining int, resetTime time.Time)
- func SetConnectionCounts(counts map[string]int)
- func SetDBConnections(open, inUse int)
- func SetJobQueueCounts(counts map[string]int)
- func SetOrphanedTempFiles(count int)
- func SetRateLimitBuckets(count int)
- func SetRedisConnections(open int)
- func SetRepositoryCounts(counts map[string]int)
- func SetStuckIndexJobs(duration string, count int)
- func SetZoektStats(shards int, indexSizeBytes int64)
- type Collector
- type DBPool
- type DBPoolAdapter
- type PoolStats
- type Rows
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPMiddleware ¶
HTTPMiddleware is middleware that records HTTP metrics.
func RecordBranchesIndexed ¶
RecordBranchesIndexed records branch indexing metrics.
func RecordCodeHostRequest ¶
RecordCodeHostRequest records code host API metrics.
func RecordError ¶
func RecordError(category, errorType string)
RecordError records an error by category and type.
func RecordGitClone ¶
RecordGitClone records git clone operation metrics.
func RecordGitFetch ¶
RecordGitFetch records git fetch operation metrics.
func RecordIndexFailure ¶
func RecordIndexFailure(reason string)
RecordIndexFailure records an index failure with categorized reason. Reasons: oom_killed, timeout, git_error, zoekt_error, unknown.
func RecordOrphanedActiveMarkerRecovered ¶
func RecordOrphanedActiveMarkerRecovered()
RecordOrphanedActiveMarkerRecovered increments the counter when an orphaned active marker is cleaned up.
func RecordRateLimit ¶
func RecordRateLimit(allowed bool)
RecordRateLimit records rate limiting metrics.
func RecordReplace ¶
RecordReplace records replace operation metrics.
func RecordRepoIndex ¶
RecordRepoIndex records repository indexing metrics.
func RecordRepoSize ¶
RecordRepoSize records repository size before indexing.
func RecordRepoSync ¶
RecordRepoSync records repository sync metrics.
func RecordSearch ¶
RecordSearch records search metrics.
func SetActiveIndexRepos ¶
func SetActiveIndexRepos(count int)
SetActiveIndexRepos sets the number of repos currently in the active index set.
func SetCodeHostRateLimit ¶
SetCodeHostRateLimit sets the code host rate limit gauges.
func SetConnectionCounts ¶
SetConnectionCounts sets the connection count gauges.
func SetDBConnections ¶
func SetDBConnections(open, inUse int)
SetDBConnections sets the database connection gauges.
func SetJobQueueCounts ¶
SetJobQueueCounts sets the job queue count gauges.
func SetOrphanedTempFiles ¶
func SetOrphanedTempFiles(count int)
SetOrphanedTempFiles sets the current count of orphaned .tmp files.
func SetRateLimitBuckets ¶
func SetRateLimitBuckets(count int)
SetRateLimitBuckets sets the number of active rate limit buckets.
func SetRedisConnections ¶
func SetRedisConnections(open int)
SetRedisConnections sets the Redis connection gauge.
func SetRepositoryCounts ¶
SetRepositoryCounts sets the repository count gauges.
func SetStuckIndexJobs ¶
SetStuckIndexJobs sets the count of repos stuck in indexing state by duration.
func SetZoektStats ¶
SetZoektStats sets the Zoekt stats gauges.
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector periodically collects infrastructure metrics.
func NewCollector ¶
func NewCollector( db DBPool, redis *redis.Client, indexPath string, interval time.Duration, ) *Collector
NewCollector creates a new metrics collector. Pass nil for any component that's not available.
type DBPool ¶
type DBPool interface {
Stats() PoolStats
Query(ctx context.Context, sql string, args ...any) (Rows, error)
}
DBPool is an interface for database pools that provide stats and query capabilities. This matches the db.Pool interface from internal/db.
type DBPoolAdapter ¶
type DBPoolAdapter struct {
StatsFunc func() PoolStats
QueryFunc func(ctx context.Context, sql string, args ...any) (Rows, error)
}
DBPoolAdapter wraps a database pool to satisfy the DBPool interface.
func (*DBPoolAdapter) Stats ¶
func (a *DBPoolAdapter) Stats() PoolStats
Stats returns pool statistics.