DiamondLightSource / blueapi

Apache License 2.0
2 stars 5 forks source link

Add correlation ID handling to rest endpoints. #177

Open rosesyrett opened 1 year ago

rosesyrett commented 1 year ago

At the moment the rest api does not handle correlation ID's, but it needs to. It seems like the client of the API should generate a correlation ID, and call the rest API endpoints with it. The rest endpoints should do things with it (e.g. submitting a task) and return it back as confirmation that stuff has been done.

callumforrester commented 5 months ago

@keithralphs does this relate to your opentelemetry work?

keithralphs commented 5 months ago

Yes, this is one of my ideas for this using the baggage to pass the id , however it may be possible to accomplish automatically via context propagation if all clients are OT instrumented when the make the call as the default is for the combintaion of the current Span plus the trace id to form the correlation id. In this scheme the Trace id would identify the client and the span id , the call it made.

callumforrester commented 5 months ago

Fair enough, if that works we can close this PR I guess. Do you have that in a draft anywhere?

keithralphs commented 5 months ago

Not as such. I have the server side example at https://github.com/DiamondLightSource/blueapi/pull/355, but it;'s not really properly addressing correlation id throughout at the moment.