Home > Back-end >  Spring Cloud Sleuth instrumentation constantly prints TODO before/after removeServiceName=
Spring Cloud Sleuth instrumentation constantly prints TODO before/after removeServiceName=

Time:02-10

After migrating from Spring Boot 2.3 to 2.6 I have weird behavior in Spring Cloud Sleuth. Instrumentation constantly prints to the console these messages

2022-02-10 11:59:46.804  INFO [SERVICE,4b9b266d4e1cf475,0bd79e17d007e0ce] 6412 --- [nio-8890-exec-6] o.s.c.s.i.jdbc.TraceListenerStrategy     : TODO before removeServiceName=serviceDataSource
2022-02-10 11:59:46.804  INFO [SERVICE,4b9b266d4e1cf475,0bd79e17d007e0ce] 6412 --- [nio-8890-exec-6] o.s.c.s.i.jdbc.TraceListenerStrategy     : TODO after removeServiceName=serviceDataSource

I have found this snippet code in Spring Cloud Sleuth source code

    void afterGetConnection(CON connectionKey, @Nullable Connection connection, String dataSourceName,
            @Nullable Throwable t) {
        if (log.isTraceEnabled()) {
            log.trace("After get connection ["   connectionKey   "]. Current span is ["   tracer.currentSpan()   "]");
        }
        ConnectionInfo connectionInfo = this.openConnections.get(connectionKey);
        SpanAndScope connectionSpan = connectionInfo.span;
        if (connection != null) {
            log.info("TODO before removeServiceName="   connectionInfo.remoteServiceName);
            parseAndSetServerIpAndPort(connectionInfo, connection, dataSourceName);
            log.info("TODO after removeServiceName="   connectionInfo.remoteServiceName);
            if (connectionSpan != null) {
                connectionSpan.getSpan().remoteServiceName(connectionInfo.remoteServiceName);
                connectionSpan.getSpan().remoteIpAndPort(connectionInfo.url.getHost(), connectionInfo.url.getPort());
            }
        }

Is this correct behavior? how to disable these messages? Or something is wrong with my database connection or Spring Cloud Sleuth after migration?

CodePudding user response:

This has already been fixed https://github.com/spring-cloud/spring-cloud-sleuth/issues/2069 and will be released shortly. Until then you can set the logging level for that class to ERROR logging.level.org.springframework.cloud.sleuth.instrument.jdbc=ERROR

  • Related