Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add custom parameters for the http-transport config #52

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Tsovak
Copy link

@Tsovak Tsovak commented Jan 14, 2024

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.

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.

1 participant