Skip to content
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

#197 Invoke actions via ActionInvoker #203

Merged
merged 6 commits into from
Oct 27, 2020

Conversation

marcinus
Copy link
Contributor

Description

Introduces ActionInvocation data object for storing more details about invoking action (duration, errors, cause of completion).
Provides ActionInvoker interface as a single point of invoking actions, providing race prevention, time measurement and basic error handling (see JavaDoc for details).
Introduces additional fields in ActionInvocationLog in order to pass on information about invoked actions.

Motivation and Context

It is a milestone to implement #197. Also, it fixes some potential race issues not tracked directly in Knot.x GitHub.

Upgrade notes (if appropriate)

It is advised to switch from direct action calling to using ActionInvoker utility class.
This ensures that the execution will not halt for some of the known issues in Vert.x and Knot.x implementations.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I have read the CONTRIBUTING document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

I hereby agree to the terms of the Knot.x Contributor License Agreement.

Populate exception details in FragmentResult and in invocation logs.
@codecov
Copy link

codecov bot commented Oct 26, 2020

Codecov Report

Merging #203 into master will increase coverage by 0.15%.
The diff coverage is 91.86%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #203      +/-   ##
============================================
+ Coverage     92.07%   92.23%   +0.15%     
- Complexity     1905     2000      +95     
============================================
  Files           181      192      +11     
  Lines          7432     7572     +140     
  Branches        180      176       -4     
============================================
+ Hits           6843     6984     +141     
- Misses          502      513      +11     
+ Partials         87       75      -12     
Impacted Files Coverage Δ Complexity Δ
...otx/fragments/action/api/log/ActionLogBuilder.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...o/knotx/fragments/action/api/log/ActionLogger.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
.../fragments/action/api/log/ActionInvocationLog.java 41.66% <47.50%> (+1.04%) 8.00 <6.00> (+2.00)
...fragments/action/api/invoker/ActionInvocation.java 64.70% <64.70%> (ø) 11.00 <11.00> (?)
...x/fragments/action/api/invoker/RacePrevention.java 92.30% <92.30%> (ø) 7.00 <7.00> (?)
...agments/action/api/invoker/RacePreventionTest.java 94.28% <94.28%> (ø) 14.00 <14.00> (?)
...nts/action/library/cb/CircuitBreakerResponder.java 95.65% <95.65%> (ø) 14.00 <14.00> (?)
...on/library/cb/CircuitBreakerActionFactoryTest.java 99.54% <99.24%> (+7.43%) 55.00 <22.00> (-18.00) ⬆️
...tx/fragments/action/api/invoker/ActionInvoker.java 100.00% <100.00%> (ø) 11.00 <11.00> (?)
...ments/action/api/invoker/ActionInvocationTest.java 100.00% <100.00%> (ø) 5.00 <5.00> (?)
... and 28 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3449fb6...2287681. Read the comment docs.

Copy link
Contributor

@Voycawojka Voycawojka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️ but consider my comment

@@ -70,6 +77,17 @@ public static FragmentResult fail(Fragment fragment, String errorCode, String er
FragmentOperationFailure.newInstance(errorCode, errorMessage));
}

// Should be used only by caller to indicate synchronous or asynchronous exception
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a comment explaining how the method should be used, maybe it should be a javadoc

FragmentOperationFailure.newInstance(error));
}

// Should be used only by caller to indicate external timeout
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@@ -152,6 +170,19 @@ public FragmentOperationFailure getError() {
return error;
}

public boolean isSuccess() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either:

  • isSuccess and isError and isException
    or
  • isSuccessful and isErroneous and isExceptional

HTTP Action docs update.

Co-authored-by: Marcin <8897707+marcinus@users.noreply.github.com>

Co-authored-by: Marcin <8897707+marcinus@users.noreply.github.com>
'}';
}

public Status getStatus() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move those getters up.

return error;
}

public enum Status {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this inner class to the beginnning.

@tomaszmichalak
Copy link
Member

Marcin Szymura and others added 4 commits October 27, 2020 10:51
Populate exception details in FragmentResult and in invocation logs.
…otx-fragments into feature/enhance-invocation-logs
@tomaszmichalak tomaszmichalak merged commit afbe962 into master Oct 27, 2020
@tomaszmichalak tomaszmichalak deleted the feature/enhance-invocation-logs branch October 27, 2020 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants