Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ The following emojis are used to highlight certain changes:
### Security


## [v0.27.3]

### Added

- `provider`: Added `ReprovideInterval` and `LastRun` stats to the Reprovider [#815](https://github.com/ipfs/boxo/pull/815)


## [v0.27.2]

### Fixed
Expand Down
9 changes: 7 additions & 2 deletions provider/reprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
statLk sync.Mutex
totalProvides, lastReprovideBatchSize uint64
avgProvideDuration, lastReprovideDuration time.Duration
lastRun time.Time

throughputCallback ThroughputCallback
// throughputProvideCurrentCount counts how many provides has been done since the last call to throughputCallback
Expand Down Expand Up @@ -363,6 +364,7 @@
if performedReprovide {
s.lastReprovideBatchSize = uint64(len(keys))
s.lastReprovideDuration = dur
s.lastRun = time.Now()

s.statLk.Unlock()

Expand Down Expand Up @@ -537,8 +539,9 @@
}

type ReproviderStats struct {
TotalProvides, LastReprovideBatchSize uint64
AvgProvideDuration, LastReprovideDuration time.Duration
TotalProvides, LastReprovideBatchSize uint64
ReprovideInterval, AvgProvideDuration, LastReprovideDuration time.Duration
LastRun time.Time
}

// Stat returns various stats about this provider system
Expand All @@ -548,8 +551,10 @@
return ReproviderStats{
TotalProvides: s.totalProvides,
LastReprovideBatchSize: s.lastReprovideBatchSize,
ReprovideInterval: s.reprovideInterval,

Check warning on line 554 in provider/reprovider.go

View check run for this annotation

Codecov / codecov/patch

provider/reprovider.go#L554

Added line #L554 was not covered by tests
AvgProvideDuration: s.avgProvideDuration,
LastReprovideDuration: s.lastReprovideDuration,
LastRun: s.lastRun,

Check warning on line 557 in provider/reprovider.go

View check run for this annotation

Codecov / codecov/patch

provider/reprovider.go#L557

Added line #L557 was not covered by tests
}, nil
}

Expand Down