Skip to content

sql.rows span don't correlate to sql.conn.query #561

@luis-mozn

Description

@luis-mozn

Description

Not sure if this is a bug or intended behavior, but currently when a single application span does multiple queries with QueryContext concurrently. We get 2 sibling spans per query: a sql.conn.query which contains the useful information like the sql annotation, and a sql.rows which is where the time taken actually goes to.

Right now it doesn't look like we can easily tell which query relates to which rows call and I wasn't sure from the code whether this is intentional or not - by passing queryCtx in newRows we should get a child span although they are different operations. Alternatively a way to set the query string on rows span would be nice.

Environment

  • OS: Alpine Linux
  • Architecture: x86
  • Go Version: 1.25.0
  • otelsql version: v0.40.0

Steps To Reproduce

Concurrently create multiple QueryContext calls and read all rows from them. Should get multiple sibling spans with no correlation between them

Expected behavior

There should be a way to know which query originated which rows call

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions