Skip to content

Conversation

dmanc
Copy link
Contributor

@dmanc dmanc commented Jul 7, 2025

Why are these changes needed?

Will change base branch to master after #1709 is merged.

Reservation expiration tracking queries a subgraph to get the latests reservations for all accounts. The metrics are updated on every scrape to the /metrics endpoint.

Sample output on Sepolia

# HELP eigenda_reservation_time_until_expiry_seconds Time until reservation expiration in seconds
# TYPE eigenda_reservation_time_until_expiry_seconds gauge
eigenda_reservation_time_until_expiry_seconds{account="0x41fa832fad553c3b92976344d44b3548517679ac"} 9.88159285152387e+08
eigenda_reservation_time_until_expiry_seconds{account="0x7ccfa1e81b8d1d85552e860a3f3f63c94bd58259"} 2.3241885152387e+07
eigenda_reservation_time_until_expiry_seconds{account="0xae2c15d8354d14c05fe38733bd33ddeb00ab71ed"} 9.222690152387e+06
eigenda_reservation_time_until_expiry_seconds{account="0xc212b67c76586979cd736ea3e9738bb7bbf01b04"} 9.242137152387e+06
eigenda_reservation_time_until_expiry_seconds{account="0xcd1161b78f01da838ce0d42ec750891ec8708f1d"} 9.242137152387e+06
eigenda_reservation_time_until_expiry_seconds{account="0xd9309b3cf1b7dbf59f53461c2a66e2783dd1766f"} 5.012028152387e+06
eigenda_reservation_time_until_expiry_seconds{account="0xe25c3dec16f989793d230dc48c17388d53b4ac6e"} 2.3241885152387e+07
# HELP eigenda_reservations_active Number of active reservations
# TYPE eigenda_reservations_active gauge
eigenda_reservations_active 7

Checks

  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • I've checked the new test coverage and the coverage percentage didn't drop.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

@dmanc dmanc requested review from pschork and samlaf July 7, 2025 22:30
@dmanc dmanc changed the title Add reservations expiration tracking to DataAPI feat: Add reservations expiration tracking to DataAPI Jul 7, 2025
pschork
pschork previously approved these changes Jul 7, 2025
@@ -97,6 +98,10 @@ type (
// The operatorIds of nonsigners for the batch.
NonSigners []string
}
Reservation struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also throw reservation symbols in here? Would allow us to monitor total allocated capacity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup I can add that

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. How are the metrics meant to be used? I'm assuming this is purely for us internally to add grafana alerts when a reservation is about to expire?

Would we ever want to expose reservations info on the blob explorer? If so then we might as well read all the info exposed per reservation by the contract/subgraph?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First use case is for reservation expiration tracking internally but we can extend the scope to any blob explorer requirements in future PRs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 76 to 83
//We need the socket address of the subgraph payments api to pull the subgraph data from.
Usage: "the socket address of the subgraph payments api",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this really a socket address? aka ip:port? Or is it a full URL with http endpoint mapping to specific satsuma resource?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just a full URL of an http endpoint

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to do in this PR but austin has raised this in the past and I agree, "socket address" typically mans "ip:port" pair. At least in offchain code/comments we should mention its a full URL
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all we need to do here is change the usage text for these subgraph flags to
Usage: "the URL of the subgraph payments api", and we're golden.
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -97,6 +98,10 @@ type (
// The operatorIds of nonsigners for the batch.
NonSigners []string
}
Reservation struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. How are the metrics meant to be used? I'm assuming this is purely for us internally to add grafana alerts when a reservation is about to expire?

Would we ever want to expose reservations info on the blob explorer? If so then we might as well read all the info exposed per reservation by the contract/subgraph?

