metrics

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package metrics owns ghsync's OpenTelemetry meter provider and Prometheus exposition. Runtime packages expose narrow observer interfaces; the daemon registers their implementations here so instrumentation never creates an import cycle.

Index

Constants

View Source
const Path = "/metrics"

Variables

This section is empty.

Functions

This section is empty.

Types

type Registrar

type Registrar interface {
	RegisterMetrics(metric.Meter) error
}

Registrar lets a component register instruments against the process-local provider without importing the registry or another runtime package.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry is one isolated OTel provider backed by one Prometheus registry. Tests and role-separated processes can therefore coexist without global collector collisions.

func New

func New() (*Registry, error)

func (*Registry) Handler

func (r *Registry) Handler() http.Handler

func (*Registry) Provider

func (r *Registry) Provider() metric.MeterProvider

Provider exposes the process-local provider to instrumentation libraries such as River's OpenTelemetry plugin. The provider remains registry-owned and must not be shut down by callers.

func (*Registry) Register

func (r *Registry) Register(scope string, registrar Registrar) error

Register installs one component's instruments under a unique OTel scope.

func (*Registry) Shutdown

func (r *Registry) Shutdown(ctx context.Context) error

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

Runtime implements the engine's observer hooks and DB-backed asynchronous instruments. Every metric name includes the constraint it verifies (C-O4).

func NewRuntime

func NewRuntime(options RuntimeOptions) (*Runtime, error)

func (*Runtime) BudgetRequest

func (r *Runtime) BudgetRequest(observation budget.RequestObservation)

func (*Runtime) BudgetStarvation

func (r *Runtime) BudgetStarvation(starvation budget.Starvation)

func (*Runtime) CacheWrite

func (r *Runtime) CacheWrite(
	ctx context.Context,
	kind string,
	accepted bool,
	tombstone bool,
)

func (*Runtime) DeriverPass

func (r *Runtime) DeriverPass(
	ctx context.Context,
	count int,
	duration time.Duration,
	err error,
)

func (*Runtime) DispatchBatch

func (r *Runtime) DispatchBatch(
	ctx context.Context,
	count int,
)

func (*Runtime) Divergence

func (r *Runtime) Divergence(
	ctx context.Context,
	finding *dbgen.DriftFinding,
)

func (*Runtime) GapRedelivery

func (r *Runtime) GapRedelivery(
	ctx context.Context,
	_ int64,
	_ string,
)

func (*Runtime) GapWindowIncomplete

func (r *Runtime) GapWindowIncomplete(
	ctx context.Context,
	_ string,
	_ int,
)

func (*Runtime) PersistentDivergence

func (r *Runtime) PersistentDivergence(
	ctx context.Context,
	finding *dbgen.DriftFinding,
)

func (*Runtime) PrunerDelete

func (r *Runtime) PrunerDelete(
	ctx context.Context,
	kind string,
	count int64,
)

func (*Runtime) RefreshDeadlineMissed

func (r *Runtime) RefreshDeadlineMissed(
	ctx context.Context,
	kind string,
	_ string,
	_ time.Time,
	_ time.Time,
)

func (*Runtime) RefreshFinished

func (r *Runtime) RefreshFinished(
	ctx context.Context,
	observation *queue.RefreshObservation,
)

func (*Runtime) RegisterMetrics

func (r *Runtime) RegisterMetrics(meter metric.Meter) error

func (*Runtime) SweepOverrun

func (r *Runtime) SweepOverrun(
	ctx context.Context,
	kind string,
	_ string,
	_ time.Duration,
)

func (*Runtime) WatermarkStep

func (r *Runtime) WatermarkStep(
	ctx context.Context,
	advanced bool,
)

type RuntimeOptions

type RuntimeOptions struct {
	Pool            *pgxpool.Pool
	InstallationID  int64
	Roles           []string
	CollectDatabase bool

	OpenStackStaleness time.Duration
	OpenPRStaleness    time.Duration
	RepoRulesStaleness time.Duration
	ClosedStaleness    time.Duration
	RepositoryPeriod   time.Duration
	StreamRetentionAge time.Duration
	DeriverDirtyCap    int
}

Jump to

Keyboard shortcuts

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