Merge branch 'master' into 2.0.x

This commit is contained in:
Marcin Grzejszczak
2017-06-29 08:55:59 +02:00
28 changed files with 112 additions and 337 deletions

View File

@@ -38,11 +38,6 @@ public class DiscoveryClientHostLocator implements HostLocator {
private final DiscoveryClient client;
private final ZipkinProperties zipkinProperties;
@Deprecated
public DiscoveryClientHostLocator(DiscoveryClient client) {
this(client, new ZipkinProperties());
}
public DiscoveryClientHostLocator(DiscoveryClient client, ZipkinProperties zipkinProperties) {
this.client = client;
Assert.notNull(this.client, "client");

View File

@@ -53,11 +53,6 @@ public class ServerPropertiesHostLocator implements HostLocator {
private final ZipkinProperties zipkinProperties;
private Integer port; // Lazy assigned
@Deprecated
public ServerPropertiesHostLocator(ServerProperties serverProperties, String appName) {
this(serverProperties, appName, new ZipkinProperties(),null);
}
public ServerPropertiesHostLocator(ServerProperties serverProperties, String appName,
ZipkinProperties zipkinProperties, InetUtils inetUtils) {
this.serverProperties = serverProperties;

View File

@@ -16,19 +16,9 @@
package org.springframework.cloud.sleuth.stream;
import java.lang.invoke.MethodHandles;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import org.apache.commons.logging.LogFactory;
import org.springframework.cloud.commons.util.IdUtils;
import org.springframework.cloud.sleuth.Log;
import org.springframework.cloud.sleuth.NoOpSpanAdjuster;
import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.SpanAdjuster;
import org.springframework.cloud.sleuth.SpanReporter;
@@ -38,6 +28,14 @@ import org.springframework.integration.annotation.InboundChannelAdapter;
import org.springframework.integration.annotation.MessageEndpoint;
import org.springframework.integration.annotation.Poller;
import java.lang.invoke.MethodHandles;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
/**
* A message source for spans. Also handles RPC flavoured annotations.
*
@@ -66,18 +64,6 @@ public class StreamSpanReporter implements SpanReporter {
private final Environment environment;
private final List<SpanAdjuster> spanAdjusters;
@Deprecated
public StreamSpanReporter(HostLocator endpointLocator,
SpanMetricReporter spanMetricReporter) {
this(endpointLocator, spanMetricReporter, null);
}
@Deprecated
public StreamSpanReporter(HostLocator endpointLocator,
SpanMetricReporter spanMetricReporter, Environment environment) {
this(endpointLocator, spanMetricReporter, environment, Collections.<SpanAdjuster>singletonList(new NoOpSpanAdjuster()));
}
public StreamSpanReporter(HostLocator endpointLocator,
SpanMetricReporter spanMetricReporter, Environment environment, List<SpanAdjuster> spanAdjusters) {
this.endpointLocator = endpointLocator;

View File

@@ -16,10 +16,6 @@
package org.springframework.cloud.sleuth.stream;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Collections;
import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.boot.autoconfigure.web.ServerProperties;
@@ -27,14 +23,16 @@ import org.springframework.cloud.commons.util.InetUtils;
import org.springframework.cloud.commons.util.InetUtilsProperties;
import org.springframework.cloud.sleuth.Span;
import java.net.InetAddress;
import java.net.UnknownHostException;
import static org.assertj.core.api.Assertions.assertThat;
public class ServerPropertiesHostLocatorTests {
public static final byte[] ADR1234 = { 1, 2, 3, 4 };
Span span = new Span(1, 3, "http:name", 1L, Collections.<Long>emptyList(), 2L, true, true,
"process");
Span span = Span.builder().begin(1).end(3).name("http:name").traceId(1L).spanId(2L).remote(true).exportable(true).processId("process").build();
@Test
public void portDefaultsTo8080() throws UnknownHostException {

View File

@@ -16,11 +16,6 @@
package org.springframework.cloud.sleuth.stream;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -29,6 +24,12 @@ import org.springframework.cloud.sleuth.SpanAdjuster;
import org.springframework.cloud.sleuth.metric.SpanMetricReporter;
import org.springframework.mock.env.MockEnvironment;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.then;
@@ -44,7 +45,8 @@ public class StreamSpanReporterTests {
@Before
public void setup() {
this.reporter = new StreamSpanReporter(this.endpointLocator, this.spanMetricReporter, this.mockEnvironment);
this.reporter = new StreamSpanReporter(this.endpointLocator, this.spanMetricReporter,
this.mockEnvironment, new ArrayList<>());
}
@Test
@@ -79,7 +81,8 @@ public class StreamSpanReporterTests {
@Test
@SuppressWarnings("unchecked")
public void should_not_append_server_serviceid_when_span_has_rpc_event_and_there_is_no_environment() throws Exception {
this.reporter = new StreamSpanReporter(this.endpointLocator, this.spanMetricReporter, null);
this.reporter = new StreamSpanReporter(this.endpointLocator, this.spanMetricReporter,
null, new ArrayList<>());
LinkedBlockingQueue<Span> queue = new LinkedBlockingQueue<>(1000);
this.reporter.setQueue(queue);
Span span = Span.builder().name("bar").exportable(true).build();