optimizely / optimizely/java-sdk

[ENHANCEMENT] Add Support for Custom `HttpRequestExecutor` in `OptimizelyHttpClient`

オープン
#564 コメント 1 件 リアクション 16 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Java
スター
44
フォーク
32
平均マージ
8時間 39分
マージ済み PR(30日)
1

説明

Description

Currently, the OptimizelyHttpClient in the Optimizely Java SDK uses a default HttpRequestExecutor provided by Apache HttpComponents library for handling HTTP requests. However, there is no extension point to allow developers to supply a custom HttpRequestExecutor.

Adding the ability to inject a custom HttpRequestExecutor would provide greater flexibility, enabling users to replace or extend the default behavior. For example, the inclusion of tools such as the MicrometerHttpRequestExecutor allows the collection of execution metrics, including latency, errors, and throughput.

While upgrading to Apache HttpComponents 5 would modernize the library and bring advanced features, adding this extension point would still be valuable. It ensures that developers can adapt or enhance the HTTP client behavior for monitoring and observability, regardless of which version of Apache HttpComponents is used.

Benefits
  • Increased Observability: Developers can use custom executors, like the MicrometerHttpRequestExecutor, to capture valuable execution metrics such as request duration, HTTP status distribution, and network errors. These metrics can be sent to monitoring systems like Prometheus or Datadog.
  • Enhanced Extensibility: A configurable HttpRequestExecutor provides an extension point for more advanced use cases, empowering developers to customize the HTTP behavior without requiring changes to the base SDK.
  • Future-Proof Design: Introducing this flexibility ensures that users have control over HTTP execution behavior, making it easier to adopt library upgrades in the future, including potential transitions to Apache HttpComponents 5.
Detail
  1. Add a configurable property to OptimizelyHttpClient to allow injection of a custom HttpRequestExecutor.
  2. Provide a fallback to the existing default HttpRequestExecutor if no custom request executor is supplied.
  3. Update documentation to highlight this new extensibility feature and provide examples of using custom executors such as MicrometerHttpRequestExecutor.
Examples

Not right now

Risks/Downsides

Not right now

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず OptimizelyHttpClient と、現在の HttpRequestExecutor のデフォルト設定を見つけ、その後、関連する HTTP クライアントのテストとドキュメントを確認します。カスタム executor を指定でき、既存のデフォルトがフォールバックとして維持され、ドキュメントに MicrometerHttpRequestExecutor などの使用例が含まれていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
backend, observability
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。