Removed an unused class

This commit is contained in:
Marcin Grzejszczak
2021-06-24 17:49:57 +02:00
parent 340454b8bb
commit d353e66556
3 changed files with 1 additions and 198 deletions

View File

@@ -1,91 +0,0 @@
/*
* Copyright 2013-2021 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
*
* https://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;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.lang.Nullable;
/**
* Represents a {@link Span} stored in thread local.
*
* @author Marcin Grzejszczak
* @since 3.1.0
*/
public interface WithThreadLocalSpan {
/**
* Logger.
*/
Log log = LogFactory.getLog(WithThreadLocalSpan.class);
/**
* Sets the span in thread local scope.
* @param span span to put in thread local
*/
default void setSpanInScope(Span span) {
getThreadLocalSpan().set(span);
if (log.isDebugEnabled()) {
log.debug("Put span in scope " + span);
}
}
/**
* Finishes the thread local span.
* @param error potential error to be stored in span
*/
default void finishSpan(@Nullable Throwable error) {
SpanAndScope spanAndScope = takeSpanFromThreadLocal();
if (spanAndScope == null) {
return;
}
Span span = spanAndScope.getSpan();
Tracer.SpanInScope scope = spanAndScope.getScope();
if (span.isNoop()) {
if (log.isDebugEnabled()) {
log.debug("Span " + span + " is noop - will stope the scope");
}
scope.close();
return;
}
if (error != null) { // an error occurred, adding error to span
span.error(error);
}
if (log.isDebugEnabled()) {
log.debug("Will finish the span and its corresponding scope " + span);
}
span.end();
scope.close();
}
/**
* Takes a span from thread local and restores the previous one if present.
* @return span from a thread local span
*/
default SpanAndScope takeSpanFromThreadLocal() {
SpanAndScope span = getThreadLocalSpan().get();
if (log.isDebugEnabled()) {
log.debug("Took span [" + span + "] from thread local");
}
getThreadLocalSpan().remove();
return span;
}
ThreadLocalSpan getThreadLocalSpan();
}

View File

@@ -1,100 +0,0 @@
{
"properties": [
{
"name": "spring.sleuth.integration.enabled",
"type": "java.lang.Boolean",
"description": "Enable Spring Integration sleuth instrumentation.",
"defaultValue": true
},
{
"name": "spring.sleuth.integration.websockets.enabled",
"type": "java.lang.Boolean",
"description": "Enable tracing for WebSockets.",
"defaultValue": true
},
{
"name": "spring.sleuth.async.enabled",
"type": "java.lang.Boolean",
"description": "Enable instrumenting async related components so that the tracing information is passed between threads.",
"defaultValue": true
},
{
"name": "spring.sleuth.async.configurer.enabled",
"type": "java.lang.Boolean",
"description": "Enable default AsyncConfigurer.",
"defaultValue": true
},
{
"name": "spring.sleuth.feign.enabled",
"type": "java.lang.Boolean",
"description": "Enable span information propagation when using Feign.",
"defaultValue": true
},
{
"name": "spring.sleuth.feign.processor.enabled",
"type": "java.lang.Boolean",
"description": "Enable post processor that wraps Feign Context in its tracing representations.",
"defaultValue": true
},
{
"name": "spring.sleuth.grpc.enabled",
"type": "java.lang.Boolean",
"description": "Enable span information propagation when using GRPC.",
"defaultValue": true
},
{
"name": "spring.sleuth.messaging.jms.enabled",
"type": "java.lang.Boolean",
"description": "Enable tracing of JMS.",
"defaultValue": true
},
{
"name": "spring.sleuth.messaging.rabbit.enabled",
"type": "java.lang.Boolean",
"description": "Enable tracing of RabbitMQ.",
"defaultValue": true
},
{
"name": "spring.sleuth.messaging.kafka.enabled",
"type": "java.lang.Boolean",
"description": "Enable tracing of Kafka.",
"defaultValue": true
},
{
"name": "spring.sleuth.messaging.kafka.mapper.enabled",
"type": "java.lang.Boolean",
"description": "Enable DefaultKafkaHeaderMapper tracing for Kafka.",
"defaultValue": true
},
{
"name": "spring.sleuth.quartz.enabled",
"type": "java.lang.Boolean",
"description": "Enable tracing for Quartz.",
"defaultValue": true
},
{
"name": "spring.sleuth.mongodb.enabled",
"type": "java.lang.Boolean",
"description": "Enable tracing for MongoDb.",
"defaultValue": true
},
{
"name": "spring.sleuth.rpc.enabled",
"type": "java.lang.Boolean",
"description": "Enable tracing of RPC.",
"defaultValue": true
},
{
"name": "spring.sleuth.sampler.refresh.enabled",
"type": "java.lang.Boolean",
"description": "Enable refresh scope for sampler.",
"defaultValue": true
},
{
"name": "spring.sleuth.web.webclient.enabled",
"type": "java.lang.Boolean",
"description": "Enable tracing instrumentation for WebClient.",
"defaultValue": true
}
]
}

View File

@@ -38,7 +38,6 @@ import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.ThreadLocalSpan;
import org.springframework.cloud.sleuth.TraceContext;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.cloud.sleuth.WithThreadLocalSpan;
import org.springframework.cloud.sleuth.docs.AssertingSpanBuilder;
import org.springframework.cloud.sleuth.instrument.reactor.ReactorSleuth;
import org.springframework.cloud.sleuth.internal.EncodingUtils;
@@ -51,7 +50,7 @@ import org.springframework.cloud.sleuth.propagation.Propagator;
* @author Oleh Dokuka
* @since 3.1.0
*/
public class TracingResponderRSocketProxy extends RSocketProxy implements WithThreadLocalSpan {
public class TracingResponderRSocketProxy extends RSocketProxy {
private static final Log log = LogFactory.getLog(TracingResponderRSocketProxy.class);
@@ -165,9 +164,4 @@ public class TracingResponderRSocketProxy extends RSocketProxy implements WithTh
return this.propagator.extract(headers, this.getter);
}
@Override
public ThreadLocalSpan getThreadLocalSpan() {
return this.threadLocalSpan;
}
}