Skip to content

Commit 54a5cb9

Browse files
committed
docs: update indexer tap agent sectino
Signed-off-by: Gustavo Inacio <[email protected]>
1 parent dbe0d19 commit 54a5cb9

File tree

1 file changed

+38
-3
lines changed

1 file changed

+38
-3
lines changed

README.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,46 @@ The Subgraph Service is an [axum](https://crates.io/crates/axum)-based web serve
171171

172172
### indexer-tap-agent
173173

174-
The TAP Agent is an actor-based system powered by [ractor](https://crates.io/crates/ractor). It is responsible for processing receipts into RAVs and marking them ready for redemption.
174+
The TAP Agent is an actor-based system powered by [ractor](https://crates.io/crates/ractor). It processes receipts into RAVs (Receipt Aggregate Vouchers) and prepares them for redemption by the `indexer-agent`.
175175

176176
#### Key Features
177-
- **Receipt Processing:** Handles receipts stored by `indexer-service-rs`, performing aggregation and RAV generation.
178-
- **Concurrency Management:** Leverages the actor model to efficiently manage receipt processing tasks.
177+
1. **Receipt Processing:**
178+
- Receipts are fetched from the `receipts` table in the database using `pglisten`.
179+
- The actor system validates and processes receipts before aggregating them into RAVs.
180+
- Debug logs can be activated using `RUST_LOG=debug` to provide additional insights during the receipt lifecycle.
181+
182+
2. **Actor System:**
183+
- The TAP Agent operates using three main actor groups:
184+
- **SenderAccountManager:**
185+
- Monitors the indexer's escrow accounts.
186+
- Handles receipt routing to the appropriate `SenderAllocation`.
187+
- Kills the application if the database connection is lost.
188+
- **SenderAccount:**
189+
- Tracks receipts, pending RAVs, and invalid receipts across allocations.
190+
- Ensures the escrow account has sufficient funds to cover outstanding obligations.
191+
- Selects the next allocation for creating a RAV request and manages `SenderAllocation` actors.
192+
- **SenderAllocation:**
193+
- Represents a `(sender, allocation)` tuple.
194+
- Processes receipts and sends updated values to the `SenderAccount`.
195+
- Handles `TriggerRequest` messages to initiate RAV creation.
196+
197+
3. **RAV Workflow:**
198+
- Valid receipts are aggregated into RAVs, which replace older RAVs in the database.
199+
- Once an allocation is closed, the system creates a **Last RAV**, aggregating all receipts. This final RAV is marked as "Last" and prepared for redemption by the `indexer-agent`.
200+
201+
4. **Metrics and Monitoring:**
202+
- The TAP Agent exposes detailed metrics to monitor system behavior. Key metrics include:
203+
- **Unaggregated Receipts:** Ensure unaggregated receipts remain below the `max_willing_to_lose` value to prevent the sender from being denied.
204+
- **RAV Request Failures:** Monitor the rate of failed RAV requests, as repeated failures can disrupt aggregation.
205+
- Full details of all metrics can be found in the [Metrics Documentation](https://github.com/graphprotocol/indexer-rs/blob/gustavo/rebuild-documentation/docs/Metrics.md#tap-agent-metrics).
206+
- A Grafana dashboard is available to visualize system metrics and provide a clear overview of the TAP Agent's performance:
207+
- [Download Dashboard JSON](https://github.com/graphprotocol/indexer-rs/blob/gustavo/rebuild-documentation/docs/dashboard.json).
208+
209+
5. **Troubleshooting:**
210+
- If RAV requests fail or unaggregated receipts exceed the `max_willing_to_lose` limit:
211+
- Check the **RAV failure metrics**.
212+
- Review debug logs (`RUST_LOG=debug`) for additional context.
213+
- Use the Grafana dashboard to identify bottlenecks or failures in the actor system.
179214

180215

181216
## Crates

0 commit comments

Comments
 (0)