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

Add the support of group by for metric to Arithmetic #63

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

rasinhas
Copy link
Contributor

@rasinhas rasinhas commented Jul 8, 2019

Follow up of PR #42

  • Fixed group by size "no limit" not working at all on arithmetic metrics
  • Fixed dashboard not saving group by size "no limit" on arithmetic metrics
  • The "Output name" field now works as a prefix for the metric name when group by is used on arithmetic metrics groupbyprefix
  • Fixed terms not showing properly when multiple group by are used multigroupbyterms

README.md Outdated
@@ -22,8 +22,7 @@ Create a new datasource with a name and select `type` as `MetaQueries`
## Examples
#### Arithmetic
Lets you perform arithmetic operations on one or more existing queries.
![Screenshot](https://raw.githubusercontent.com/GoshPosh/grafana-meta-queries/master/img/arithmetic-ex1.png?raw=true "Arithmetic Example 1 - Metric * 2")
![Screenshot](https://raw.githubusercontent.com/GoshPosh/grafana-meta-queries/master/img/arithmetic-ex2.png?raw=true "Arithmetic Example 2 - Metric A + Metric B")
![Screenshot](https://github.com/sunnut/grafana-meta-queries/blob/master/img/arithmetic-ex.jpg?raw=true "Arithmetic Example - Metric A + Metric B")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why would we remove existing examples ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't even see this was changed from the previous merge request. I reverted these changes (I may add the last screenshot later, but with the light theme for consistency)

@@ -82,7 +82,20 @@
<label class="gf-form-label" bs-tooltip="ctrl.target.errors.expression" style="color: rgb(229, 189, 28)" ng-show="ctrl.target.errors.expression">
<i class="fa fa-warning"></i>
</label>

<label class="gf-form-label query-keyword width-4">
Order
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a help text ?

</select>
</div>
<label class="gf-form-label query-keyword width-4">
Size
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a help text ?

@@ -119,8 +119,15 @@ function (angular, _, dateMath, moment) {

}
else if (target.queryType === 'Arithmetic') {
var expression = target.expression || '';
var queryLetters = Object.keys(targetsByRefId).filter(x => expression.indexOf(x + '[') !== -1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we filtering out arithmetic queries ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know why this was changed on the last PR, but apparently this code is the reason why it is not possible to make nested arithmetic grouped metrics.
As soon as I have some time I will take a look at this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gauravshah if the expression did not use some metric, then the metric is not considered here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any advantage to skip ? people can use A.var1 as well. And I am not sure what else would they use to access

try {
result = expressionFunction.apply(this, resultTotal.value);
} catch(err) {
console.log(err);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add more logging details ?

this.target.orderSize = 5;
}

this.orderSizes = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we limiting the results by orderSize ? can you help me understand the use case for it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use this so some insignificant results don't clutter a graph.
For example, in the graph on this PR description I want to see the hit rate on some redis servers. But the only servers that are interesting to me are the ones with low hit rate (low hit rate is an issue for me).
The orderSize helps me unclutter the graph and visualize faster the servers where I need to take action.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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

Successfully merging this pull request may close these issues.

3 participants