Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implements backoff delay in usage counters service #206363

Merged
Merged
Prev Previous commit
Next Next commit
backoff delay as exported const
  • Loading branch information
TinaHeiligers committed Jan 15, 2025
commit 4411951f571bc22629ed8160b2f979ac3e633bc0
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
export const KIBANA_STATS_TYPE = 'kibana_stats';
export const DEFAULT_MAXIMUM_WAIT_TIME_FOR_ALL_COLLECTORS_IN_S = 1;
export const MAIN_APP_DEFAULT_VIEW_ID = 'main';
export const USAGE_COUNTERS_BACKOFF_DELAY_IN_MS = 50;
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
} from './saved_objects';
import { registerUsageCountersRollups } from './rollups';
import { searchUsageCounters } from './search';
import { USAGE_COUNTERS_BACKOFF_DELAY_IN_MS } from '../../common/constants';

interface UsageCountersLogMeta extends LogMeta {
kibana: { usageCounters: { results: unknown[] } };
Expand Down Expand Up @@ -159,7 +160,8 @@ export class UsageCountersService {
};
};

private backoffDelay = (attempt: number) => Math.pow(2, attempt) * 50; // exponential backoff: 20ms, 40ms, 80ms, 150ms etc
private backoffDelay = (attempt: number) =>
Math.pow(2, attempt) * USAGE_COUNTERS_BACKOFF_DELAY_IN_MS; // exponential backoff: 50ms, 100ms, 200ms

private storeDate$(
counters: UsageCounters.v1.CounterMetric[],
Expand Down