Skip to content

spring-cloud-sleuth-instrumentation sql issue for spans #2083

@mschielmann

Description

@mschielmann

Describe the bug
Version: 3.1.0
The TraceListenerStrategy in spring-cloud-sleuth-instrumentation throws a StringOutOfBoundsException when the SQL consists of only one word, like: BEGIN. Such word, afaik, constitutes a valid SQL statement, and as such should be handled without throwing an exception.

The exception is thrown here:
https://github.com/spring-cloud/spring-cloud-sleuth/blob/main/spring-cloud-sleuth-instrumentation/src/main/java/org/springframework/cloud/sleuth/instrument/jdbc/TraceListenerStrategy.java#L432
(in spanName method), as indexOf(' ') is -1.

I'd suggest handling this with returning the whole SQL as span name in such case. Another option would be to ignore such SQL.

Sample
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions