-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Changes error message when using invalid endpoint.url
#8603
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: main
Are you sure you want to change the base?
Conversation
@blueorangutan package |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #8603 +/- ##
============================================
+ Coverage 30.37% 30.76% +0.39%
- Complexity 32633 33078 +445
============================================
Files 5352 5353 +1
Lines 374419 374605 +186
Branches 54609 54633 +24
============================================
+ Hits 113719 115244 +1525
+ Misses 245523 244085 -1438
- Partials 15177 15276 +99
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@blueorangutan package |
@weizhouapache 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]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8536 |
@blueorangutan test |
@DaanHoogland a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) 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
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.
overall code lgtm
left 2 minor comments
api/src/main/java/org/apache/cloudstack/config/ApiServiceConfiguration.java
Show resolved
Hide resolved
api/src/main/java/org/apache/cloudstack/config/ApiServiceConfiguration.java
Outdated
Show resolved
Hide resolved
@weizhouapache, thanks for your review. I've made changes to incorporate your suggestions in the latest commit (4cf74fc), so if you could provide another review, I would greatly appreciate it! |
@blueorangutan package |
@weizhouapache 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. |
@lucas-a-martins |
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8556 |
[SF] Trillian test result (tid-9096)
|
Hey, @lucas-a-martins please change your logger imports to use log4j2 |
@lucas-a-martins do you want to target this for 4.20?
|
@DaanHoogland I do. I'm just testing the code with log4j2. |
api/src/main/java/org/apache/cloudstack/config/ApiServiceConfiguration.java
Outdated
Show resolved
Hide resolved
…guration.java Co-authored-by: Daniel Augusto Veronezi Salvador <[email protected]>
@blueorangutan package |
@weizhouapache 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]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8694 |
@blueorangutan test |
@DaanHoogland a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
[SF] Trillian test result (tid-9288)
|
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.
LGTM, I manually tested the proposed changes in a local environment.
- CloudMonkey:
(lab) 🐱 > createKubernetesCluster name=dummy-kubernetes-cluster zoneid=0ea94256-6969-46a8-b02e-b1604c81dd01
🙈 Error: (HTTP 530, error code 9999) Unable to complete this operation. Contact your cloud admin.
- Management server logs:
2024-04-16T20:22:30,881 ERROR [o.a.c.c.ApiServiceConfiguration] (qtp1759482496-19:[ctx-9ff4e912, ctx-4928e0cd]) (logid:6f2b30d3) Global setting [endpoint.url] cannot contain localhost or be blank. Current value: http://localhost:8080/client/api
To be honest, I think the old error message makes more sense for root admin |
One of the major issues with the old exception message is its lack of clarity. Even for root admins, it would be difficult to discern what action needs to be taken. The new exception is more generic compared to the old one, as the intention is to give no environment information. To give any direction to operators, this PR adds a new log that is more objective, indicating to the operator where and what the problem is. IMO, the new message can also help prevent operators from making the same mistake again, as they will now know that |
I know @lucas-a-martins but the new error message
|
The exception being unclear is intentional, as this is what users will see. I understand what you mean by showing an exclusive message to ROOT admins, but is this really necessary since they have access to the logs with a clear message? Especially considering that the current exception is unclear, so this wouldn't change. I can't see a benefit in adding a "less unclear but not clear enough" exception. Also, is there any case of an exception in the UI being different between Users and Root Admins in the same situation? |
@lucas-a-martins However I hope, as a root admin, we can get more information from error message on the UI and in the API response. Please bear in mind , not all root admins have access to the management server log and have the ability to find the root cause from massvie logs. you can explore the options, for example in the API response or UI, display "Unable to complete this operation. Contact your cloud admin." (configurable) to normal users, and display the detailed error message to root admins. It could apply on ALL exceptions. |
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
Thanks, @lucas-a-martins. The previous message was misleading; the new log is way more clear.
Hey, @weizhouapache Considering these scenarios, I agree that having an exception to Root Admins makes sense and could be applied to all exceptions; however, this goes out of the scope of this PR. We have a discussion about patterns about logging (#8746) that could address these cases as well; we can discuss that there. |
ok @lucas-a-martins |
I do not see why we need to wait that discussion to improve a log message. The previous message was misleading; the new log is way more clear. The idea of presenting different messages for operators and final users is interesting; however, is a different context from this PR. If we define something later, we can create another PR to address the concept. |
@GutoVeronezi For root admins, no information is given by the new error message, it makes no sense. As a workaround, can you display the error message on UI for regular users? If your customers use UI not API. @lucas-a-martins |
The previous message says: |
@GutoVeronezi
What I disagree is the message in the exception, see below
My suggestion is
|
@lucas-a-martins any update on this Could you please take a look at @weizhouapache suggestion |
Description
When validating the
endpoint.url
global setting, such as when using thecreateKubernetesCluster
API, we encounter the exception messageGlobal setting endpoint.url has to be set to the Management Server's API endpoint
. This message lacks clarity about the problem to be solved and exposes information about the environment. Upon further analysis, it was found that this same message was used across several classes, repeating the same code in each one of them.This pull request addresses this issue by replacing the exception with a generic one that does not expose any information about the environment. Also, it introduces a more detailed and explicit message to the logs, including the current value of
endpoint.url
. Furthermore, a new method has been implemented to validate theendpoint.url
whenever necessary.Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
I tested by using CloudMonkey and tried to create a Kubernetes cluster. I implemented unit tests for the new method too.
Exception before changes:
Exception after changes: