-
Notifications
You must be signed in to change notification settings - Fork 21
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
Backend: Set field.Config.DisplayNameFromDS instead of frame.name #180
Conversation
Backend code coverage report for PR #180
|
Frontend code coverage report for PR #180 |
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 |
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.
Seems reasonable to me! Good Catch!
bucket := utils.NewJsonFromAny(v) | ||
value := castToNullFloat(bucket.Get("doc_count")) |
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.
is there any diff between castToNullFloat and castToFloat?
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.
What this PR does / why we need it:
The time series legend when displayed from a backend query (alerting, expressions) was duplicating.
This PR applies a change from Elasticsearch to generate field names for the value field of time series frames.
It applies the fixes from another PR in Elasticsearch to move from putting the frame name in
frame.name
tofield.Config.DisplayNameFromDS
and getting the metric name frommetric.Field
instead ofmetric.ID
.The screenshot illustrates the same label for a backend flow and frontend flow.
Thank you @idastambuk for pointing out where to set the legend.
Which issue(s) this PR fixes:
Fixes #178