@@ -4,7 +4,7 @@ const metrics = configs.listMetrics()
44const bucket = 'httparchive'
55const storagePath = '/reports/'
66
7- function generateExportQuery ( metric , sql , params , ctx ) {
7+ function generateExportQuery ( metric , sql , params , ctx ) {
88 if ( sql . type === 'histogram' ) {
99 return `
1010SELECT
@@ -18,12 +18,13 @@ SELECT
1818 FORMAT_DATE('%Y_%m_%d', date) AS date,
1919 * EXCEPT(date)
2020FROM reports.${ metric } _timeseries
21- ` } else {
21+ `
22+ } else {
2223 throw new Error ( 'Unknown SQL type' )
2324 }
2425}
2526
26- function generateExportPath ( metric , sql , params ) {
27+ function generateExportPath ( metric , sql , params ) {
2728 if ( sql . type === 'histogram' ) {
2829 return `${ storagePath } ${ params . date . replaceAll ( '-' , '_' ) } /${ metric } .json`
2930 } else if ( sql . type === 'timeseries' ) {
@@ -35,9 +36,9 @@ function generateExportPath(metric, sql, params) {
3536
3637const iterations = [ ]
3738for (
38- let date = constants . currentMonth ; month >= constants . currentMonth ; month = constants . fnPastMonth ( month ) ) {
39+ let date = constants . currentMonth ; date >= constants . currentMonth ; date = constants . fnPastMonth ( date ) ) {
3940 iterations . push ( {
40- date : date
41+ date
4142 } )
4243}
4344
@@ -49,8 +50,8 @@ if (iterations.length === 1) {
4950 type : 'incremental' ,
5051 protected : true ,
5152 bigquery : sql . type === 'histogram' ? { partitionBy : 'date' , clusterBy : [ 'client' ] } : { } ,
52- schema : 'reports' ,
53- //tags: ['crawl_complete', 'http_reports']
53+ schema : 'reports'
54+ // tags: ['crawl_complete', 'http_reports']
5455 } ) . preOps ( ctx => `
5556--DELETE FROM ${ ctx . self ( ) }
5657--WHERE date = '${ params . date } ';
7677 metrics . forEach ( metric => {
7778 metric . SQL . forEach ( sql => {
7879 operate ( metric . id + '_' + sql . type + '_' + params . date , {
79- //tags: ['crawl_complete']
80+ // tags: ['crawl_complete']
8081 } ) . queries ( ctx => `
8182DELETE FROM reports.${ metric . id } _${ sql . type }
8283WHERE date = '${ params . date } ';
0 commit comments