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

[TSVB] add _last_series to math metric #130766

Closed
wants to merge 1 commit into from

Conversation

flash1293
Copy link
Contributor

This PR adds params._last_series.<variable name> to the math context which contains an array of all values of the split for the current time step (e.g. if grouped by fieldX which has the values A, B and C and there's a count metric mapped to the variable c, then there would be params._last_series.c which contains a list of 3 counts for A, B and C respectively for the current time step.

This can be used to do a ratio of two series aggs:

  • Use group by to split the series
  • Fetch the metrics you need
  • Do a math agg like params.metric1 / sum(params._last_series.metric2)
  • Do a series agg sum

This will give you the ratio of the metric1 and metric2 values summed up per series

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant