Documentation
¶
Overview ¶
Package ppdm holds the PPDM metric model, snapshot store, modular collectors, and the Prometheus + OTLP export paths.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Activities ¶
Activities aggregates PPDM job outcome counts and total bytes within a lookback window. When PerJob is set it also emits per-job detail metrics (opt-in; higher cardinality).
func (Activities) Collect ¶
func (a Activities) Collect(ctx context.Context, c ppdmclient.Client) ([]Sample, error)
func (Activities) Name ¶
func (Activities) Name() string
type Assets ¶
Assets aggregates protection rollups plus a bounded per-asset SLA-age series. AgeThreshold gates the per-asset emission; now is injectable for tests (defaults to time.Now).
type Capacity ¶
type Capacity struct{}
Capacity collects storage-unit (MTree) and storage-system capacity in bytes.
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector runs the background loop: every interval it polls all servers in parallel and publishes a fresh Snapshot. One server's failure never blocks others.
func NewCollector ¶
func NewCollector(clients []ppdmclient.Client, collectors []ResourceCollector, store *SnapshotStore, interval, timeout time.Duration) *Collector
NewCollector wires the loop.
func (*Collector) CollectOnce ¶
CollectOnce runs a single cycle, stores, and returns the snapshot.
type Health ¶
type Health struct{}
Health collects PPDM health-entity status and alert counts.
type OTLPExporter ¶
type OTLPExporter struct {
// contains filtered or unexported fields
}
OTLPExporter pushes the snapshot's metrics via OTLP using asynchronous observable gauges. A periodic reader drives collection: on each cycle every registered instrument's callback reads the latest snapshot and observes its samples.
func NewOTLPExporter ¶
func NewOTLPExporter(ctx context.Context, endpoint string, insecure bool, interval string, store *SnapshotStore, serviceVersion string) (*OTLPExporter, error)
NewOTLPExporter creates an exporter that pushes metrics to an OTLP gRPC endpoint.
func (*OTLPExporter) EnsureInstruments ¶
func (e *OTLPExporter) EnsureInstruments() error
EnsureInstruments registers an observable gauge for every metric name in the current snapshot that does not already have one. Idempotent; safe to call after reloads.
type PromCollector ¶
type PromCollector struct {
// contains filtered or unexported fields
}
PromCollector is an unchecked Prometheus collector: Describe emits nothing so the metric-name set can vary per snapshot. Collect reads the latest snapshot.
func NewPromCollector ¶
func NewPromCollector(store *SnapshotStore) *PromCollector
NewPromCollector wraps the snapshot store as a prometheus.Collector.
func (*PromCollector) Collect ¶
func (p *PromCollector) Collect(ch chan<- prometheus.Metric)
Collect turns every snapshot sample into a gauge metric.
func (*PromCollector) Describe ¶
func (p *PromCollector) Describe(chan<- *prometheus.Desc)
Describe sends nothing (unchecked collector).
type ResourceCollector ¶
type ResourceCollector interface {
Name() string
Collect(ctx context.Context, c ppdmclient.Client) ([]Sample, error)
}
ResourceCollector collects one metric domain from a single PPDM server. It returns server-agnostic samples; the loop stamps the `server` label. Implementations own their endpoint path and JSON struct so provisional-API risk is localized.
type Sample ¶
Sample is one metric data point: a name, an ordered label set, and a value.
func (Sample) LabelValue ¶
LabelValue returns the value of the named label, or "" if absent.
func (Sample) WithServer ¶
WithServer returns a copy with a leading {server=name} label. Collectors emit server-agnostic samples; the collection loop stamps the server identity.
type ServerSnapshot ¶
type ServerSnapshot struct {
Server string
LastScrape time.Time
OK bool // server reachable & authenticated
Err string // top-level failure (auth/unreachable); empty when OK
Samples []Sample
}
ServerSnapshot is one PPDM server's result for a single collection cycle.
type Snapshot ¶
type Snapshot struct {
BuiltAt time.Time
Servers []*ServerSnapshot
}
Snapshot is an immutable, point-in-time view across all servers.
func (*Snapshot) MetricNames ¶
MetricNames returns the sorted, de-duplicated set of metric names in the snapshot.
func (*Snapshot) SamplesByName ¶
SamplesByName returns every sample with the given metric name across all servers.
type SnapshotStore ¶
type SnapshotStore struct {
// contains filtered or unexported fields
}
SnapshotStore holds the latest Snapshot behind an RWMutex pointer-swap.
func NewSnapshotStore ¶
func NewSnapshotStore() *SnapshotStore
NewSnapshotStore returns a store pre-populated with an empty snapshot so readers never see nil before the first collection cycle.
func (*SnapshotStore) Load ¶
func (s *SnapshotStore) Load() *Snapshot
Load returns the current snapshot (never nil).
func (*SnapshotStore) Store ¶
func (s *SnapshotStore) Store(snap *Snapshot)
Store atomically swaps in a new snapshot.