Skip to content

logging: add requestID for access logs, application logs and traceback logs#1064

Open
boddumanohar wants to merge 2 commits into
mainfrom
logs-add-requestid
Open

logging: add requestID for access logs, application logs and traceback logs#1064
boddumanohar wants to merge 2 commits into
mainfrom
logs-add-requestid

Conversation

@boddumanohar

@boddumanohar boddumanohar commented May 26, 2026

Copy link
Copy Markdown
Member

currently in the WebApp API we have see 3 types of logs:

  1. Access logs --> ex: POST /cluster/<uid>.. 20ms "Go client
  2. Application logs --> ERROR: failed to clone volume
  3. Traceback logs --> Traceback: ...

To allow us to connect all these 3 together, have added a new field request_id to the logging filter.

So at the start of the request, within the middleware, we inject the request_id

token = core_utils.request_id_var.set(request_id)

and then reset it after the request ends

core_utils.request_id_var.reset(token)

But since the update has been to the core logger, simplyblock_core/utils/__init__.py for CLI, output, we'll see the extra [-] in between.

@boddumanohar boddumanohar requested a review from mxsrc May 28, 2026 10:14

@mxsrc mxsrc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Generally I like this, but in the case of sbctl execution, instead of -, establishing a context var with some random hash might be helpful

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.

2 participants