Skip to content

fix: Fix SQL marginalia parsing

Issue: gitlab-com/gl-infra/data-access/dbo/dbo-issue-tracker#615

The format of the correlation_id field changed recently (2025-10-16), adding a dash (-) to the set of expected characters. This format change silently broke the parsing of the marginalia prepended to most SQL query text. Specifically the correlation_id field and all subsequent fields were no longer matched.

This caused the Prometheus metrics to lack label values for those fields. In particular, we lost the labels for:

  • endpoint_id
  • db_config_database (a.k.a. database)

This fix updates the regexp allowing - to be part of the correlation_id value.

Example:

This is a marginalia string showing the new format for correlation_id (992a720860faba41-ATL):

/*application:web,correlation_id:992a720860faba41-ATL,endpoint_id:GET /api/:version/projects/:id/repository/files/:file_path/raw,db_config_database:gitlabhq_production,db_config_name:main*/
Edited by Matt Smiley

Merge request reports

Loading