-
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
[TSVB] Breaks requests when series id or metric id is purely digits #113601
Comments
Pinging @elastic/kibana-vis-editors (Team:VisEditors) |
This should be fixed by looking through the saved object during load and prefixing all series and metric ids parseable as number with a character to
Can be tested with this SO (should fail without the fix described above):
|
This was actually caused by us upgrading We missed that during testing, since you cannot generate those IDs inside Kibana, and the library did not really have any changelogs ... Fix stays the same, but I'll change this to a regression, since it worked beforehand. |
Hey, y'all! I'm super excited to see that we found a solution to the problem, and thank you 100x for solving it so quickly. This bug was a weird one. Do you all have any thoughts on what we can do to prevent further bugs like this from occurring? Do we need stricter validation on import/creation? Do we need to rely less on "reflection-esque" design patterns? Did we just need more testing? |
@kobelb I think there are two perspectives here:
Maybe we should be more thorough testing/validating package upgrades, especially for small libraries which are not optimally maintained. In the end all of them can become critical. |
I completely agree. However, I think it's something we need to fix long-term. The Kibana core team has discussed the way that we can provide validation as part of this effort.
This part scares me. Without the ability to know the various parameters that are used to render these visualizations, we're going to really struggle to figure out how to evolve these visualizations over time without creating breaking changes. Is this a remnant of the way that TSVB was architected or is it just inherent when dealing with this subject matter? |
This is a tsvb specific problem - there was an attempt to type it already but we ran into tons of issues with legacy saved objects with unexpected shapes. However we are not fully guarded against these problems in other visualization types as well, mostly because it wasn’t a priority so far. If you already have an issue for this I can add details for the visualization use case (Lens in particular). Things to consider:
In general I would love a mechanism making sure every aspect of the visualization is correct as it would help with the Lens embedded use case as well, happy to work towards it. |
Here's the issue where they're talking about adding per-type validation to saved objects: #104088 |
When the
visState
of a TSVB visualization contains series ids or metric ids that are purely containing digits, e.g. `"2"`` the request won't be built correctly.We're using lodash.set to call something like:
set(doc,
aggs.${series.id}.aggs.timeseries.aggs.${metric.id}, bucket);
. Ifmetric.id
orseries.id
is now an integer value (even if it's a string by type), lodash.set will interpret that as an array access, instead of a property name, and thus suddenly create arrays foraggs
instead of an object, which will fail then with an error message like:[parsing_exception]: Expected [START_OBJECT] under [aggs], but got a [START_ARRAY] in [timeseries]
when we send out that request.We never generate purely numerical
ids
internally, but users might inject visualizations via scripts where they generate the ids in this format and cause a failure. We should try to be as fail-safe as possible towards those ids.cc @stratoula @flash1293
The text was updated successfully, but these errors were encountered: