File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ export class ReportsExporter {
66 constructor ( ) {
77 this . bigquery = new BigQueryExport ( )
88 this . storage = new StorageExport ( )
9+ this . storagePath = 'reports/dev/' // TODO change to prod
910 }
1011
1112 // Export timeseries reports
1819FROM reports.${ metric } _timeseries
1920`
2021 const rows = await this . bigquery . queryResults ( query )
21- await this . storage . exportToJson ( rows , metric )
22+ await this . storage . exportToJson ( rows , ` ${ this . storagePath } ${ metric } .json` )
2223 }
2324
2425 // Export monthly histogram report
@@ -41,6 +42,10 @@ WHERE date = '${date}'
4142 return
4243 }
4344
45+ if ( exportData . lense && exportData . lense !== 'all' ) {
46+ this . storagePath = this . storagePath + `${ exportData . lense } /`
47+ }
48+
4449 if ( exportData . type === 'histogram' ) {
4550 await this . exportHistogram ( exportData )
4651 } else if ( exportData . type === 'timeseries' ) {
Original file line number Diff line number Diff line change @@ -7,16 +7,13 @@ const storage = new Storage()
77export class StorageExport {
88 constructor ( bucket = 'httparchive' ) {
99 this . bucket = bucket
10- this . storagePath = 'reports/dev/' // TODO change to prod
1110 this . stream = new Readable ( {
1211 objectMode : true ,
1312 read ( ) { }
1413 } )
1514 }
1615
1716 async exportToJson ( data , fileName ) {
18- fileName = this . storagePath + fileName + '.json'
19-
2017 const bucket = storage . bucket ( this . bucket )
2118 const file = bucket . file ( fileName )
2219
You can’t perform that action at this time.
0 commit comments