Skip to content

contrib/jmoiron/sqlx: returns duplicate traces and "driver error: skip fast-path" #270

Description

@aarrtteemmuuss

When enabling sql/sqlx integration, making db queries sends multiple query traces duplicates. The following error is also persistently present:
*errors.errorString: driver: skip fast-path; continue as if unimplemented
Below is the result of single request: there are 3 duplicates of the same DB query for both of queries, error appeared two times as well.
screen shot 2018-06-28 at 2 21 26 pm

UPDATE: Actually I just found out why I get 2 queries - one is for Prepare and one is for Query. But in code it is not reflected. The question about error is still open though. Possible solution is to change resource = query to resource = resource + " " + query in contrib/database/sql/driver.go in the following method:

func (tp *traceParams) newChildSpanFromContext(ctx context.Context, resource string, query string) ddtrace.Span {
	name := fmt.Sprintf("%s.query", tp.driverName)
	span, _ := tracer.StartSpanFromContext(ctx, name,
		tracer.SpanType(ext.AppTypeDB),
		tracer.ServiceName(tp.config.serviceName),
	)
	if query != "" {
		resource = query
	}
	span.SetTag(ext.ResourceName, resource)
	for k, v := range tp.meta {
		span.SetTag(k, v)
	}
	return span
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    ackapm:ecosystemcontrib/* related feature requests or bugs

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions