• Dylan Griffith's avatar
    Add db_config_name label to prometheus database metrics · ddb27c18
    Dylan Griffith authored
    The sharding team is adding support for multiple databases and in order
    for us to have good visibility into performance we'll want to be able to
    distinguish between the different databases in our prometheus metrics.
    
    Adding a prometheus label allows us to filter/group by the different
    databases.
    
    By default there will only be 1 `db_config_name` which is `primary` by
    default. But this is configured by `config/database.yml` and in future
    there will be 2 databases called `main` and `ci`.
    
    This MR also ensures the new label is disabled by default to allow us to
    introduce this to production in a slightly more controlled way. We opted
    to use an environment variable instead of feature flag in
    https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66885 because it's
    too expensive to query the databases so frequently to check the feature
    flag value.
    ddb27c18
active_record.rb 7.97 KB