File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
webapps/console/pages/api/admin Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ export default createRoute()
29
29
log . atInfo ( ) . log ( `Trimming events log` ) ;
30
30
const metricsSchema =
31
31
process . env . CLICKHOUSE_METRICS_SCHEMA || process . env . CLICKHOUSE_DATABASE || "newjitsu_metrics" ;
32
- const clickhouseCluster = process . env . CLICKHOUSE_CLUSTER || "jitsu_cluster" ;
32
+ const metricsCluster = process . env . CLICKHOUSE_METRICS_CLUSTER || process . env . CLICKHOUSE_CLUSTER ;
33
+ const onCluster = metricsCluster ? ` ON CLUSTER ${ metricsCluster } ` : "" ;
33
34
const eventsLogSize = process . env . EVENTS_LOG_SIZE ? parseInt ( process . env . EVENTS_LOG_SIZE ) : 200000 ;
34
35
// trim logs to eventsLogSize only after exceeding threshold
35
36
const thresholdSize = Math . floor ( eventsLogSize * 1.25 ) ;
@@ -49,7 +50,7 @@ export default createRoute()
49
50
and
50
51
timestamp
51
52
< {timestamp :DateTime64};` ;
52
- const dropPartitionQuery : string = `alter table ${ metricsSchema } .events_log on cluster ${ clickhouseCluster } drop partition {partition:String}` ;
53
+ const dropPartitionQuery : string = `alter table ${ metricsSchema } .events_log ${ onCluster } drop partition {partition:String}` ;
53
54
const result : any [ ] = [ ] ;
54
55
const sw = stopwatch ( ) ;
55
56
let actorsResult : any = { } ;
@@ -149,7 +150,7 @@ export default createRoute()
149
150
} ) ;
150
151
log . atInfo ( ) . log ( `Deleted partition ${ oldPartition } ` ) ;
151
152
} catch ( e : any ) {
152
- log . atError ( ) . withCause ( e ) . log ( `Failed to delete partition ${ oldPartition } ` ) ;
153
+ log . atDebug ( ) . withCause ( e ) . log ( `Failed to delete partition ${ oldPartition } ` ) ;
153
154
}
154
155
log . atInfo ( ) . log ( `Completed in ${ sw . elapsedPretty ( ) } ` ) ;
155
156
if ( admin ) {
You can’t perform that action at this time.
0 commit comments