in common/lib/plugins/efm/monitor_service.ts [65:106]
async startMonitoring(
clientToAbort: ClientWrapper,
hostKeys: Set<string>,
hostInfo: HostInfo,
properties: Map<string, any>,
failureDetectionTimeMillis: number,
failureDetectionIntervalMillis: number,
failureDetectionCount: number
): Promise<MonitorConnectionContext> {
if (hostKeys.size === 0) {
throw new IllegalArgumentError(Messages.get("MonitorService.emptyAliasSet", hostInfo.host));
}
let monitor: Monitor | null = this.cachedMonitorRef?.deref() ?? null;
if (!monitor || (monitor && monitor.isStopped()) || this.cachedMonitorHostKeys?.size === 0 || this.cachedMonitorHostKeys !== hostKeys) {
monitor = await this.getMonitor(hostKeys, hostInfo, properties);
if (monitor) {
this.cachedMonitorRef = new WeakRef(monitor);
this.cachedMonitorHostKeys = hostKeys;
}
}
const telemetryFactory = this.pluginService.getTelemetryFactory();
const abortedConnectionsCounter = telemetryFactory.createCounter("efm.connections.aborted");
if (monitor) {
const context = new MonitorConnectionContext(
monitor,
clientToAbort,
failureDetectionTimeMillis,
failureDetectionIntervalMillis,
failureDetectionCount,
this.pluginService,
abortedConnectionsCounter
);
monitor.startMonitoring(context);
return context;
}
throw new AwsWrapperError(Messages.get("MonitorService.startMonitoringNullMonitor", hostInfo.host));
}