Skip to content

Commit

Permalink
fix(gorgone/mbi): add weekly and monthly centiles partitioning
Browse files Browse the repository at this point in the history
  • Loading branch information
cgagnaire authored and Evan-Adam committed Jul 9, 2024
1 parent bcbe894 commit e66eeec
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions gorgone/gorgone/modules/centreon/mbi/etl/perfdata/main.pm
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,30 @@ sub dailyProcessing {
]
};
}
if (defined($etl->{run}->{etlProperties}->{'centile.week'}) && $etl->{run}->{etlProperties}->{'centile.week'} eq '1') {
push @{$etl->{run}->{schedule}->{perfdata}->{stages}->[0]}, {
type => 'sql',
db => 'centstorage',
sql => [
[
'[PARTITIONS] Add partition [p' . $partName . '] on table [mod_bi_metriccentileweeklyvalue]',
"ALTER TABLE `mod_bi_metriccentileweeklyvalue` ADD PARTITION (PARTITION `p$partName` VALUES LESS THAN(" . $epoch . "))"
]
]
};
}
if (defined($etl->{run}->{etlProperties}->{'centile.month'}) && $etl->{run}->{etlProperties}->{'centile.month'} eq '1') {
push @{$etl->{run}->{schedule}->{perfdata}->{stages}->[0]}, {
type => 'sql',
db => 'centstorage',
sql => [
[
'[PARTITIONS] Add partition [p' . $partName . '] on table [mod_bi_metriccentilemonthlyvalue]',
"ALTER TABLE `mod_bi_metriccentilemonthlyvalue` ADD PARTITION (PARTITION `p$partName` VALUES LESS THAN(" . $epoch . "))"
]
]
};
}

# processing agregation by month. If the day is the first day of the month, also processing agregation by month
processDayAndMonthAgregation($etl, $liveServices, $start, $end);
Expand Down

0 comments on commit e66eeec

Please sign in to comment.