Skip to content

Refine regex in Gitlab::Metrics::Subscribers::ActiveRecord to exclude all write statements

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

In https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/metrics/subscribers/active_record.rb#L13, the regex filters for sql queries to determine if the query should be counted as a write.

The metrics indicates that we have a very low volume of writes to the replicas.

Screenshot_2024-09-19_at_6.17.40_PM

source

That is untrue looking at the charts for inserts/updates/deletes.

It is likely that there are certain queries that does not match the typical pattern and get classified as a non-select statement. We should figure that out and refine the regex.

Edited by 🤖 GitLab Bot 🤖