optimizely / optimizely/java-sdk

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

Offen
#564 1 Kommentar 16 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Java
Sterne
44
Forks
32
Ø Merge
8 Std. 39 Min.
Gemergte PRs (30 T.)
1

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, OptimizelyHttpClient und dessen aktuelle Einrichtung von HttpRequestExecutor als Standard zu lokalisieren, und überprüfe anschließend die zugehörigen HTTP-Client-Tests und die Dokumentation. Erledigt ist die Aufgabe, wenn ein benutzerdefinierter Executor angegeben werden kann, der bestehende Standard als Fallback erhalten bleibt und die Dokumentation ein Verwendungsbeispiel wie MicrometerHttpRequestExecutor enthält.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
backend, observability
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.