Skip to content

Commit

Permalink
Report metrics for statically-bound balancing httpclients using the a…
Browse files Browse the repository at this point in the history
…nnotation name
  • Loading branch information
johngmyers committed Aug 25, 2023
1 parent 4495824 commit 3300abc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
6 changes: 6 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Platform 2.97

* HttpClient

We fixed the metrics reporting for a HttpClientBinder method that was added in Platform 2.96

Platform 2.96

* Reporting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public BalancingHttpClientBindingBuilder bindBalancingHttpClient(String name, Cl
.toProvider(new ConfiguredStaticHttpServiceBalancerProvider(serviceName,
Key.get(HttpServiceBalancerConfig.class, annotation),
Key.get(HttpServiceBalancerUriConfig.class, annotation)));
return createBalancingHttpClientBindingBuilder(privateBinder, name, annotation, serviceName);
return createBalancingHttpClientBindingBuilder(privateBinder, name, annotation);
}

private BalancingHttpClientBindingBuilder createBalancingHttpClientBindingBuilder(PrivateBinder privateBinder, String name, Class<? extends Annotation> annotation)
Expand Down Expand Up @@ -443,24 +443,6 @@ private BalancingHttpClientBindingBuilder createBalancingHttpClientBindingBuilde

return new BalancingHttpClientBindingBuilder(binder, annotation, delegateBindingBuilder);
}

private BalancingHttpClientBindingBuilder createBalancingHttpClientBindingBuilder(PrivateBinder privateBinder, String name, Class<? extends Annotation> annotation, String serviceName)
{
HttpClientBindingBuilder delegateBindingBuilder = httpClientPrivateBinder(privateBinder, binder).bindHttpClient(name, ForBalancingHttpClient.class);
bindConfig(privateBinder).bind(BalancingHttpClientConfig.class).prefixedWith(name);
privateBinder.bind(HttpClient.class).annotatedWith(annotation).to(BalancingHttpClient.class).in(Scopes.SINGLETON);
privateBinder.expose(HttpClient.class).annotatedWith(annotation);
reportBinder(binder).export(HttpClient.class).annotatedWith(annotation).withNamePrefix("HttpClient." + serviceName);
newExporter(binder).export(HttpClient.class).annotatedWith(annotation).as(new ObjectNameBuilder(HttpClient.class.getPackage().getName())
.withProperty("type", "HttpClient")
.withProperty("name", serviceName)
.build()
);
binder.bind(ScheduledExecutorService.class).annotatedWith(ForBalancingHttpClient.class).toProvider(RetryExecutorProvider.class);

return new BalancingHttpClientBindingBuilder(binder, annotation, delegateBindingBuilder);
}

public static class HttpClientBindingBuilder
{
private final HttpClientModule module;
Expand Down

0 comments on commit 3300abc

Please sign in to comment.