@@ -108,12 +108,8 @@ export function backendAnalytics(scope: Construct, name: (name: string) => strin
108108 type : 'string' ,
109109 } ,
110110 {
111- name : 'year' ,
112- type : 'int' ,
113- } ,
114- {
115- name : 'month' ,
116- type : 'int' ,
111+ name : 'page_opened_at_date' ,
112+ type : 'string' ,
117113 } ,
118114 ] ,
119115 storageDescriptor : {
@@ -128,7 +124,9 @@ export function backendAnalytics(scope: Construct, name: (name: string) => strin
128124 } ,
129125 parameters : {
130126 'storage.location.template' :
131- 's3://' + analyticsBucket . bucketName + '/page_views/site=${site}/year=${year}/month=${month}' ,
127+ 's3://' +
128+ analyticsBucket . bucketName +
129+ '/page_views/site=${site}/page_opened_at_date=${page_opened_at_date}' ,
132130 } ,
133131 columns : [
134132 {
@@ -207,12 +205,11 @@ export function backendAnalytics(scope: Construct, name: (name: string) => strin
207205 } ,
208206 parameters : {
209207 'projection.enabled' : 'true' ,
210- 'projection.year.type' : 'integer' ,
211- 'projection.year.range' : '2023,3023' ,
212- 'projection.year.interval' : '1' ,
213- 'projection.month.type' : 'integer' ,
214- 'projection.month.range' : '1,12' ,
215- 'projection.month.interval' : '1' ,
208+ 'projection.page_opened_at_date.type' : 'date' ,
209+ 'projection.page_opened_at_date.format' : 'yyyy-MM-dd' ,
210+ 'projection.page_opened_at_date.interval' : '1' ,
211+ 'projection.page_opened_at_date.interval.unit' : 'DAYS' ,
212+ 'projection.page_opened_at_date.range' : '2023-01-01,NOW' ,
216213 'projection.site.type' : 'enum' ,
217214 'projection.site.values' : props . sites . join ( ',' ) ,
218215 } ,
@@ -231,7 +228,7 @@ export function backendAnalytics(scope: Construct, name: (name: string) => strin
231228 bucketArn : analyticsBucket . bucketArn ,
232229 roleArn : firehoseDeliveryRole . roleArn ,
233230 prefix :
234- 'page_views/site=!{partitionKeyFromQuery:site}/year =!{partitionKeyFromQuery:year}/month=!{partitionKeyFromQuery:month }/' ,
231+ 'page_views/site=!{partitionKeyFromQuery:site}/page_opened_at_date =!{partitionKeyFromQuery:page_opened_at_date }/' ,
235232 errorOutputPrefix : 'error/!{firehose:error-output-type}/' ,
236233 bufferingHints : {
237234 intervalInSeconds : props . firehoseBufferInterval ?? defaultFirehoseBufferInterval ,
@@ -250,7 +247,7 @@ export function backendAnalytics(scope: Construct, name: (name: string) => strin
250247 parameters : [
251248 {
252249 parameterName : 'MetadataExtractionQuery' ,
253- parameterValue : '{site: .site,' + ' year : .year,' + ' month: .month }',
250+ parameterValue : '{site: .site, page_opened_at_date : .page_opened_at_date }' ,
254251 } ,
255252 //Required as property it seems
256253 {
0 commit comments