responseExtractor) throws RestClientException {
- URI uri = this.extractor.zipkinUrl(this.zipkinProperties);
- URI newUri = resolvedZipkinUri(originalUrl, uri);
- return super.doExecute(newUri, method, requestCallback, responseExtractor);
- }
-
- private URI resolvedZipkinUri(URI originalUrl, URI resolvedZipkinUri) {
- try {
- return new URI(resolvedZipkinUri.getScheme(), resolvedZipkinUri.getUserInfo(),
- resolvedZipkinUri.getHost(), resolvedZipkinUri.getPort(), originalUrl.getPath(),
- originalUrl.getQuery(), originalUrl.getFragment());
- } catch (URISyntaxException e) {
- if (log.isDebugEnabled()) {
- log.debug("Failed to create the new URI from original [" + originalUrl + "] and new one [" + resolvedZipkinUri + "]");
- }
- return originalUrl;
- }
- }
-}
diff --git a/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin/ZipkinLoadBalancer.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin/ZipkinLoadBalancer.java
deleted file mode 100644
index 383c1cc94..000000000
--- a/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin/ZipkinLoadBalancer.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.springframework.cloud.sleuth.zipkin;
-
-import java.net.URI;
-
-/**
- * Load balancing strategy for picking a Zipkin instance
- *
- * @author Marcin Grzejszczak
- * @since 1.3.0
- * @deprecated Please use spring-cloud-sleuth-zipkin2 to report spans to Zipkin
- */
-@Deprecated
-public interface ZipkinLoadBalancer {
-
- /**
- * Returns a concrete {@link URI} of a Zipkin instance.
- *
- * @return {@link URI} of the picked instance
- */
- URI instance();
-}
diff --git a/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin/ZipkinProperties.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin/ZipkinProperties.java
deleted file mode 100644
index 4516a39ca..000000000
--- a/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin/ZipkinProperties.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright 2013-2015 the original author or 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 org.springframework.cloud.sleuth.zipkin;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-import zipkin.reporter.Encoding;
-
-/**
- * Zipkin settings
- *
- * @author Spencer Gibb
- * @since 1.0.0
- */
-@ConfigurationProperties("spring.zipkin")
-public class ZipkinProperties {
- /** URL of the zipkin query server instance. You can also provide
- * the service id of the Zipkin server if Zipkin's registered in
- * service discovery (e.g. http://zipkinserver/)
- */
- private String baseUrl = "http://localhost:9411/";
- /**
- * Enables sending spans to Zipkin
- */
- private boolean enabled = true;
- /**
- * Interval in seconds in which spans will be sent in batches to Zipkin
- */
- private int flushInterval = 1;
- /**
- * Encoding type of spans sent to Zipkin
- */
- private Encoding encoding = Encoding.JSON;
- /**
- * Configuration related to compressions of spans sent to Zipkin
- */
- private Compression compression = new Compression();
-
- private Service service = new Service();
-
- private Locator locator = new Locator();
-
- public Locator getLocator() {
- return this.locator;
- }
-
- public String getBaseUrl() {
- return this.baseUrl;
- }
-
- public boolean isEnabled() {
- return this.enabled;
- }
-
- public int getFlushInterval() {
- return this.flushInterval;
- }
-
- public Compression getCompression() {
- return this.compression;
- }
-
- public Service getService() {
- return this.service;
- }
-
- public void setBaseUrl(String baseUrl) {
- this.baseUrl = baseUrl;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- public void setFlushInterval(int flushInterval) {
- this.flushInterval = flushInterval;
- }
-
- public void setCompression(Compression compression) {
- this.compression = compression;
- }
-
- public void setService(Service service) {
- this.service = service;
- }
-
- public void setLocator(Locator locator) {
- this.locator = locator;
- }
-
- public Encoding getEncoding() {
- return this.encoding;
- }
-
- public void setEncoding(Encoding encoding) {
- this.encoding = encoding;
- }
-
- /** When enabled, spans are gzipped before sent to the zipkin server */
- public static class Compression {
-
- private boolean enabled = false;
-
- public boolean isEnabled() {
- return this.enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
- }
-
- /** When set will override the default {@code spring.application.name} value of the service id */
- public static class Service {
-
- /** The name of the service, from which the Span was sent via HTTP, that should appear in Zipkin */
- private String name;
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
- }
-
- /** Configuration related to locating of the host name from service discovery.
- * This property is NOT related to finding Zipkin via Service Disovery.
- * To do so use the {@link ZipkinProperties#baseUrl} property with the
- * service name set inside the URL.
- */
- public static class Locator {
-
- private Discovery discovery;
-
- public Discovery getDiscovery() {
- return this.discovery;
- }
-
- public void setDiscovery(Discovery discovery) {
- this.discovery = discovery;
- }
-
- public static class Discovery {
-
- /** Enabling of locating the host name via service discovery */
- private boolean enabled;
-
- public boolean isEnabled() {
- return this.enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
- }
- }
-}
diff --git a/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin/ZipkinRestTemplateCustomizer.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin/ZipkinRestTemplateCustomizer.java
deleted file mode 100644
index 5cdbe252f..000000000
--- a/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin/ZipkinRestTemplateCustomizer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2013-2016 the original author or 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 org.springframework.cloud.sleuth.zipkin;
-
-import org.springframework.web.client.RestTemplate;
-
-/**
- * Implementations customize the {@link RestTemplate} used to report spans to Zipkin.
- * For example, they can add an additional header needed by their environment.
- *
- * Implementors must gzip according to {@link ZipkinProperties.Compression},
- * for example by using the {@link DefaultZipkinRestTemplateCustomizer}.
- *
- * @author Marcin Grzejszczak
- *
- * @since 1.1.0
- * @deprecated Please use spring-cloud-sleuth-zipkin2 to report spans to Zipkin
- */
-@Deprecated
-public interface ZipkinRestTemplateCustomizer {
-
- void customize(RestTemplate restTemplate);
-}
diff --git a/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin/ZipkinSpanListener.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin/ZipkinSpanListener.java
deleted file mode 100644
index 1ab4e83c1..000000000
--- a/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin/ZipkinSpanListener.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright 2013-2015 the original author or 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 org.springframework.cloud.sleuth.zipkin;
-
-import java.nio.charset.Charset;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import org.springframework.cloud.commons.util.IdUtils;
-import org.springframework.cloud.sleuth.Log;
-import org.springframework.cloud.sleuth.Span;
-import org.springframework.cloud.sleuth.SpanAdjuster;
-import org.springframework.cloud.sleuth.SpanReporter;
-import org.springframework.core.env.Environment;
-import org.springframework.util.StringUtils;
-import zipkin.Annotation;
-import zipkin.BinaryAnnotation;
-import zipkin.Constants;
-import zipkin.Endpoint;
-
-/**
- * Listener of Sleuth events. Reports to Zipkin via {@link ZipkinSpanReporter}.
- *
- * @author Spencer Gibb
- * @since 1.0.0
- */
-public class ZipkinSpanListener implements SpanReporter {
- private static final List ZIPKIN_START_EVENTS = Arrays.asList(
- Constants.CLIENT_RECV, Constants.SERVER_RECV
- );
- private static final List RPC_EVENTS = Arrays.asList(
- Constants.CLIENT_RECV, Constants.CLIENT_SEND, Constants.SERVER_RECV, Constants.SERVER_SEND
- );
-
- private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory
- .getLog(ZipkinSpanListener.class);
- private static final Charset UTF_8 = Charset.forName("UTF-8");
- private static final byte[] UNKNOWN_BYTES = "unknown".getBytes(UTF_8);
-
- private final ZipkinSpanReporter reporter;
- private final Environment environment;
- private final List spanAdjusters;
- /**
- * Endpoint is the visible IP address of this service, the port it is listening on and
- * the service name from discovery.
- */
- // Visible for testing
- final EndpointLocator endpointLocator;
-
- public ZipkinSpanListener(ZipkinSpanReporter reporter, EndpointLocator endpointLocator,
- Environment environment, List spanAdjusters) {
- this.reporter = reporter;
- this.endpointLocator = endpointLocator;
- this.environment = environment;
- this.spanAdjusters = spanAdjusters;
- }
-
- /**
- * Converts a given Sleuth span to a Zipkin Span.
- *
- * - Set ids, etc
- *
- Create timeline annotations based on data from Span object.
- *
- Create binary annotations based on data from Span object.
- *
- *
- * When logging {@link Constants#CLIENT_SEND}, instrumentation should also log the {@link Constants#SERVER_ADDR}
- * Check Zipkin code
- * for more information
- */
- // Visible for testing
- zipkin.Span convert(Span span) {
- //TODO: Consider adding support for the debug flag (related to #496)
- Span convertedSpan = span;
- for (SpanAdjuster adjuster : this.spanAdjusters) {
- convertedSpan = adjuster.adjust(convertedSpan);
- }
- zipkin.Span.Builder zipkinSpan = zipkin.Span.builder();
- Endpoint endpoint = this.endpointLocator.local();
- processLogs(convertedSpan, zipkinSpan, endpoint);
- addZipkinAnnotations(zipkinSpan, convertedSpan, endpoint);
- addZipkinBinaryAnnotations(zipkinSpan, convertedSpan, endpoint);
- // In the RPC span model, the client owns the timestamp and duration of the span. If we
- // were propagated an id, we can assume that we shouldn't report timestamp or duration,
- // rather let the client do that. Worst case we were propagated an unreported ID and
- // Zipkin backfills timestamp and duration.
- if (!convertedSpan.isRemote()) {
- // don't report server-side timestamp on shared spans
- if (Boolean.TRUE.equals(convertedSpan.isShared())) {
- zipkinSpan.timestamp(null).duration(null);
- } else {
- zipkinSpan.timestamp(convertedSpan.getBegin() * 1000L);
- if (!convertedSpan.isRunning()) { // duration is authoritative, only write when the span stopped
- zipkinSpan.duration(calculateDurationInMicros(convertedSpan));
- }
- }
- }
- zipkinSpan.traceIdHigh(convertedSpan.getTraceIdHigh());
- zipkinSpan.traceId(convertedSpan.getTraceId());
- if (convertedSpan.getParents().size() > 0) {
- if (convertedSpan.getParents().size() > 1) {
- log.error("Zipkin doesn't support spans with multiple parents. Omitting "
- + "other parents for " + convertedSpan);
- }
- zipkinSpan.parentId(convertedSpan.getParents().get(0));
- }
- zipkinSpan.id(convertedSpan.getSpanId());
- if (StringUtils.hasText(convertedSpan.getName())) {
- zipkinSpan.name(convertedSpan.getName());
- }
- return zipkinSpan.build();
- }
-
- private void ensureLocalComponent(Span span, zipkin.Span.Builder zipkinSpan, Endpoint localEndpoint) {
- if (span.tags().containsKey(Constants.LOCAL_COMPONENT)) {
- return;
- }
- byte[] processId = span.getProcessId() != null
- ? span.getProcessId().toLowerCase().getBytes(UTF_8)
- : UNKNOWN_BYTES;
- BinaryAnnotation component = BinaryAnnotation.builder()
- .type(BinaryAnnotation.Type.STRING)
- .key("lc") // LOCAL_COMPONENT
- .value(processId)
- .endpoint(localEndpoint).build();
- zipkinSpan.addBinaryAnnotation(component);
- }
-
- private void ensureServerAddr(Span span, zipkin.Span.Builder zipkinSpan) {
- if (span.tags().containsKey(Span.SPAN_PEER_SERVICE_TAG_NAME)) {
- zipkinSpan.addBinaryAnnotation(BinaryAnnotation.address(Constants.SERVER_ADDR,
- Endpoint.builder().serviceName(
- span.tags().get(Span.SPAN_PEER_SERVICE_TAG_NAME)).build()));
- }
- }
-
- // Instead of going through the list of logs multiple times we're doing it only once
- private void processLogs(Span span, zipkin.Span.Builder zipkinSpan, Endpoint endpoint) {
- boolean notClientOrServer = true;
- boolean hasClientSend = false;
- boolean instanceIdToTag = false;
- for (Log log : span.logs()) {
- if (RPC_EVENTS.contains(log.getEvent())) {
- instanceIdToTag = true;
- }
- if (ZIPKIN_START_EVENTS.contains(log.getEvent())) {
- notClientOrServer = false;
- }
- if (Constants.CLIENT_SEND.equals(log.getEvent())) {
- hasClientSend = !span.tags().containsKey(Constants.SERVER_ADDR);
- }
- }
- if (notClientOrServer) {
- // A zipkin span without any annotations cannot be queried, add special "lc" to avoid that.
- ensureLocalComponent(span, zipkinSpan, endpoint);
- }
- if (hasClientSend) {
- ensureServerAddr(span, zipkinSpan);
- }
- if (instanceIdToTag && this.environment != null) {
- setInstanceIdIfPresent(zipkinSpan, endpoint, Span.INSTANCEID);
- }
- }
-
- private void setInstanceIdIfPresent(zipkin.Span.Builder zipkinSpan,
- Endpoint endpoint, String key) {
- String property = IdUtils.getDefaultInstanceId(this.environment);
- if (StringUtils.hasText(property)) {
- addZipkinBinaryAnnotation(key, property, endpoint, zipkinSpan);
- }
- }
-
- /**
- * Add annotations from the sleuth Span.
- */
- private void addZipkinAnnotations(zipkin.Span.Builder zipkinSpan,
- Span span, Endpoint endpoint) {
- for (Log ta : span.logs()) {
- Annotation zipkinAnnotation = Annotation.builder()
- .endpoint(endpoint)
- .timestamp(ta.getTimestamp() * 1000) // Zipkin is in microseconds
- .value(ta.getEvent()).build();
- zipkinSpan.addAnnotation(zipkinAnnotation);
- }
- }
-
- /**
- * Adds binary annotation from the sleuth Span
- */
- private void addZipkinBinaryAnnotations(zipkin.Span.Builder zipkinSpan,
- Span span, Endpoint ep) {
- for (Map.Entry e : span.tags().entrySet()) {
- addZipkinBinaryAnnotation(e.getKey(), e.getValue(), ep, zipkinSpan);
- }
- }
-
- private void addZipkinBinaryAnnotation(String key, String value, Endpoint ep,
- zipkin.Span.Builder zipkinSpan) {
- BinaryAnnotation binaryAnn = BinaryAnnotation.builder()
- .type(BinaryAnnotation.Type.STRING)
- .key(key)
- .value(value.getBytes(UTF_8))
- .endpoint(ep).build();
- zipkinSpan.addBinaryAnnotation(binaryAnn);
- }
-
- /**
- * There could be instrumentation delay between span creation and the
- * semantic start of the span (client send). When there's a difference,
- * spans look confusing. Ex users expect duration to be client
- * receive - send, but it is a little more than that. Rather than have
- * to teach each user about the possibility of instrumentation overhead,
- * we truncate absolute duration (span finish - create) to semantic
- * duration (client receive - send)
- */
- private long calculateDurationInMicros(Span span) {
- Log clientSend = hasLog(Span.CLIENT_SEND, span);
- Log clientReceived = hasLog(Span.CLIENT_RECV, span);
- if (clientSend != null && clientReceived != null) {
- return (clientReceived.getTimestamp() - clientSend.getTimestamp()) * 1000;
- }
- return span.getAccumulatedMicros();
- }
-
- private Log hasLog(String logName, Span span) {
- for (Log log : span.logs()) {
- if (logName.equals(log.getEvent())) {
- return log;
- }
- }
- return null;
- }
-
- @Override
- public void report(Span span) {
- if (span.isExportable()) {
- this.reporter.report(convert(span));
- } else {
- if (log.isDebugEnabled()) {
- log.debug("The span " + span + " will not be sent to Zipkin due to sampling");
- }
- }
- }
-}
diff --git a/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin/ZipkinSpanReporter.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin/ZipkinSpanReporter.java
deleted file mode 100644
index d009f2ad9..000000000
--- a/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin/ZipkinSpanReporter.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.springframework.cloud.sleuth.zipkin;
-
-/**
- * Contract for reporting Zipkin spans to Zipkin.
- *
- * @author Adrian Cole
- * @since 1.0.0
- * @deprecated Please use spring-cloud-sleuth-zipkin2 to report spans to Zipkin
- */
-@Deprecated
-public interface ZipkinSpanReporter {
- /**
- * Receives completed spans from {@link ZipkinSpanListener} and submits them to a Zipkin
- * collector.
- */
- void report(zipkin.Span span);
-}
diff --git a/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/DefaultEndpointLocator.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/DefaultEndpointLocator.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/DefaultEndpointLocator.java
rename to spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/DefaultEndpointLocator.java
diff --git a/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/DefaultZipkinRestTemplateCustomizer.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/DefaultZipkinRestTemplateCustomizer.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/DefaultZipkinRestTemplateCustomizer.java
rename to spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/DefaultZipkinRestTemplateCustomizer.java
diff --git a/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/EndpointLocator.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/EndpointLocator.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/EndpointLocator.java
rename to spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/EndpointLocator.java
diff --git a/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/ReporterMetricsAdapter.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/ReporterMetricsAdapter.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/ReporterMetricsAdapter.java
rename to spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/ReporterMetricsAdapter.java
diff --git a/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinAutoConfiguration.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinAutoConfiguration.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinAutoConfiguration.java
rename to spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinAutoConfiguration.java
diff --git a/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinLoadBalancer.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinLoadBalancer.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinLoadBalancer.java
rename to spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinLoadBalancer.java
diff --git a/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinProperties.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinProperties.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinProperties.java
rename to spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinProperties.java
diff --git a/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinRestTemplateCustomizer.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinRestTemplateCustomizer.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinRestTemplateCustomizer.java
rename to spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinRestTemplateCustomizer.java
diff --git a/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinSpanReporter.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinSpanReporter.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinSpanReporter.java
rename to spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/ZipkinSpanReporter.java
diff --git a/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/LoadBalancerClientZipkinLoadBalancer.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/LoadBalancerClientZipkinLoadBalancer.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/LoadBalancerClientZipkinLoadBalancer.java
rename to spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/LoadBalancerClientZipkinLoadBalancer.java
diff --git a/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/RestTemplateSender.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/RestTemplateSender.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/RestTemplateSender.java
rename to spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/RestTemplateSender.java
diff --git a/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinKafkaSenderConfiguration.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinKafkaSenderConfiguration.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinKafkaSenderConfiguration.java
rename to spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinKafkaSenderConfiguration.java
diff --git a/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinRabbitSenderConfiguration.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinRabbitSenderConfiguration.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinRabbitSenderConfiguration.java
rename to spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinRabbitSenderConfiguration.java
diff --git a/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinRestTemplateSenderConfiguration.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinRestTemplateSenderConfiguration.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinRestTemplateSenderConfiguration.java
rename to spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinRestTemplateSenderConfiguration.java
diff --git a/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinSenderCondition.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinSenderCondition.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinSenderCondition.java
rename to spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinSenderCondition.java
diff --git a/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinSenderConfigurationImportSelector.java b/spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinSenderConfigurationImportSelector.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinSenderConfigurationImportSelector.java
rename to spring-cloud-sleuth-zipkin/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinSenderConfigurationImportSelector.java
diff --git a/spring-cloud-sleuth-zipkin/src/main/resources/META-INF/spring.factories b/spring-cloud-sleuth-zipkin/src/main/resources/META-INF/spring.factories
index 6fa651654..7a0e23d33 100644
--- a/spring-cloud-sleuth-zipkin/src/main/resources/META-INF/spring.factories
+++ b/spring-cloud-sleuth-zipkin/src/main/resources/META-INF/spring.factories
@@ -1,3 +1,3 @@
# Auto Configuration
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-org.springframework.cloud.sleuth.zipkin.ZipkinAutoConfiguration
\ No newline at end of file
+org.springframework.cloud.sleuth.zipkin2.ZipkinAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/FallbackHavingEndpointLocatorTests.java b/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/FallbackHavingEndpointLocatorTests.java
deleted file mode 100644
index 076327203..000000000
--- a/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/FallbackHavingEndpointLocatorTests.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.springframework.cloud.sleuth.zipkin;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-
-import zipkin.Endpoint;
-
-import static org.assertj.core.api.BDDAssertions.then;
-import static org.mockito.BDDMockito.given;
-
-@RunWith(MockitoJUnitRunner.class)
-public class FallbackHavingEndpointLocatorTests {
-
- @Mock
- ServiceInstanceEndpointLocator serviceInstanceEndpointLocator;
- @Mock ServerPropertiesEndpointLocator serverPropertiesEndpointLocator;
- Endpoint expectedEndpoint = Endpoint.builder()
- .serviceName("my-tomcat").ipv4(127 << 24 | 1).port(8080).build();
-
- @Test
- public void should_use_system_property_locator_if_discovery_client_locator_is_not_present() {
- given(this.serverPropertiesEndpointLocator.local()).willReturn(this.expectedEndpoint);
- FallbackHavingEndpointLocator sut = new FallbackHavingEndpointLocator(null,
- this.serverPropertiesEndpointLocator);
-
- Endpoint endpoint = sut.local();
-
- then(endpoint).isSameAs(this.expectedEndpoint);
- }
-
- @Test
- public void should_use_system_property_locator_if_discovery_client_locator_throws_an_exception() {
- given(this.serviceInstanceEndpointLocator.local()).willThrow(new RuntimeException());
- given(this.serverPropertiesEndpointLocator.local()).willReturn(this.expectedEndpoint);
- FallbackHavingEndpointLocator sut = new FallbackHavingEndpointLocator(this.serviceInstanceEndpointLocator,
- this.serverPropertiesEndpointLocator);
-
- Endpoint endpoint = sut.local();
-
- then(endpoint).isSameAs(this.expectedEndpoint);
- }
-
- @Test
- public void should_use_discovery_client_locator_by_default() {
- given(this.serviceInstanceEndpointLocator.local()).willReturn(this.expectedEndpoint);
- FallbackHavingEndpointLocator sut = new FallbackHavingEndpointLocator(this.serviceInstanceEndpointLocator,
- this.serverPropertiesEndpointLocator);
-
- Endpoint endpoint = sut.local();
-
- then(endpoint).isSameAs(this.expectedEndpoint);
- }
-}
\ No newline at end of file
diff --git a/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/HttpZipkinSpanReporterTest.java b/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/HttpZipkinSpanReporterTest.java
deleted file mode 100644
index be0b0cf14..000000000
--- a/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/HttpZipkinSpanReporterTest.java
+++ /dev/null
@@ -1,221 +0,0 @@
-package org.springframework.cloud.sleuth.zipkin;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Random;
-import java.util.concurrent.atomic.AtomicReference;
-
-import io.micrometer.core.instrument.Counter;
-import org.junit.Rule;
-import org.junit.Test;
-import org.springframework.boot.autoconfigure.web.ServerProperties;
-import org.springframework.cloud.sleuth.DefaultSpanNamer;
-import org.springframework.cloud.sleuth.TraceKeys;
-import org.springframework.cloud.sleuth.Tracer;
-import org.springframework.cloud.sleuth.log.NoOpSpanLogger;
-import org.springframework.cloud.sleuth.metric.CounterServiceBasedSpanMetricReporter;
-import org.springframework.cloud.sleuth.metric.SpanMetricReporter;
-import org.springframework.cloud.sleuth.sampler.AlwaysSampler;
-import org.springframework.cloud.sleuth.trace.DefaultTracer;
-import org.springframework.cloud.sleuth.util.ExceptionUtils;
-import org.springframework.mock.env.MockEnvironment;
-import org.springframework.web.client.RestTemplate;
-import zipkin.Span;
-import zipkin.junit.HttpFailure;
-import zipkin.junit.ZipkinRule;
-import zipkin.reporter.Encoding;
-
-import static java.util.Arrays.asList;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.BDDAssertions.then;
-import static org.awaitility.Awaitility.await;
-
-public class HttpZipkinSpanReporterTest {
-
- @Rule public final ZipkinRule zipkin = new ZipkinRule();
- Counter accepted = counter("accepted");
- Counter dropped = counter("dropped");
-
- SpanMetricReporter spanMetricReporter = new CounterServiceBasedSpanMetricReporter(this.accepted, this.dropped);
- RestTemplate restTemplate = defaultRestTemplate();
- HttpZipkinSpanReporter reporter = new HttpZipkinSpanReporter(restTemplate, this.zipkin.httpUrl(),
- 0, // so that tests can drive flushing explicitly
- this.spanMetricReporter
- );
-
- @Test
- public void reportDoesntDoIO() throws Exception {
- this.reporter.report(span(1L, "foo"));
-
- assertThat(this.zipkin.httpRequestCount()).isZero();
- }
-
- @Test
- public void reportIncrementsAcceptedMetrics() throws Exception {
- this.reporter.report(span(1L, "foo"));
-
- assertThat(this.accepted.count()).isEqualTo(1);
- assertThat(this.dropped.count()).isZero();
- }
-
- @Test
- public void dropsWhenQueueIsFull() throws Exception {
- for (int i = 0; i < 1001; i++)
- this.reporter.report(span(1L, "foo"));
-
- assertThat(this.accepted.count()).isEqualTo(1001);
- assertThat(this.dropped.count()).isEqualTo(1);
- }
-
- @Test
- public void postsSpans() throws Exception {
- this.reporter.report(span(1L, "foo"));
- this.reporter.report(span(2L, "bar"));
-
- this.reporter.flush(); // manually flush the spans
-
- // Ensure only one request was sent
- assertThat(this.zipkin.httpRequestCount()).isEqualTo(1);
-
- assertThat(this.zipkin.getTraces()).containsExactly(
- asList(span(1L, "foo")),
- asList(span(2L, "bar"))
- );
- }
-
- @Test
- public void postsCompressedSpans() throws Exception {
- this.reporter = new HttpZipkinSpanReporter(restTemplateWithCompression(), this.zipkin.httpUrl(),
- 0, // so that tests can drive flushing explicitly
- this.spanMetricReporter
- );
-
- this.reporter.report(span(1L, "foo"));
- this.reporter.report(span(2L, "bar"));
-
- this.reporter.flush(); // manually flush the spans
-
- // Ensure only one request was sent
- assertThat(this.zipkin.httpRequestCount()).isEqualTo(1);
-
- assertThat(this.zipkin.getTraces()).containsExactly(
- asList(span(1L, "foo")),
- asList(span(2L, "bar"))
- );
- }
-
- @Test
- public void incrementsDroppedSpansWhenServerErrors() throws Exception {
- this.zipkin.enqueueFailure(HttpFailure.sendErrorResponse(500, "Ouch"));
-
- this.reporter.report(span(1L, "foo"));
- this.reporter.report(span(2L, "bar"));
-
- this.reporter.flush(); // manually flush the spans
-
- assertThat(this.dropped.count()).isEqualTo(2);
- }
-
- @Test
- public void incrementsDroppedSpansWhenServerDisconnects() throws Exception {
- this.zipkin.enqueueFailure(HttpFailure.disconnectDuringBody());
-
- this.reporter.report(span(1L, "foo"));
- this.reporter.report(span(2L, "bar"));
-
- this.reporter.flush(); // manually flush the spans
-
- assertThat(this.dropped.count()).isEqualTo(2);
- }
-
- @Test
- public void should_change_the_service_name_in_zipkin_to_the_manually_provided_one() {
- AtomicReference receivedSpan = new AtomicReference<>();
- Tracer tracer = new DefaultTracer(new AlwaysSampler(), new Random(), new DefaultSpanNamer(),
- new NoOpSpanLogger(), new ZipkinSpanListener(receivedSpan::set,
- new ServerPropertiesEndpointLocator(new ServerProperties(), new MockEnvironment(),
- new ZipkinProperties()),
- null, new ArrayList<>()), new TraceKeys());
- // tag::service_name[]
- org.springframework.cloud.sleuth.Span newSpan = tracer.createSpan("redis");
- try {
- newSpan.tag("redis.op", "get");
- newSpan.tag("lc", "redis");
- newSpan.logEvent(org.springframework.cloud.sleuth.Span.CLIENT_SEND);
- // call redis service e.g
- // return (SomeObj) redisTemplate.opsForHash().get("MYHASH", someObjKey);
- } finally {
- newSpan.tag("peer.service", "redisService");
- newSpan.tag("peer.ipv4", "1.2.3.4");
- newSpan.tag("peer.port", "1234");
- newSpan.logEvent(org.springframework.cloud.sleuth.Span.CLIENT_RECV);
- tracer.close(newSpan);
- }
- // end::service_name[]
-
- then(tracer.getCurrentSpan()).isNull();
- then(ExceptionUtils.getLastException()).isNull();
- then(receivedSpan.get().binaryAnnotations)
- .flatExtracting(input -> input.key, input -> new String(input.value))
- .contains("peer.service", "redisService");
- }
-
- @Test
- public void testSenderThriftEncoding() {
- ZipkinProperties zipkinProperties = new ZipkinProperties();
- zipkinProperties.setEncoding(Encoding.THRIFT);
- zipkinProperties.setBaseUrl(zipkin.httpUrl());
-
- HttpZipkinSpanReporter httpZipkinSpanReporter = new HttpZipkinSpanReporter(restTemplate(zipkinProperties)
- , zipkinProperties.getBaseUrl(), 1, spanMetricReporter, zipkinProperties.getEncoding());
-
- Tracer tracer = new DefaultTracer(new AlwaysSampler(), new Random(), new DefaultSpanNamer(),
- new NoOpSpanLogger(),new ZipkinSpanListener(httpZipkinSpanReporter,
- new ServerPropertiesEndpointLocator(new ServerProperties(), new MockEnvironment(),
- zipkinProperties),
- null, Collections.emptyList()), new TraceKeys());
-
- tracer.close(tracer.createSpan("foo"));
- httpZipkinSpanReporter.flush();
-
- await().until(() -> zipkin.getTraces().size() == 1);
- assertThat(zipkin.getTraces().size()).isEqualTo(1);
- }
-
- static Span span(long traceId, String spanName) {
- return Span.builder().traceId(traceId).id(traceId).name(spanName).build();
- }
-
- private RestTemplate restTemplate(ZipkinProperties zipkinProperties) {
- RestTemplate restTemplate = new RestTemplate();
- new DefaultZipkinRestTemplateCustomizer(zipkinProperties).customize(restTemplate);
- return restTemplate;
- }
-
- private RestTemplate defaultRestTemplate() {
- return restTemplate(new ZipkinProperties());
- }
-
- private RestTemplate restTemplateWithCompression() {
- ZipkinProperties zipkinProperties = new ZipkinProperties();
- zipkinProperties.getCompression().setEnabled(true);
- return restTemplate(zipkinProperties);
- }
-
- private Counter counter(final String name) {
- return new Counter() {
- private double counter;
- @Override public void increment(double amount) {
- this.counter = this.counter + amount;
- }
-
- @Override public double count() {
- return this.counter;
- }
-
- @Override public Id getId() {
- return new Id(name, Collections.emptyList(), "unit", "description");
- }
- };
- }
-}
diff --git a/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/ServerPropertiesEndpointLocatorTests.java b/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/ServerPropertiesEndpointLocatorTests.java
deleted file mode 100644
index 2933f608a..000000000
--- a/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/ServerPropertiesEndpointLocatorTests.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 2015 the original author or 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 org.springframework.cloud.sleuth.zipkin;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-import org.junit.Test;
-import org.springframework.boot.autoconfigure.web.ServerProperties;
-import org.springframework.mock.env.MockEnvironment;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ServerPropertiesEndpointLocatorTests {
-
- public static final byte[] ADDRESS1234 = { 1, 2, 3, 4 };
-
- @Test
- public void portDefaultsTo8080() throws UnknownHostException {
- ServerPropertiesEndpointLocator locator = new ServerPropertiesEndpointLocator(
- new ServerProperties(), new MockEnvironment(), new ZipkinProperties());
-
- assertThat(locator.local().port).isEqualTo((short) 8080);
- }
-
- @Test
- public void portFromServerProperties() throws UnknownHostException {
- ServerProperties properties = new ServerProperties();
- properties.setPort(1234);
-
- ServerPropertiesEndpointLocator locator = new ServerPropertiesEndpointLocator(
- properties, new MockEnvironment(), new ZipkinProperties());
-
- assertThat(locator.local().port).isEqualTo((short) 1234);
- }
-
- @Test
- public void portDefaultsToLocalhost() throws UnknownHostException {
- MockEnvironment environment = new MockEnvironment();
- environment.setProperty("spring.cloud.client.ipAddress", String.valueOf(1 << 24 | 2 << 16 | 3 << 8 | 4));
- ServerPropertiesEndpointLocator locator = new ServerPropertiesEndpointLocator(
- new ServerProperties(), environment, new ZipkinProperties());
-
- assertThat(locator.local().ipv4).isEqualTo(1 << 24 | 2 << 16 | 3 << 8 | 4);
- }
-
- @Test
- public void hostFromServerPropertiesIp() throws UnknownHostException {
- ServerProperties properties = new ServerProperties();
- properties.setAddress(InetAddress.getByAddress(ADDRESS1234));
-
- ServerPropertiesEndpointLocator locator = new ServerPropertiesEndpointLocator(
- properties, new MockEnvironment(), new ZipkinProperties());
-
- assertThat(locator.local().ipv4).isEqualTo(1 << 24 | 2 << 16 | 3 << 8 | 4);
- }
-
- @Test
- public void appNameFromProperties() throws UnknownHostException {
- ServerProperties properties = new ServerProperties();
- ZipkinProperties zipkinProperties = new ZipkinProperties();
- zipkinProperties.getService().setName("foo");
-
- ServerPropertiesEndpointLocator locator = new ServerPropertiesEndpointLocator(
- properties, new MockEnvironment(), zipkinProperties);
-
- assertThat(locator.local().serviceName).isEqualTo("foo");
- }
-
- @Test
- public void negativePortFromServerProperties() throws UnknownHostException {
- ServerProperties properties = new ServerProperties();
- properties.setPort(-1);
-
- ServerPropertiesEndpointLocator locator = new ServerPropertiesEndpointLocator(
- properties, new MockEnvironment(), new ZipkinProperties());
-
- assertThat(locator.local().port).isEqualTo((short) 8080);
- }
-}
diff --git a/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/ServiceInstanceEndpointLocatorConfigurationTest.java b/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/ServiceInstanceEndpointLocatorConfigurationTest.java
deleted file mode 100644
index 1ec6b853b..000000000
--- a/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/ServiceInstanceEndpointLocatorConfigurationTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.springframework.cloud.sleuth.zipkin;
-
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.cloud.client.serviceregistry.Registration;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * @author Marcin Wielgus
- */
-public class ServiceInstanceEndpointLocatorConfigurationTest {
-
- @Test
- public void endpointLocatorShouldDefaultToServerPropertiesEndpointLocator() {
- ConfigurableApplicationContext ctxt = new SpringApplication(
- EmptyConfiguration.class).run("--spring.jmx.enabled=false",
- "--spring.cloud.discovery.client.composite-indicator.enabled=false");
- assertThat(ctxt.getBean(EndpointLocator.class))
- .isInstanceOf(ServerPropertiesEndpointLocator.class);
- ctxt.close();
- }
-
- @Test
- public void endpointLocatorShouldDefaultToServerPropertiesEndpointLocatorEvenWhenDiscoveryClientPresent() {
- ConfigurableApplicationContext ctxt = new SpringApplication(
- ConfigurationWithRegistration.class).run("--spring.jmx.enabled=false",
- "--spring.cloud.discovery.client.composite-indicator.enabled=false");
- assertThat(ctxt.getBean(EndpointLocator.class))
- .isInstanceOf(ServerPropertiesEndpointLocator.class);
- ctxt.close();
- }
-
- @Test
- public void endpointLocatorShouldRespectExistingEndpointLocator() {
- ConfigurableApplicationContext ctxt = new SpringApplication(
- ConfigurationWithCustomLocator.class).run("--spring.jmx.enabled=false",
- "--spring.cloud.discovery.client.composite-indicator.enabled=false");
- assertThat(ctxt.getBean(EndpointLocator.class))
- .isSameAs(ConfigurationWithCustomLocator.locator);
- ctxt.close();
- }
-
- @Test
- public void endpointLocatorShouldBeFallbackHavingEndpointLocatorWhenAskedTo() {
- ConfigurableApplicationContext ctxt = new SpringApplication(
- ConfigurationWithRegistration.class).run("--spring.jmx.enabled=false",
- "--spring.zipkin.locator.discovery.enabled=true",
- "--spring.cloud.discovery.client.composite-indicator.enabled=false");
- assertThat(ctxt.getBean(EndpointLocator.class))
- .isInstanceOf(FallbackHavingEndpointLocator.class);
- ctxt.close();
- }
-
- @Test
- public void endpointLocatorShouldRespectExistingEndpointLocatorEvenWhenAskedToBeDiscovery() {
- ConfigurableApplicationContext ctxt = new SpringApplication(
- ConfigurationWithRegistration.class,
- ConfigurationWithCustomLocator.class).run("--spring.jmx.enabled=false",
- "--spring.zipkin.locator.discovery.enabled=true",
- "--spring.cloud.discovery.client.composite-indicator.enabled=false");
- assertThat(ctxt.getBean(EndpointLocator.class))
- .isSameAs(ConfigurationWithCustomLocator.locator);
- ctxt.close();
- }
-
- @Configuration
- @EnableAutoConfiguration
- public static class EmptyConfiguration {
- }
-
- @Configuration
- @EnableAutoConfiguration
- public static class ConfigurationWithRegistration {
- @Bean public Registration registration() {
- return Mockito.mock(Registration.class);
- }
- }
-
- @Configuration
- @EnableAutoConfiguration
- public static class ConfigurationWithCustomLocator {
- static EndpointLocator locator = Mockito.mock(EndpointLocator.class);
-
- @Bean public EndpointLocator getEndpointLocator() {
- return locator;
- }
- }
-
-}
\ No newline at end of file
diff --git a/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/ServiceInstanceEndpointLocatorTest.java b/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/ServiceInstanceEndpointLocatorTest.java
deleted file mode 100644
index 9b1cf0040..000000000
--- a/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/ServiceInstanceEndpointLocatorTest.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright 2013-2017 the original author or 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 org.springframework.cloud.sleuth.zipkin;
-
-import java.net.URI;
-import java.util.Map;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.springframework.cloud.client.ServiceInstance;
-import org.springframework.cloud.commons.util.InetUtils;
-import org.springframework.cloud.sleuth.zipkin.ServiceInstanceEndpointLocator.NoServiceInstanceAvailableException;
-
-import static org.assertj.core.api.BDDAssertions.then;
-
-import zipkin.Endpoint;
-
-/**
- * @author Marcin Grzejszczak
- */
-@RunWith(MockitoJUnitRunner.class)
-public class ServiceInstanceEndpointLocatorTest {
-
- @Test(expected = NoServiceInstanceAvailableException.class)
- public void should_throw_exception_when_no_instances_are_available() throws Exception {
- ServiceInstanceEndpointLocator endpointLocator = endpointLocator(null);
- endpointLocator.local();
- }
-
- private ServiceInstanceEndpointLocator endpointLocator(ServiceInstance serviceInstance) {
- return endpointLocator(serviceInstance, new ZipkinProperties());
- }
-
- private ServiceInstanceEndpointLocator endpointLocator(ServiceInstance serviceInstance, ZipkinProperties zipkinProperties) {
- return new ServiceInstanceEndpointLocator(serviceInstance, zipkinProperties);
- }
-
- @Test
- public void should_create_endpoint_with_0_ip_when_exception_occurs_on_resolving_host() throws Exception {
- ServiceInstanceEndpointLocator endpointLocator = endpointLocator(serviceInstanceWithInvalidHost());
-
- Endpoint local = endpointLocator.local();
-
- then(local.serviceName).isEqualTo("serviceid");
- then(local.port).isEqualTo((short)8_000);
- then(local.ipv4).isEqualTo(0);
- }
-
- @Test
- public void should_create_valid_endpoint_when_proper_host_is_passed() throws Exception {
- ServiceInstanceEndpointLocator endpointLocator = endpointLocator(serviceInstanceWithValidHost());
-
- Endpoint local = endpointLocator.local();
-
- then(local.serviceName).isEqualTo("serviceid");
- then(local.port).isEqualTo((short)8_000);
- then(local.ipv4).isEqualTo(InetUtils.getIpAddressAsInt("localhost"));
- }
-
- @Test
- public void should_create_endpoint_with_overridden_name() throws Exception {
- ZipkinProperties zipkinProperties = new ZipkinProperties();
- zipkinProperties.getService().setName("foo");
- ServiceInstanceEndpointLocator locator = endpointLocator(serviceInstanceWithValidHost(), zipkinProperties);
-
- Endpoint local = locator.local();
-
- then(local.serviceName).isEqualTo("foo");
- then(local.port).isEqualTo((short)8_000);
- then(local.ipv4).isEqualTo(InetUtils.getIpAddressAsInt("localhost"));
- }
-
- private ServiceInstance serviceInstanceWithInvalidHost() {
- return new ServiceInstance() {
- @Override public String getServiceId() {
- return "serviceId";
- }
-
- @Override public String getHost() {
- throw new RuntimeException();
- }
-
- @Override public int getPort() {
- return 8000;
- }
-
- @Override public boolean isSecure() {
- return false;
- }
-
- @Override public URI getUri() {
- return null;
- }
-
- @Override public Map getMetadata() {
- return null;
- }
- };
- }
-
- private ServiceInstance serviceInstanceWithValidHost() {
- return new ServiceInstance() {
- @Override public String getServiceId() {
- return "serviceId";
- }
-
- @Override public String getHost() {
- return "localhost";
- }
-
- @Override public int getPort() {
- return 8000;
- }
-
- @Override public boolean isSecure() {
- return false;
- }
-
- @Override public URI getUri() {
- return null;
- }
-
- @Override public Map getMetadata() {
- return null;
- }
- };
- }
-}
\ No newline at end of file
diff --git a/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/ZipkinDiscoveryClientTests.java b/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/ZipkinDiscoveryClientTests.java
deleted file mode 100644
index 173e6fc05..000000000
--- a/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/ZipkinDiscoveryClientTests.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package org.springframework.cloud.sleuth.zipkin;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.Map;
-
-import org.awaitility.Awaitility;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.client.ServiceInstance;
-import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
-import org.springframework.cloud.client.loadbalancer.LoadBalancerRequest;
-import org.springframework.cloud.sleuth.Span;
-import org.springframework.cloud.sleuth.SpanReporter;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.test.context.junit4.SpringRunner;
-import zipkin.junit.ZipkinRule;
-
-import static org.assertj.core.api.BDDAssertions.then;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = ZipkinDiscoveryClientTests.Config.class, properties = {
- "spring.zipkin.baseUrl=http://zipkin/",
- "spring.cloud.discovery.client.composite-indicator.enabled=false" })
-public class ZipkinDiscoveryClientTests {
-
- @ClassRule public static ZipkinRule ZIPKIN_RULE = new ZipkinRule();
-
- @Autowired SpanReporter spanReporter;
-
- @Test
- public void shouldUseDiscoveryClientToFindZipkinUrlIfPresent() throws Exception {
- Span span = Span.builder().traceIdHigh(1L).traceId(2L).spanId(3L).name("foo")
- .build();
-
- this.spanReporter.report(span);
-
- Awaitility.await().untilAsserted(() -> then(ZIPKIN_RULE.httpRequestCount()).isGreaterThan(0));
- }
-
- @Configuration
- @EnableAutoConfiguration
- static class Config {
-
- @Bean LoadBalancerClient loadBalancerClient() {
- return new LoadBalancerClient() {
- @Override public T execute(String serviceId,
- LoadBalancerRequest request) throws IOException {
- return null;
- }
-
- @Override public T execute(String serviceId,
- ServiceInstance serviceInstance, LoadBalancerRequest request)
- throws IOException {
- return null;
- }
-
- @Override public URI reconstructURI(ServiceInstance instance,
- URI original) {
- return null;
- }
-
- @Override public ServiceInstance choose(String serviceId) {
- return new ServiceInstance() {
- @Override
- public String getServiceId() {
- return "zipkin";
- }
-
- @Override
- public String getHost() {
- return "localhost";
- }
-
- @Override
- public int getPort() {
- return URI.create(ZIPKIN_RULE.httpUrl()).getPort();
- }
-
- @Override
- public boolean isSecure() {
- return false;
- }
-
- @Override
- public URI getUri() {
- return URI.create(ZIPKIN_RULE.httpUrl());
- }
-
- @Override
- public Map getMetadata() {
- return null;
- }
- };
- }
- };
- }
- }
-}
\ No newline at end of file
diff --git a/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/ZipkinSpanListenerTests.java b/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/ZipkinSpanListenerTests.java
deleted file mode 100644
index 130d70e59..000000000
--- a/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/ZipkinSpanListenerTests.java
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * Copyright 2013-2017 the original author or 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 org.springframework.cloud.sleuth.zipkin;
-
-import org.assertj.core.api.Condition;
-import zipkin.Constants;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import javax.annotation.PostConstruct;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.sleuth.Sampler;
-import org.springframework.cloud.sleuth.Span;
-import org.springframework.cloud.sleuth.SpanAdjuster;
-import org.springframework.cloud.sleuth.SpanReporter;
-import org.springframework.cloud.sleuth.Tracer;
-import org.springframework.cloud.sleuth.sampler.AlwaysSampler;
-import org.springframework.cloud.sleuth.zipkin.ZipkinSpanListenerTests.TestConfiguration;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Primary;
-import org.springframework.mock.env.MockEnvironment;
-import org.springframework.test.context.junit4.SpringRunner;
-import zipkin.Endpoint;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-
-/**
- * @author Dave Syer
- *
- */
-@SpringBootTest(classes = TestConfiguration.class)
-@RunWith(SpringRunner.class)
-public class ZipkinSpanListenerTests {
-
- @Autowired Tracer tracer;
- @Autowired TestConfiguration test;
- @Autowired ZipkinSpanListener spanListener;
- @Autowired ZipkinSpanReporter spanReporter;
- @Autowired MockEnvironment mockEnvironment;
- @Autowired EndpointLocator endpointLocator;
-
- @PostConstruct
- public void init() {
- this.test.zipkinSpans.clear();
- }
-
- Span parent = Span.builder().traceId(1L).name("http:parent").remote(true).build();
-
- /** Sleuth timestamps are millisecond granularity while zipkin is microsecond. */
- @Test
- public void convertsTimestampToMicrosecondsAndSetsDurationToAccumulatedMicros() {
- Span span = Span.builder().traceId(1L).name("http:api").build();
- long start = System.currentTimeMillis();
- span.logEvent("hystrix/retry"); // System.currentTimeMillis
- span.stop();
-
- zipkin.Span result = this.spanListener.convert(span);
-
- assertThat(result.timestamp)
- .isEqualTo(span.getBegin() * 1000);
- assertThat(result.duration)
- .isEqualTo(span.getAccumulatedMicros());
- assertThat(result.annotations.get(0).timestamp)
- .isGreaterThanOrEqualTo(start * 1000)
- .isLessThanOrEqualTo(System.currentTimeMillis() * 1000);
- }
-
- @Test
- public void setsTheDurationToTheDifferenceBetweenCRandCS()
- throws InterruptedException {
- Span span = Span.builder().traceId(1L).name("http:api").build();
- span.logEvent(Span.CLIENT_SEND);
- Thread.sleep(10);
- span.logEvent(Span.CLIENT_RECV);
- Thread.sleep(20);
- span.stop();
-
- zipkin.Span result = this.spanListener.convert(span);
-
- assertThat(result.timestamp).isEqualTo(span.getBegin() * 1000);
- long clientSendTimestamp = span.logs().stream()
- .filter(log -> Span.CLIENT_SEND.equals(log.getEvent())).findFirst().get()
- .getTimestamp();
- long clientRecvTimestamp = span.logs().stream()
- .filter(log -> Span.CLIENT_RECV.equals(log.getEvent())).findFirst().get()
- .getTimestamp();
- assertThat(result.duration).isNotEqualTo(span.getAccumulatedMicros())
- .isEqualTo((clientRecvTimestamp - clientSendTimestamp) * 1000);
- }
-
- /** Zipkin's duration should only be set when the span is finished. */
- @Test
- public void doesntSetDurationWhenStillRunning() {
- Span span = Span.builder().traceId(1L).name("http:api").build();
- zipkin.Span result = this.spanListener.convert(span);
-
- assertThat(result.timestamp)
- .isGreaterThan(0); // sanity check it did start
- assertThat(result.duration)
- .isNull();
- }
-
- /**
- * In the RPC span model, the client owns the timestamp and duration of the span. If
- * we were propagated an id, we can assume that we shouldn't report timestamp or
- * duration, rather let the client do that. Worst case we were propagated an
- * unreported ID and Zipkin backfills timestamp and duration.
- */
- @Test
- public void doesntSetTimestampOrDurationWhenRemote() {
- this.parent.stop();
- zipkin.Span result = this.spanListener.convert(this.parent);
-
- assertThat(result.timestamp)
- .isNull();
- assertThat(result.duration)
- .isNull();
- }
-
- /** Sleuth host corresponds to annotation/binaryAnnotation.host in zipkin. */
- @Test
- public void annotationsIncludeHost() {
- this.parent.logEvent("hystrix/retry");
- this.parent.tag("spring-boot/version", "1.3.1.RELEASE");
-
- zipkin.Span result = this.spanListener.convert(this.parent);
-
- assertThat(result.annotations.get(0).endpoint)
- .isEqualTo(this.spanListener.endpointLocator.local());
- assertThat(result.binaryAnnotations.get(0).endpoint)
- .isEqualTo(result.annotations.get(0).endpoint);
- }
-
- /** zipkin's Endpoint.serviceName should never be null. */
- @Test
- public void localEndpointIncludesServiceName() {
- assertThat(this.spanListener.endpointLocator.local().serviceName)
- .isNotEmpty();
- }
-
- /**
- * In zipkin, the service context is attached to annotations. Sleuth spans that have
- * no annotations will get an "lc" one, which allows them to be queryable in zipkin by
- * service name.
- */
- @Test
- public void spanWithoutAnnotationsLogsComponent() {
- Span context = this.tracer.createSpan("http:foo");
- this.tracer.close(context);
- assertEquals(1, this.test.zipkinSpans.size());
- assertThat(this.test.zipkinSpans.get(0).binaryAnnotations.get(0).value)
- .isEqualTo("unknown".getBytes()); // TODO: "unknown" bc process id, documented as not nullable, is null.
- }
-
- @Test
- public void rpcAnnotations() {
- Span context = this.tracer.createSpan("http:child", this.parent);
- context.logEvent(Span.CLIENT_SEND);
- logServerReceived(this.parent);
- logServerSent(this.spanListener, this.parent);
- this.tracer.close(context);
- assertEquals(2, this.test.zipkinSpans.size());
- }
-
- void logServerReceived(Span parent) {
- if (parent != null && parent.isRemote()) {
- parent.logEvent(Span.SERVER_RECV);
- }
- }
-
- void logServerSent(SpanReporter spanReporter, Span parent) {
- if (parent != null && parent.isRemote()) {
- parent.logEvent(Span.SERVER_SEND);
- spanReporter.report(parent);
- }
- }
-
- @Test
- public void appendsLocalComponentTagIfNoZipkinLogIsPresent() {
- this.parent.logEvent("hystrix/retry");
- this.parent.stop();
-
- zipkin.Span result = this.spanListener.convert(this.parent);
-
- assertThat(result.binaryAnnotations)
- .extracting(input -> input.key)
- .contains(Constants.LOCAL_COMPONENT);
- }
-
- @Test
- public void appendServerAddressTagIfClientLogIsPresentWhenPeerServiceIsPresent() {
- this.parent.logEvent(Constants.CLIENT_SEND);
- this.parent.tag(Span.SPAN_PEER_SERVICE_TAG_NAME, "fooservice");
- this.parent.stop();
-
- zipkin.Span result = this.spanListener.convert(this.parent);
-
- assertThat(result.binaryAnnotations)
- .filteredOn("key", Constants.SERVER_ADDR)
- .extracting(input -> input.endpoint)
- .hasSize(1)
- .has(new Condition>() {
- @Override public boolean matches(List extends Endpoint> value) {
- Endpoint endpoint = value.get(0);
- return endpoint.serviceName.equals("fooservice") && endpoint.ipv4 == 0;
- }
- });
- }
-
- @Test
- public void doesNotAppendServerAddressTagIfClientLogIsPresent() {
- this.parent.logEvent(Constants.CLIENT_SEND);
- this.parent.stop();
-
- zipkin.Span result = this.spanListener.convert(this.parent);
-
- assertThat(result.binaryAnnotations)
- .filteredOn("key", Constants.SERVER_ADDR)
- .isEmpty();
- }
-
- @Test
- public void converts128BitTraceId() {
- Span span = Span.builder().traceIdHigh(1L).traceId(2L).spanId(3L).name("foo").build();
-
- zipkin.Span result = this.spanListener.convert(span);
-
- assertThat(result.traceIdHigh).isEqualTo(span.getTraceIdHigh());
- assertThat(result.traceId).isEqualTo(span.getTraceId());
- }
-
- @Test
- public void shouldReuseServerAddressTag() {
- this.parent.logEvent(Constants.CLIENT_SEND);
- this.parent.tag(Span.SPAN_PEER_SERVICE_TAG_NAME, "fooservice");
- this.parent.stop();
-
- zipkin.Span result = this.spanListener.convert(this.parent);
-
- assertThat(result.binaryAnnotations)
- .filteredOn("key", Constants.SERVER_ADDR)
- .extracting(input -> input.endpoint.serviceName)
- .containsOnly("fooservice");
- }
-
- @Test
- public void shouldNotReportToZipkinWhenSpanIsNotExportable() {
- Span span = Span.builder().exportable(false).build();
-
- this.spanListener.report(span);
-
- assertThat(this.test.zipkinSpans).isEmpty();
- }
-
- @Test
- public void shouldAddClientServiceIdTagWhenSpanContainsRpcEvent() {
- this.parent.logEvent(Span.CLIENT_SEND);
- this.mockEnvironment.setProperty("vcap.application.instance_id", "foo");
-
- zipkin.Span result = this.spanListener.convert(this.parent);
-
- assertThat(result.binaryAnnotations)
- .filteredOn("key", Span.INSTANCEID)
- .extracting(input -> input.value)
- .containsOnly("foo".getBytes());
- }
-
- @Test
- public void shouldNotAddAnyServiceIdTagWhenSpanContainsRpcEventAndThereIsNoEnvironment() {
- this.parent.logEvent(Span.CLIENT_RECV);
- ZipkinSpanListener spanListener = new ZipkinSpanListener(this.spanReporter,
- this.endpointLocator, null, new ArrayList<>());
-
- zipkin.Span result = spanListener.convert(this.parent);
-
- assertThat(result.binaryAnnotations)
- .filteredOn("key", Span.INSTANCEID)
- .extracting(input -> input.value)
- .isEmpty();
- }
-
- @Test
- public void should_adjust_span_before_reporting_it() {
- this.parent.logEvent(Span.CLIENT_RECV);
- ZipkinSpanListener spanListener = new ZipkinSpanListener(this.spanReporter,
- this.endpointLocator, null, Arrays.asList(
- (SpanAdjuster) span -> Span.builder().from(span).name("foo").build(),
- (SpanAdjuster) span -> Span.builder().from(span).name(span.getName() + "bar").build()
- ));
-
- zipkin.Span result = spanListener.convert(this.parent);
-
- assertThat(result.name).isEqualTo("foobar");
- }
-
- @Test
- public void shouldRemoveTimestampAndDurationForNonRemoteSharedSpan() {
- Span span = Span.builder()
- .name("foo")
- .exportable(false)
- .remote(false)
- .shared(true)
- .build();
-
- zipkin.Span result = this.spanListener.convert(span);
-
- assertThat(result.duration).isNull();
- assertThat(result.timestamp).isNull();
- }
-
- @Test
- public void shouldNotRemoveTimestampAndDurationForNonRemoteNonSharedSpan() {
- Span span = Span.builder()
- .name("foo")
- .exportable(false)
- .remote(false)
- .shared(false)
- .build();
- span.stop();
-
- zipkin.Span result = this.spanListener.convert(span);
-
- assertThat(result.duration).isNotNull();
- assertThat(result.timestamp).isNotNull();
- }
-
- @Configuration
- @EnableAutoConfiguration
- protected static class TestConfiguration {
-
- private List zipkinSpans = new ArrayList<>();
-
- @Bean
- public Sampler sampler() {
- return new AlwaysSampler();
- }
-
- @Bean
- public ZipkinSpanReporter reporter() {
- return this.zipkinSpans::add;
- }
-
- @Bean @Primary MockEnvironment mockEnvironment() {
- return new MockEnvironment();
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/ZipkinWithDisabledSleuthTests.java b/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/ZipkinWithDisabledSleuthTests.java
deleted file mode 100644
index 5d09755fc..000000000
--- a/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin/ZipkinWithDisabledSleuthTests.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2013-2017 the original author or 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 org.springframework.cloud.sleuth.zipkin;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = ZipkinWithDisabledSleuthTests.Config.class)
-@TestPropertySource(properties = "spring.sleuth.enabled=false")
-public class ZipkinWithDisabledSleuthTests {
-
- @Test public void shouldStartContext() {
-
- }
-
- @EnableAutoConfiguration
- static class Config {
- }
-}
diff --git a/spring-cloud-sleuth-zipkin2/src/test/java/org/springframework/cloud/sleuth/zipkin2/DefaultEndpointLocatorConfigurationTest.java b/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin2/DefaultEndpointLocatorConfigurationTest.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/test/java/org/springframework/cloud/sleuth/zipkin2/DefaultEndpointLocatorConfigurationTest.java
rename to spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin2/DefaultEndpointLocatorConfigurationTest.java
diff --git a/spring-cloud-sleuth-zipkin2/src/test/java/org/springframework/cloud/sleuth/zipkin2/ZipkinAutoConfigurationTests.java b/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin2/ZipkinAutoConfigurationTests.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/test/java/org/springframework/cloud/sleuth/zipkin2/ZipkinAutoConfigurationTests.java
rename to spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin2/ZipkinAutoConfigurationTests.java
diff --git a/spring-cloud-sleuth-zipkin2/src/test/java/org/springframework/cloud/sleuth/zipkin2/ZipkinDiscoveryClientTests.java b/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin2/ZipkinDiscoveryClientTests.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/test/java/org/springframework/cloud/sleuth/zipkin2/ZipkinDiscoveryClientTests.java
rename to spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin2/ZipkinDiscoveryClientTests.java
diff --git a/spring-cloud-sleuth-zipkin2/src/test/java/org/springframework/cloud/sleuth/zipkin2/ZipkinSpanReporterTests.java b/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin2/ZipkinSpanReporterTests.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/test/java/org/springframework/cloud/sleuth/zipkin2/ZipkinSpanReporterTests.java
rename to spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin2/ZipkinSpanReporterTests.java
diff --git a/spring-cloud-sleuth-zipkin2/src/test/java/org/springframework/cloud/sleuth/zipkin2/ZipkinWithDisabledSleuthTests.java b/spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin2/ZipkinWithDisabledSleuthTests.java
similarity index 100%
rename from spring-cloud-sleuth-zipkin2/src/test/java/org/springframework/cloud/sleuth/zipkin2/ZipkinWithDisabledSleuthTests.java
rename to spring-cloud-sleuth-zipkin/src/test/java/org/springframework/cloud/sleuth/zipkin2/ZipkinWithDisabledSleuthTests.java
diff --git a/spring-cloud-sleuth-zipkin2/pom.xml b/spring-cloud-sleuth-zipkin2/pom.xml
deleted file mode 100644
index a4f0e2dee..000000000
--- a/spring-cloud-sleuth-zipkin2/pom.xml
+++ /dev/null
@@ -1,137 +0,0 @@
-
-
-
-
- 4.0.0
-
- spring-cloud-sleuth-zipkin2
- jar
- Spring Cloud Sleuth Zipkin v2
- Spring Cloud Sleuth Zipkin v2
-
-
- org.springframework.cloud
- spring-cloud-sleuth
- 2.0.0.BUILD-SNAPSHOT
- ..
-
-
-
-
- org.springframework.boot
- spring-boot-starter-web
- true
-
-
- org.springframework.cloud
- spring-cloud-sleuth-core
-
-
- org.springframework
- spring-web
-
-
- org.springframework.cloud
- spring-cloud-commons
-
-
-
- org.springframework.boot
- spring-boot-actuator
- true
-
-
- org.springframework.boot
- spring-boot-starter-logging
- true
-
-
- org.springframework.boot
- spring-boot-configuration-processor
- true
-
-
- io.zipkin.zipkin2
- zipkin
-
-
- io.zipkin.reporter2
- zipkin-reporter
-
-
- io.zipkin.reporter2
- zipkin-sender-kafka11
-
-
- org.springframework.kafka
- spring-kafka
- true
-
-
- io.zipkin.reporter2
- zipkin-sender-amqp-client
-
-
- org.springframework.amqp
- spring-rabbit
- true
-
-
- org.springframework
- spring-messaging
- test
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.assertj
- assertj-core
- test
-
-
- org.awaitility
- awaitility
- test
-
-
- com.squareup.okhttp3
- mockwebserver
- 3.9.0
- test
-
-
- org.aspectj
- aspectjrt
- test
-
-
- org.aspectj
- aspectjweaver
- test
-
-
-
-
diff --git a/spring-cloud-sleuth-zipkin2/src/main/resources/META-INF/spring.factories b/spring-cloud-sleuth-zipkin2/src/main/resources/META-INF/spring.factories
deleted file mode 100644
index 7a0e23d33..000000000
--- a/spring-cloud-sleuth-zipkin2/src/main/resources/META-INF/spring.factories
+++ /dev/null
@@ -1,3 +0,0 @@
-# Auto Configuration
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-org.springframework.cloud.sleuth.zipkin2.ZipkinAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-starter-zipkin/pom.xml b/spring-cloud-starter-zipkin/pom.xml
index fffbf6a13..f7f18c789 100644
--- a/spring-cloud-starter-zipkin/pom.xml
+++ b/spring-cloud-starter-zipkin/pom.xml
@@ -9,8 +9,8 @@
..
spring-cloud-starter-zipkin
- spring-cloud-starter-zipkin
- Spring Cloud Starter
+ Spring Cloud Starter Zipkin
+ Spring Cloud Starter Zipkin
${basedir}/../..
diff --git a/spring-cloud-starter-zipkin2/pom.xml b/spring-cloud-starter-zipkin2/pom.xml
deleted file mode 100644
index 69fed48de..000000000
--- a/spring-cloud-starter-zipkin2/pom.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
- 4.0.0
-
- org.springframework.cloud
- spring-cloud-sleuth
- 2.0.0.BUILD-SNAPSHOT
- ..
-
- spring-cloud-starter-zipkin2
- spring-cloud-starter-zipkin2
- Spring Cloud Starter Zipkin v2
-
- ${basedir}/../..
-
-
-
- org.springframework.cloud
- spring-cloud-starter-sleuth
-
-
- org.springframework.cloud
- spring-cloud-sleuth-zipkin2
-
-
-
diff --git a/spring-cloud-starter-zipkin2/src/main/resources/META-INF/spring.provides b/spring-cloud-starter-zipkin2/src/main/resources/META-INF/spring.provides
deleted file mode 100644
index 3dc45a036..000000000
--- a/spring-cloud-starter-zipkin2/src/main/resources/META-INF/spring.provides
+++ /dev/null
@@ -1 +0,0 @@
-provides: spring-platform-netflix-core, eureka-client
\ No newline at end of file