pinterest / teletraan

Teletraan is Pinterest's deploy system.
Apache License 2.0
1.81k stars 250 forks source link

Refactor Http Client implementation #1741

Closed tylerwowen closed 3 weeks ago

tylerwowen commented 4 weeks ago

Refactor the implementation using java.net with OkHttp.

The current HTTP client has various issues. Instead of pathing the existing implementations, it's better to use another client library. OkHTTPClient is one of the most popular one and it's used by PinDeploy and Spinnaker.

Improvements

  1. Observability for outgoing requests.
  2. 1 shared connection pool managed by OkHttp instead of many ad-hoc connections.
  3. Exponential backup retry on certain failures.
  4. Logging with configurable level and sensitive header redaction.
  5. Moved to universal so Rodimus can use the same implementation

Tests and validations

Thanks to the added observability, it's very easy to know and monitor if this refactoring is working in addition to the unit tests.

Smoke tests

Deploy both service and worker to dev1 and ensure these are working

Additional details

Various logging levels

Basic

Screenshot 2024-11-07 at 15 34 48

Body and header

Screenshot 2024-11-07 at 15 35 46

Metrics

Screenshot 2024-11-07 at 15 31 55 Screenshot 2024-11-07 at 15 31 42