micrometer-metrics/tracing

Micrometer-tracing does not work in case @EnableJpaRepositories(repositoryFactoryBeanClass = CustomFactoryBean.class)

Nickolas990 opened this issue · 1 comments

Hi there!
I've stuck with problem when micrometer-tracing can not autoconfigure with custom JpaFactoryBean.class

@SpringBootApplication
@Slf4j
@EnableJpaRepositories(repositoryFactoryBeanClass = CustomFactoryBean.class)
public class GitllabBotApplication {

    public static void main(String[] args) throws UnknownHostException {
        try {
            ConfigurableEnvironment environment = SpringApplication.run(GitllabBotApplication.class, args).getEnvironment();
            int port = StringUtils.isBlank(environment.getProperty("server.port")) ?
                    80 : Integer.parseInt(environment.getProperty("server.port"));

            String contextPath = environment.getProperty("server.servlet.context-path");
            contextPath = StringUtils.isBlank(contextPath) ? "/" : contextPath;
            String kafkaInfo = environment.getProperty("spring.cloud.stream.kafka.binder.brokers");
            log.debug(String.format(
                    "\n----------------------------------------------------------\n\t"
                            + "Application %s is running! Access URLs:\n\t"
                            + "Local: \t\thttp://127.0.0.1:%s%s\n\t"
                            + "External: \thttp://%s:%s%s\n\t"
                            + "Kafka broker host and port: %s"
                            + "\n----------------------------------------------------------\n" ,
                    environment.getProperty("spring.application.name"),
                    port,
                    contextPath,
                    InetAddress.getLocalHost().getHostAddress(),
                    port,
                    contextPath,
                    kafkaInfo != null ? kafkaInfo : "undefined"));
        } catch (RuntimeException ex) {
            if (!ex.getClass().getSimpleName().contains("SilentExitException")) {
                log.warn(ex.getMessage());
                log.warn(Arrays.toString(ex.getStackTrace()));
            }
            throw ex;
        }
    }

}

logBot.txt

logPom.txt

Micrometer Tracing has nothing to do with Spring. Please create an issue in a proper Spring repository. Also in your sample I can see kafka, lombok, http, jpa and test setup without any production code. Please isolate your problem and only then file a new issue. Thank you