Emit query duration metric
- Dominant language
- Go
- Stars
- 190
- Forks
- 65
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 10
Description
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](https://github.com/grafana/xk6-sql/issues/22#issuecomment-1195323702), 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](https://medium.com/@ducmeit/integrate-hook-operations-for-tracking-time-finish-for-a-sqls-query-at-golang-267471e325a2) 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.
Contributor guide
Assessment
This issue has not been assessed yet.