Skip to content

Add endpoint_id label to web transaction metrics

Sylvester Chin requested to merge sc1-add-endpoint-id-to-web-txn into master

What does this MR do and why?

This MR adds endpoint_id label to metrics that use Gitlab::Metrics::WebTransaction's labels. Our Rails SLI metrics uses endpoint_id. Adding endpoint_id across other relevant metrics will allow us to use endpoint_id to filter for metrics instead of using controller+action.

Note: there should be no increase in cardinality increase as endpoint_id is fundamentally controller + action.

See discussion in gitlab-com/runbooks#139 (comment 1562918668) and gitlab-com/runbooks!6273 (comment 1552663903)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Update config/gitlab.yml with the following and run gdk restart rails-web

  monitoring:
    web_exporter:
      enabled: true
      address: gdk.test
      port: 8083
  1. curl for metrics. You should get endpoint_id in the metrics, compared to current metrics in production which does not.
➜ curl gdk.test:8083/metrics | rg gitlab_transaction_db_
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1342k  100 1342k    0     0  9946k      0 --:--:-- --:--:-- --:--:--  9.9M
# HELP gitlab_transaction_db_cached_count_total Multiprocess metric
# TYPE gitlab_transaction_db_cached_count_total counter
gitlab_transaction_db_cached_count_total{action="new",controller="SessionsController",db_config_name="main",endpoint_id="SessionsController#new",feature_category="unknown"} 4
# HELP gitlab_transaction_db_count_total Multiprocess metric
# TYPE gitlab_transaction_db_count_total counter
gitlab_transaction_db_count_total{action="index",controller="RootController",db_config_name="main",endpoint_id="RootController#index",feature_category="groups_and_projects"} 8
gitlab_transaction_db_count_total{action="new",controller="SessionsController",db_config_name="main",endpoint_id="SessionsController#new",feature_category="unknown"} 21
# HELP gitlab_transaction_db_primary_cached_count_total Multiprocess metric
# TYPE gitlab_transaction_db_primary_cached_count_total counter
gitlab_transaction_db_primary_cached_count_total{action="new",controller="SessionsController",db_config_name="main",endpoint_id="SessionsController#new",feature_category="unknown"} 4
# HELP gitlab_transaction_db_primary_count_total Multiprocess metric
# TYPE gitlab_transaction_db_primary_count_total counter
gitlab_transaction_db_primary_count_total{action="index",controller="RootController",db_config_name="main",endpoint_id="RootController#index",feature_category="groups_and_projects"} 8
gitlab_transaction_db_primary_count_total{action="new",controller="SessionsController",db_config_name="main",endpoint_id="SessionsController#new",feature_category="unknown"} 21

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sylvester Chin

Merge request reports