-
Notifications
You must be signed in to change notification settings - Fork 265
Support artifact listing in new ICP #4457
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: master
Are you sure you want to change the base?
Conversation
| public static void invokeHeartbeatExecutorService() { | ||
|
|
||
| // Check if new ICP is configured | ||
| if (ICPHeartBeatComponent.isICPConfigured()) { | ||
| log.info("New ICP configuration detected. Starting ICP heartbeat service."); | ||
| ICPHeartBeatComponent.invokeICPHeartbeatExecutorService(); | ||
| return; | ||
| } | ||
| // Fall back to old dashboard heartbeat | ||
| String heartbeatApiUrl = configs.get(DASHBOARD_CONFIG_URL) + "/heartbeat"; |
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.
Log Improvement Suggestion No: 1
| public static void invokeHeartbeatExecutorService() { | |
| // Check if new ICP is configured | |
| if (ICPHeartBeatComponent.isICPConfigured()) { | |
| log.info("New ICP configuration detected. Starting ICP heartbeat service."); | |
| ICPHeartBeatComponent.invokeICPHeartbeatExecutorService(); | |
| return; | |
| } | |
| // Fall back to old dashboard heartbeat | |
| String heartbeatApiUrl = configs.get(DASHBOARD_CONFIG_URL) + "/heartbeat"; | |
| // Check if new ICP is configured | |
| if (ICPHeartBeatComponent.isICPConfigured()) { | |
| log.info("New ICP configuration detected. Starting ICP heartbeat service."); | |
| ICPHeartBeatComponent.invokeICPHeartbeatExecutorService(); | |
| return; | |
| } | |
| // Fall back to old dashboard heartbeat | |
| if (log.isDebugEnabled()) { | |
| log.debug("Starting dashboard heartbeat service with URL: " + heartbeatApiUrl); | |
| } |
| String stringResponse = getStringResponse(response); | ||
| JsonObject responseObject = null; | ||
| try { | ||
| responseObject = new JsonParser().parse(stringResponse).getAsJsonObject(); | ||
| Gson gson = new Gson(); | ||
| responseObject = gson.fromJson(stringResponse, JsonObject.class); |
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.
Log Improvement Suggestion No: 2
| String stringResponse = getStringResponse(response); | |
| JsonObject responseObject = null; | |
| try { | |
| responseObject = new JsonParser().parse(stringResponse).getAsJsonObject(); | |
| Gson gson = new Gson(); | |
| responseObject = gson.fromJson(stringResponse, JsonObject.class); | |
| JsonObject responseObject = null; | |
| try { | |
| Gson gson = new Gson(); | |
| responseObject = gson.fromJson(stringResponse, JsonObject.class); | |
| if (log.isDebugEnabled()) { | |
| log.debug("Successfully parsed heartbeat response"); | |
| } |
| * and full heartbeats when requested by the ICP. | ||
| */ | ||
| public static void invokeICPHeartbeatExecutorService() { | ||
| String icpUrl = getConfigValue(ICP_CONFIG_URL, null); | ||
| if (icpUrl == null) { | ||
| log.warn("ICP URL not configured. ICP heartbeat will not be started."); |
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.
Log Improvement Suggestion No: 3
| * and full heartbeats when requested by the ICP. | |
| */ | |
| public static void invokeICPHeartbeatExecutorService() { | |
| String icpUrl = getConfigValue(ICP_CONFIG_URL, null); | |
| if (icpUrl == null) { | |
| log.warn("ICP URL not configured. ICP heartbeat will not be started."); | |
| log.info("Starting ICP heartbeat service. Runtime: " + runtime + ", Interval: " + interval + "s"); | |
| ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); | |
| Runnable runnableTask = () -> { | |
| try { | |
| log.debug("Executing scheduled ICP heartbeat task"); | |
| sendDeltaHeartbeat(runtime, icpUrl); |
| private static JsonArray collectLocalEntries(SynapseConfiguration synapseConfig) { | ||
| JsonArray localEntries = new JsonArray(); | ||
| try { | ||
| @SuppressWarnings("unchecked") | ||
| Map<String, Object> entryMap = synapseConfig.getLocalRegistry(); | ||
| for (Map.Entry<String, Object> entry : entryMap.entrySet()) { | ||
| JsonObject entryObj = new JsonObject(); | ||
| entryObj.addProperty("name", entry.getKey()); | ||
| entryObj.addProperty("type", "LocalEntry"); | ||
| entryObj.addProperty("valueType", entry.getValue().getClass().getSimpleName()); | ||
| localEntries.add(entryObj); | ||
| } | ||
| } catch (Exception e) { | ||
| log.error("Error collecting Local Entries", e); | ||
| } |
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.
Log Improvement Suggestion No: 4
| private static JsonArray collectLocalEntries(SynapseConfiguration synapseConfig) { | |
| JsonArray localEntries = new JsonArray(); | |
| try { | |
| @SuppressWarnings("unchecked") | |
| Map<String, Object> entryMap = synapseConfig.getLocalRegistry(); | |
| for (Map.Entry<String, Object> entry : entryMap.entrySet()) { | |
| JsonObject entryObj = new JsonObject(); | |
| entryObj.addProperty("name", entry.getKey()); | |
| entryObj.addProperty("type", "LocalEntry"); | |
| entryObj.addProperty("valueType", entry.getValue().getClass().getSimpleName()); | |
| localEntries.add(entryObj); | |
| } | |
| } catch (Exception e) { | |
| log.error("Error collecting Local Entries", e); | |
| } | |
| */ | |
| private static JsonArray collectDataServices(SynapseConfiguration synapseConfig) { | |
| JsonArray dataServices = new JsonArray(); | |
| try { | |
| if (synapseConfig == null || synapseConfig.getAxisConfiguration() == null) { | |
| log.debug("Synapse configuration or Axis configuration is not available for data services collection"); | |
| return dataServices; | |
| } | |
| log.info("Starting data services collection"); | |
| AxisConfiguration axisConfiguration = synapseConfig.getAxisConfiguration(); | |
| // Get available data service names using DBUtils | |
| String[] dataServiceNames = org.wso2.micro.integrator.dataservices.core.DBUtils.getAvailableDS(axisConfiguration); | |
| log.info("Found " + dataServiceNames.length + " data services to process"); |
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.
AI Agent Log Improvement Checklist
- The log-related comments and suggestions in this review were generated by an AI tool to assist with identifying potential improvements. Purpose of reviewing the code for log improvements is to improve the troubleshooting capabilities of our products.
- Please make sure to manually review and validate all suggestions before applying any changes. Not every code suggestion would make sense or add value to our purpose. Therefore, you have the freedom to decide which of the suggestions are helpful.
✅ Before merging this pull request:
- Review all AI-generated comments for accuracy and relevance.
- Complete and verify the table below. We need your feedback to measure the accuracy of these suggestions and the value they add. If you are rejecting a certain code suggestion, please mention the reason briefly in the suggestion for us to capture it.
| Comment | Accepted (Y/N) | Reason |
|---|---|---|
| #### Log Improvement Suggestion No: 1 | ||
| #### Log Improvement Suggestion No: 2 | ||
| #### Log Improvement Suggestion No: 3 | ||
| #### Log Improvement Suggestion No: 4 |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
4b4989c to
66cf458
Compare
Purpose
Adds the following.
Goals
Support artifact listing in new ICP version
Approach
User stories
Release note
Documentation
Training
Certification
Marketing
Automation tests
Security checks
Samples
Related PRs
Migrations (if applicable)
Test environment
Learning