• Bob Van Landuyt's avatar
    Add gauges for threads using db connections · 65239ef9
    Bob Van Landuyt authored
    This adds a gauge exposing the configured number of threads we expect
    to be running and using the database called
    `gitlab_ruby_threads_concurrency_total`.
    
    It also adds `gitlab_ruby_threads_total`.
    
    This gauge has a `thread_name` label used to identify the kind of
    thread. For unnamed threads the label will contain `unnamed`.
    
    To identify sidekiq worker threads, that before had no name, we set it
    in the `Gitlab::SidekiqMiddleware::Metrics` server middleware. So we
    can distinguish it from other running threads.
    
    The `uses_db_connection` label indicates if the thread has at some
    point connected to the database. We use the same subscriber as we do
    for the query counts to flip this value on the thread.
    65239ef9
active_record.rb 2.23 KB