Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Commit

Permalink
Remove deprecated API - HttpSender and RemoteBagMan (#431)
Browse files Browse the repository at this point in the history
* Remove deprecated API - HttpSender and RemoteBaggMana

Signed-off-by: Pavol Loffay <ploffay@redhat.com>

* Use protected

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
  • Loading branch information
pavolloffay authored Jun 1, 2018
1 parent 9a82c6a commit 9dca4ce
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,34 +41,7 @@ public class RemoteBaggageRestrictionManager implements BaggageRestrictionManage
private final Restriction invalidRestriction;
private final Restriction validRestriction;

/**
* @deprecated use {@link Builder}
*/
@Deprecated
public RemoteBaggageRestrictionManager(
String serviceName,
BaggageRestrictionManagerProxy proxy,
Metrics metrics,
boolean denyBaggageOnInitializationFailure
) {
this(serviceName, proxy, metrics, denyBaggageOnInitializationFailure, DEFAULT_REFRESH_INTERVAL_MS);
}

/**
* @deprecated use {@link Builder}
*/
@Deprecated
public RemoteBaggageRestrictionManager(
String serviceName,
BaggageRestrictionManagerProxy proxy,
Metrics metrics,
boolean denyBaggageOnInitializationFailure,
int refreshIntervalMs
) {
this(serviceName, proxy, metrics, denyBaggageOnInitializationFailure, refreshIntervalMs, DEFAULT_INITIAL_DELAY_MS);
}

private RemoteBaggageRestrictionManager(
protected RemoteBaggageRestrictionManager(
String serviceName,
BaggageRestrictionManagerProxy proxy,
Metrics metrics,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,7 @@ public class HttpSender extends ThriftSender {
private final OkHttpClient httpClient;
private final Request.Builder requestBuilder;

/**
* @param endpoint Jaeger REST endpoint consuming jaeger.thrift, e.g
* http://localhost:14268/api/traces
*
* Uses the default {@link okhttp3.OkHttpClient} which uses {@link okhttp3.ConnectionPool#ConnectionPool()}.
* Use {@link HttpSender.Builder} if you need to add more parameters
* @deprecated use {@link Builder}
*/
@Deprecated
public HttpSender(String endpoint) {
this(new Builder(endpoint));
}

private HttpSender(Builder builder) {
protected HttpSender(Builder builder) {
super(ProtocolType.Binary, builder.maxPacketSize);
HttpUrl collectorUrl = HttpUrl
.parse(String.format("%s?%s", builder.endpoint, HTTP_COLLECTOR_JAEGER_THRIFT_FORMAT_PARAM));
Expand Down
13 changes: 0 additions & 13 deletions jaeger-core/src/test/java/io/jaegertracing/ConfigurationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -460,17 +460,4 @@ public String get(String key) {
return values.get(key);
}
}

private static class CustomSender extends HttpSender {
private String endpoint;

public CustomSender(String endpoint) {
super(endpoint);
this.endpoint = endpoint;
}

public String getEndpoint() {
return endpoint;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ protected Application configure() {

@Test
public void sendHappy() throws Exception {
new HttpSender(target("/api/traces").getUri().toString())
new HttpSender.Builder(target("/api/traces").getUri().toString())
.build()
.send(new Process("robotrock"), generateSpans());
new HttpSender.Builder(target("/api/traces").getUri().toString()).withMaxPacketSize(6500).build()
.send(new Process("name"), generateSpans());
Expand All @@ -72,24 +73,27 @@ public void sendHappy() throws Exception {

@Test(expected = Exception.class)
public void sendServerError() throws Exception {
HttpSender sender = new HttpSender(target("/api/tracesErr").getUri().toString());
HttpSender sender = new HttpSender.Builder(target("/api/tracesErr").getUri().toString())
.build();
sender.send(new Process("robotrock"), generateSpans());
}

@Test(expected = IllegalArgumentException.class)
public void misconfiguredUrl() throws Exception {
new HttpSender("misconfiguredUrl");
new HttpSender.Builder("misconfiguredUrl").build();
}

@Test(expected = Exception.class)
public void serverDoesntExist() throws Exception {
HttpSender sender = new HttpSender("http://some-server/api/traces");
HttpSender sender = new HttpSender.Builder("http://some-server/api/traces")
.build();
sender.send(new Process("robotrock"), generateSpans());
}

@Test(expected = SenderException.class)
public void senderFail() throws Exception {
HttpSender sender = new HttpSender("http://some-server/api/traces");
HttpSender sender = new HttpSender.Builder("http://some-server/api/traces")
.build();
sender.send(null, generateSpans());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ private static String getEvn(String envName, String defaultValue) {
private static Sender senderFromEnv(String collectorHostPort, String agentHost) {
String senderEnvVar = System.getenv(Constants.ENV_PROP_SENDER_TYPE);
if ("http".equalsIgnoreCase(senderEnvVar)) {
return new HttpSender(String.format("http://%s/api/traces", collectorHostPort));
return new HttpSender.Builder(String.format("http://%s/api/traces", collectorHostPort))
.build();
} else if ("udp".equalsIgnoreCase(senderEnvVar) || senderEnvVar == null || senderEnvVar.isEmpty()) {
return new UdpSender(agentHost, 0, 0);
}
Expand Down

0 comments on commit 9dca4ce

Please sign in to comment.