Skip to content

Conversation

@yuvrajjsingh0
Copy link
Contributor

@yuvrajjsingh0 yuvrajjsingh0 commented Oct 6, 2025

Reduce parallelism so that superposition doesn't get into race conditions - if I have N operations to do, I'do N-1 operations concurrently and wait for them to complete, then do the last operation, this way superposition's last config snapshot creation will always have latest data and won't run through race conditions.

[Logging]
Added more contexts in the default span:

  1. Fixed request_id being duplicated
  2. Return request_id as x-req-id header in response
  3. Added orgid, appid and superposition workspace id in the default span, so each request logs them for each of the log

res.headers_mut().insert(
actix_web::http::header::HeaderName::from_static("x-request-id"),
rid.parse().unwrap(),
HeaderName::from_static("x-req-id"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this renamed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it back to x-request-id

@JamesGeorg
Copy link
Collaborator

@yuvrajjsingh0 why does this need a lot of changes?

Making code from parallel to sequential should usually be a lot simpler

{
let n = operations.len();
let mut set = JoinSet::new();
assert!(n >= 1, "need at least one operation (the final)");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where is this assert handled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it, added safe if..else to handle these

App::new()
.wrap(actix_web::middleware::from_fn(request_id_mw))
.wrap(TracingLogger::default())
.wrap(TracingLogger::<WithRequestId>::new())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this PR have other changes, Or is this needed to sequentialise

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It has changes for request_id other than sequentialise

@yuvrajjsingh0 yuvrajjsingh0 force-pushed the make-default-config-creation-serial branch from 568a5e0 to 92a6bee Compare October 8, 2025 07:42
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