Skip to content

Add feature categories to web metrics and logs

Sean McGivern requested to merge feature-category-controller-metrics into master
  1. Add feature categories to http_requests_total counter. As this is in a middleware, it's easiest to do it with a header - which will also work nicely when we do this for Grape.

    image

  2. Add feature category to Rails logs.

    $ grep -F '"meta.feature_category"' log/development_json.log | jq -c '[.controller, .action, ."meta.feature_category"]'
    ["DashboardController","issues","issue_tracking"]
    ["DashboardController","merge_requests","code_review"]
    ["RootController","index","projects"]
    ["DashboardController","merge_requests","code_review"]
    ["DashboardController","merge_requests","code_review"]
    ["DashboardController","issues","issue_tracking"]
    ["Admin::DashboardController","index","not_owned"]
    ["Admin::UsersController","index","users"]

    And Sidekiq logs:

    {"severity":"INFO","time":"2020-10-12T16:36:16.073Z","class":"UpdateAllMirrorsWorker","args":[],"retry":0,"queue":"cronjob:update_all_mirrors","backtrace":true,"version":0,"queue_namespace":"cronjob","jid":"a4662a25774fa7b8bf2e5b23","created_at":"2020-10-12T16:36:15.903Z","meta.caller_id":"UpdateAllMirrorsWorker","meta.feature_category":"source_code_management","correlation_id":"e1e8d60ef4346e1577e55944fbc94e7f","uber-trace-id":"8860fd613480e9dc:31a7c7caffb3a24a:51fbbe12d0d8fcb:1","enqueued_at":"2020-10-12T16:36:15.906Z","pid":67254,"message":"UpdateAllMirrorsWorker JID-a4662a25774fa7b8bf2e5b23: done: 0.161328 sec","job_status":"done","scheduling_latency_s":0.005037,"redis_calls":5,"redis_duration_s":0.0009350000000000001,"redis_read_bytes":5,"redis_write_bytes":492,"redis_queues_calls":2,"redis_queues_duration_s":0.000412,"redis_queues_read_bytes":2,"redis_queues_write_bytes":195,"redis_shared_state_calls":3,"redis_shared_state_duration_s":0.000523,"redis_shared_state_read_bytes":3,"redis_shared_state_write_bytes":297,"db_count":1,"db_write_count":0,"db_cached_count":0,"duration_s":0.161328,"cpu_s":0.148231,"completed_at":"2020-10-12T16:36:16.072Z","db_duration_s":0.000886}

For gitlab-com/gl-infra/scalability#405 (closed) and gitlab-com/gl-infra/scalability#601 (closed).

Edited by Sean McGivern

Merge request reports