[TSVB] add _last_series to math metric #130766
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 variablec
, then there would beparams._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:
params.metric1 / sum(params._last_series.metric2)
This will give you the ratio of the metric1 and metric2 values summed up per series