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

Commit

Permalink
Remove deprecated APIs from core (#414)
Browse files Browse the repository at this point in the history
* Remove deprecated APIs

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

* Remove deprecasted Tracer.Builder(name, reporter, sampler)

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

* Polish readme

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

* Fix after merge in master

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
  • Loading branch information
pavolloffay authored May 23, 2018
1 parent 07df0b8 commit ed5791d
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 659 deletions.
21 changes: 10 additions & 11 deletions jaeger-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ Example configuration:
```java
b3Codec = new B3TextMapCodec();
tracer = new Tracer.Builder(serviceName)
.registerInjector(Format.Builtin.HTTP_HEADERS, b3Codec)
.registerExtractor(Format.Builtin.HTTP_HEADERS, b3Codec)
...
.registerInjector(Format.Builtin.HTTP_HEADERS, b3Codec)
.registerExtractor(Format.Builtin.HTTP_HEADERS, b3Codec)
...
```

#### Configuration via Environment
Expand Down Expand Up @@ -110,24 +110,23 @@ To accomplish that, include the artifact `io.jaegertracing:jaeger-micrometer` as
MicrometerMetricsFactory metricsReporter = new MicrometerMetricsFactory();
Configuration configuration = new Configuration("myServiceName");
Tracer tracer = configuration
.getTracerBuilder()
.withMetrics(new io.jaegertracing.metrics.Metrics(metricsReporter))
.build();
.getTracerBuilder()
.withMetrics(new io.jaegertracing.metrics.Metrics(metricsReporter))
.build();
```

### Development

The last two parameters to `new Configuration()` allow control over configuration of the Sampler and Reporter.
However, especially in unit tests, it's useful to have tracer that is not connected to tracing backend, but collects
Especially in unit tests, it's useful to have tracer that is not connected to tracing backend, but collects
spans in memory:

```java
Reporter reporter = new InMemoryReporter();
Sampler sampler = new ConstSampler(true);
Tracer tracer = new Tracer.Builder(serviceName)
.withReporter(reporter)
.withSampler(sampler)
.build();
.withReporter(reporter)
.withSampler(sampler)
.build();
```

See also: [opentracing-java](https://github.com/opentracing/opentracing-java)
233 changes: 0 additions & 233 deletions jaeger-core/src/main/java/io/jaegertracing/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import io.jaegertracing.metrics.Metrics;
import io.jaegertracing.metrics.MetricsFactory;
import io.jaegertracing.metrics.NoopMetricsFactory;
import io.jaegertracing.metrics.StatsFactory;
import io.jaegertracing.propagation.B3TextMapCodec;
import io.jaegertracing.propagation.Codec;
import io.jaegertracing.propagation.CompositeCodec;
Expand Down Expand Up @@ -55,12 +54,6 @@
*/
@Slf4j
public class Configuration {
/**
* @deprecated use {@link ProbabilisticSampler#DEFAULT_SAMPLING_PROBABILITY} instead
*/
@Deprecated
public static final double DEFAULT_SAMPLING_PROBABILITY = ProbabilisticSampler.DEFAULT_SAMPLING_PROBABILITY;

/**
* Prefix for all properties used to configure the Jaeger tracer.
*/
Expand Down Expand Up @@ -177,33 +170,6 @@ public Configuration(String serviceName) {
this.serviceName = Tracer.Builder.checkValidServiceName(serviceName);
}

/**
* @deprecated use {@link #Configuration(String)} and fluent API
*/
@Deprecated
public Configuration(
String serviceName,
SamplerConfiguration samplerConfig,
ReporterConfiguration reporterConfig) {
this(serviceName, samplerConfig, reporterConfig, null);
}

/**
* @deprecated use {@link #Configuration(String)} and fluent API
*/
@Deprecated
private Configuration(
String serviceName,
SamplerConfiguration samplerConfig,
ReporterConfiguration reporterConfig,
CodecConfiguration codecConfig) {
this(serviceName);
this.samplerConfig = samplerConfig;
this.reporterConfig = reporterConfig;
this.codecConfig = codecConfig;
this.metricsFactory = new NoopMetricsFactory();
}

/**
* @return Configuration object from environmental variables
*/
Expand Down Expand Up @@ -257,26 +223,6 @@ public synchronized void closeTracer() {
}
}

/**
* @see #withMetricsFactory(MetricsFactory)
* @param statsFactory the StatsFactory to use on the Tracer to be built
* @deprecated Use {@link #withMetricsFactory(MetricsFactory)} instead
*/
@Deprecated
public void setStatsFactor(StatsFactory statsFactory) {
this.metricsFactory = statsFactory;
}

/**
* @see #withMetricsFactory(MetricsFactory)
* @param statsFactory the StatsFactory to use on the Tracer to be built
* @deprecated Use {@link #withMetricsFactory(MetricsFactory)} instead
*/
@Deprecated
public void setStatsFactory(StatsFactory statsFactory) {
this.metricsFactory = statsFactory;
}

/**
* @param metricsFactory the MetricsFactory to use on the Tracer to be built
*/
Expand Down Expand Up @@ -360,24 +306,6 @@ public static class SamplerConfiguration {
public SamplerConfiguration() {
}

/**
* @deprecated use {@link #SamplerConfiguration()} and fluent API
*/
@Deprecated
public SamplerConfiguration(String type, Number param) {
this(type, param, null);
}

/**
* @deprecated use {@link #SamplerConfiguration()} and fluent API
*/
@Deprecated
public SamplerConfiguration(String type, Number param, String managerHostPort) {
this.type = type;
this.param = param;
this.managerHostPort = managerHostPort;
}

public static SamplerConfiguration fromEnv() {
return new SamplerConfiguration()
.withType(getProperty(JAEGER_SAMPLER_TYPE))
Expand Down Expand Up @@ -529,48 +457,6 @@ public static class ReporterConfiguration {
public ReporterConfiguration() {
}

/**
* @deprecated use {@link Tracer.Builder} instead or {@link Configuration#getTracerBuilder()}
*/
@Deprecated
public ReporterConfiguration(Sender sender) {
this.senderConfiguration = new Configuration.SenderConfiguration.Builder()
.sender(sender)
.build();
}

/**
* @deprecated use {@link #ReporterConfiguration()} and fluent API
*/
@Deprecated
public ReporterConfiguration(
Boolean logSpans,
String agentHost,
Integer agentPort,
Integer flushIntervalMs,
Integer maxQueueSize) {
this.logSpans = logSpans;
this.flushIntervalMs = flushIntervalMs;
this.maxQueueSize = maxQueueSize;
this.senderConfiguration.withAgentHost(agentHost)
.withAgentPort(agentPort);
}

/**
* @deprecated use {@link #ReporterConfiguration()} and fluent API
*/
@Deprecated
public ReporterConfiguration(
Boolean logSpans,
Integer flushIntervalMs,
Integer maxQueueSize,
SenderConfiguration senderConfiguration) {
this.logSpans = logSpans;
this.flushIntervalMs = flushIntervalMs;
this.maxQueueSize = maxQueueSize;
this.senderConfiguration = senderConfiguration;
}

public static ReporterConfiguration fromEnv() {
return new ReporterConfiguration()
.withLogSpans(getPropertyAsBool(JAEGER_REPORTER_LOG_SPANS))
Expand Down Expand Up @@ -618,30 +504,6 @@ public Boolean getLogSpans() {
return logSpans;
}

/**
* @deprecated use {@link #getSenderConfiguration()}
*/
@Deprecated
public String getAgentHost() {
if (null == this.senderConfiguration) {
return null;
}

return this.senderConfiguration.agentHost;
}

/**
* @deprecated use {@link #getSenderConfiguration()}
*/
@Deprecated
public Integer getAgentPort() {
if (null == this.senderConfiguration) {
return null;
}

return this.senderConfiguration.agentPort;
}

public Integer getFlushIntervalMs() {
return flushIntervalMs;
}
Expand Down Expand Up @@ -699,16 +561,6 @@ public static class SenderConfiguration {
public SenderConfiguration() {
}

private SenderConfiguration(SenderConfiguration.Builder builder) {
this.sender = builder.sender;
this.agentHost = builder.agentHost;
this.agentPort = builder.agentPort;
this.endpoint = builder.endpoint;
this.authToken = builder.authToken;
this.authUsername = builder.authUsername;
this.authPassword = builder.authPassword;
}

public SenderConfiguration withAgentHost(String agentHost) {
this.agentHost = agentHost;
return this;
Expand Down Expand Up @@ -793,91 +645,6 @@ public static SenderConfiguration fromEnv() {
.withAuthUsername(authUsername)
.withAuthPassword(authPassword);
}

/**
* @deprecated use {@link SenderConfiguration} directly
*/
@Deprecated
public static class Builder {
private Sender sender;
private String agentHost = null;
private Integer agentPort = null;
private String endpoint = null;
private String authToken = null;
private String authUsername = null;
private String authPassword = null;

/**
* @deprecated use {@link Configuration#getTracerBuilder()} or {@link Tracer.Builder} directly
*/
@Deprecated
public Builder sender(Sender sender) {
this.sender = sender;
return this;
}

/**
* @deprecated use {@link SenderConfiguration} directly
*/
@Deprecated
public Builder agentHost(String agentHost) {
this.agentHost = agentHost;
return this;
}

/**
* @deprecated use {@link SenderConfiguration} directly
*/
@Deprecated
public Builder agentPort(Integer agentPort) {
this.agentPort = agentPort;
return this;
}

/**
* @deprecated use {@link SenderConfiguration} directly
*/
@Deprecated
public Builder endpoint(String endpoint) {
this.endpoint = endpoint;
return this;
}

/**
* @deprecated use {@link SenderConfiguration} directly
*/
@Deprecated
public Builder authToken(String authToken) {
this.authToken = authToken;
return this;
}

/**
* @deprecated use {@link SenderConfiguration} directly
*/
@Deprecated
public Builder authUsername(String authUsername) {
this.authUsername = authUsername;
return this;
}

/**
* @deprecated use {@link SenderConfiguration} directly
*/
@Deprecated
public Builder authPassword(String authPassword) {
this.authPassword = authPassword;
return this;
}

/**
* @deprecated use {@link SenderConfiguration} directly
*/
@Deprecated
public Configuration.SenderConfiguration build() {
return new Configuration.SenderConfiguration(this);
}
}
}

private static String stringOrDefault(String value, String defaultValue) {
Expand Down
27 changes: 0 additions & 27 deletions jaeger-core/src/main/java/io/jaegertracing/SpanContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,31 +173,4 @@ public static SpanContext withDebugId(String debugId) {
String getDebugId() {
return debugId;
}

/**
* @deprecated use {@link SpanContext#getTraceId()} instead.
* @return same as getTraceId
*/
@Deprecated
public long getTraceID() {
return traceId;
}

/**
* @deprecated use {@link SpanContext#getSpanID()} instead.
* @return same as getSpanId
*/
@Deprecated
public long getSpanID() {
return spanId;
}

/**
* @deprecated use {@link SpanContext#getParentID()} instead.
* @return same as getParentId
*/
@Deprecated
public long getParentID() {
return parentId;
}
}
Loading

0 comments on commit ed5791d

Please sign in to comment.