Skip to content

[MCC-1487238] Python Lib - Add Headers to each request for logging#36

Merged
butsyk-mdsol merged 3 commits into
mainfrom
feat/MCC-1487238-add-logging-headers
May 22, 2026
Merged

[MCC-1487238] Python Lib - Add Headers to each request for logging#36
butsyk-mdsol merged 3 commits into
mainfrom
feat/MCC-1487238-add-logging-headers

Conversation

@dsilaghi-mdsol

Copy link
Copy Markdown
Contributor

MCC-1487238 - Add Headers to each request for logging

Checklist

  • Add proper PR title in format [MCC-XXXX] <App> - <Fix Details>
  • Add Jira ticket MCC, title and link
  • Add summary of changes
  • Add reviewers
  • ADD LABELS!
  • If code is testable, please add/update tests for the code changes.
  • If changes impact deployment, please update deploy guide.

Changes

Jira Ticket: MCC-1487238 Add Headers to each request for logging

This PR introduces comprehensive request tracing and telemetry headers injected into the Arrow Flight transport layer to fulfill logging and traceability requirements across environments.

Summary of Implementation:

  • Composition Root Threading: Updated the DataConnectClient.connect() factory method to accept user_uuid from Enodia and pass it cleanly down to the transport layer instantiation.
  • Metadata Header Injection: Enhanced the ArrowFlightTransport.__init__ constructor to dynamically populate self._call_headers with four required binary metadata tuples:
    • user-uuid: The authenticated Enodia user identifier (AC-01).
    • python-sdk-version: The dynamic package version fetched via importlib.metadata (AC-02).
    • sdk-type: Hardcoded value set to Python (AC-03).
    • client-ip: The host's outgoing network interface IP address resolved via a lightweight socket lookup (AC-04).
  • Defensive Architecture: Isolated the logging block to execute unconditionally before authentication token validation. Implemented global exception handling for network/metadata lookups with safe fallbacks (127.0.0.1 for offline environments and 0.1.0 for missing package states) to guarantee client execution under any system state.

Screen Shots (IF NEEDED)

N/A - Backend protocol and client logging fix.

Before

N/A

After

N/A

@dsilaghi-mdsol dsilaghi-mdsol self-assigned this May 21, 2026
@dsilaghi-mdsol dsilaghi-mdsol added good first issue Good for newcomers Needs Engineer Review python Pull requests that update python code labels May 21, 2026
@dsilaghi-mdsol
dsilaghi-mdsol force-pushed the feat/MCC-1487238-add-logging-headers branch from c7bd764 to 12b64ab Compare May 21, 2026 14:41
…port

- Thread user_uuid from DataConnectClient.connect down to ArrowFlightTransport
- Dynamically resolve client IP address via UDP socket with local loopback fallback
- Dynamically read python-sdk-version with safe fallback on PackageNotFoundError
- Force sdk-type header to 'Python'
- Add comprehensive happy path and defensive edge-case unit tests
@dsilaghi-mdsol
dsilaghi-mdsol force-pushed the feat/MCC-1487238-add-logging-headers branch from 12b64ab to 49d4e2d Compare May 21, 2026 14:51
- Fix import order sorting using ruff rules
- Remove trailing whitespaces and redundant empty lines
- Clean up unused or commented-out lines of code
- Remove obsolete inline documentation to improve readability
@butsyk-mdsol
butsyk-mdsol merged commit e987a66 into main May 22, 2026
3 checks passed
@butsyk-mdsol
butsyk-mdsol deleted the feat/MCC-1487238-add-logging-headers branch May 22, 2026 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good first issue Good for newcomers Needs Engineer Review python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants