-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Updated agent connections monitor thread timeunit to secs, in sync with the Wait config. #10525
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
base: 4.20
Are you sure you want to change the base?
Updated agent connections monitor thread timeunit to secs, in sync with the Wait config. #10525
Conversation
…th the Wait config
@blueorangutan package |
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.20 #10525 +/- ##
=========================================
Coverage 16.00% 16.01%
- Complexity 13104 13107 +3
=========================================
Files 5651 5651
Lines 495841 495840 -1
Branches 60044 60042 -2
=========================================
+ Hits 79365 79384 +19
+ Misses 407613 407592 -21
- Partials 8863 8864 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12699 |
@blueorangutan test |
@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
[SF] Trillian Build Failed (tid-12616) |
@blueorangutan test |
@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clgtm
[SF] Trillian test result (tid-12633)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sureshanaparti sorry it was my mistake considering wait
config in minutes but can we also add the following change to fix cleanup time in seconds in the task and some optimisation. I'm happy to open a separate PR if needed
diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
index 818a3c5a23..1504af702b 100644
--- a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
+++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
@@ -51,8 +51,8 @@ import org.apache.cloudstack.framework.jobs.AsyncJobExecutionContext;
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
import org.apache.cloudstack.outofbandmanagement.dao.OutOfBandManagementDao;
import org.apache.cloudstack.utils.identity.ManagementServerNode;
-import org.apache.commons.collections.MapUtils;
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
+import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.ThreadContext;
@@ -1859,25 +1859,19 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
logger.trace("Agent New Connections Monitor is started.");
final int cleanupTime = Wait.value();
Set<Map.Entry<String, Long>> entrySet = newAgentConnections.entrySet();
- long cutOff = System.currentTimeMillis() - (cleanupTime * 60 * 1000L);
- if (logger.isDebugEnabled()) {
- List<String> expiredConnections = newAgentConnections.entrySet()
- .stream()
- .filter(e -> e.getValue() <= cutOff)
- .map(Map.Entry::getKey)
- .collect(Collectors.toList());
- logger.debug(String.format("Currently %d active new connections, of which %d have expired - %s",
- entrySet.size(),
- expiredConnections.size(),
- StringUtils.join(expiredConnections)));
- }
- for (Map.Entry<String, Long> entry : entrySet) {
- if (entry.getValue() <= cutOff) {
- if (logger.isTraceEnabled()) {
- logger.trace(String.format("Cleaning up new agent connection for %s", entry.getKey()));
- }
- newAgentConnections.remove(entry.getKey());
- }
+ long cutOff = System.currentTimeMillis() - (cleanupTime * 1000L);
+ List<String> expiredConnections = newAgentConnections.entrySet()
+ .stream()
+ .filter(e -> e.getValue() <= cutOff)
+ .map(Map.Entry::getKey)
+ .collect(Collectors.toList());
+ logger.debug("Currently {} active new connections, of which {} have expired - {}",
+ entrySet.size(),
+ expiredConnections.size(),
+ StringUtils.join(expiredConnections));
+ for (String connection : expiredConnections) {
+ logger.trace("Cleaning up new agent connection for {}", connection);
+ newAgentConnections.remove(connection);
}
}
}
updated @shwstppr, missed this, thanks for pointing out. |
@blueorangutan package |
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12804 |
@blueorangutan test |
@Pearl1594 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
[SF] Trillian Build Failed (tid-12731) |
@blueorangutan test |
@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
[SF] Trillian Build Failed (tid-12785) |
@blueorangutan package |
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Packaging result [SF]: ✖️ el8 ✖️ el9 ✔️ debian ✖️ suse15. SL-JID 13031 |
@blueorangutan package |
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13035 |
@blueorangutan test |
@sureshanaparti a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
[SF] Trillian test result (tid-12976)
|
@sureshanaparti @Pearl1594 , I added needs-testing to this PR, but I am not really convinced if we need to and how. Can you advise? |
Description
This PR updates agent connections monitor thread timeunit to secs, in sync with the Wait config.
New agent connections monitor thread introduced here: #9840
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?