Skip to content

feat: Add the correlation ID middleware to the websocket server

What does this merge request do and why?

This MR is the first one in a sequence that translates the gRPC interceptors to middlewares for the websocket server. This MR:

  • Adds the first translated interceptor (CorrelationId)
  • Adds a MiddlewareChain that simplifies the addition of the new "middleware"
  • Sets up a Depends parameter on the server endpoint that ensures that the "middleware" act as middlewares should

How to set up and validate locally

  • Check out this branch
  • Set env vars: WEBSOCKET_SERVER=true and WEBSOCKET_PORT=8080
  • Run the duo workflow service
  • Run the example client poetry run python tests/example_websocket_client.py --port 8080
  • Verify that the logs have a valid correlation ID (e.g. [...] "logger": "websocket_server", "level": "info", "correlation_id": "4956eb58-6219-49b0-9f86-981f2d6e6e14", [...])

Merge request checklist

  • Tests added for new functionality. If not, please raise an issue to follow up.
  • Documentation added/updated, if needed.

Relates to #968 (closed)

Edited by Andras Herczeg

Merge request reports

Loading