Skip to content
Snippets Groups Projects

Add CLI support for time_frame arrays in metrics

Merged Michał Wielich requested to merge michold-time-frame-array-cli into master
All threads resolved!

What does this MR do and why?

Related to #478008 (closed)

After !167201 (merged) has been deployed & tested on production, we now know that metrics with time_frame array are working.

Now, we add official support for them, by making the CLI use them as the default & adding them to our documentation.

This also updates all of the tests that were previously creating a separate metric definition for each time_frame.

References

Please include cross links to any resources that are relevant to this MR This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

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

To test this, run the internal events CLI:

ruby scripts/internal_events/cli.rb

And try to create new metric definition with time_frame array. Then, verify that the new metrics are working, using the Manual testing in GDK commands listed by the CLI when using the view usage command of the CLI.

Edited by Michał Wielich

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • :tools: Generated by gitlab_quality-test_tooling.


    :snail: Slow tests detected in this merge request. These slow tests might be related to this merge request's changes.

    Click to expand
    Job File Name Duration Expected duration
    #8308190806 spec/scripts/internal_events/product_group_renamer_spec.rb#L13 ProductGroupRenamer with real definitions reads all definitions files 56.33 s < 45.4 s
    #8308819202 spec/scripts/internal_events/product_group_renamer_spec.rb#L13 ProductGroupRenamer with real definitions reads all definitions files 54.55 s < 45.4 s
  • A deleted user added rspec:slow test detected label
  • added 1 commit

    • b49f2dbf - Update time_frame documentation

    Compare with previous version

  • Michał Wielich added 511 commits

    added 511 commits

    Compare with previous version

  • Michał Wielich
  • mentioned in issue #478008 (closed)

  • Michał Wielich
  • added 1 commit

    • 9b4c45dd - Reduce #reduce_metrics_by_time_frame

    Compare with previous version

  • Michał Wielich
  • added 1 commit

    • 819c2795 - Reduce no longer necessary code

    Compare with previous version

  • Michał Wielich
  • Michał Wielich
  • Michał Wielich
  • Michał Wielich changed the description

    changed the description

  • Michał Wielich changed milestone to %17.6

    changed milestone to %17.6

  • Michał Wielich changed the description

    changed the description

  • added 1 commit

    • e34b2eee - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • A deleted user added maintenancerefactor typemaintenance labels and removed typefeature label

    added maintenancerefactor typemaintenance labels and removed typefeature label

  • Ghost User
  • Michał Wielich requested review from @j_lar

    requested review from @j_lar

  • Jonas Larsen
  • Jonas Larsen
  • Jonas Larsen
  • Jonas Larsen
  • Jonas Larsen
  • Jonas Larsen removed review request for @j_lar

    removed review request for @j_lar

  • changed milestone to %17.7

  • added 1 commit

    Compare with previous version

  • Michał Wielich requested review from @j_lar

    requested review from @j_lar

  • Michał Wielich added 1957 commits

    added 1957 commits

    Compare with previous version

  • Jonas Larsen approved this merge request

    approved this merge request

  • Jonas Larsen requested review from @syasonik

    requested review from @syasonik

  • Before you set this MR to auto-merge

    This merge request will progress on pipeline tiers until it reaches the last tier: pipelinetier-3. We will trigger a new pipeline for each transition to a higher tier.

    Before you set this MR to auto-merge, please check the following:

    • You are the last maintainer of this merge request
    • The latest pipeline for this merge request is pipelinetier-3 (You can find which tier it is in the pipeline name)
    • This pipeline is recent enough (created in the last 8 hours)

    If all the criteria above apply, please set auto-merge for this merge request.

    See pipeline tiers and merging a merge request for more details.

  • Jonas Larsen removed review request for @j_lar

    removed review request for @j_lar

  • E2E Test Result Summary

    allure-report-publisher generated test report!

    e2e-test-on-gdk: :white_check_mark: test report for f4474b60

    expand test summary
    +------------------------------------------------------------------+
    |                          suites summary                          |
    +-------------+--------+--------+---------+-------+-------+--------+
    |             | passed | failed | skipped | flaky | total | result |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Verify      | 43     | 0      | 2       | 0     | 45    | ✅     |
    | Data Stores | 33     | 0      | 1       | 0     | 34    | ✅     |
    | Plan        | 76     | 0      | 0       | 0     | 76    | ✅     |
    | Govern      | 75     | 0      | 3       | 0     | 78    | ✅     |
    | Create      | 129    | 0      | 22      | 0     | 151   | ✅     |
    | Monitor     | 8      | 0      | 0       | 0     | 8     | ✅     |
    | Package     | 25     | 0      | 11      | 0     | 36    | ✅     |
    | Fulfillment | 2      | 0      | 0       | 0     | 2     | ✅     |
    | Ai-powered  | 0      | 0      | 1       | 0     | 1     | ➖     |
    | Analytics   | 2      | 0      | 0       | 0     | 2     | ✅     |
    | Release     | 5      | 0      | 0       | 0     | 5     | ✅     |
    | Secure      | 4      | 0      | 0       | 0     | 4     | ✅     |
    | Manage      | 1      | 0      | 1       | 0     | 2     | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Total       | 403    | 0      | 41      | 0     | 444   | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+

    e2e-test-on-cng: :white_check_mark: test report for f4474b60

    expand test summary
    +------------------------------------------------------------------+
    |                          suites summary                          |
    +-------------+--------+--------+---------+-------+-------+--------+
    |             | passed | failed | skipped | flaky | total | result |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Govern      | 84     | 0      | 9       | 1     | 93    | ✅     |
    | Monitor     | 8      | 0      | 12      | 0     | 20    | ✅     |
    | Data Stores | 33     | 0      | 10      | 0     | 43    | ✅     |
    | Verify      | 49     | 0      | 16      | 0     | 65    | ✅     |
    | Plan        | 86     | 0      | 8       | 0     | 94    | ✅     |
    | Create      | 140    | 0      | 20      | 0     | 160   | ✅     |
    | Analytics   | 2      | 0      | 0       | 1     | 2     | ✅     |
    | Secure      | 2      | 0      | 5       | 0     | 7     | ✅     |
    | Fulfillment | 2      | 0      | 7       | 1     | 9     | ✅     |
    | Release     | 5      | 0      | 1       | 0     | 6     | ✅     |
    | Configure   | 0      | 0      | 3       | 0     | 3     | ➖     |
    | Manage      | 1      | 0      | 9       | 0     | 10    | ✅     |
    | Package     | 24     | 0      | 14      | 0     | 38    | ✅     |
    | Ai-powered  | 0      | 0      | 2       | 0     | 2     | ➖     |
    | ModelOps    | 0      | 0      | 1       | 0     | 1     | ➖     |
    | Growth      | 0      | 0      | 2       | 0     | 2     | ➖     |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Total       | 436    | 0      | 119     | 3     | 555   | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+
  • added 1 commit

    Compare with previous version

  • Michał Wielich reset approvals from @j_lar by pushing to the branch

    reset approvals from @j_lar by pushing to the branch

    • Resolved by Sarah Yasonik

      @michold @j_lar Looks mostly ok to me! There's just one functional thing that should be fixed, and then I think this can merge.

      There are a few other things that I think could be nice improvements, but they probably don't need to be a part of this issue.

      UX improvements:

      1. Show a message when prompted to save the file that the definition will create multiple metrics
        • along with this, we should display the key_path of each metric
        • this should ideally happen before the file is saved/created so users have accurate expectations ahead
      2. Default the metric options to include all of Total/Monthly/Weekly (except unique-by-identifier metrics)
        • if I want to creates all three metrics, I'll still end up with 2 files, because it's two separate flows in the CLI to add total, then monthly/weekly. And for the 2nd file, I'll have to define a new filename because the default name is already taken by the first definition

      Maintenance improvements:

      1. Swap metric_definer.rb to operate on a single @metric instead of over @metrics
        • simplifies complexity of grouping logic in MetricOptions (to the point of !171972 (comment 2218951874), as I was confused the same way)
        • treating Metric as essentially a MetricFile better matches how we expect users to interact
        • this can remove the complexity from multiple description inputs, rename inputs, defaults, etc
      2. When creating metrics that could be defined in the same file as existing metrics, dedupe the files and relocate to the CLI-suggested filepath

      While reviewing & thinking this through, I tested out some of the above suggestions in sy-review-michold-time-frame-array-cli just to get an idea.

  • added 1 commit

    Compare with previous version

  • mentioned in issue #505803

  • Michał Wielich requested review from @syasonik

    requested review from @syasonik

  • added 1 commit

    Compare with previous version

  • Sarah Yasonik added 1865 commits

    added 1865 commits

    Compare with previous version

  • Sarah Yasonik approved this merge request

    approved this merge request

  • Sarah Yasonik requested review from @j_lar

    requested review from @j_lar

  • Jonas Larsen approved this merge request

    approved this merge request

  • Jonas Larsen resolved all threads

    resolved all threads

  • Jonas Larsen enabled automatic add to merge train when checks pass

    enabled automatic add to merge train when checks pass

  • merged

  • Jonas Larsen mentioned in commit 90931360

    mentioned in commit 90931360

  • Hello @michold :wave:

    The Analytics Instrumentation team is actively working on improving the metrics implementation and event tracking processes. We would love to hear about your experience and any feedback you might have!

    To provide your feedback, please use this Google Form.

    Thanks for your help! :heart:


    This message was generated automatically. Improve it or delete it.

  • added workflowstaging label and removed workflowcanary label

  • Michał Wielich resolved all threads

    resolved all threads

  • Please register or sign in to reply
    Loading