diff --git a/jaeger-core/README.md b/jaeger-core/README.md index 2a7d0acb1..e3fa58e42 100644 --- a/jaeger-core/README.md +++ b/jaeger-core/README.md @@ -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 @@ -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) diff --git a/jaeger-core/src/main/java/io/jaegertracing/Configuration.java b/jaeger-core/src/main/java/io/jaegertracing/Configuration.java index d6036c19c..87922cc22 100644 --- a/jaeger-core/src/main/java/io/jaegertracing/Configuration.java +++ b/jaeger-core/src/main/java/io/jaegertracing/Configuration.java @@ -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; @@ -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. */ @@ -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 */ @@ -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 */ @@ -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)) @@ -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)) @@ -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; } @@ -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; @@ -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) { diff --git a/jaeger-core/src/main/java/io/jaegertracing/SpanContext.java b/jaeger-core/src/main/java/io/jaegertracing/SpanContext.java index 0dd3d657a..84b4d9d75 100644 --- a/jaeger-core/src/main/java/io/jaegertracing/SpanContext.java +++ b/jaeger-core/src/main/java/io/jaegertracing/SpanContext.java @@ -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; - } } diff --git a/jaeger-core/src/main/java/io/jaegertracing/Tracer.java b/jaeger-core/src/main/java/io/jaegertracing/Tracer.java index 8a79d266c..16091a012 100644 --- a/jaeger-core/src/main/java/io/jaegertracing/Tracer.java +++ b/jaeger-core/src/main/java/io/jaegertracing/Tracer.java @@ -23,8 +23,6 @@ import io.jaegertracing.metrics.Metrics; import io.jaegertracing.metrics.MetricsFactory; import io.jaegertracing.metrics.NoopMetricsFactory; -import io.jaegertracing.metrics.StatsFactoryImpl; -import io.jaegertracing.metrics.StatsReporter; import io.jaegertracing.propagation.Extractor; import io.jaegertracing.propagation.Injector; import io.jaegertracing.propagation.TextMapCodec; @@ -479,16 +477,6 @@ public Builder(String serviceName) { // TODO binary codec not implemented } - /** - * Use {@link #Builder(String)} and fluent API {@link #withReporter(Reporter)}, {@link #withSampler(Sampler)} - */ - @Deprecated - public Builder(String serviceName, Reporter reporter, Sampler sampler) { - this(serviceName); - this.reporter = reporter; - this.sampler = sampler; - } - /** * @param reporter reporter. */ @@ -515,15 +503,6 @@ public Builder registerExtractor(Format format, Extractor extractor) { return this; } - /** - * @deprecated Use {@link #withMetricsFactory(MetricsFactory)} instead - */ - @Deprecated - public Builder withStatsReporter(StatsReporter statsReporter) { - this.metrics = new Metrics(new StatsFactoryImpl(statsReporter)); - return this; - } - /** * Creates a new {@link Metrics} to be used with the tracer, backed by the given {@link MetricsFactory} * @param metricsFactory the metrics factory to use diff --git a/jaeger-core/src/main/java/io/jaegertracing/metrics/InMemoryStatsReporter.java b/jaeger-core/src/main/java/io/jaegertracing/metrics/InMemoryStatsReporter.java deleted file mode 100644 index f6fb37f55..000000000 --- a/jaeger-core/src/main/java/io/jaegertracing/metrics/InMemoryStatsReporter.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2016, Uber Technologies, Inc - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ - -package io.jaegertracing.metrics; - -import java.util.HashMap; -import java.util.Map; - -/** - * @deprecated Use {@link InMemoryMetricsFactory} instead - */ -@Deprecated -public class InMemoryStatsReporter implements StatsReporter { - public Map counters = new HashMap(); - public Map gauges = new HashMap(); - public Map timers = new HashMap(); - - void reset() { - counters = new HashMap(); - gauges = new HashMap(); - timers = new HashMap(); - } - - @Override - public void incCounter(String name, long delta, Map tags) { - String metricName = Metrics.addTagsToMetricName(name, tags); - long initialValue = 0; - if (counters.containsKey(metricName)) { - initialValue = counters.get(metricName); - } - counters.put(metricName, initialValue + delta); - } - - @Override - public void recordTimer(String name, long time, Map tags) { - String metricName = Metrics.addTagsToMetricName(name, tags); - long initialValue = 0; - if (counters.containsKey(metricName)) { - initialValue = counters.get(metricName); - } - timers.put(metricName, initialValue + time); - } - - @Override - public void updateGauge(String name, long amount, Map tags) { - String metricName = Metrics.addTagsToMetricName(name, tags); - long initialValue = 0; - if (counters.containsKey(metricName)) { - initialValue = counters.get(metricName); - } - gauges.put(metricName, initialValue + amount); - } -} diff --git a/jaeger-core/src/main/java/io/jaegertracing/metrics/Metrics.java b/jaeger-core/src/main/java/io/jaegertracing/metrics/Metrics.java index e72018644..85454d164 100644 --- a/jaeger-core/src/main/java/io/jaegertracing/metrics/Metrics.java +++ b/jaeger-core/src/main/java/io/jaegertracing/metrics/Metrics.java @@ -22,13 +22,6 @@ import java.util.TreeMap; public class Metrics { - /** - * @deprecated Use {@link #Metrics(MetricsFactory)} instead - */ - @Deprecated - public Metrics(StatsFactory factory) { - createMetrics(factory); - } public Metrics(MetricsFactory factory) { createMetrics(factory); @@ -100,14 +93,6 @@ public static String addTagsToMetricName(String name, Map tags) return sb.toString(); } - /** - * @deprecated Use {@link MetricsFactory} and {@link Metrics#Metrics(MetricsFactory)} instead - */ - @Deprecated - public static Metrics fromStatsReporter(StatsReporter reporter) { - return new Metrics(new StatsFactoryImpl(reporter)); - } - @Metric( name = "traces", tags = { diff --git a/jaeger-core/src/main/java/io/jaegertracing/metrics/NullStatsReporter.java b/jaeger-core/src/main/java/io/jaegertracing/metrics/NullStatsReporter.java deleted file mode 100644 index 16c8060d5..000000000 --- a/jaeger-core/src/main/java/io/jaegertracing/metrics/NullStatsReporter.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2016, Uber Technologies, Inc - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ - -package io.jaegertracing.metrics; - -import java.util.Map; - -/** - * A stats reporter that is NOOP. - * - * @deprecated Use {@link NoopMetricsFactory} instead - */ -@Deprecated -public class NullStatsReporter implements StatsReporter { - @Override - public void incCounter(String name, long delta, Map tags) {} - - @Override - public void recordTimer(String name, long time, Map tags) {} - - @Override - public void updateGauge(String name, long amount, Map tags) {} -} diff --git a/jaeger-core/src/main/java/io/jaegertracing/metrics/StatsFactory.java b/jaeger-core/src/main/java/io/jaegertracing/metrics/StatsFactory.java deleted file mode 100644 index b6506e931..000000000 --- a/jaeger-core/src/main/java/io/jaegertracing/metrics/StatsFactory.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2016, Uber Technologies, Inc - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ - -package io.jaegertracing.metrics; - -/** - * @deprecated Use {@link MetricsFactory} instead. At the moment of the deprecation, all methods from this interface - * were moved to the new interface and this interface was made to extend the new one. This allows current - * implementations of this interface to seamlessly move to the new interface. - */ -@Deprecated -public interface StatsFactory extends MetricsFactory { -} diff --git a/jaeger-core/src/main/java/io/jaegertracing/metrics/StatsFactoryImpl.java b/jaeger-core/src/main/java/io/jaegertracing/metrics/StatsFactoryImpl.java deleted file mode 100644 index e0937a9cc..000000000 --- a/jaeger-core/src/main/java/io/jaegertracing/metrics/StatsFactoryImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2016, Uber Technologies, Inc - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ - -package io.jaegertracing.metrics; - -import java.util.Map; - -/** - * A {@link StatsFactory} backed by a {@link StatsReporter}. - * - * @deprecated Use {@link MetricsFactory} instead - */ -@Deprecated -public class StatsFactoryImpl implements StatsFactory { - private final StatsReporter reporter; - - public StatsFactoryImpl(StatsReporter reporter) { - this.reporter = reporter; - } - - @Override - public Counter createCounter(final String name, final Map tags) { - return new Counter() { - @Override - public void inc(long delta) { - reporter.incCounter(name, delta, tags); - } - }; - } - - @Override - public Timer createTimer(final String name, final Map tags) { - return new Timer() { - @Override - public void durationMicros(long time) { - reporter.recordTimer(name, time, tags); - } - }; - } - - @Override - public Gauge createGauge(final String name, final Map tags) { - return new Gauge() { - - @Override - public void update(long amount) { - reporter.updateGauge(name, amount, tags); - } - }; - } -} diff --git a/jaeger-core/src/main/java/io/jaegertracing/metrics/StatsReporter.java b/jaeger-core/src/main/java/io/jaegertracing/metrics/StatsReporter.java deleted file mode 100644 index 67d5e8160..000000000 --- a/jaeger-core/src/main/java/io/jaegertracing/metrics/StatsReporter.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2016, Uber Technologies, Inc - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ - -package io.jaegertracing.metrics; - -import java.util.Map; - -/** - * @deprecated Use {@link MetricsFactory} instead - */ -@Deprecated -public interface StatsReporter { - - void incCounter(String name, long delta, Map tags); - - void recordTimer(String name, long time, Map tags); - - void updateGauge(String name, long amount, Map tags); -} diff --git a/jaeger-core/src/main/java/io/jaegertracing/reporters/RemoteReporter.java b/jaeger-core/src/main/java/io/jaegertracing/reporters/RemoteReporter.java index df6304ff1..71d3c67a3 100644 --- a/jaeger-core/src/main/java/io/jaegertracing/reporters/RemoteReporter.java +++ b/jaeger-core/src/main/java/io/jaegertracing/reporters/RemoteReporter.java @@ -46,17 +46,6 @@ public class RemoteReporter implements Reporter { private final int closeEnqueueTimeout; private final Metrics metrics; - /** - * RemoteReporter takes a Sender object, and sends spans for a specific protocol, and transport. - * At this point in time the protocol (thrift) is tightly-coupled to Reporter, but in the future it may not be. - * - * @deprecated use {@link RemoteReporter.Builder} with fluent API - **/ - @Deprecated - public RemoteReporter(Sender sender, int flushInterval, int maxQueueSize, Metrics metrics) { - this(sender, flushInterval, maxQueueSize, DEFAULT_CLOSE_ENQUEUE_TIMEOUT_MILLIS, metrics); - } - RemoteReporter(Sender sender, int flushInterval, int maxQueueSize, int closeEnqueueTimeout, Metrics metrics) { this.sender = sender; diff --git a/jaeger-core/src/main/java/io/jaegertracing/samplers/RemoteControlledSampler.java b/jaeger-core/src/main/java/io/jaegertracing/samplers/RemoteControlledSampler.java index 6e0978cb0..dac9406c8 100644 --- a/jaeger-core/src/main/java/io/jaegertracing/samplers/RemoteControlledSampler.java +++ b/jaeger-core/src/main/java/io/jaegertracing/samplers/RemoteControlledSampler.java @@ -45,31 +45,6 @@ public class RemoteControlledSampler implements Sampler { @Getter(AccessLevel.PACKAGE) private Sampler sampler; - /** - * @deprecated use {@link Builder} instead - */ - @Deprecated - public RemoteControlledSampler( - String serviceName, SamplingManager manager, Sampler initial, Metrics metrics) { - this(new Builder(serviceName) - .withSamplingManager(manager) - .withInitialSampler(initial) - .withMetrics(metrics)); - } - - /** - * @deprecated use {@link Builder} instead - */ - @Deprecated - public RemoteControlledSampler( - String serviceName, SamplingManager manager, Sampler initial, Metrics metrics, int pollingIntervalMs) { - this(new Builder(serviceName) - .withSamplingManager(manager) - .withInitialSampler(initial) - .withMetrics(metrics) - .withPollingInterval(pollingIntervalMs)); - } - private RemoteControlledSampler(Builder builder) { this.serviceName = builder.serviceName; this.manager = builder.samplingManager; diff --git a/jaeger-core/src/main/java/io/jaegertracing/senders/HttpSender.java b/jaeger-core/src/main/java/io/jaegertracing/senders/HttpSender.java index 964cd6864..1ec7f4fe1 100644 --- a/jaeger-core/src/main/java/io/jaegertracing/senders/HttpSender.java +++ b/jaeger-core/src/main/java/io/jaegertracing/senders/HttpSender.java @@ -43,47 +43,12 @@ public class HttpSender extends ThriftSender { * http://localhost:14268/api/traces * * Uses the default {@link okhttp3.OkHttpClient} which uses {@link okhttp3.ConnectionPool#ConnectionPool()}. - * Use {@link HttpSender#HttpSender(java.lang.String, int, okhttp3.OkHttpClient)} to adjust parameters. + * Use {@link HttpSender.Builder} if you need to add more parameters */ public HttpSender(String endpoint) { this(new Builder(endpoint)); } - /** - * @param endpoint Jaeger REST endpoint consuming jaeger.thrift, e.g - * http://localhost:14268/api/traces - * @param maxPacketSize max bytes to serialize as payload, if 0 it will use - * {@value io.jaegertracing.thrift.reporters.protocols.ThriftUdpTransport#MAX_PACKET_SIZE} - * @deprecated use {@link HttpSender.Builder} with fluent API - */ - @Deprecated - public HttpSender(String endpoint, int maxPacketSize) { - this(new Builder(endpoint).withMaxPacketSize(maxPacketSize)); - } - - /** - * @deprecated use {@link HttpSender.Builder} with fluent API - */ - @Deprecated - public HttpSender(String endpoint, OkHttpClient client) { - this(new Builder(endpoint).withClient(client)); - } - - /** - * @param endpoint Jaeger REST endpoint consuming jaeger.thrift, e.g - * http://localhost:14268/api/traces - * @param maxPacketSize max bytes to serialize as payload, if 0 it will use - * {@value io.jaegertracing.thrift.reporters.protocols.ThriftUdpTransport#MAX_PACKET_SIZE} - * @param client a client used to make http requests - * @deprecated use {@link HttpSender.Builder} with fluent API - */ - @Deprecated - public HttpSender(String endpoint, int maxPacketSize, OkHttpClient client) { - this(new Builder(endpoint) - .withClient(client) - .withMaxPacketSize(maxPacketSize)); - } - private HttpSender(Builder builder) { super(ProtocolType.Binary, builder.maxPacketSize); HttpUrl collectorUrl = HttpUrl diff --git a/jaeger-core/src/test/java/io/jaegertracing/ConfigurationTest.java b/jaeger-core/src/test/java/io/jaegertracing/ConfigurationTest.java index 2f260389f..9638fdc73 100644 --- a/jaeger-core/src/test/java/io/jaegertracing/ConfigurationTest.java +++ b/jaeger-core/src/test/java/io/jaegertracing/ConfigurationTest.java @@ -201,33 +201,6 @@ public void testSenderBackwardsCompatibilityGettingAgentHostAndPort() { .getSenderConfiguration().getAgentPort()); } - @Test - public void testNoNullPointerOnNullSender() { - Configuration.ReporterConfiguration reporterConfiguration = - new Configuration.ReporterConfiguration(null, null, null, null); - assertNull(reporterConfiguration.getAgentHost()); - assertNull(reporterConfiguration.getAgentPort()); - - reporterConfiguration = new Configuration.ReporterConfiguration(null); - assertNull(reporterConfiguration.getAgentHost()); - assertNull(reporterConfiguration.getAgentPort()); - - reporterConfiguration = new Configuration.ReporterConfiguration(); - assertNull(reporterConfiguration.getAgentHost()); - assertNull(reporterConfiguration.getAgentPort()); - } - - @Test - public void testCustomSender() { - String endpoint = "https://custom-sender-endpoint:14268/api/traces"; - System.setProperty(Configuration.JAEGER_ENDPOINT, "https://jaeger-collector:14268/api/traces"); - CustomSender customSender = new CustomSender(endpoint); - Configuration.SenderConfiguration senderConfiguration = new Configuration.SenderConfiguration.Builder() - .sender(customSender) - .build(); - assertEquals(endpoint, ((CustomSender)senderConfiguration.getSender()).getEndpoint()); - } - @Test public void testSenderWithBasicAuthUsesHttpSender() { Configuration.SenderConfiguration senderConfiguration = new Configuration.SenderConfiguration() diff --git a/jaeger-core/src/test/java/io/jaegertracing/utils/TestUtils.java b/jaeger-core/src/test/java/io/jaegertracing/utils/TestUtils.java deleted file mode 100644 index c6c547f8a..000000000 --- a/jaeger-core/src/test/java/io/jaegertracing/utils/TestUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2017, The Jaeger Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ - -package io.jaegertracing.utils; - -import io.opentracing.noop.NoopTracerFactory; -import io.opentracing.util.GlobalTracer; -import java.lang.reflect.Field; - -/** - * @deprecated Use io.opentracing.util.GlobalTracerTestUtil - */ -@Deprecated -public class TestUtils { - public static void resetGlobalTracer() throws NoSuchFieldException, IllegalAccessException { - // Reset opentracing's global tracer - Field field = GlobalTracer.class.getDeclaredField("tracer"); - field.setAccessible(true); - field.set(null, NoopTracerFactory.create()); - } -} diff --git a/jaeger-zipkin/README.md b/jaeger-zipkin/README.md index d622bfe0c..a8de269fa 100644 --- a/jaeger-zipkin/README.md +++ b/jaeger-zipkin/README.md @@ -14,10 +14,10 @@ register `B3TextMapCodec`, Jaeger can join traces started by other Zipkin instru For example: ```java b3Codec = new B3TextMapCodec(); -tracer = new Tracer.Builder(serviceName, reporter, sampler) - .registerInjector(Format.Builtin.HTTP_HEADERS, b3Codec) - .registerExtractor(Format.Builtin.HTTP_HEADERS, b3Codec) - ... +tracer = new Tracer.Builder(serviceName) + .registerInjector(Format.Builtin.HTTP_HEADERS, b3Codec) + .registerExtractor(Format.Builtin.HTTP_HEADERS, b3Codec) + ... ``` ## Sending data to Zipkin @@ -32,8 +32,9 @@ For example: import io.jaegertracing.senders.zipkin.ZipkinSender; reporter = new RemoteReporter(ZipkinSender.create("http://localhost:9411/api/v1/spans")); -tracer = new Tracer.Builder(serviceName, reporter, sampler) - ... +tracer = new Tracer.Builder(serviceName) + .withReporter(reporter) + ... ``` ### Zipkin 2 Reporters diff --git a/jaeger-zipkin/src/test/java/io/jaegertracing/zipkin/V2SpanConverterTest.java b/jaeger-zipkin/src/test/java/io/jaegertracing/zipkin/V2SpanConverterTest.java index e276a5c6b..c108c3d3e 100644 --- a/jaeger-zipkin/src/test/java/io/jaegertracing/zipkin/V2SpanConverterTest.java +++ b/jaeger-zipkin/src/test/java/io/jaegertracing/zipkin/V2SpanConverterTest.java @@ -111,7 +111,9 @@ public static Object[][] dataProviderTracerTags() { @UseDataProvider("dataProviderTracerTags") public void testTracerTags(SpanType spanType, Map expectedTags) throws Exception { InMemoryReporter spanReporter = new InMemoryReporter(); - Tracer tracer = new Tracer.Builder("x", spanReporter, new ConstSampler(true)) + Tracer tracer = new Tracer.Builder("x") + .withReporter(spanReporter) + .withSampler(new ConstSampler(true)) .withZipkinSharedRpcSpan() .withTag("tag.str", "y") .withTag("tag.bool", true)