Skip to content

Bug Report jdbc generate duplicated span #203

Closed
@wuyupengwoaini

Description

@wuyupengwoaini
Contributor

@Around("execution(java.sql.Connection *.getConnection(..)) && target(javax.sql.DataSource)")
public Object getConnection(final ProceedingJoinPoint pjp) throws Throwable {
Connection conn = (Connection) pjp.proceed();
String url = conn.getMetaData().getURL();
ConnectionInfo connectionInfo = URLParser.parser(url);
return new TracingConnection(conn, connectionInfo, withActiveSpanOnly, ignoredStatements);
}
}

When I use a datasouce implements AbstractRoutingDataSource which contains two kind of datasouces (write datasource and read datasource),and I find it will generate duplicated span .
image

I debugged and found out that the reason is because JdbcAspect cuts the access point of the Connection, and the actual DataSouce is the DataSouce that the proxy reads and writes the data source, so it cuts twice, resulting in repeated spans.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @wuyupengwoaini

      Issue actions

        Bug Report jdbc generate duplicated span · Issue #203 · opentracing-contrib/java-spring-cloud