@@ -77,7 +77,7 @@ func RunScan(ctx *cli.Context) error {
if chainState == nil {
return errors.New("failed to create chain state")
}
subgraphApi := subgraph.NewApi(config.SubgraphEndpoint, config.SubgraphEndpoint)
subgraphApi := subgraph.NewApi(config.SubgraphEndpoint, config.SubgraphEndpoint, config.SubgraphEndpoint)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of shows that the NewApi config/constructor is generic for no reasons. Are there ever cases where the different subgraphs don't use the same endpoint? This looks weird that we're just passing the same endpoint 3 times. If we don't ever need the different subgraphs to have different endpoints, then prob best to consolidate them into a single endpoint field like in this config

Copy link
Contributor Author

@dmanc dmanc Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was weird when I saw it but seems like this specific ejection tool thing only needs the middle one but this object needs all three. Open to suggestions on refactoring but feel like it's gonna be a big change.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I see. Fine with just adding a comment then.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea the ejection tool is my work. Passing duplicate urls is a hack since NewApi is an abstraction over multiple subgraph clients (ejection only needs one) and I didn't want to justify yak shaving a refactor of 2yo code assumptions built for dependency injection because some esoteric ejection reporting tool needed to call a subgraph 💀

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm totally fine with these decisions, just think they should be documented in the code itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Base automatically changed from payments-subgraph to master July 8, 2025 20:09
@dmanc dmanc dismissed pschork’s stale review July 8, 2025 20:09

The base branch was changed.

@dmanc dmanc force-pushed the dataapi-reservations branch from 3545ebd to d5efc06 Compare July 9, 2025 23:01
@dmanc dmanc marked this pull request as ready for review July 19, 2025 01:41
@dmanc dmanc requested review from samlaf and pschork July 19, 2025 01:42
samlaf
samlaf previously approved these changes Jul 19, 2025
pschork
pschork previously approved these changes Jul 19, 2025
Comment on lines 76 to 83
//We need the socket address of the subgraph payments api to pull the subgraph data from.
Usage: "the socket address of the subgraph payments api",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all we need to do here is change the usage text for these subgraph flags to
Usage: "the URL of the subgraph payments api", and we're golden.
image

@@ -77,7 +77,7 @@ func RunScan(ctx *cli.Context) error {
if chainState == nil {
return errors.New("failed to create chain state")
}
subgraphApi := subgraph.NewApi(config.SubgraphEndpoint, config.SubgraphEndpoint)
subgraphApi := subgraph.NewApi(config.SubgraphEndpoint, config.SubgraphEndpoint, config.SubgraphEndpoint)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea the ejection tool is my work. Passing duplicate urls is a hack since NewApi is an abstraction over multiple subgraph clients (ejection only needs one) and I didn't want to justify yak shaving a refactor of 2yo code assumptions built for dependency injection because some esoteric ejection reporting tool needed to call a subgraph 💀

@dmanc dmanc dismissed stale reviews from pschork and samlaf via 390aaeb July 22, 2025 04:36
@dmanc dmanc merged commit 9a95396 into master Jul 22, 2025
18 of 19 checks passed
@dmanc dmanc deleted the dataapi-reservations branch July 22, 2025 04:57
pakim249CAL pushed a commit that referenced this pull request Jul 22, 2025
* Initialize subgraph

* Initialize subgraph

* Initialize subgraph

* Save payment subgraph state

* fix

* Add reservation collector to dataapi

* Add query examples + more test coverage

* Remove docker compose

* Add scripts for updating abi and adds a CI check when subgraph tests run

* fix flags

* fix lint error

* Fix rebase issues

* Inject the registry

* wrap errors

* expose more info from reservation data

* fmt

* rename updateCounts to updateMetrics

* Document subgraph.NewApi in ejections tool
pakim249CAL pushed a commit that referenced this pull request Jul 23, 2025
* Initialize subgraph

* Initialize subgraph

* Initialize subgraph

* Save payment subgraph state

* fix

* Add reservation collector to dataapi

* Add query examples + more test coverage

* Remove docker compose

* Add scripts for updating abi and adds a CI check when subgraph tests run

* fix flags

* fix lint error

* Fix rebase issues

* Inject the registry

* wrap errors

* expose more info from reservation data

* fmt

* rename updateCounts to updateMetrics

* Document subgraph.NewApi in ejections tool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants