Skip to content

Commit cf48240

Browse files
committed
Add ADRs about updating of experiments as part of the TSP
Contributes to #608 Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
1 parent b9e3132 commit cf48240

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

doc/adr/0005-tsp-update-experiment.md

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# 5. Tsp update experiment
2+
3+
Date: 2022-03-22
4+
5+
## Status
6+
7+
Proposed
8+
9+
## Context
10+
11+
The tentative [TSP specification][tsp] proposes a PUT command on the `tsp/api/experiments/{expUUID}` endpoint for the following use cases:
12+
13+
- Rename experiment
14+
- Add/remove traces to/from an experiment
15+
- Other updates (e.g. offsetting of traces)
16+
17+
When an experiment is created the client passes the `name` of the experiment and a `list of trace UUIDs` to the POST request.
18+
It returns a data structure with experiment details and a `unique UUID`, to identify the experiment.
19+
20+
This ADR proposes the way-forward for renaming and adding/removing of traces of experiments. It doesn't cover other updates like offsetting of traces. They will be handled in other ADRs.
21+
22+
PUT commands require to be idempotent, multiple requests have to have the same outcome. For a PUT to be idempotent, it is required to provide all parameters that make up an experiment to be sent in the PUT command. In the case of updating an experiment, the `name` and `list of trace UUIDs` have to be present, even if some parts don't change. The PUT command replaces the experiment resource on the server with a new one.
23+
24+
PATCH commands don't have that requirement of having to be idempotent. They can be idempotent, but don't have to. PATCH can be used to update parts of the experiment resource. For example, when updating the name of an experiment only the `name` has to be passed in the PATCH request, and not the `list of trace UUIDs`.
25+
26+
For both PUT and PATCH, the experiment UUID must not change. The Trace Server implementation needs to be able to provide that.
27+
28+
For updating of an experiment PATCH would be more suitable because only the name to be modified needs to be provided.
29+
30+
`Notes`:
31+
32+
- The current Trace Compass server implementation creates the UUID based on the experiment name and persists the experiment as folder resource in the server workspace. Renaming an experiment and renaming the corresponding workspace resource would lead to a change of the UUID as well. Hence, the server implementation needs to be changed to return the same UUID.
33+
- Renaming the workspace resource, all relevant experiment, trace and data provider resources will need to be disposed before the rename action. Because of the disposal of the data providers, the front-end will need to be fully refreshed to update stale cached information.
34+
- Adding and removing of traces in an experiment will affect the start/end time, available views and other capabilities. The front-end will need to be fully refreshed and any invalid views need to be removed. This can be achieved by closing the experiment front-end.
35+
36+
## Decision
37+
38+
Implement PATCH endpoint for updating of an experiment. PATCH is easier to implement because only the to-be-updated parameters need to be passed in the command. If needed, added traces will have to be uploaded first, while removed traces need to be removed automatically by the server (if not in use otherwise). The UUID will be unchanged.
39+
40+
The server will be updated to support the new use cases. Clients will see the updated experiment on a refresh.
41+
42+
## Consequences
43+
44+
### Easier to do
45+
46+
Introducing a dedicated command to update will simplify the client implementation. It's mainly a server-side implementation, and hence, all clients will benefit from the server implementation.
47+
48+
### More difficult
49+
50+
The server implementation will be more complicated and will require a thread-safe implementation, so that other commands to the experiment endpoints using the same UUID succeed or are handled gracefully.
51+
52+
### Risks introduced
53+
54+
Because of changing the experiment parameters, the client performing the update will have to refresh cached information to avoid client-side errors.
55+
56+
Other clients won't be aware of any updated experiments, and hence errors can happen during query operations, if cached information is used. Introducing some notification channel, like server-side events, in the future can mitigate the risk.
57+
58+
[tsp]: https://github.com/theia-ide/trace-server-protocol/blob/10cc9ba5419656315333cdac4fb8e392b1c752e7/API-proposed.yaml#L902

0 commit comments

Comments
 (0)