grpc-consul-resolver icon indicating copy to clipboard operation
grpc-consul-resolver copied to clipboard

fix: add custom parameters for the http-transport config

Open Tsovak opened this issue 5 months ago • 0 comments

Why:

This Pull Request introduces enhancements and fixes to the HTTP transport configuration logic within the grpc-consul-resolver library. It primarily aims to offer more flexibility and control over the HTTP transport used for communication with Consul, enabling users to customize HTTP transport parameters such as idle connections, timeouts, and compression settings.

What:

  • Custom HTTP Transport Parameters: Added new fields to the target struct to support customization of HTTP transport parameters like MaxIdleConns, IdleConnTimeout, DisableCompression, TLSHandshakeTimeout, and ExpectContinueTimeout.
  • Updated README: Revised the README document to include the newly introduced HTTP transport parameters with descriptions and default values.
  • Correct Typo in Test Function Name: Renamed the test function from TestCLient to TestClient to correct a typo.

How can it be used:

  • The newly introduced HTTP transport parameters allow users to fine-tune the behavior of the HTTP client used in service discovery through Consul. Users can leverage these parameters as follows:
targetConfig := "consul://127.0.0.1:8500/my-service?max-idle-conns=10&idle-conn-timeout=30s&disable-compression=true"
  • These parameters can significantly impact the performance and reliability of applications that rely on Consul for service discovery, especially in environments with high network latency or stringent resource constraints.

How did you test it:

  • Modified unit tests in target_test.go to cover the parsing and handling of the new HTTP transport parameters.
  • Added additional test scenarios to ensure these parameters are correctly applied to the HTTP transport and reflected in the behavior of the HTTP client.
  • Manual testing was presumably conducted to verify that the service discovery mechanism behaves as expected with the new parameters, although specific manual test cases are not detailed.

Notes for the reviewer:

  • Reviewers should pay special attention to the new fields added to the target struct, ensuring they are correctly parsed and applied to the HTTP transport.
  • It's important to verify that the changes are backward compatible and do not disrupt existing functionality, especially for users who do not specify the newly introduced parameters.
  • The typo correction in the test function name (TestClient) is minor but improves code readability and consistency.

Tsovak avatar Jan 14 '24 16:01 Tsovak