-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Improve logging to include more identifiable information #9873
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
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
5bea350
Improve logging to include more identifiable information for kvm plugin
vishesh92 e388764
Update logging for scaleio plugin
vishesh92 bd59153
Improve logging to include more identifiable information for default …
vishesh92 e1b9862
Improve logging to include more identifiable information for agent ma…
vishesh92 c4dcb2b
Fixup
vishesh92 0bbc2cb
Improve logging to include more identifiable information for Listeners
vishesh92 6b6ae03
fixup
vishesh92 7e0d848
Address comments
vishesh92 d28ffab
Replace ids with objects or uuids
vishesh92 2bf838b
fixup
vishesh92 20dbdaa
Improve logging to include more identifiable information for engine
vishesh92 a639d3c
Improve logging to include more identifiable information for server
vishesh92 6557a3d
Fixups in engine
vishesh92 9146221
Improve logging to include more identifiable information for plugins
vishesh92 785c064
Improve logging to include more identifiable information for Cmd classes
vishesh92 c197b83
Minor fixups
vishesh92 b903796
Merge branch '4.20' into improve-logging
vishesh92 7ba32df
Update remaining files
vishesh92 499df2d
Fixups
vishesh92 74124af
Merge branch '4.20' into improve-logging
vishesh92 b47db16
fixups
vishesh92 1cb1962
monir fixups
vishesh92 f0ee884
Address comments
vishesh92 8af0b13
Fix toString method for StorageFilterTO.java
vishesh92 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -132,6 +132,8 @@ public int value() { | |||||
| ServerResource _resource; | ||||||
| Link _link; | ||||||
| Long _id; | ||||||
| String _uuid; | ||||||
| String _name; | ||||||
|
|
||||||
| Timer _timer = new Timer("Agent Timer"); | ||||||
| Timer certTimer; | ||||||
|
|
@@ -182,8 +184,10 @@ public Agent(final IAgentShell shell, final int localAgentId, final ServerResour | |||||
| resource.setAgentControl(this); | ||||||
|
|
||||||
| final String value = _shell.getPersistentProperty(getResourceName(), "id"); | ||||||
| _uuid = _shell.getPersistentProperty(getResourceName(), "uuid"); | ||||||
| _name = _shell.getPersistentProperty(getResourceName(), "name"); | ||||||
| _id = value != null ? Long.parseLong(value) : null; | ||||||
| logger.info("id is {}", ObjectUtils.defaultIfNull(_id, "")); | ||||||
| logger.info("Initialising agent [id: {}, uuid: {}, name: {}]", ObjectUtils.defaultIfNull(_id, ""), _uuid, _name); | ||||||
|
|
||||||
| final Map<String, Object> params = new HashMap<>(); | ||||||
|
|
||||||
|
|
@@ -212,8 +216,9 @@ public Agent(final IAgentShell shell, final int localAgentId, final ServerResour | |||||
| new ThreadPoolExecutor(_shell.getWorkers(), 5 * _shell.getWorkers(), 1, TimeUnit.DAYS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory( | ||||||
| "agentRequest-Handler")); | ||||||
|
|
||||||
| logger.info("Agent [id = {} : type = {} : zone = {} : pod = {} : workers = {} : host = {} : port = {}", ObjectUtils.defaultIfNull(_id, "new"), getResourceName(), | ||||||
| _shell.getZone(), _shell.getPod(), _shell.getWorkers(), host, _shell.getPort()); | ||||||
| logger.info("Agent [id = {}, uuid: {}, name: {}] : type = {} : zone = {} : pod = {} : workers = {} : host = {} : port = {}", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| ObjectUtils.defaultIfNull(_id, "new"), _uuid, _name, getResourceName(), | ||||||
| _shell.getZone(), _shell.getPod(), _shell.getWorkers(), host, _shell.getPort()); | ||||||
| } | ||||||
|
|
||||||
| public String getVersion() { | ||||||
|
|
@@ -377,11 +382,28 @@ public Long getId() { | |||||
| } | ||||||
|
|
||||||
| public void setId(final Long id) { | ||||||
| logger.debug("Set agent id {}", id); | ||||||
| _id = id; | ||||||
| _shell.setPersistentProperty(getResourceName(), "id", Long.toString(id)); | ||||||
| } | ||||||
|
|
||||||
| public String getUuid() { | ||||||
| return _uuid; | ||||||
| } | ||||||
|
|
||||||
| public void setUuid(String uuid) { | ||||||
| this._uuid = uuid; | ||||||
| _shell.setPersistentProperty(getResourceName(), "uuid", uuid); | ||||||
| } | ||||||
|
|
||||||
| public String getName() { | ||||||
| return _name; | ||||||
| } | ||||||
|
|
||||||
| public void setName(String name) { | ||||||
| this._name = name; | ||||||
| _shell.setPersistentProperty(getResourceName(), "name", name); | ||||||
| } | ||||||
|
|
||||||
| private synchronized void scheduleServicesRestartTask() { | ||||||
| if (certTimer != null) { | ||||||
| certTimer.cancel(); | ||||||
|
|
@@ -594,17 +616,21 @@ public void processStartupAnswer(final Answer answer, final Response response, f | |||||
| return; | ||||||
| } | ||||||
|
|
||||||
| logger.info("Process agent startup answer, agent id = {}", startup.getHostId()); | ||||||
| logger.info("Process agent startup answer, agent [id: {}, uuid: {}, name: {}] connected to the server", | ||||||
| startup.getHostId(), startup.getHostUuid(), startup.getHostName()); | ||||||
|
|
||||||
| setId(startup.getHostId()); | ||||||
| setUuid(startup.getHostUuid()); | ||||||
| setName(startup.getHostName()); | ||||||
| _pingInterval = (long)startup.getPingInterval() * 1000; // change to ms. | ||||||
|
|
||||||
| setLastPingResponseTime(); | ||||||
| scheduleWatch(link, response, _pingInterval, _pingInterval); | ||||||
|
|
||||||
| _ugentTaskPool.setKeepAliveTime(2 * _pingInterval, TimeUnit.MILLISECONDS); | ||||||
|
|
||||||
| logger.info("Startup Response Received: agent id = {}", getId()); | ||||||
| logger.info("Startup Response Received: agent [id: {}, uuid: {}, name: {}]", | ||||||
| startup.getHostId(), startup.getHostUuid(), startup.getHostName()); | ||||||
| } | ||||||
|
|
||||||
| protected void processRequest(final Request request, final Link link) { | ||||||
|
|
@@ -860,15 +886,17 @@ public void processReadyCommand(final Command cmd) { | |||||
| NumbersUtil.enableHumanReadableSizes = humanReadable; | ||||||
| } | ||||||
|
|
||||||
| logger.info("Processing agent ready command, agent id = {}", ready.getHostId()); | ||||||
| logger.info("Processing agent ready command, agent id = {}, uuid = {}, name = {}", ready.getHostId(), ready.getHostUuid(), ready.getHostName()); | ||||||
| if (ready.getHostId() != null) { | ||||||
| setId(ready.getHostId()); | ||||||
| setUuid(ready.getHostUuid()); | ||||||
| setName(ready.getHostName()); | ||||||
| } | ||||||
|
|
||||||
| verifyAgentArch(ready.getArch()); | ||||||
| processManagementServerList(ready.getMsHostList(), ready.getLbAlgorithm(), ready.getLbCheckInterval()); | ||||||
|
|
||||||
| logger.info("Ready command is processed for agent id = {}", getId()); | ||||||
| logger.info("Ready command is processed for agent [id: {}, uuid: {}, name: {}]", getId(), getUuid(), getName()); | ||||||
| } | ||||||
|
|
||||||
| private void verifyAgentArch(String arch) { | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -125,8 +125,9 @@ public void execute() { | |||||
| hostResponse.setResponseName(getCommandName()); | ||||||
| this.setResponseObject(hostResponse); | ||||||
| } catch (Exception e) { | ||||||
| logger.debug("Failed to update host:" + getId(), e); | ||||||
| throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update host:" + getId() + "," + e.getMessage()); | ||||||
| Host host = _entityMgr.findById(Host.class, getId()); | ||||||
| logger.debug("Failed to update host: {} with id {}", host, getId(), e); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Failed to update host: %s with id %d, %s", host, getId(), e.getMessage())); | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.