Skip to content

Conversation

@joaopaulovieira
Copy link
Member

Main Changes

1. Context and Request ID

  • Refactored the use of context key for request ID:
    • The key type is now exported (ContextRequestIDKey) and uses a safer name to avoid collisions.
    • The function to retrieve the request ID from context (RequestID) is now public and used throughout the project.
    • Usage of the function was updated in transport.go and in tests.

2. Tests

  • Context, request, and suite tests were moved to the httpclient_test package to follow the black box pattern.
  • Added unit test for the SetHostURL method in Request.
  • Added integration test for metrics using mocks, covering success scenarios.

3. Request

  • Added public SetHostURL method to the Request struct.
  • Improved test coverage for Request methods.

4. Metrics

  • Refactored the registerMetrics function for better control of attributes and metric counters.
  • Host and path attributes are now correctly added to metrics.

5. Transport

  • Refactored to use the public RequestID function when setting the request ID header.

Other Adjustments

  • Organized imports and removed unused ones.
  • Improved comments and documentation for greater clarity.

@dneto dneto self-requested a review November 27, 2025 17:08
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.

6 participants