Given a comment on the first line could we have our span name be or have selectLatestFooBar in it?
-- Name: selectLatestFooBar
select
foo,
bar
from baz;
Currently we do this for metrics and would be nice for traces as well.
We parse the sql like so:
private val re = """--\s*Name:\s*(\w+)""".r
def extractQueryNameOrSql(sql: String): String = {
re.findFirstMatchIn(sql).flatMap(m => Option(m.group(1))).getOrElse(sql)
}
If it happened to not have a comment in it then you could default back to your current way you display the sql (com.ovoenergy.natchez.extras.doobie.TracedTransactor$#formatQuery)
We are currently on 6.25 of natchez-extras-doobie but would likely upgrade to newer version if we need newer version of natchez.
Given a comment on the first line could we have our span name be or have
selectLatestFooBarin it?Currently we do this for metrics and would be nice for traces as well.
We parse the sql like so:
If it happened to not have a comment in it then you could default back to your current way you display the sql (com.ovoenergy.natchez.extras.doobie.TracedTransactor$#formatQuery)
We are currently on 6.25 of natchez-extras-doobie but would likely upgrade to newer version if we need newer version of natchez.