-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fix backend pipeline aggregation query parsing and data frame building #168
Conversation
Backend code coverage report for PR #168
|
Frontend code coverage report for PR #168 |
Levitate is-compatible report: 🔍 Resolving @grafana/data@latest... 🔬 Checking compatibility between ./src/module.ts and @grafana/data@9.5.2... 🔬 Checking compatibility between ./src/module.ts and @grafana/ui@9.5.2... 🔬 Checking compatibility between ./src/module.ts and @grafana/runtime@9.5.2... 🔬 Checking compatibility between ./src/module.ts and @grafana/e2e-selectors@9.5.2... ✔️ ./src/module.ts appears to be compatible with @grafana/data,@grafana/ui,@grafana/runtime,@grafana/e2e-selectors |
1e1e900
to
53fa1dc
Compare
da00e24
to
4ed743a
Compare
4ed743a
to
9093797
Compare
…ineAgg Applies fix from grafana/grafana#60337
2baf2ea
to
e522eea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I tested it with the reported bug and it works now.
Its not a priority, but I wonder if it would make sense in a future commit to refactor the response_parser.go code to not use the null.Float
object to make the syntax more similar
@@ -149,6 +150,20 @@ func (h *luceneHandler) processQuery(q *Query) error { | |||
return nil | |||
} | |||
|
|||
func getPipelineAggField(m *MetricAgg) string { | |||
// From https://github.com/grafana/grafana/pull/60337 | |||
// In frontend we are using Field as pipelineAggField |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I don't know if we need to copy the todo comment (I'm assuming that if it's this old we decided that it was fine)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like littering comments either, but in this case if that's alright for you, maybe we should leave this one for now.
We don't yet know the overall impact of this change and I know some tests are still using the old PipelineAggregate input.
I think to remove this function and this comment we should make a decision to deprecate the MetricAgg "PipelineAggregate" field and systematically use Field to get the pipeline aggregate field.
The original issue is "only" about 5 months old -- I think eventually we will clean out a number of comments in this repo and we could include cleaning out this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I know it's not the point of this pr, but would you mind removing the m := m
on line 85 while we're in here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clicked around, looks good. Great job on this!
I also see the problem with duplicated labels. I think it's a good idea to open a ticket for this
@@ -588,6 +608,25 @@ func (rp *responseParser) getMetricName(metric string) string { | |||
return metric | |||
} | |||
|
|||
func castToFloat(j *simplejson.Json) *float64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The originally-used castToNullFloat function below uses an underlying standard library type sql.NullFloat64 which is also a way to distinguish between something "null/nil" or with a float64 value. In this case, we can also just use a *float64 type to distinguish between "nil" and float64 and there is no strong reason to use an imported type for that.
Here's a similar discussion: https://stackoverflow.com/questions/33458439/using-sql-nullfloat64-vs-float64-in-golang
In Elasticsearch I noticed they moved towards *float64 so I copied that; I think that in further refactors the castToNullFloat will no longer be used.
@@ -149,6 +150,20 @@ func (h *luceneHandler) processQuery(q *Query) error { | |||
return nil | |||
} | |||
|
|||
func getPipelineAggField(m *MetricAgg) string { | |||
// From https://github.com/grafana/grafana/pull/60337 | |||
// In frontend we are using Field as pipelineAggField |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like littering comments either, but in this case if that's alright for you, maybe we should leave this one for now.
We don't yet know the overall impact of this change and I know some tests are still using the old PipelineAggregate input.
I think to remove this function and this comment we should make a decision to deprecate the MetricAgg "PipelineAggregate" field and systematically use Field to get the pipeline aggregate field.
The original issue is "only" about 5 months old -- I think eventually we will clean out a number of comments in this repo and we could include cleaning out this one.
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #154
Special notes
I still notice an issue with the time series labels are being duplicated. #178