Skip to content

Fix Service Ping every metric definition test

Michał Wielich requested to merge 354134-fix-every-metric-definition-spec into master

What does this MR do and why?

Related to #354134 (closed)

This MR is meant to serve two purposes:

  1. Use BuildPayloadService instead of ServicePingReport because payload from ServicePingReport is later filtered by BuildPayloadService before being reported
  2. Add a new test assuring that there are no unused instrumentation classes

I also fixed a typo in a comment of lib/gitlab/usage/service_ping/instrumented_payload.rb.

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

  1. Add a new Gitlab::Usage::Metrics::Instrumentations class
  2. Run the spec added in this MR. It should fail now.
  3. Use the new metrics class when building service ping payload, eg invoke add_metric('YourMetricClassName') in a UsageData method.
  4. Run the spec added in this MR. It should pass now.

The same steps should also work for a metrics class nested inside a module, eg Gitlab::Usage::Metrics::Instrumentations::TestModule1::TestModule2::TestMetric.

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 Michał Wielich

Merge request reports