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

Refactor server communication to JSON-RPC #990

Merged
merged 5 commits into from
Sep 15, 2023

Conversation

sgraband
Copy link
Contributor

@sgraband sgraband commented Jun 22, 2023

Update to newest tsp-typescript-client next version

To consume the new types introduced with eclipse-cdt-cloud/tsp-typescript-client#83.
Invoke the yarn clean script before running the prepare script.
Make sure all imports are from lib instead of src.

Update types of base package and react-components

Use the newly introduced types of tsp-typescript-client.
The type of TspClient becomes ITspClient.
The constructor for the base implementation becomes HttpTspClient.

Refactor server communication to JSON-RPC

TspClient Proxy:
Provide an implementation of the ITspClient called TheiaRpcTspProxy.
The implementation forwards all calls to a JSON RPC proxy called TheiaClientProxy.
Responses are then mapped to a TspClientResponse.
On the backend the TheiaClientProxy returns a lazyTspClient.
The lazyTspClient returns a HttpTspClient (default implementation).

Trace Server url provider:
The implementation of the provider was moved to the backend.
This way the env variable can be read out directly.
For the port preference a proxy mechanism was added.
Changes to the preference are sent via JSON RPC and handled by the url provider.

Trace Server connection status:
The implementation was moved to the backend.
Frontends can register themselves on the backend.
Each registered frontend will be pinged when the status has changed.

Misc:
Use ITspClient instead of TspClient for types, as TspClient is deprecated.

Fixes #976

Contributed on behalf of STMicroelectronics

@sgraband
Copy link
Contributor Author

sgraband commented Jun 22, 2023

@bhufmann regarding these two points in the description:

  • note that this interface could be moved to tsp-typescript-client
  • then the TspClient could also follow the same interface

The plan would be to make the TspClient in the tsp-typescript-client package an interface and also offer a DefaultTspClient that implements the new interface, and is the same as the current TspClient. This way we can remove the TspFrontendClient interface from this PR and just implement the new TspClient interface. Then both the DefaultTspClient and the client used in the Theia frontend would follow the same interface.

Is there anything that would speak against this rename and redesign from your perspective? Otherwise, i would also open the contribution on tsp-typescript-client and adjust this PR. In the meantime you could already check out this PR as it would basically only be interface changes and the implementations will not change.

@bhufmann
Copy link
Collaborator

bhufmann commented Jun 29, 2023

Thanks for the contribution. I'm a bit stretch with time at the moment for the review and test, and hence I had to backlog it. Having said that, one team member will look into the impact on the latency so that we have an idea what the additional communication step adds for the visualization of large(r) data.

Copy link
Contributor

@marco-miller marco-miller left a comment

Choose a reason for hiding this comment

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

Thanks for this promising effort, well appreciated! Some comments for me as well, herein.

packages/base/src/tsp-frontend-client.ts Outdated Show resolved Hide resolved
packages/base/src/experiment-manager.ts Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
hoangphamEclipse added a commit to hoangphamEclipse/theia-trace-extension that referenced this pull request Aug 23, 2023
This commit adds a study on the impact of the JSON-RCP patch on the
Theia Front End - Back End - Trace Server communication speed.

Relates to eclipse-cdt-cloud#990.

Signed-off-by: Hoang Thuan Pham <hoang.pham@calian.ca>
hoangphamEclipse added a commit to hoangphamEclipse/theia-trace-extension that referenced this pull request Aug 23, 2023
This commit adds a study on the impact of the JSON-RCP patch on the
Theia Front End - Back End - Trace Server communication speed.

Relates to eclipse-cdt-cloud#990.

Signed-off-by: Hoang Thuan Pham <hoang.pham@calian.ca>
hoangphamEclipse added a commit to hoangphamEclipse/theia-trace-extension that referenced this pull request Aug 23, 2023
This commit adds a study on the impact of the JSON-RCP patch on the
Theia Front End - Back End - Trace Server communication speed.

Relates to eclipse-cdt-cloud#990.

Signed-off-by: Hoang Thuan Pham <hoang.pham@calian.ca>
hoangphamEclipse added a commit to hoangphamEclipse/theia-trace-extension that referenced this pull request Aug 23, 2023
This commit adds a study on the impact of the JSON-RPC patch on the
Theia Front End - Back End - Trace Server communication speed.

