Skip to content

chore: refactor efm plugins#662

Open
karenc-bq wants to merge 1 commit into
chore/remove-aliasesfrom
refactor/monitor-service
Open

chore: refactor efm plugins#662
karenc-bq wants to merge 1 commit into
chore/remove-aliasesfrom
refactor/monitor-service

Conversation

@karenc-bq

Copy link
Copy Markdown
Contributor

Summary

  • Refactor EFM plugins to use Monitor Service to manage monitors

Description

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@karenc-bq karenc-bq requested a review from a team as a code owner June 22, 2026 21:41
/*
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

monitor_connection_context.test.ts might need some updates too. could also be a good place to add tests for ContextPoolImpl, HostMonitorImpl, ConnectionContextImpl

.catch((error: any) => {
throw error;
});
const raceResult = await Promise.race([this.waitForUnhealthy(context), methodFunc()]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does race ensure that we cancel or clean up the one that does not finish first? or are we relying on stop monitoring to kill anything eventually?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waitForUnhealthy should complete on its own eventually and the finally block should clean up methodFunc

export interface ConnectionContext {
readonly failureDetectionIntervalMillis: number;
readonly failureDetectionCount: number;
readonly expectedActiveMonitoringStartTimeNano: number;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we put nano times as bigint in the other parts of the wrapper

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The util method getCurrentTimeNano returns the current nanos as a Number.
I will create a separate PR going over all the nano variables in the codebase and make it consistent.

Comment thread common/lib/plugins/efm/base/host_monitor.ts
Comment thread common/lib/plugins/efm/base/host_monitor.ts
/**
* Manages active and pending monitoring contexts grouped by host.
*/
export interface ContextPool {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm curious if this is as needed for node, as node is single threaded it shouldn't have the same concurrency concerns - could there be a simpler solution for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. Although I do wonder if it is even worthwhile introducing the extra complexity. The context pool implementation in JDBC didn't have significant performance impact either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants