Skip to content

Pass metric definition to instrumentation class

What does this MR do and why?

Before this change only time_frame, and options were passed into metric instrumentation class in initializer. However recently there were need to pass also data_source. Such change even though required by only one instrumentation class would cause changes in all instrumentation base classes. This commits changes instrumentation classes initiaizers so they accept whole metric definition (hash) to make whole framework more flexible and better suited for future maintenance

Screenshots or screen recordings

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

How to set up and validate locally

In rails console

[1] pry(main)> Gitlab::Usage::ServicePingReport.for(output: :all_metrics_values)
   (0.1ms)  SELECT COUNT("bulk_import_entities"."id") FROM "bulk_import_entities" WHERE "bulk_import_entities"."created_at" BETWEEN '2022-08-17 10:00:31.568253' AND '2022-09-14 10:00:31.568288' AND "bulk_import_entities"."source_type" = 1 AND "bulk_import_entities"."status" = -1 AND "bulk_import_entities"."id" >= 0 AND "bulk_import_entities"."id" < 1 /*application:console,db_config_name:main,line:/lib/gitlab/database/batch_counter.rb:71:in `count_with_timeout'*/
=> {"recorded_at"=>Fri, 16 Sep 2022 10:00:10.904211000 UTC +00:00,
 "uuid"=>"6b3578df-146d-4915-af4a-00fda80abac8",
 "hostname"=>"gdk.test",
 "version"=>"15.4.0-pre",
 "installation_type"=>"gitlab-development-kit",
 "active_user_count"=>99,

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 Mikołaj Wawrzyniak

Merge request reports