Relates to eclipse-cdt-cloud#990.

Signed-off-by: Hoang Thuan Pham <hoang.pham@calian.ca>
@sgraband
Copy link
Contributor Author

@marco-miller I consumed the changes of eclipse-cdt-cloud/tsp-typescript-client#83 and rearranged the commits to hopefully make it easier to review. Your comments of your earlier review should also be incorporated as well as the naming discussions.
Could you take another look?
If you have any suggestions on how to split up the last commit i am happy to incorporate them, but i feel like the changes all are connected somehow so i wasn't sure on how (or if) to split them.

@marco-miller
Copy link
Contributor

@marco-miller I consumed the changes of eclipse-cdt-cloud/tsp-typescript-client#83 and rearranged the commits to hopefully make it easier to review. Your comments of your earlier review should also be incorporated as well as the naming discussions. Could you take another look? If you have any suggestions on how to split up the last commit i am happy to incorporate them, but i feel like the changes all are connected somehow so i wasn't sure on how (or if) to split them.

Thanks for this. I recently changed focus at work, so leaving this follow-up and review to our other reviewers listed here. Cheers.

Copy link
Collaborator

@bhufmann bhufmann left a comment

Choose a reason for hiding this comment

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

I'll continue with reviewing from Marco. Thanks for the updates.

I did some testing and the main feature is working well. However, I found some issues during testing. Could you please investigate this? I'll continue with this PR once updated.

hoangphamEclipse added a commit to hoangphamEclipse/theia-trace-extension that referenced this pull request Sep 5, 2023
This commit adds a study on the impact of the JSON-RPC patch on the
Theia Front End - Back End - Trace Server communication speed.

Relates to eclipse-cdt-cloud#990.

Signed-off-by: Hoang Thuan Pham <hoang.pham@calian.ca>
MatthewKhouzam pushed a commit that referenced this pull request Sep 5, 2023
This commit adds a study on the impact of the JSON-RPC patch on the
Theia Front End - Back End - Trace Server communication speed.

Relates to #990.

Signed-off-by: Hoang Thuan Pham <hoang.pham@calian.ca>
Contributed on behalf of STMicroelectronics
Use the newly introduced types of tsp-typescript-client.
The type of TspClient becomes ITspClient.
The constructor for the base implementation becomes HttpTspClient.

Contributed on behalf of STMicroelectronics
TspClient Proxy:
Provide an implementation of the ITspClient called `TheiaRpcTspProxy`.
The implementation forwards all calls to a JSON RPC proxy called `TheiaClientProxy`.
Responses are then mapped to a `TspClientResponse`.
On the backend the `TheiaClientProxy` returns a lazyTspClient.
The lazyTspClient returns a `HttpTspClient` (default implementation).

Trace Server url provider:
The implementation of the provider was moved to the backend.
This way the env variable can be read out directly.
For the port preference a proxy mechanism was added.
Changes to the preference are sent via JSON RPC and handled by the url provider.

Trace Server connection status:
The implementation was moved to the backend.
Frontends can register themselves on the backend.
Each registered frontend will be pinged when the status has changed.

Misc:
Use `ITspClient` instead of `TspClient` for types, as `TspClient` is deprecated.

Fixes eclipse-cdt-cloud#976

Contributed on behalf of STMicroelectronics
Fix yarn.lock changes.
Fix ConnectionStatus RPC communication:
- Properly register client.
- Save the last status to apply on newly added clients.
- Remove clients that disconnect.
- Only render on client when the view is visible.
Rename setClient to addClient.

Contributed on behalf of STMicroelectronics
Also fix a small issue with the preferences.

Contributed on behalf of STMicroelectronics
@bhufmann bhufmann dismissed marco-miller’s stale review September 14, 2023 13:06

Marco is available for a second review. I will delegate to another committer.

Copy link
Collaborator

@bhufmann bhufmann left a comment

Choose a reason for hiding this comment

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

It looks good to me. Thank you very much for the contribution!

Copy link
Contributor

@MatthewKhouzam MatthewKhouzam left a comment

Choose a reason for hiding this comment

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

This chain improves the code by making communications simpler. I very much approve it.

Thanks Simon!

@bhufmann bhufmann merged commit a1d5a0c into eclipse-cdt-cloud:master Sep 15, 2023
3 checks passed
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.

Refactor server communication to JSON-RPC
5 participants