metrics

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConflictPathsTotal = prometheus.NewCounter(prometheus.CounterOpts{
	Name: "git_rest_conflict_paths_total",
	Help: "Total count of conflicted file paths passed to the ConflictResolver across pod lifetime.",
})

ConflictPathsTotal counts total conflicted file paths passed to the resolver across pod lifetime.

View Source
var GitOperationDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
	Name:    "git_rest_git_operation_duration_seconds",
	Help:    "Duration of git operations.",
	Buckets: prometheus.DefBuckets,
}, []string{"operation"})

GitOperationDuration records the duration of git operations.

View Source
var GitOperationErrors = prometheus.NewCounterVec(prometheus.CounterOpts{
	Name: "git_rest_git_operation_errors_total",
	Help: "Total git operation errors by operation type.",
}, []string{"operation", "conflict"})

GitOperationErrors counts git operation errors by operation type and conflict status.

View Source
var HTTPRequestsTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
	Name: "git_rest_http_requests_total",
	Help: "Total HTTP requests by method, path template, and status code.",
}, []string{"method", "path", "status"})

HTTPRequestsTotal counts HTTP requests by method, path template, and status code.

View Source
var MergeOutcomeTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
	Name: "git_rest_merge_outcome_total",
	Help: "Total merge outcomes by result type (clean=auto-merged, resolved=resolver succeeded, aborted=resolver failed).",
}, []string{"result"})

MergeOutcomeTotal counts merge outcomes by result: clean, resolved, aborted.

View Source
var QuarantinedBacklog = prometheus.NewGauge(prometheus.GaugeOpts{
	Name: "git_rest_quarantined_backlog",
	Help: "Number of regular files currently under _conflicts/ in the served repo (counted recursively).",
})

QuarantinedBacklog reports the number of regular files currently under _conflicts/.

View Source
var QuarantinedFilesTotal = prometheus.NewCounter(prometheus.CounterOpts{
	Name: "git_rest_quarantined_files_total",
	Help: "Total number of conflicted files quarantined to _conflicts/ during pull (per-file quarantine for the resolver-failure branch).",
})

QuarantinedFilesTotal counts conflicted files moved to _conflicts/ during pull.

View Source
var ResolverFailuresTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
	Name: "git_rest_resolver_failures_total",
	Help: "Total conflict-resolver failures by category. Resolver failures: yaml_parse_failed, no_frontmatter, write_failed, git_add_failed. Quarantine failures: quarantine_io_failed (any I/O step of the quarantine flow), unsafe_path (path-traversal rejection), nested_source (a conflicted path already under _conflicts/ was rejected by the nesting guard).",
}, []string{"category"})

ResolverFailuresTotal counts conflict-resolver failures by category. Categories: yaml_parse_failed, no_frontmatter, write_failed, git_add_failed, quarantine_io_failed, unsafe_path, nested_source. The quarantine_io_failed bucket covers any I/O failure in the quarantine flow (read source, git rm source, mkdir destination, write destination, git add destination) — the implementation does not use git mv (git refuses to move conflicted files), so the historical "git_mv_failed" label is renamed to reflect what it actually counts.

Functions

This section is empty.

Types

type BuildInfoMetrics added in v0.5.2

type BuildInfoMetrics interface {
	SetBuildInfo(buildDate *libtime.DateTime)
}

BuildInfoMetrics records build information as a Prometheus gauge.

func NewBuildInfoMetrics added in v0.5.2

func NewBuildInfoMetrics(version, commit string) BuildInfoMetrics

NewBuildInfoMetrics returns a BuildInfoMetrics that registers a git_rest_build_info gauge.

type Metrics added in v0.6.4

type Metrics interface {
	ObserveGitOperation(operation string, duration float64)
	IncGitOperationError(operation string)
	IncHTTPRequest(method, path, statusCode string)
	IncRebaseConflict()
	// IncMergeOutcome records a merge outcome. result must be "clean", "resolved", or "aborted".
	IncMergeOutcome(result string)
	// IncConflictPaths records n conflicted paths passed to the resolver in one merge cycle.
	IncConflictPaths(n int)
	// IncResolverFailure records a conflict-resolver failure by category.
	// category must be one of: yaml_parse_failed, no_frontmatter, write_failed,
	// git_add_failed, unsafe_path, quarantine_io_failed, nested_source.
	IncResolverFailure(category string)
	// IncQuarantinedFiles records a single file moved into _conflicts/ during pull.
	IncQuarantinedFiles()
	// SetQuarantinedBacklog records the number of regular files currently under
	// _conflicts/ in the served repo. It is a setter rather than an increment so a
	// deletion reduces the reported backlog.
	SetQuarantinedBacklog(count int)
}

Metrics records git operation instrumentation.

func NewMetrics added in v0.6.4

func NewMetrics() Metrics

NewMetrics returns a Prometheus-backed Metrics implementation.

Jump to

Keyboard shortcuts

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