Search in sources :

Example 1 with ServerSpanState

use of com.github.kristofa.brave.ServerSpanState in project zipkin by openzipkin.

the class TraceZipkinMySQLStorageAutoConfiguration method executor.

@Bean
@ConditionalOnMissingBean(Executor.class)
public Executor executor(ServerSpanState serverState) {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setThreadNamePrefix("MySQLStorage-");
    executor.initialize();
    return command -> {
        ServerSpan currentSpan = serverState.getCurrentServerSpan();
        executor.execute(() -> {
            serverState.setCurrentServerSpan(currentSpan);
            command.run();
        });
    };
}
Also used : ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ThreadPoolTaskExecutor(org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor) ZipkinMySQLStorageProperties(zipkin.autoconfigure.storage.mysql.ZipkinMySQLStorageProperties) Executor(java.util.concurrent.Executor) Brave(com.github.kristofa.brave.Brave) ServerSpanState(com.github.kristofa.brave.ServerSpanState) Endpoint(com.twitter.zipkin.gen.Endpoint) Autowired(org.springframework.beans.factory.annotation.Autowired) StringUtils(org.jooq.tools.StringUtils) ServerSpan(com.github.kristofa.brave.ServerSpan) UnknownHostException(java.net.UnknownHostException) ByteBuffer(java.nio.ByteBuffer) InetAddress(java.net.InetAddress) Configuration(org.springframework.context.annotation.Configuration) ExecuteContext(org.jooq.ExecuteContext) DefaultExecuteListener(org.jooq.impl.DefaultExecuteListener) Qualifier(org.springframework.beans.factory.annotation.Qualifier) SQL_QUERY(zipkin.TraceKeys.SQL_QUERY) ExecuteListenerProvider(org.jooq.ExecuteListenerProvider) Lazy(org.springframework.context.annotation.Lazy) Bean(org.springframework.context.annotation.Bean) ConditionalOnProperty(org.springframework.boot.autoconfigure.condition.ConditionalOnProperty) DefaultExecuteListenerProvider(org.jooq.impl.DefaultExecuteListenerProvider) ServerSpan(com.github.kristofa.brave.ServerSpan) ThreadPoolTaskExecutor(org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

Brave (com.github.kristofa.brave.Brave)1 ServerSpan (com.github.kristofa.brave.ServerSpan)1 ServerSpanState (com.github.kristofa.brave.ServerSpanState)1 Endpoint (com.twitter.zipkin.gen.Endpoint)1 InetAddress (java.net.InetAddress)1 UnknownHostException (java.net.UnknownHostException)1 ByteBuffer (java.nio.ByteBuffer)1 Executor (java.util.concurrent.Executor)1 ExecuteContext (org.jooq.ExecuteContext)1 ExecuteListenerProvider (org.jooq.ExecuteListenerProvider)1 DefaultExecuteListener (org.jooq.impl.DefaultExecuteListener)1 DefaultExecuteListenerProvider (org.jooq.impl.DefaultExecuteListenerProvider)1 StringUtils (org.jooq.tools.StringUtils)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 Qualifier (org.springframework.beans.factory.annotation.Qualifier)1 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 ConditionalOnProperty (org.springframework.boot.autoconfigure.condition.ConditionalOnProperty)1 Bean (org.springframework.context.annotation.Bean)1 Configuration (org.springframework.context.annotation.Configuration)1