-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: gateway tracking requested cids in database #1386
feat: gateway tracking requested cids in database #1386
Conversation
Deploying with Cloudflare Pages
|
ed439c0
to
cdcbf74
Compare
|
||
/** | ||
* Durable Object for keeping summary metrics of gateway.nft.storage | ||
*/ | ||
export class SummaryMetrics0 { | ||
constructor(state) { | ||
this.state = state | ||
// @ts-ignore we don't need token just for check | ||
this.nftStorageClient = new NFTStorage({}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For just check, we don't need a token, while it is "required" in NFTstorage (but param called option)
@hugomrdias should we make it optional in the types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes we should, but here if you just use it for check call might be better to not include the client.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean, just HTTP the endpoint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, I agree, if we just want to hit the public check endpoint, maybe just add a helper function around a fetch
cdcbf74
to
2c437ae
Compare
notable that this PR is the only thing that ties the gateway impl to nftstorage. It would be neat to have a generic "racing gateway proxy" that anyone could deploy, and then have some mechinism for adding extra metrics for a given deployment. We might want to reuse this for a web3.storage gateway |
We can have a check endpoint ENV Var to have this generic |
Closing this and we will track on issue nftstorage/nftstorage.link#14 how to gather this |
This PR adds metrics tracking whether content was stored in NFT.storage and its Pinning status characteristics. It uses nft.storage client to check the state of the content. We could go through the route of directly connecting to the DB here, but as we do this in the waitUntil it seems cleaner to rely on the client (specially as we can't access replica directly).
Prometheus metrics to be consumed are as follows:
Follow up work (will create issue):
Should use #1391 cache in check endpoint
Closes nftstorage/nftstorage.link#14