Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Metrics parametrization #1553

Open
3 tasks done
alenaomal opened this issue Nov 29, 2024 · 0 comments
Open
3 tasks done

[Feature] Metrics parametrization #1553

alenaomal opened this issue Nov 29, 2024 · 0 comments
Labels
enhancement New feature or request triage Tasks that need to be triaged

Comments

@alenaomal
Copy link

Is this your first time submitting a feature request?

  • I have read the expectations for open source contributors
  • I have searched the existing issues, and I could not find an existing issue for this feature
  • I am requesting a straightforward extension of existing metricflow functionality, rather than a Big Idea better suited to a discussion

Describe the feature

Metrics has additional parameter(s) option to execute same expression but with different input parameters.

Describe alternatives you've considered

Currently we need to create bunch of similar metrics to calculate, for instance, different percentiles, or create metrics with same sense but different 'start' and 'end' points (description in next benefits section).
Or we need to make predefined calculations on data mart side.

Who will this benefit?

Let's assume we have stores all over the world and we are analyzing our supply chain effectiveness in different countries.
We would like to understand duration of the whole chain - from order accepted to goods delivered, or particular parts of this process - order accepted to order in processing, goods sent - goods delivered.
Workaround of this case is to configure all needed steps combinations in data mart. But any new step combination should be added manually to the code.
Same with conversions from one step to another. Ratio metrics can be used for easier parametrization.
As is (example of ratio metric):

- name: conversion_across_steps
    description: "Conversion rate from one process step to another"
    type: ratio
    label: Conversion % Buys from Visits
    type_params:
      numerator:
        name: total_users
        filter: "{{ Dimension('user_session__event_name') }} = 'buy'"
      denominator:
        name: total_users
        filter: "{{ Dimension('user_session__event_name') }} = 'visit'"

To be example:

- name: conversion_across_steps
    description: "Conversion rate from one process step to another"
    type: ratio
    label: Conversion % {numerator_to} from {denominator_from}
    type_params:
      numerator:
        name: total_users
        filter: "{{ Dimension('user_session__event_name') }} = {numerator_to}"
      denominator:
        name: total_users
        filter: "{{ Dimension('user_session__event_name') }} = {denominator_from}"

where
{numerator_to} = buy
{denominator_from} = visit

Second part of this is percentiles. Yes, we can configure most popular, but we need to duplicate tones of code to get the result. And still if we, in some cases, need to dive deeper, and such percentile was not configured, we again need manual intervention.
But if we can have parametrization, we can ask/set whatever percentile we want.
As is (example of measure configuration):

- name: p99_transaction_value
        description: The 99th percentile transaction value
        expr: transaction_amount_usd
        agg: percentile
        agg_params:
          percentile: .99

To be:

- name: p{percentile_value}_transaction_value
        description: The 99th percentile transaction value
        expr: transaction_amount_usd
        agg: percentile
        agg_params:
          percentile: .{percentile_value}

where {percentile_value} = 99

Are you interested in contributing this feature?

No response

Anything else?

No response

@alenaomal alenaomal added enhancement New feature or request triage Tasks that need to be triaged labels Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage Tasks that need to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant