cloudfoundry / cloudfoundry/cf-java-client
Better customization options for the underlying HTTP client
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Java
- Sterne
- 334
- Forks
- 319
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
We're using the CF Java client under a fairly high load (tens of thousands of requests per day) and we would like to enable the metrics feature of reactor-netty, so that we can see how many connections are used at any point in time:
return createHttpClient().compress(true) // Code taken from _DefaultConnectionContext.java
.tcpConfiguration(this::configureTcpClient)
.secure(this::configureSsl)
.metrics(true, new CustomHttpClientMetricsRecorder());
This is currently not possible unless we also override the entire reactor-netty client via DefaultConnectionContext.builder().httpClient(...), which we don't want to do, because it would involve to copy-pasting the entire HttpClient building logic from _DefaultConnectionContext. I could make a pull request that allows users of the CF Java client to do:
DefaultConnectionContext.builder()
.metrics(true) // OR
.metrics(true, new CustomHttpClientMetricsRecorder())
.build();
But I also don't particularly like that idea, because this doesn't cover any future features that the rector-netty devs may implement (or already have implemented). Maybe something like the following would be best?
DefaultConnectionContext.builder()
.additionalHttpClientConfiguration(httpClient -> httpClient.metrics(true) // OR
.metrics(true, new CustomHttpClientMetricsRecorder()))
.build();
What do you think?
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Lies _DefaultConnectionContext und den Einstiegspunkt DefaultConnectionContext.builder, um zu verstehen, wie der reactor-netty HttpClient zusammengesetzt wird. Vergleiche die vorgeschlagenen Metrikoptionen mit dem additionalHttpClientConfiguration-Hook und ermittle vorhandene Tests zum Aufbau des Clients; erledigt ist die Aufgabe, wenn Aufrufer den zugrunde liegenden Client anpassen können, ohne die vollständige Konstruktionslogik zu ersetzen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- api, backend
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 30/100