Skip to content

Commit

Permalink
Improve log threshold alert factory argument order
Browse files Browse the repository at this point in the history
  • Loading branch information
weltenwort committed Jul 22, 2021
1 parent 1a7469f commit 5ea5961
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ type LogThresholdAlertInstance = AlertInstance<
type LogThresholdAlertInstanceFactory = (
id: string,
reason: string,
threshold: number,
value: number
value: number,
threshold: number
) => LogThresholdAlertInstance;

const COMPOSITE_GROUP_SIZE = 2000;
Expand Down Expand Up @@ -96,7 +96,7 @@ export const createLogThresholdExecutor = (libs: InfraBackendLibs) =>
>(async ({ services, params }) => {
const { alertWithLifecycle, savedObjectsClient, scopedClusterClient } = services;
const { sources } = libs;
const alertInstanceFactory: LogThresholdAlertInstanceFactory = (id, reason, threshold, value) =>
const alertInstanceFactory: LogThresholdAlertInstanceFactory = (id, reason, value, threshold) =>
alertWithLifecycle({
id,
fields: {
Expand Down Expand Up @@ -251,8 +251,8 @@ export const processUngroupedResults = (
const alertInstance = alertInstanceFactory(
UNGROUPED_FACTORY_KEY,
getReasonMessageForUngroupedCountAlert(documentCount, count.value, count.comparator),
count.value,
documentCount
documentCount,
count.value
);
alertInstaceUpdater(alertInstance, AlertStates.ALERT, [
{
Expand Down Expand Up @@ -285,8 +285,8 @@ export const processUngroupedRatioResults = (
const alertInstance = alertInstanceFactory(
UNGROUPED_FACTORY_KEY,
getReasonMessageForUngroupedRatioAlert(ratio, count.value, count.comparator),
count.value,
ratio
ratio,
count.value
);
alertInstaceUpdater(alertInstance, AlertStates.ALERT, [
{
Expand Down Expand Up @@ -364,8 +364,8 @@ export const processGroupByResults = (
count.comparator,
group.name
),
count.value,
documentCount
documentCount,
count.value
);
alertInstaceUpdater(alertInstance, AlertStates.ALERT, [
{
Expand Down Expand Up @@ -415,8 +415,8 @@ export const processGroupByRatioResults = (
count.comparator,
numeratorGroup.name
),
count.value,
ratio
ratio,
count.value
);
alertInstaceUpdater(alertInstance, AlertStates.ALERT, [
{
Expand Down

0 comments on commit 5ea5961

Please sign in to comment.