-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
updating metricvis interpreter func arguments #34532
updating metricvis interpreter func arguments #34532
Conversation
💔 Build Failed |
bd2f784
to
08156e5
Compare
💔 Build Failed |
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.
Makes sense to me - had a few nits around the help text for some of these args, otherwise no major concerns.
This also reinforces how it'll be helpful to refactor the build_pipeline utility to clean up some of this string concatenation. Still something on my near-to-midterm list
types: ['boolean'], | ||
default: false, | ||
help: i18n.translate('metricVis.function.percentage.help', { | ||
defaultMessage: 'Shows metric in percentage mode. Dont forget to set colorRange.' |
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.
Dont
-> Don't
Or would it be better to say Requires colorRange to be set
?
types: ['string'], | ||
default: '"Green to Red"', | ||
help: i18n.translate('metricVis.function.colorSchema.help', { | ||
defaultMessage: 'Color schema to use' |
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 way to describe this besides "Color schema"? It feels like the type of thing that wouldn't be immediately intuitive to a user
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.
Also (I don't know the answer to this): should colorSchema have a list of options? e.g.
options: ['Green to Red', 'Blah to blahblah'],
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: "Color scheme" (not schema) seems like the right name here too, at least as an alias.
style: { | ||
bgFill: args.bgFill, | ||
bgColor: args.colorMode === 'Background', | ||
labelColor: args.colorMode === 'Label', |
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 like how colorMode simplifies these
@@ -21,7 +21,7 @@ import { functionsRegistry } from 'plugins/interpreter/registries'; | |||
import { i18n } from '@kbn/i18n'; | |||
|
|||
export const metric = () => ({ | |||
name: 'kibana_metric', | |||
name: 'metricvis', |
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: should this be camelCase if we are avoiding underscores? metricVis
types: ['string'], | ||
default: '"[{ from: 0, to: 10000 }]"', | ||
help: i18n.translate('metricVis.function.colorRange.help', { | ||
defaultMessage: 'Color ranges' |
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 think more specific help text would be useful here (TBH i'm not sure how colorRange even works)
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.
well its just array of objects with from and to property .... we probably want to create another helper function here to generate this objects, and maybe use a multi agg then ? @w33ble ?
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.
Yeah, making users type JSON is pretty much always the wrong thing to do. You could split the args into "from" and "to", or make a new function. I also don't know what this does so it's hard for me to decide which, or offer much more input.
That help text also isn't very helpful 😛
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 wonder if it makes sense to put colorSchema
(or colorScheme), colorMode
, and even invertColors
into its own function too. Are these concepts shared with other visualizations? If so, even partially, a new function (and type) probably makes sense.
There's a lot of "color" concepts to deal with as it is now, and I don't know what is unique to this vis.
08156e5
to
bab5600
Compare
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
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.
Some change requests, nit
ones would be nice but are not required.
useRanges: args.useRanges, | ||
colorSchema: args.colorSchema, | ||
metricColorMode: args.colorMode, | ||
colorsRange: JSON.parse(args.colorRange), |
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.
Making users type JSON is pretty much always the wrong thing to do.
}, | ||
fontSize: { | ||
types: ['number'], | ||
default: 60, |
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.
This should have a help
property.
types: ['string'], | ||
default: `'[{ "from": 0, "to": 10000 }]'`, | ||
help: i18n.translate('metricVis.function.colorRange.help', { | ||
defaultMessage: 'Color ranges: array of objects with from and to property.' |
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: you're one of maybe 6 people that understands the vis object. The rest of us need more guidance than this... what do these numbers mean/do?
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.
creates color range. for example passing in an array:
[
{ from: 0, to: 100 },
{ from: 100, to: 200 },
]
will color metric in the "first color" (in scheme) if its value is between 0-100 and in second color if value is between 100 and 200
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.
That's more helpful than "array of objects with from and to property", and that makes it sound like this should both be part of a new function and be a multi arg (multi: true
).
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.
@ppisljar I think for clarity we should update this help text since the user isn't expected to provide an array -- they just use the arg multiple times and the parser handles it for them. Maybe something like:
defaultMessage: 'Color ranges: array of objects with from and to property.' | |
defaultMessage: 'A range object specifying groups of values to which different colors should be applied.' |
I don't fully understand all the args here, but some thoughts:
|
@w33ble it feels like we'll end up with quite some helper functions, that can only be used with 1 or maybe 2 other functions. Whats canvas approach here ? Should we worry about having too many functions that can't be used independently or is that completely ok ? feels also like we should do some additional work on visualization itself ... |
That's OK, we have a bit of that in canvas. There is a line of course, but a single-use function here or there is fine. It's better if the thing the function does can be re-used of couse, which is why a lot of my feedback was trying to group concepts.
Yes it is, but that's also something you can do later. The font function is general and encapsulates a concept. Even if you don't use all the parts it can provide, it's still useful, and can work the same way even if the user switches to a different function. And you can make upstream changes to support more font properties and the expression does not change, it just starts doing more than it previously did. The same could be true for controlling colors, like via a "colorConfig" object, which could be plugged into any argument that controls a color in nearly any function. Maybe... that's the idea I was trying to get across, but I don't know how all these vis objects work so I can't provide more than abstract ideas. |
💔 Build Failed |
💔 Build Failed |
@w33ble using
are you ok with going down this route ? |
💔 Build Failed |
@ppisljar I don't see an issue with that off-hand. Are there side effects I'm not aware of? Nothing's really special about that function, there's no reason it can't be in OSS. |
…plugin/filter-manager-1
…ependency on rootScope
d9b3451
to
afba947
Compare
💔 Build Failed |
💚 Build Succeeded |
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.
LGTM!
Just wanted to double check this question I had to be sure the help text is okay: #34532 (comment)
Summary
updating metricvis interpreter func arguments:
visdimension
helper functionfor example:
metricvis visConfig='"dimensions": {"metric": { "accessor": 1 }, "bucket": { "accessor": 0, "format": { "type": "ip" }}}, "metric": { "labels": {"show": true}, "percentage": true }}'
becomes:
metricvis metric={vis_dimension 1} bucket={vis_dimension 0 format='ip'} showLabels=true percentage=true
using multiple metric dimensions:
metricvis metric={vis_dimension 1} metric={vis_dimension 0} metric={vis_dimension 1} showLabels=true
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.[ ] This was checked for cross-browser compatibility, including a check against IE11[ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers
[ ] This was checked for breaking API changes and was labeled appropriately[ ] This includes a feature addition or change that requires a release note and was labeled appropriately