You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/10/28 11:14:17 UTC

[GitHub] [camel] Croway opened a new pull request #6351: CAMEL-17138: Propagate error details from Camel health to MicroProfile Health

Croway opened a new pull request #6351:
URL: https://github.com/apache/camel/pull/6351


   <!-- Uncomment and fill this section if your PR is not trivial
   - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).  Trivial changes like typos do not require a JIRA issue.  Your pull request should address just this issue, without pulling in other changes.
   - [ ] Each commit in the pull request should have a meaningful subject line and body.
   - [ ] If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
   - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [ ] Run `mvn clean install -Psourcecheck` in your module with source check enabled to make sure basic checks pass and there are no checkstyle violations. A more thorough check will be performed on your pull request automatically.
   Below are the contribution guidelines:
   https://github.com/apache/camel/blob/main/CONTRIBUTING.md
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] Croway commented on a change in pull request #6351: CAMEL-17138: Propagate error details from Camel health to MicroProfile Health

Posted by GitBox <gi...@apache.org>.
Croway commented on a change in pull request #6351:
URL: https://github.com/apache/camel/pull/6351#discussion_r738304404



##########
File path: components/camel-microprofile/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/AbstractCamelMicroProfileHealthCheck.java
##########
@@ -44,9 +45,8 @@
 
     @Override
     public HealthCheckResponse call() {
-        final HealthCheckResponseBuilder builder = HealthCheckResponse.builder();
-        builder.name(getHealthCheckName());
-        builder.up();
+        Map<String, Object> data = new HashMap<>();

Review comment:
       Hi James, I couldn't use withData() because of the builder apis,
   ```
   public abstract HealthCheckResponseBuilder withData(String key, String value);
   public abstract HealthCheckResponseBuilder withData(String key, long value);
   public abstract HealthCheckResponseBuilder withData(String key, boolean value);
   ```
   if I'm not mistaken the purpose of the issue is to provide exception (Throwable and additional data) to the consumers, that's why I had to use HealthCheckResponse directly.
   
   If the stacktrace should be provided as String, I will refactor it to use the Builder like before.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] davsclaus merged pull request #6351: CAMEL-17138: Propagate error details from Camel health to MicroProfile Health

Posted by GitBox <gi...@apache.org>.
davsclaus merged pull request #6351:
URL: https://github.com/apache/camel/pull/6351


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] astefanutti commented on a change in pull request #6351: CAMEL-17138: Propagate error details from Camel health to MicroProfile Health

Posted by GitBox <gi...@apache.org>.
astefanutti commented on a change in pull request #6351:
URL: https://github.com/apache/camel/pull/6351#discussion_r738288490



##########
File path: components/camel-microprofile/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/AbstractCamelMicroProfileHealthCheck.java
##########
@@ -62,25 +62,30 @@ public HealthCheckResponse call() {
                 }
 
                 if (enabled) {
-                    builder.withData(result.getCheck().getId(), result.getState().name());
+                    result.getError().ifPresent(
+                            error -> data.put(error.getMessage(), error));

Review comment:
       I wonder whether setting stable keys like `error.message` or `error.stacktrace`, would help consumers?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] Croway commented on a change in pull request #6351: CAMEL-17138: Propagate error details from Camel health to MicroProfile Health

Posted by GitBox <gi...@apache.org>.
Croway commented on a change in pull request #6351:
URL: https://github.com/apache/camel/pull/6351#discussion_r738362521



##########
File path: components/camel-microprofile/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/AbstractCamelMicroProfileHealthCheck.java
##########
@@ -44,9 +45,8 @@
 
     @Override
     public HealthCheckResponse call() {
-        final HealthCheckResponseBuilder builder = HealthCheckResponse.builder();
-        builder.name(getHealthCheckName());
-        builder.up();
+        Map<String, Object> data = new HashMap<>();

Review comment:
       Builder restored, since the results will be serialized anyway `withData(String key, String value);` is enough




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] Croway commented on a change in pull request #6351: CAMEL-17138: Propagate error details from Camel health to MicroProfile Health

Posted by GitBox <gi...@apache.org>.
Croway commented on a change in pull request #6351:
URL: https://github.com/apache/camel/pull/6351#discussion_r738292781



##########
File path: components/camel-microprofile/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/AbstractCamelMicroProfileHealthCheck.java
##########
@@ -62,25 +62,30 @@ public HealthCheckResponse call() {
                 }
 
                 if (enabled) {
-                    builder.withData(result.getCheck().getId(), result.getState().name());
+                    result.getError().ifPresent(
+                            error -> data.put(error.getMessage(), error));

Review comment:
       Agree, what about returning only one item like _error.exception_ and the Throwable object?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] jamesnetherton commented on a change in pull request #6351: CAMEL-17138: Propagate error details from Camel health to MicroProfile Health

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on a change in pull request #6351:
URL: https://github.com/apache/camel/pull/6351#discussion_r738297829



##########
File path: components/camel-microprofile/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/AbstractCamelMicroProfileHealthCheck.java
##########
@@ -44,9 +45,8 @@
 
     @Override
     public HealthCheckResponse call() {
-        final HealthCheckResponseBuilder builder = HealthCheckResponse.builder();
-        builder.name(getHealthCheckName());
-        builder.up();
+        Map<String, Object> data = new HashMap<>();

Review comment:
       Maybe a bit of a nitpick - but why not use `HealthCheckResponseBuilder.withData()`?
   
   With this change we're creating a new `HashMap` on every invocation of the health check regardless of whether we need it or not.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] astefanutti commented on a change in pull request #6351: CAMEL-17138: Propagate error details from Camel health to MicroProfile Health

Posted by GitBox <gi...@apache.org>.
astefanutti commented on a change in pull request #6351:
URL: https://github.com/apache/camel/pull/6351#discussion_r738303587



##########
File path: components/camel-microprofile/camel-microprofile-health/src/main/java/org/apache/camel/microprofile/health/AbstractCamelMicroProfileHealthCheck.java
##########
@@ -62,25 +62,30 @@ public HealthCheckResponse call() {
                 }
 
                 if (enabled) {
-                    builder.withData(result.getCheck().getId(), result.getState().name());
+                    result.getError().ifPresent(
+                            error -> data.put(error.getMessage(), error));

Review comment:
       The health check results will often be serialised, so I'd be inclined to have both `error.message` and `error.exception` so that consumers that only want/care about the messages do not have to manually parse the full exceptions.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org