// Path: instrument-starters/opentracing-spring-cloud-core/src/main/java/io/opentracing/contrib/spring/cloud/aop/MethodInterceptorSpanDecorator.java
// public interface MethodInterceptorSpanDecorator {
// 
//   /**
//    * Decorate span before invocation is done, e.g. before
//    * {@link ProceedingJoinPoint#proceed()}
//    * is called
//    *
//    * @param ProceedingJoinPoint pjp
//    * @param Object result
//    * @param span span
//    */
//   void onPreProceed(ProceedingJoinPoint pjp, Span span);
// 
//   /**
//    * Decorate span after invocation is done, e.g. after
//    * {@link ProceedingJoinPoint#proceed()}
//    * is called
//    *
//    * @param ProceedingJoinPoint pjp
//    * @param Object result
//    * @param span span
//    */
//   void onPostProceed(ProceedingJoinPoint pjp, Object result, Span span);
// 
//   /**
//    * Decorate span when exception is thrown during the invocation, e.g. during
//    * {@link ProceedingJoinPoint#proceed()}
//    * is processing.
//    *
//    * @param ProceedingJoinPoint pjp
//    * @param ex exception
//    * @param span span
//    */
//   void onError(ProceedingJoinPoint pjp, Exception ex, Span span);
// 
//   /**
//    * This decorator adds set of standard tags to the span.
//    */
//   class StandardTags implements MethodInterceptorSpanDecorator {
// 
//     @Override
//     public void onPreProceed(ProceedingJoinPoint pjp, Span span) {
//       ExtensionTags.CLASS_TAG.set(span, pjp.getTarget().getClass().getSimpleName());
//       ExtensionTags.METHOD_TAG.set(span, ((MethodSignature) pjp.getSignature()).getName());
//     }
// 
//     @Override
//     public void onPostProceed(ProceedingJoinPoint pjp, Object result, Span span) {
//     }
// 
//     @Override
//     public void onError(ProceedingJoinPoint pjp, Exception ex, Span span) {
//       SpanUtils.captureException(span, ex);
//     }
//   }
// }


import org.springframework.util.CollectionUtils;
import io.opentracing.Tracer;
import io.opentracing.contrib.spring.cloud.aop.MethodInterceptorSpanDecorator;
import io.opentracing.contrib.spring.tracer.configuration.TracerAutoConfiguration;
import java.util.ArrayList;
import java.util.List;
import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
/**
 * Copyright 2017-2018 The OpenTracing 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.opentracing.contrib.spring.cloud.traced;


@Configuration
@ConditionalOnBean(Tracer.class)
@AutoConfigureAfter(TracerAutoConfiguration.class)
@ConditionalOnProperty(name = "opentracing.spring.cloud.traced.enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnWebApplication
@ConditionalOnClass({ProceedingJoinPoint.class})
@EnableConfigurationProperties(TracedTracingProperties.class)
public class TracedAutoConfiguration {

// Path: instrument-starters/opentracing-spring-cloud-core/src/main/java/io/opentracing/contrib/spring/cloud/aop/MethodInterceptorSpanDecorator.java
// public interface MethodInterceptorSpanDecorator {
// 
//   /**
//    * Decorate span before invocation is done, e.g. before
//    * {@link ProceedingJoinPoint#proceed()}
//    * is called
//    *
//    * @param ProceedingJoinPoint pjp
//    * @param Object result
//    * @param span span
//    */
//   void onPreProceed(ProceedingJoinPoint pjp, Span span);
// 
//   /**
//    * Decorate span after invocation is done, e.g. after
//    * {@link ProceedingJoinPoint#proceed()}
//    * is called
//    *
//    * @param ProceedingJoinPoint pjp
//    * @param Object result
//    * @param span span
//    */
//   void onPostProceed(ProceedingJoinPoint pjp, Object result, Span span);
// 
//   /**
//    * Decorate span when exception is thrown during the invocation, e.g. during
//    * {@link ProceedingJoinPoint#proceed()}
//    * is processing.
//    *
//    * @param ProceedingJoinPoint pjp
//    * @param ex exception
//    * @param span span
//    */
//   void onError(ProceedingJoinPoint pjp, Exception ex, Span span);
// 
//   /**
//    * This decorator adds set of standard tags to the span.
//    */
//   class StandardTags implements MethodInterceptorSpanDecorator {
// 
//     @Override
//     public void onPreProceed(ProceedingJoinPoint pjp, Span span) {
//       ExtensionTags.CLASS_TAG.set(span, pjp.getTarget().getClass().getSimpleName());
//       ExtensionTags.METHOD_TAG.set(span, ((MethodSignature) pjp.getSignature()).getName());
//     }
// 
//     @Override
//     public void onPostProceed(ProceedingJoinPoint pjp, Object result, Span span) {
//     }
// 
//     @Override
//     public void onError(ProceedingJoinPoint pjp, Exception ex, Span span) {
//       SpanUtils.captureException(span, ex);
//     }
//   }
// }


// Path: instrument-starters/opentracing-spring-cloud-core/src/main/java/io/opentracing/contrib/spring/cloud/traced/TracedAutoConfiguration.java
import org.springframework.util.CollectionUtils;
import io.opentracing.Tracer;
import io.opentracing.contrib.spring.cloud.aop.MethodInterceptorSpanDecorator;
import io.opentracing.contrib.spring.tracer.configuration.TracerAutoConfiguration;
import java.util.ArrayList;
import java.util.List;
import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.AnnotationAwareOrderComparator;

/**
 * Copyright 2017-2018 The OpenTracing 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.opentracing.contrib.spring.cloud.traced;


@Configuration
@ConditionalOnBean(Tracer.class)
@AutoConfigureAfter(TracerAutoConfiguration.class)
@ConditionalOnProperty(name = "opentracing.spring.cloud.traced.enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnWebApplication
@ConditionalOnClass({ProceedingJoinPoint.class})
@EnableConfigurationProperties(TracedTracingProperties.class)
public class TracedAutoConfiguration {

  private final ObjectProvider<List<MethodInterceptorSpanDecorator>> methodInterceptorSpanDecorators;