Documentation
¶
Overview ¶
Package observability owns the boundary between collected storage facts and product-facing health signals.
Collection adapters gather facts from providers, chain state, wallet-scoped data sets, local storage metadata, and task state. They should not decide how those facts affect operator attention beyond producing typed state rows.
Interpretation belongs in this package. Status, reason codes, freshness, item signals, summary signals, and readiness/attention policies are computed here so admin APIs and UI surfaces do not duplicate health semantics.
Presentation layers consume observations and policy outputs. They may choose labels, layout, and copy, but must not reimplement provider/data set status, freshness, or readiness rules.
Index ¶
- Variables
- type ApprovedProviderSource
- type ChainDataSet
- type Checker
- func (c *Checker) CheckDataSets(ctx context.Context, checkedAt time.Time, localDataSets []LocalDataSet) ([]DataSetState, error)
- func (c *Checker) CheckProvider(ctx context.Context, checkedAt time.Time, id types.OnChainID) (ProviderState, error)
- func (c *Checker) CheckProviders(ctx context.Context, checkedAt time.Time, localDataSets []LocalDataSet) ([]ProviderState, error)
- type CheckerOptions
- type CollectionState
- type CollectionType
- type CopyFacts
- type DataSetFacts
- type DataSetObservation
- type DataSetObservationPage
- type DataSetScanner
- type DataSetState
- type DataSetStatePage
- type EndorsedProviderSource
- type Flow
- type Freshness
- type FreshnessWarning
- type ListOptions
- type LocalDataSet
- type LocalDataSetCountSource
- type LocalDataSetCountSourceFunc
- type LocalDataSetSource
- type LocalDataSetSourceFunc
- type MonitoringPoint
- type MonitoringSnapshot
- type MonitoringStatus
- type Provider
- type ProviderFacts
- type ProviderHealth
- type ProviderHealthFunc
- type ProviderObservation
- type ProviderObservationPage
- type ProviderProfile
- type ProviderSource
- type ProviderState
- type ProviderStatePage
- type ProviderTierSnapshot
- type ReasonCode
- type RefreshChecker
- type RegistryProviderSource
- type RuntimeMonitor
- type Service
- func (s *Service) DataSetObservationsByLocalIDs(ctx context.Context, localIDs []int64) (map[int64]DataSetObservation, error)
- func (s *Service) DataSetStatesByLocalIDs(ctx context.Context, localIDs []int64) (map[int64]DataSetState, error)
- func (s *Service) ListDataSetObservations(ctx context.Context, opts ListOptions) (DataSetObservationPage, error)
- func (s *Service) ListDataSets(ctx context.Context, opts ListOptions) (DataSetStatePage, error)
- func (s *Service) ListProviderObservations(ctx context.Context, opts ListOptions) (ProviderObservationPage, error)
- func (s *Service) ListProviders(ctx context.Context, opts ListOptions) (ProviderStatePage, error)
- func (s *Service) ProviderCandidates(ctx context.Context) (providerselect.Inventory, error)
- func (s *Service) ProviderProfile(ctx context.Context, id types.OnChainID) (*ProviderProfile, error)
- func (s *Service) ProviderTiersAvailable() bool
- func (s *Service) RefreshApprovedProviders(ctx context.Context) (time.Time, time.Time, error)
- func (s *Service) RefreshDataSetObservations(ctx context.Context, opts ListOptions) (DataSetObservationPage, error)
- func (s *Service) RefreshDataSetStates(ctx context.Context) error
- func (s *Service) RefreshDataSets(ctx context.Context, opts ListOptions) (DataSetStatePage, error)
- func (s *Service) RefreshEndorsedProviders(ctx context.Context) (time.Time, time.Time, error)
- func (s *Service) RefreshInterval() time.Duration
- func (s *Service) RefreshMissingProviderTiers(ctx context.Context) error
- func (s *Service) RefreshProvider(ctx context.Context, id types.OnChainID) (ProviderState, error)
- func (s *Service) RefreshProviderObservations(ctx context.Context, opts ListOptions) (ProviderObservationPage, error)
- func (s *Service) RefreshProviderStates(ctx context.Context) error
- func (s *Service) RefreshProviders(ctx context.Context, opts ListOptions) (ProviderStatePage, error)
- func (s *Service) RefreshProvidersWithContext(ctx context.Context, opts ListOptions) (ProviderStatePage, error)
- func (s *Service) RefreshTimeout() time.Duration
- func (s *Service) SelectionAdmission(ctx context.Context, tier providerselect.Tier) (providerselect.Admission, error)
- func (s *Service) SelectionInventory(ctx context.Context, tier providerselect.Tier) (providerselect.Inventory, error)
- type ServiceOptions
- type Signal
- type SignalLevel
- type StateStore
- type Status
- type StorageDataSetScanner
- type Summary
- type SummarySignal
- type TransferByteTotals
- type TransferCounters
- func (c *TransferCounters) Gatherer() prometheus.Gatherer
- func (c *TransferCounters) Totals() TransferTotals
- func (c *TransferCounters) WrapReadCloser(flow Flow, r io.ReadCloser) io.ReadCloser
- func (c *TransferCounters) WrapReader(flow Flow, r io.Reader) io.Reader
- func (c *TransferCounters) WrapWriter(flow Flow, w io.Writer) io.Writer
- type TransferTotals
Constants ¶
This section is empty.
Variables ¶
var ErrProviderNotFound = errors.New("provider not found")
var ErrProviderRefreshInProgress = errors.New("provider refresh in progress")
Functions ¶
This section is empty.
Types ¶
type ApprovedProviderSource ¶
type ChainDataSet ¶
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
func NewChecker ¶
func NewChecker(opts CheckerOptions) *Checker
func (*Checker) CheckDataSets ¶
func (c *Checker) CheckDataSets(ctx context.Context, checkedAt time.Time, localDataSets []LocalDataSet) ([]DataSetState, error)
func (*Checker) CheckProvider ¶
func (*Checker) CheckProviders ¶
func (c *Checker) CheckProviders(ctx context.Context, checkedAt time.Time, localDataSets []LocalDataSet) ([]ProviderState, error)
type CheckerOptions ¶
type CheckerOptions struct {
ProviderSource ProviderSource
ProviderHealth ProviderHealthFunc
DataSetScanner DataSetScanner
Timeout time.Duration
Concurrency int
Now func() time.Time
Logger *slog.Logger
ErrorFormatter func(error) string
}
type CollectionState ¶
type CollectionState struct {
bun.BaseModel `bun:"table:observability_collection_states"`
CollectionType CollectionType `bun:"collection_type,pk,type:text" json:"collection_type"`
LastCheckedAt time.Time `bun:"last_checked_at,nullzero,notnull" json:"last_checked_at"`
}
type CollectionType ¶
type CollectionType string
const ( CollectionProviders CollectionType = "providers" CollectionDataSets CollectionType = "data_sets" )
type CopyFacts ¶
type CopyFacts struct {
Status model.StorageCopyStatus `json:"status"`
ProviderID *types.OnChainID `json:"provider_id,omitempty"`
LocalDataSetID *int64 `json:"local_data_set_id,omitempty"`
ChainDataSetID *types.OnChainID `json:"chain_data_set_id,omitempty"`
PieceID *types.OnChainID `json:"piece_id,omitempty"`
RetrievalURL *string `json:"retrieval_url,omitempty"`
LastError *string `json:"last_error,omitempty"`
}
type DataSetFacts ¶
type DataSetFacts struct {
LocalDataSetID int64 `json:"local_data_set_id"`
BucketID int64 `json:"bucket_id"`
BucketName string `json:"bucket_name"`
CopyIndex int `json:"copy_index"`
ProviderID types.OnChainID `json:"provider_id"`
ChainDataSetID *types.OnChainID `json:"chain_data_set_id,omitempty"`
ClientDataSetID *types.OnChainID `json:"client_data_set_id,omitempty"`
LocalStatus model.StorageDataSetStatus `json:"local_status"`
ActivePieceCount *int64 `json:"active_piece_count,omitempty"`
HasActivePieces *bool `json:"has_active_pieces,omitempty"`
}
type DataSetObservation ¶
type DataSetObservation struct {
Facts DataSetFacts `json:"facts"`
Signal Signal `json:"signal"`
}
func DataSetObservationFromState ¶
func DataSetObservationFromState(state DataSetState, interval time.Duration, now time.Time) DataSetObservation
type DataSetObservationPage ¶
type DataSetObservationPage struct {
Items []DataSetObservation `json:"items"`
Summary Summary `json:"summary"`
SummarySignal SummarySignal `json:"summary_signal"`
Total int `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
type DataSetScanner ¶
type DataSetScanner interface {
ScanWalletDataSets(context.Context) ([]ChainDataSet, error)
}
type DataSetState ¶
type DataSetState struct {
bun.BaseModel `bun:"table:observability_data_set_states,alias:observability_data_set_state"`
LocalDataSetID int64 `bun:"local_data_set_id,pk" json:"local_data_set_id"`
BucketID int64 `bun:"bucket_id,notnull" json:"bucket_id"`
CopyIndex int `bun:"copy_index,type:integer,notnull" json:"copy_index"`
ProviderID types.OnChainID `bun:"provider_id,type:text,notnull" json:"provider_id"`
ChainDataSetID *types.OnChainID `bun:"chain_data_set_id,type:text" json:"chain_data_set_id,omitempty"`
ClientDataSetID *types.OnChainID `bun:"client_data_set_id,type:text" json:"client_data_set_id,omitempty"`
// BucketName and LocalStatus are projected from the rows that own them.
// Observations are rebuilt wholesale on every refresh, so a copy here would
// only add a second, staler answer to the same question.
BucketName string `bun:",scanonly" json:"bucket_name"`
LocalStatus model.StorageDataSetStatus `bun:",scanonly" json:"local_status"`
Status Status `bun:"status,type:text,notnull" json:"status"`
ReasonCodes []ReasonCode `bun:"reason_codes,type:jsonb,notnull" json:"reason_codes"`
ActivePieceCount *int64 `bun:"active_piece_count,nullzero" json:"active_piece_count,omitempty"`
LastCheckedAt time.Time `bun:"last_checked_at,nullzero,notnull" json:"last_checked_at"`
LastError *string `bun:"last_error,type:text,nullzero" json:"last_error,omitempty"`
Evidence map[string]any `bun:"evidence_json,type:jsonb,notnull" json:"evidence"`
}
type DataSetStatePage ¶
type EndorsedProviderSource ¶
type Freshness ¶
type Freshness struct {
LastCheckedAt *time.Time `json:"last_checked_at,omitempty"`
Stale bool `json:"stale"`
Warnings []FreshnessWarning `json:"warnings"`
}
type FreshnessWarning ¶
type FreshnessWarning string
const ( FreshnessNoStateRecorded FreshnessWarning = "no_state_recorded" FreshnessStaleState FreshnessWarning = "stale_state" )
type ListOptions ¶
type LocalDataSet ¶
type LocalDataSetCountSource ¶
type LocalDataSetCountSourceFunc ¶
func (LocalDataSetCountSourceFunc) CountLocalDataSets ¶
func (f LocalDataSetCountSourceFunc) CountLocalDataSets(ctx context.Context) (int, error)
type LocalDataSetSource ¶
type LocalDataSetSource interface {
ListLocalDataSets(context.Context) ([]LocalDataSet, error)
}
type LocalDataSetSourceFunc ¶
type LocalDataSetSourceFunc func(context.Context) ([]LocalDataSet, error)
func (LocalDataSetSourceFunc) ListLocalDataSets ¶
func (f LocalDataSetSourceFunc) ListLocalDataSets(ctx context.Context) ([]LocalDataSet, error)
type MonitoringPoint ¶
type MonitoringPoint struct {
At time.Time `json:"at"`
CPUCores *float64 `json:"cpu_cores"`
RSSBytes *uint64 `json:"rss_bytes"`
ClientUploadBytesPerSecond *float64 `json:"client_upload_bytes_per_second"`
ClientDownloadBytesPerSecond *float64 `json:"client_download_bytes_per_second"`
StorageUploadBytesPerSecond *float64 `json:"storage_upload_bytes_per_second"`
StorageDownloadBytesPerSecond *float64 `json:"storage_download_bytes_per_second"`
GapBefore bool `json:"gap_before"`
}
MonitoringPoint measures process resources and object payload transfer rates.
type MonitoringSnapshot ¶
type MonitoringSnapshot struct {
InstanceID string `json:"instance_id"`
StartedAt time.Time `json:"started_at"`
WindowStart time.Time `json:"window_start"`
WindowEnd time.Time `json:"window_end"`
SnapshotAt time.Time `json:"snapshot_at"`
SampledAt *time.Time `json:"sampled_at"`
IntervalSeconds int `json:"interval_seconds"`
RetentionSeconds int `json:"retention_seconds"`
Status MonitoringStatus `json:"status"`
Totals TransferTotals `json:"totals"`
Points []MonitoringPoint `json:"points"`
}
MonitoringSnapshot is an isolated copy of a runtime's bounded sample history.
type MonitoringStatus ¶
type MonitoringStatus struct {
CPU string `json:"cpu"`
RSS string `json:"rss"`
Traffic string `json:"traffic"`
}
MonitoringStatus describes the latest sample's metric availability.
type ProviderFacts ¶
type ProviderHealth ¶
type ProviderHealth = provider.HealthResult
ProviderHealth is one provider health probe result. A failed probe's Detail becomes the provider's last error.
type ProviderHealthFunc ¶
type ProviderObservation ¶
type ProviderObservation struct {
Facts ProviderFacts `json:"facts"`
Signal Signal `json:"signal"`
}
func ProviderObservationFromState ¶
func ProviderObservationFromState(state ProviderState, interval time.Duration, now time.Time) ProviderObservation
type ProviderObservationPage ¶
type ProviderObservationPage struct {
Items []ProviderObservation `json:"items"`
Summary Summary `json:"summary"`
SummarySignal SummarySignal `json:"summary_signal"`
Total int `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
type ProviderProfile ¶
type ProviderProfile struct {
bun.BaseModel `bun:"table:provider_profiles"`
ProviderID types.OnChainID `bun:"provider_id,pk,type:text" json:"provider_id"`
Name string `bun:"name,type:text,notnull" json:"name"`
Description string `bun:"description,type:text,notnull" json:"description"`
ServiceProviderAddress string `bun:"service_provider_address,type:text,notnull" json:"service_provider_address"`
PayeeAddress string `bun:"payee_address,type:text,notnull" json:"payee_address"`
Active bool `bun:"active,notnull" json:"active"`
ServiceURL string `bun:"service_url,type:text,notnull" json:"service_url"`
RegistrySnapshot json.RawMessage `bun:"registry_snapshot_json,type:jsonb,notnull" json:"registry_snapshot"`
LastSuccessAt time.Time `bun:"last_success_at,notnull" json:"last_success_at"`
Approved bool `bun:"-" json:"approved"`
ApprovedCheckedAt *time.Time `bun:"-" json:"approved_checked_at"`
Endorsed bool `bun:"-" json:"endorsed"`
EndorsedCheckedAt *time.Time `bun:"-" json:"endorsed_checked_at"`
}
ProviderProfile is the last successful Registry read for one provider.
type ProviderSource ¶
type ProviderState ¶
type ProviderState struct {
bun.BaseModel `bun:"table:observability_provider_states"`
Profile *ProviderProfile `bun:"-" json:"-"`
ProviderID types.OnChainID `bun:"provider_id,pk,type:text" json:"provider_id"`
Status Status `bun:"status,type:text,notnull" json:"status"`
ReasonCodes []ReasonCode `bun:"reason_codes,type:jsonb,notnull" json:"reason_codes"`
Active *bool `bun:"active" json:"active,omitempty"`
HasPDP *bool `bun:"has_pdp" json:"has_pdp,omitempty"`
ServiceURL *string `bun:"service_url,type:text" json:"service_url,omitempty"`
HealthStatus *string `bun:"health_status,type:text" json:"health_status,omitempty"`
LastCheckedAt time.Time `bun:"last_checked_at,nullzero,notnull" json:"last_checked_at"`
LastAttemptAt time.Time `bun:"last_attempt_at,nullzero,notnull" json:"last_attempt_at"`
LastError *string `bun:"last_error,type:text,nullzero" json:"last_error,omitempty"`
Evidence map[string]any `bun:"evidence_json,type:jsonb,notnull" json:"evidence"`
}
type ProviderStatePage ¶
type ProviderTierSnapshot ¶
type ReasonCode ¶
type ReasonCode string
const ( ReasonRegistryLookupFailed ReasonCode = "registry_lookup_failed" ReasonProviderInactive ReasonCode = "provider_inactive" ReasonProviderMissingPDP ReasonCode = "provider_missing_pdp" ReasonProviderHTTPUnreachable ReasonCode = "provider_http_unreachable" ReasonChainLookupFailed ReasonCode = "chain_lookup_failed" ReasonChainDataSetMissing ReasonCode = "chain_data_set_missing" ReasonChainDataSetInactive ReasonCode = "chain_data_set_inactive" ReasonChainDataSetUnmanaged ReasonCode = "chain_data_set_unmanaged" ReasonLocalStatusNotReady ReasonCode = "local_status_not_ready" ReasonProviderMismatch ReasonCode = "provider_mismatch" ReasonMetadataMismatch ReasonCode = "metadata_mismatch" ReasonCopyUnderReplicated ReasonCode = "copy_under_replicated" ReasonCopyPending ReasonCode = "copy_pending" ReasonCopyCommitting ReasonCode = "copy_committing" ReasonCopyFailed ReasonCode = "copy_failed" ReasonCopyMissingProvider ReasonCode = "copy_missing_provider" ReasonCopyMissingDataSet ReasonCode = "copy_missing_data_set" ReasonCopyMissingPiece ReasonCode = "copy_missing_piece" ReasonCopyMissingRetrievalURL ReasonCode = "copy_missing_retrieval_url" ReasonCopyObservationMissing ReasonCode = "copy_observation_missing" )
func AppendReasonCode ¶
func AppendReasonCode(reasons []ReasonCode, reason ReasonCode) []ReasonCode
AppendReasonCode appends a non-empty reason code if it is not already present.
func (ReasonCode) String ¶
func (r ReasonCode) String() string
type RefreshChecker ¶
type RefreshChecker interface {
CheckProviders(context.Context, time.Time, []LocalDataSet) ([]ProviderState, error)
CheckDataSets(context.Context, time.Time, []LocalDataSet) ([]DataSetState, error)
}
type RegistryProviderSource ¶
type RegistryProviderSource struct {
// contains filtered or unexported fields
}
func NewRegistryProviderSource ¶
func NewRegistryProviderSource(registry *provider.RegistryService) *RegistryProviderSource
func (*RegistryProviderSource) ListActiveProviders ¶
func (s *RegistryProviderSource) ListActiveProviders(ctx context.Context) ([]Provider, error)
func (*RegistryProviderSource) LookupProvider ¶
type RuntimeMonitor ¶
type RuntimeMonitor struct {
// contains filtered or unexported fields
}
RuntimeMonitor keeps read-only telemetry in a bounded process-local history.
func NewRuntimeMonitor ¶
func NewRuntimeMonitor(transfers *TransferCounters) *RuntimeMonitor
NewRuntimeMonitor creates telemetry sources without starting background work.
func (*RuntimeMonitor) Capture ¶
func (m *RuntimeMonitor) Capture()
Capture records one sample; the first capture establishes rate baselines.
func (*RuntimeMonitor) Run ¶
func (m *RuntimeMonitor) Run(ctx context.Context)
Run samples until cancelled; its owner captures the initial baseline first.
func (*RuntimeMonitor) Snapshot ¶
func (m *RuntimeMonitor) Snapshot() MonitoringSnapshot
Snapshot copies the last sample's totals and the retained history atomically.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(opts ServiceOptions) *Service
func (*Service) DataSetObservationsByLocalIDs ¶
func (*Service) DataSetStatesByLocalIDs ¶
func (*Service) ListDataSetObservations ¶
func (s *Service) ListDataSetObservations(ctx context.Context, opts ListOptions) (DataSetObservationPage, error)
func (*Service) ListDataSets ¶
func (s *Service) ListDataSets(ctx context.Context, opts ListOptions) (DataSetStatePage, error)
func (*Service) ListProviderObservations ¶
func (s *Service) ListProviderObservations(ctx context.Context, opts ListOptions) (ProviderObservationPage, error)
func (*Service) ListProviders ¶
func (s *Service) ListProviders(ctx context.Context, opts ListOptions) (ProviderStatePage, error)
func (*Service) ProviderCandidates ¶
ProviderCandidates reads stored provider health, profiles, and tier membership.
func (*Service) ProviderProfile ¶
func (*Service) ProviderTiersAvailable ¶
func (*Service) RefreshApprovedProviders ¶
RefreshApprovedProviders reads the approved tier and returns when the read started and the collection time of the snapshot stored afterwards. The two differ when a newer read committed first; the newer snapshot is kept.
func (*Service) RefreshDataSetObservations ¶
func (s *Service) RefreshDataSetObservations(ctx context.Context, opts ListOptions) (DataSetObservationPage, error)
func (*Service) RefreshDataSetStates ¶
func (*Service) RefreshDataSets ¶
func (s *Service) RefreshDataSets(ctx context.Context, opts ListOptions) (DataSetStatePage, error)
func (*Service) RefreshEndorsedProviders ¶
RefreshEndorsedProviders is RefreshApprovedProviders for the endorsed tier.
func (*Service) RefreshInterval ¶
func (*Service) RefreshMissingProviderTiers ¶
func (*Service) RefreshProvider ¶
func (*Service) RefreshProviderObservations ¶
func (s *Service) RefreshProviderObservations(ctx context.Context, opts ListOptions) (ProviderObservationPage, error)
func (*Service) RefreshProviderStates ¶
func (*Service) RefreshProviders ¶
func (s *Service) RefreshProviders(ctx context.Context, opts ListOptions) (ProviderStatePage, error)
func (*Service) RefreshProvidersWithContext ¶
func (s *Service) RefreshProvidersWithContext(ctx context.Context, opts ListOptions) (ProviderStatePage, error)
RefreshProvidersWithContext refreshes provider state using the caller context.
func (*Service) RefreshTimeout ¶
func (*Service) SelectionAdmission ¶
func (s *Service) SelectionAdmission(ctx context.Context, tier providerselect.Tier) (providerselect.Admission, error)
func (*Service) SelectionInventory ¶
func (s *Service) SelectionInventory(ctx context.Context, tier providerselect.Tier) (providerselect.Inventory, error)
SelectionInventory reads health and a fresh, independent tier snapshot.
type ServiceOptions ¶
type ServiceOptions struct {
ApprovedProviders ApprovedProviderSource
EndorsedProviders EndorsedProviderSource
Checker RefreshChecker
LocalDataSets LocalDataSetSource
LocalDataSetCount LocalDataSetCountSource
Store StateStore
RefreshInterval time.Duration
RefreshTimeout time.Duration
Now func() time.Time
}
type Signal ¶
type Signal struct {
Status Status `json:"status"`
Level SignalLevel `json:"level"`
ReasonCodes []ReasonCode `json:"reason_codes"`
LastError *string `json:"last_error,omitempty"`
Freshness Freshness `json:"freshness"`
}
func BuildSignal ¶
func CopyHealthFromFacts ¶
type SignalLevel ¶
type SignalLevel string
const ( SignalOK SignalLevel = "ok" SignalWarning SignalLevel = "warning" SignalBlocking SignalLevel = "blocking" )
func WorstSignalLevel ¶
func WorstSignalLevel(current SignalLevel, candidate SignalLevel) SignalLevel
type StateStore ¶
type StateStore interface {
ReplaceProviderStates(context.Context, time.Time, []ProviderState) error
ListProviderStates(context.Context, ListOptions) (ProviderStatePage, error)
ReplaceDataSetStates(context.Context, time.Time, []DataSetState) error
ListDataSetStates(context.Context, ListOptions) (DataSetStatePage, error)
GetDataSetStatesByLocalIDs(context.Context, []int64) (map[int64]DataSetState, error)
}
type StorageDataSetScanner ¶
type StorageDataSetScanner struct {
// contains filtered or unexported fields
}
func NewStorageDataSetScanner ¶
func NewStorageDataSetScanner(storage dataSetFinder) *StorageDataSetScanner
func (*StorageDataSetScanner) ScanWalletDataSets ¶
func (s *StorageDataSetScanner) ScanWalletDataSets(ctx context.Context) ([]ChainDataSet, error)
type SummarySignal ¶
type SummarySignal struct {
Level SignalLevel `json:"level"`
Freshness Freshness `json:"freshness"`
}
type TransferByteTotals ¶
type TransferByteTotals struct {
UploadBytes uint64 `json:"upload_bytes,string"`
DownloadBytes uint64 `json:"download_bytes,string"`
}
TransferByteTotals holds cumulative payload bytes at one boundary.
type TransferCounters ¶
type TransferCounters struct {
// contains filtered or unexported fields
}
TransferCounters measures bytes actually read or written by payload streams.
func NewTransferCounters ¶
func NewTransferCounters() *TransferCounters
NewTransferCounters creates isolated counters and their Prometheus gatherer.
func (*TransferCounters) Gatherer ¶
func (c *TransferCounters) Gatherer() prometheus.Gatherer
Gatherer exposes only this instance's payload transfer counters.
func (*TransferCounters) Totals ¶
func (c *TransferCounters) Totals() TransferTotals
Totals reads the cumulative counters without collecting Prometheus metrics.
func (*TransferCounters) WrapReadCloser ¶
func (c *TransferCounters) WrapReadCloser(flow Flow, r io.ReadCloser) io.ReadCloser
WrapReadCloser counts reads and preserves the stream's Close behavior.
func (*TransferCounters) WrapReader ¶
WrapReader counts bytes returned by Read, including partial failed reads.
func (*TransferCounters) WrapWriter ¶
WrapWriter counts bytes accepted by Write, including partial failed writes.
type TransferTotals ¶
type TransferTotals struct {
Client TransferByteTotals `json:"client"`
Storage TransferByteTotals `json:"storage"`
}
TransferTotals contains process-local cumulative payload bytes.