cloudfoundry / cloudfoundry/cf-java-client

Better customization options for the underlying HTTP client

未关闭
#1,024 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

enhancement reactor triaged
主要语言
Java
星标
334
派生
319
PR 合并指标
30 天内没有已合并 PR

描述

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?

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

阅读 _DefaultConnectionContext 和入口点 DefaultConnectionContext.builder,以了解 reactor-netty HttpClient 的组装方式。将提议的 metrics 选项与 additionalHttpClientConfiguration hook 进行比较,然后找出现有的客户端构建测试;完成的标准是调用方可以自定义底层客户端,而无需替换完整的构建逻辑。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
api, backend
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。