Skip to content
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: add prom metrics endpoint generated from postgres data #495

Merged
merged 2 commits into from
Oct 4, 2021

Conversation

alanshaw
Copy link
Contributor

Not exporting byte totals anymore as these can come from dagcargo.

Have split upload totals out by type.

Have split pin totals by service and status (as opposed to just status).

Example output:

# HELP nftstorage_users_total Total users registered.
# TYPE nftstorage_users_total counter
nftstorage_users_total 1
# HELP nftstorage_uploads_total Total number of Car uploads.
# TYPE nftstorage_uploads_total counter
nftstorage_uploads_total{type:"Car"} 0
# HELP nftstorage_uploads_total Total number of Blob uploads.
# TYPE nftstorage_uploads_total counter
nftstorage_uploads_total{type:"Blob"} 0
# HELP nftstorage_uploads_total Total number of Multipart uploads.
# TYPE nftstorage_uploads_total counter
nftstorage_uploads_total{type:"Multipart"} 0
# HELP nftstorage_uploads_total Total number of Remote uploads.
# TYPE nftstorage_uploads_total counter
nftstorage_uploads_total{type:"Remote"} 0
# HELP nftstorage_uploads_total Total number of Nft uploads.
# TYPE nftstorage_uploads_total counter
nftstorage_uploads_total{type:"Nft"} 0
# HELP nftstorage_pins_total Total number of Pinata pins that are PinQueued.
# TYPE nftstorage_pins_total counter
nftstorage_pins_total{service:"Pinata",status:"PinQueued"} 0
# HELP nftstorage_pins_total Total number of Pinata pins that are Pinning.
# TYPE nftstorage_pins_total counter
nftstorage_pins_total{service:"Pinata",status:"Pinning"} 0
# HELP nftstorage_pins_total Total number of Pinata pins that are Pinned.
# TYPE nftstorage_pins_total counter
nftstorage_pins_total{service:"Pinata",status:"Pinned"} 0
# HELP nftstorage_pins_total Total number of Pinata pins that are PinError.
# TYPE nftstorage_pins_total counter
nftstorage_pins_total{service:"Pinata",status:"PinError"} 0
# HELP nftstorage_pins_total Total number of IpfsCluster pins that are PinQueued.
# TYPE nftstorage_pins_total counter
nftstorage_pins_total{service:"IpfsCluster",status:"PinQueued"} 0
# HELP nftstorage_pins_total Total number of IpfsCluster pins that are Pinning.
# TYPE nftstorage_pins_total counter
nftstorage_pins_total{service:"IpfsCluster",status:"Pinning"} 0
# HELP nftstorage_pins_total Total number of IpfsCluster pins that are Pinned.
# TYPE nftstorage_pins_total counter
nftstorage_pins_total{service:"IpfsCluster",status:"Pinned"} 0
# HELP nftstorage_pins_total Total number of IpfsCluster pins that are PinError.
# TYPE nftstorage_pins_total counter
nftstorage_pins_total{service:"IpfsCluster",status:"PinError"} 0

@alanshaw alanshaw requested a review from hugomrdias September 30, 2021 15:54
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 30, 2021

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: dfa3313
Status: ✅  Deploy successful!
Preview URL: https://b5ab7477.nft-storage.pages.dev

View logs

@alanshaw alanshaw mentioned this pull request Sep 30, 2021
19 tasks

export async function getUserMetrics() {
const query = db.client.from('account')
const res = await query.select('*', { head: true, count: 'exact' })
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need the count to be exact ? maybe we should measure how long does the other modes take with a full db

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think for users it is fine for now but I was thinking the same thing for uploads. Lets see how long it takes and we can switch to fuzzy count if problematic.

@alanshaw alanshaw force-pushed the feat/postgres-metrics branch from 8078af2 to 567aaca Compare October 4, 2021 12:01
@alanshaw alanshaw merged commit a99df3d into main Oct 4, 2021
@alanshaw alanshaw deleted the feat/postgres-metrics branch October 4, 2021 12:24
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.

2 participants