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 cargo metric statements and dummy data inserts for testing … #1835

Merged
merged 14 commits into from
Apr 27, 2022

Conversation

dashcraft
Copy link
Contributor

@dashcraft dashcraft commented Apr 16, 2022

Adds cargo metrics/metrics_log remote schema to the application.
Adds the cargo schema to the postgrest schema list for access.
Adds query to find necessary data for diffing.
Adds some generic seed data for populating local database.

Updates frontend to support new dag filecoine deals bytes growth rate week over week.

NOTE: This needs deploy of #1799

Will resolve following issues:
#1783
#1784
#1786
#1800

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Apr 17, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: c3b19a0
Status: ✅  Deploy successful!
Preview URL: https://11940d6f.nft-storage-1at.pages.dev

View logs

@@ -9,7 +9,7 @@ services:
- 3000:3000/tcp
environment:
PGRST_DB_URI: postgres://postgres:postgres@db:5432/postgres
PGRST_DB_SCHEMA: public
PGRST_DB_SCHEMAS: public,cargo
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is so we can query the cargo schema through postgrest


return data.reduce((obj, curr) => {
const dagByteSizeHistory = metricsLogQuery
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These should return a promise, that we can then pass into promise.all


// Simple splatting of the metrics from first query
if (primaryMetrics && primaryMetrics.length) {
for (const metric of primaryMetrics) {
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 could also use .map to transform this, this felt better with the checks for existence than using object.keys.map.


it('should return proper response for cid v1', async () => {
const demoData = {
deals_size_total: 169389985753391,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are taken directly from hard coded seed data inside of the cargo.testing.sql file

@JeffLowe JeffLowe requested a review from alanshaw April 18, 2022 13:03
packages/api/db/cargo.testing.sql Outdated Show resolved Hide resolved
packages/api/src/routes/metrics.js Outdated Show resolved Hide resolved
packages/api/src/utils/db-client.js Outdated Show resolved Hide resolved
packages/api/src/utils/db-client.js Outdated Show resolved Hide resolved
packages/api/src/utils/db-client.js Show resolved Hide resolved
packages/api/src/utils/db-client.js Outdated Show resolved Hide resolved
packages/api/src/utils/db-client.js Outdated Show resolved Hide resolved
packages/api/src/utils/db-client.js Outdated Show resolved Hide resolved
packages/api/src/utils/db-client.js Outdated Show resolved Hide resolved
packages/api/test/stats-get.spec.js Outdated Show resolved Hide resolved
@dashcraft dashcraft requested a review from alanshaw April 19, 2022 23:19
packages/api/src/utils/db-client.js Outdated Show resolved Hide resolved
packages/api/src/utils/db-client.js Outdated Show resolved Hide resolved
packages/api/src/utils/db-client.js Outdated Show resolved Hide resolved
packages/api/src/utils/db-client.js Outdated Show resolved Hide resolved
packages/api/src/utils/db-client.js Outdated Show resolved Hide resolved
packages/api/src/utils/db-client.js Outdated Show resolved Hide resolved
@dashcraft dashcraft requested a review from alanshaw April 21, 2022 14:02
@JeffLowe
Copy link
Contributor

@alanshaw can we get a review of this please.

packages/api/db/cargo.testing.sql Outdated Show resolved Hide resolved
packages/api/src/utils/db-client.js Outdated Show resolved Hide resolved
@dashcraft dashcraft force-pushed the feat/stats-dag-updates branch from d5209e7 to c3b19a0 Compare April 27, 2022 13:18
@codecov-commenter
Copy link

Codecov Report

Merging #1835 (c3b19a0) into main (c13c4aa) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##              main     #1835   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines         1242      1242           
=========================================
  Hits          1242      1242           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 97b680d...c3b19a0. Read the comment docs.

@dashcraft dashcraft merged commit 72480d6 into main Apr 27, 2022
@dashcraft dashcraft deleted the feat/stats-dag-updates branch April 27, 2022 16:31
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.

4 participants