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

Remove deprecated API - HttpSender and RemoteBaggMana #431

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,6 @@ public class RemoteBaggageRestrictionManager implements BaggageRestrictionManage
private final Restriction invalidRestriction;
private final Restriction validRestriction;

/**
* @deprecated use {@link Builder}
*/
@Deprecated
public RemoteBaggageRestrictionManager(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that now it's not possible to override this class

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not good, then.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, my bad, we shouldn't deprecate this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to deprecate it and use builder instead. Does protected constructor work for you?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's fine

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks the private with the most parameters is changed from private to protected

protected RemoteBaggageRestrictionManager(
       String serviceName,
       BaggageRestrictionManagerProxy proxy,
       Metrics metrics,
       boolean denyBaggageOnInitializationFailure,
       int refreshIntervalMs,
       int initialDelayMs
   ) {

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(
String serviceName,
BaggageRestrictionManagerProxy proxy,
Expand Down
13 changes: 0 additions & 13 deletions jaeger-core/src/main/java/io/jaegertracing/senders/HttpSender.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,6 @@ 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) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that now it's not possible to override this class

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not good :)

this(new Builder(endpoint));
}

private HttpSender(Builder builder) {
super(ProtocolType.Binary, builder.maxPacketSize);
HttpUrl collectorUrl = HttpUrl
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 @@ -450,17 +450,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