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

Wire up client to send errors to http server / Change 'shows details' button to 'report to TripleA' #4687

Merged
merged 5 commits into from
Feb 22, 2019

Conversation

DanVanAtta
Copy link
Member

@DanVanAtta DanVanAtta commented Feb 16, 2019

Overview

First two commits are mostly house-keeping/API changes, third commit summarizes the bulk of this update:

Wire up client to send errors to http server

User facing change where on the error message pop-up window, instead of
having a 'Show Details' button (that would open the console), we now
have a 'Report to TripleA' button that opens up a form window. The form
window has one text field where a user can enter details (optional), and
click 'upload' to then send to http server.

Notable code/design changes:
- LogRecord maybe having an exception is a bit tricky, there is a lot of
logic in formatting the title+body to have data extracted from log
record.
- Error report window is essentially re-written, focusing on case where
we have a LogRecord object and user input is optional.
- Error report window model has new design/contract where it interacts
with the UI only through interface. The UI has a 'bind' method to let it
attach model methods to UI components. This avoids a circular dependency
between UI and model, and model and the view interface have no JavaFx or
Swing dependencies, so we can swap out different view interfaces between
the two without changing model.

Functional Changes

  • 'Show details' button on the error pop-up window that we show when there is a log mesage that triggers a pop-up or an uncaught exception is replaced with a 'upload to triplea button'
  • http server http client, feign, logging level is reduces to no longer log http header values

Manual Testing Performed

Before & After Screen Shots

Before

Error message pop-up dialog, note the 'Show Details' button:
screenshot from 2019-02-15 18-48-39

After

When there is an error message the 'show details' button is now replaced:
screenshot from 2019-02-15 17-55-23

Clicking 'show details' opens this form window that has a hover text. The submit button can be clicked and error report will be sent with the system + log record exception or message data:
screenshot from 2019-02-15 17-55-27

If the http server has a problem (simulated by having incorrect github API token), then the client will see this error message and the upload form will remain open:
screenshot from 2019-02-15 17-55-35

Happy case where http server uploads, this response will be returned with clickable link:
screenshot from 2019-02-15 17-56-39

Example Error Report

triplea-game/test#54

Additional Review Notes

To demo:

  • add a log.severe('severe') or throw an uncaught excpetion in HeadedGameRunner.java

The http server will not be there and it'll cause an error, but it'll be the full flow minus the success message. To get an http server running:

  • set the game override for http server to be localhost
  • take a moment to find and set the github API key (logged in Triplea secrets)
  • start up http server
  • launch HeadedGameRunner with injected error or log statement.

The flow is still pretty interesting even without the http-server running.

The 'border' method now becomes an overload, bit more obvious that it is
a simplified version of 'border(BorderBuilder)'
Enables a swing property in JTextAreaBuilder that will be used
in an upcoming change.
User facing change where on the error message pop-up window, instead of
having a 'Show Details' button (that would open the console), we now
have a 'Report to TripleA' button that opens up a form window. The form
window has one text field where a user can enter details (optional), and
click 'upload' to then send to http server.

Notable code/design changes:
- LogRecord maybe having an exception is a bit tricky, there is a lot of
logic in formatting the title+body to have data extracted from log
record.
- Error report window is essentially re-written, focusing on case where
we have a LogRecord object and user input is optional.
- Error report window model has new design/contract where it interacts
with the UI only through interface. The UI has a 'bind' method to let it
attach model methods to UI components. This avoids a circular dependency
between UI and model, and model and the view interface have no JavaFx or
Swing dependencies, so we can swap out different view interfaces between
the two without changing model.
@codecov-io
Copy link

codecov-io commented Feb 16, 2019

Codecov Report

Merging #4687 into master will increase coverage by 0.07%.
The diff coverage is 37.34%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master   #4687      +/-   ##
===========================================
+ Coverage     23.22%   23.3%   +0.07%     
- Complexity     6213    6221       +8     
===========================================
  Files           873     870       -3     
  Lines         70483   70389      -94     
  Branches      11242   11243       +1     
===========================================
+ Hits          16369   16401      +32     
+ Misses        52078   51949     -129     
- Partials       2036    2039       +3
Impacted Files Coverage Δ Complexity Δ
...client/github/issues/GithubIssueClientFactory.java 0% <ø> (ø) 0 <0> (ø) ⬇️
...rver/reporting/error/ErrorUploadConfiguration.java 0% <ø> (ø) 0 <0> (ø) ⬇️
...gy/engine/framework/startup/ui/MetaSetupPanel.java 0% <ø> (ø) 0 <0> (ø) ⬇️
...ine/framework/map/download/DownloadMapsWindow.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...c/main/java/games/strategy/debug/ErrorMessage.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...trategy/engine/lobby/client/ui/TimespanDialog.java 27.58% <0%> (ø) 3 <0> (ø) ⬇️
...ne/framework/startup/ui/panels/main/MainPanel.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...games/strategy/triplea/ui/FindTerritoryDialog.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...gy/debug/error/reporting/StackTraceReportView.java 0% <0%> (ø) 0 <0> (?)
.../error/reporting/ConfirmationDialogController.java 0% <0%> (ø) 0 <0> (ø) ⬇️
... and 17 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 cfd00ee...ed10bfa. Read the comment docs.

Copy link
Member

@RoiEXLab RoiEXLab left a comment

Choose a reason for hiding this comment

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

Well there's not too much I can say about this.
The code looks fine (except for string building of course, that looks always messy)
Also I hesitate a bit to press the button, because this fundamentally changes the way we do debugging (with user problems)

@DanVanAtta
Copy link
Member Author

DanVanAtta commented Feb 17, 2019

Sincere thank you for looking over the code @RoiEXLab despite any delivery criticisms.

It's a bit late to be doing UX design, but I have been considering whether to add 'report' as a 3rd button and keeping the 'show details' button.

A subtle benefit here is an error report can now be done with zero key-strokes and two button clicks. A pretty low bar for sending us an error report. To re-iterate, just clicking the 'report' and 'send' buttons will upload the stack-trace.

The nail in the 'show details' coffin for me is the unnecessary control, adding UI elements subtracts from the other UI elements. The stack-trace is for dev's, we can see that without a button to 'show details'.

Copy link
Member

@RoiEXLab RoiEXLab left a comment

Choose a reason for hiding this comment

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

No more objections from my side.

return Arrays.stream(stackTrace)
.map(StackTraceElement::toString)
.toArray(String[]::new);
.collect(Collectors.joining("\n\n"));
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious where the additional newline comes from.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good eye, fixed: ed10bfa

@tvleavitt
Copy link

tvleavitt commented Feb 18, 2019 via email

@DanVanAtta
Copy link
Member Author

@tvleavitt I originally had in the last iteration a number of confirmations/warnings/previews. For the sake of getting this out the door, it was redesigned to have a much simpler more focused mandate that could land more easily.

Adding back in a 'preview' button would not be too difficult, particularly if it is a modal dialog. On the other hand, all info uploaded is viewable from the issue ticket created. I wonder if instead we could just message via tooltip that the error report with all details uploaded will be viewable after upload? So should this be fixed with a preview button, or perhaps better tooltip messaging?

@DanVanAtta
Copy link
Member Author

I created a tracking card to update the preview/messaging treatment: https://github.com/triplea-game/triplea/projects/4#card-17997555; @tvleavitt I'll mention you on the PR update that tries to improve on that point.

@DanVanAtta DanVanAtta merged commit 28e6c53 into triplea-game:master Feb 22, 2019
@DanVanAtta DanVanAtta deleted the error-reporting branch February 22, 2019 19:49
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.

6 participants