xk6-sql icon indicating copy to clipboard operation
xk6-sql copied to clipboard

Emit query duration metric

Open imiric opened this issue 3 years ago • 0 comments

The extension currently doesn't emit any SQL-specific k6 metrics. A basic one that would be useful for tracking DB performance would be query_duration. It should be possible to apply thresholds and tags per query, as mentioned in #22.

While this could be implemented in JS as shown in this example, it's a very imprecise method.

Suggested solution

Golang's database/sql doesn't seem to expose any such statistics, but there's an example here that wraps driver.Driver to calculate the value. It's essentially doing what the above JS example does, but in Go, so it's not great, but it's an improvement nonetheless.

imiric avatar Jul 26 '22 11:07 imiric