Skip to content

TASK: Add gateway correlation ID propagation and structured request logging #222

Closed
digital-bank-java/api-gateway
#24

Description

@ramioooz

Parent\n\n- Parent Story: #64\n- Parent Epic: #24\n\n## Objective\n\nPropagate a safe correlation identifier at the API Gateway boundary and emit one structured request log for each exchange so downstream SIT workflows can be traced without exposing credentials or business payloads.\n\n## Scope\n\n- Accept an existing valid correlation ID from the request or generate one when absent.\n- Return the correlation ID in the response.\n- Make it available to downstream filters through the reactive exchange context/request headers.\n- Log method, route, status, duration, service, environment, and correlation ID as structured JSON.\n- Do not log authorization headers, cookies, tokens, request bodies, account data, customer data, or payment data.\n- Keep the behavior compatible with existing routes and security responses.\n\n## Acceptance Criteria\n\n- Every gateway response has a valid correlation ID.\n- A caller-provided correlation ID is propagated only when it meets the documented safe format and length.\n- Invalid or oversized values are replaced with a generated ID.\n- Request logging occurs once at completion, including error responses where possible.\n- Existing gateway Maven and Helm verification remains green.\n- The implementation is documented and delivered through a normal reviewable PR.\n\n## Delivery\n\nThis is an API Gateway implementation under Sprint 6. It is independent of the pending Config Repo authentication fixture PR; SIT rollout can follow after merge.

Activity

  1. added theissue type on Sep 4, 2026
  2. self-assigned this
    on Sep 4, 2026
  3. ramioooz commented on Sep 4, 2026

    @ramioooz
    MemberAuthor

    Implementation is ready for review in api-gateway#24.

    Verification completed on 2026-09-05:

    • API Gateway ./mvnw --batch-mode --no-transfer-progress verify: 20 tests passed.
    • Focused route integration: 7 tests passed, including generated IDs, accepted safe IDs, invalid-ID replacement, unmatched requests, and error responses.
    • ECS console output was inspected and contains the service, environment, route, status, duration, and correlation.id without Logback appender errors.
    • Helm lint with SIT values passed.
    • Helm template rendering with SIT values passed.
    • git diff --check passed.

    The PR is independent of config-repo#42 and infra-sit#24/#25; no merge delay is required. After merge, roll out the Gateway in SIT and verify X-Correlation-ID through the existing port-forward and the structured records in the pod logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions