UNPKG

3.19 kBTypeScriptView Raw
1import { ChannelOptions } from './channel-options';
2import { Duration } from './duration';
3import { ChannelControlHelper } from './experimental';
4import { LoadBalancer, TypedLoadBalancingConfig } from './load-balancer';
5import { Endpoint } from './subchannel-address';
6import { LoadBalancingConfig } from './service-config';
7import { ChannelCredentials } from './channel-credentials';
8export interface SuccessRateEjectionConfig {
9 readonly stdev_factor: number;
10 readonly enforcement_percentage: number;
11 readonly minimum_hosts: number;
12 readonly request_volume: number;
13}
14export interface FailurePercentageEjectionConfig {
15 readonly threshold: number;
16 readonly enforcement_percentage: number;
17 readonly minimum_hosts: number;
18 readonly request_volume: number;
19}
20export interface OutlierDetectionRawConfig {
21 interval?: Duration;
22 base_ejection_time?: Duration;
23 max_ejection_time?: Duration;
24 max_ejection_percent?: number;
25 success_rate_ejection?: Partial<SuccessRateEjectionConfig>;
26 failure_percentage_ejection?: Partial<FailurePercentageEjectionConfig>;
27 child_policy: LoadBalancingConfig[];
28}
29export declare class OutlierDetectionLoadBalancingConfig implements TypedLoadBalancingConfig {
30 private readonly childPolicy;
31 private readonly intervalMs;
32 private readonly baseEjectionTimeMs;
33 private readonly maxEjectionTimeMs;
34 private readonly maxEjectionPercent;
35 private readonly successRateEjection;
36 private readonly failurePercentageEjection;
37 constructor(intervalMs: number | null, baseEjectionTimeMs: number | null, maxEjectionTimeMs: number | null, maxEjectionPercent: number | null, successRateEjection: Partial<SuccessRateEjectionConfig> | null, failurePercentageEjection: Partial<FailurePercentageEjectionConfig> | null, childPolicy: TypedLoadBalancingConfig);
38 getLoadBalancerName(): string;
39 toJsonObject(): object;
40 getIntervalMs(): number;
41 getBaseEjectionTimeMs(): number;
42 getMaxEjectionTimeMs(): number;
43 getMaxEjectionPercent(): number;
44 getSuccessRateEjectionConfig(): SuccessRateEjectionConfig | null;
45 getFailurePercentageEjectionConfig(): FailurePercentageEjectionConfig | null;
46 getChildPolicy(): TypedLoadBalancingConfig;
47 static createFromJson(obj: any): OutlierDetectionLoadBalancingConfig;
48}
49export declare class OutlierDetectionLoadBalancer implements LoadBalancer {
50 private childBalancer;
51 private entryMap;
52 private latestConfig;
53 private ejectionTimer;
54 private timerStartTime;
55 constructor(channelControlHelper: ChannelControlHelper, credentials: ChannelCredentials, options: ChannelOptions);
56 private isCountingEnabled;
57 private getCurrentEjectionPercent;
58 private runSuccessRateCheck;
59 private runFailurePercentageCheck;
60 private eject;
61 private uneject;
62 private switchAllBuckets;
63 private startTimer;
64 private runChecks;
65 updateAddressList(endpointList: Endpoint[], lbConfig: TypedLoadBalancingConfig, attributes: {
66 [key: string]: unknown;
67 }): void;
68 exitIdle(): void;
69 resetBackoff(): void;
70 destroy(): void;
71 getTypeName(): string;
72}
73export declare function setup(): void;