-
Notifications
You must be signed in to change notification settings - Fork 0
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
Upgrade report data pipelines #30
Changes from 5 commits
48a3b35
f752d9f
172e120
39ae950
eb76476
4a2d145
a8e2137
4250677
607c6b2
aba1af4
791c0e8
3fff267
3be0274
4c361a9
b804540
cc04bb6
9c8e567
45f1095
e38d4f0
1185758
9591bf0
4acdf05
9a1f13e
b2cd6b4
02d1db7
e090ebc
256fd88
c3f75d2
6ae6e72
537aa60
b5b625b
486ec2e
3fbf2bb
c34c57a
1db9ff6
f8bc51a
08d9fa6
1a2188d
0e11edf
65d310d
d46b68e
8d316ce
941e157
4b34849
dd38945
d64a316
73c3100
d786036
3d6657d
b4dd900
76b3d5f
0819a7b
eee1311
9b317ca
33df626
58b6c3c
da4718c
8e042a3
1a1caa6
7baa4df
687750a
d61666b
ab581df
2f5bed6
a78999b
85a5690
2d116dd
9fd868a
e859d29
0c81fb2
dbe38a1
dc5732e
ae875d9
a4eba5a
963ebfa
91822e1
e0de181
87909ef
24a9bac
ade5867
f2b56f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const configs = new reports.HTTPArchiveReports() | ||
const params = { | ||
date: constants.currentMonth, | ||
rankFilter: constants.devRankFilter | ||
} | ||
|
||
const metrics = configs.listMetrics() | ||
metrics.forEach(metric => { | ||
metric.SQL.forEach(sql => { | ||
publish(sql.type, { | ||
type: 'table', | ||
schema: 'reports', | ||
tags: ['crawl_reports'] | ||
}).query(ctx => constants.fillTemplate(sql.query, params)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In Currently it's configured to have a table per metric per chart type, e.g |
||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
const { config } = require('./reports_config') | ||
|
||
class HTTPArchiveReports { | ||
constructor () { | ||
this.config = config | ||
} | ||
|
||
listReports () { | ||
const reportIds = this.config._reports | ||
|
||
const reports = reportIds.map(reportId => { | ||
const report = this.getReport(reportId) | ||
return report | ||
}) | ||
|
||
console.log('reports', reports) | ||
|
||
return reports | ||
} | ||
|
||
getReport (reportId) { | ||
const report = this.config[reportId] | ||
return { | ||
id: reportId, | ||
...report | ||
} | ||
} | ||
|
||
listMetrics (reportId) { | ||
if (reportId === undefined) { | ||
const metrics = Object.keys(this.config._metrics).map(metricId => { | ||
const metric = this.getMetric(metricId) | ||
return metric | ||
}).filter(metric => metric.SQL) | ||
|
||
return metrics | ||
} else { | ||
const report = this.getReport(reportId) | ||
const metricIds = report.metrics | ||
|
||
const metrics = metricIds.map(metricId => { | ||
const metric = this.getMetric(metricId) | ||
return metric | ||
}).filter(metric => metric.SQL) | ||
|
||
return metrics | ||
} | ||
} | ||
|
||
getMetric (metricId) { | ||
const metric = this.config._metrics[metricId] | ||
|
||
return { | ||
id: metricId, | ||
...metric | ||
} | ||
} | ||
} | ||
|
||
module.exports = { | ||
HTTPArchiveReports | ||
} |
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.
Query parameters.
I found only
date
.Need to list all the required and add the queries to test them with.