There is a bug in this recent refactoring of the contention information which causes the statement increment to be done at the txn level instead. The following line needs to be moved to the statement finish so the metric is at the stmt level instead of the transaction level.
ex.planner.DistSQLPlanner().distSQLSrv.Metrics.ContendedQueriesCount.Inc(1)
https://cockroachlabs.slack.com/archives/C0159JK877C/p1675297127031379
Jira issue: CRDB-24120