-
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
fix: metrics #1051
fix: metrics #1051
Conversation
Deploying with Cloudflare Pages
|
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.
LGTM overall
Minor details commented inline
@@ -14,6 +14,7 @@ export async function dbTypesCmd() { | |||
|
|||
try { | |||
await dbSqlCmd({ cargo: true, testing: true }) | |||
await delay(2000) |
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.
Is there a reason for this?
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 I was getting a socket hangup error. I think because the new postgrest version restarts itself when changes are made. It just needs a second or two to come back.
packages/api/src/routes/metrics.js
Outdated
) | ||
return { totals: Object.assign({}, ...totals) } | ||
} | ||
const UPLOAD_TYPES = ['Car', 'Blob', 'Multipart', 'Remote', 'Nft'] |
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.
nit: it would be great to have these in a single place. Currently, we have them at list here and in the cron code. This might be error prone in the case of a new PinService, or type of upload as we can forget to update the other side.
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.
We already do this in the cron package:
import { DBClient } from '../../../api/src/utils/db-client.js'
So I think should be ok to import them...
await pg.query(UPDATE_METRIC, [metric.name, metric.value]) | ||
} | ||
|
||
if (error) throw error |
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.
Good call that we update what we can and only error in the end. We still need to create an issue to integrate these errors with an alert system.
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.
I saw this in the pins job
nft.storage/.github/workflows/cron-pins.yml
Lines 35 to 37 in 20ee0b6
- name: Heartbeat | |
if: ${{ success() }} | |
run: ./packages/tools/cli.js heartbeat --token ${{ secrets.OPSGENIE_KEY }} --name cron-nft-pins |
Is that what we want @hugomrdias?
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.
Oh yes, I think that's it. Not sure if we need any config in the expected opsgenie heartbeat timings
Co-authored-by: Vasco Santos <santos.vasco10@gmail.com>
This PR:
metric
/metrics
endpoint to query themetric
table for the latest value