storacha / w3infra

🏗️ Infra for the w3up UCAN protocol implementation
Other
17 stars 7 forks source link

Piece level monitoring w3infra #391

Open vasco-santos opened 5 months ago

vasco-santos commented 5 months ago

We currently monitor at aggregate level whether aggregates are being offered and accepted by MPs https://github.com/w3s-project/w3filecoin-infra/blob/main/packages/functions/src/monitor/handle-deal-monitor-alert-cron-tick.js (in stack https://github.com/w3s-project/w3filecoin-infra/blob/main/stacks/api-stack.js#L188).

It should be easy to port similar behaviour for w3infra to track piece level monitoring with same thresholds. Instead of relying on https://github.com/w3s-project/w3filecoin-infra/blob/main/packages/functions/src/monitor/handle-deal-monitor-alert-cron-tick.js#L31 it would rely on the PieceStore like we do for the other CRON tick in w3infra: https://github.com/w3s-project/w3infra/blob/main/filecoin/functions/handle-cron-tick.js. This queries the PieceStore for the oldest Pieces pending a deal, and if they were inserted older than the threshold, they would have the alert.