-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Improve data plugin handling of resolve
#111196
Comments
Pinging @elastic/kibana-security (Team:Security) |
Pinging @elastic/kibana-app-services (Team:AppServices) |
Thank you for raising this concern @jportner, it's an important one. Whatever code either directly or transitively relies on If we were to go with option 1, would the plan be to have the |
Yeah, unfortunately as soon as objects are made share-capable in 8.0, you can experience a A user has some 3rd party integration (or Terraform or something else) that is designed to create/recreate saved objects using our HTTP APIs. They upgrade to 8.0, and their integration runs, and a bunch of index patterns get created with their old IDs. This means that whenever a If we did go with option 2, data views would only break where they are included in a deep link. So we shield our users from that impact. |
Gotcha, thanks for correcting my understanding @jportner. Option 1 does sound like a very bad user experience and something that we would absolutely want to avoid. With option 2, would anything be breaking or would the user just be shown a dialog alerting them that there was a conflict and allow them to proceed? |
I think we should mention in the issue that the same applies to saved queries saved object as well. It feels to me option 2 is a huge effort and definitely requires careful design and planning. To just briefly describe what we are looking at: Every consumer of index patterns would need to start using indexPatterns.resolve (instead of .get) and correclty handling the response. Eventually this information needs to propagate all the way up to the application, as it responsible for managing the url. Lets look at our dashboard application for example:
What I am trying to say is that with 62 plugins depending on data and our deep dependency trees at the moment its impossible to estimate the complexity and amount of work we are looking towards so planning it for 8.0 seems unrealistic to me. |
My understanding was, that we discussed exactly that in a meeting on August 11th and decided to not implement the "correct solution" until we rediscuss whether it's really needed sometime in 8.x. Could we clarify if something has changed since then, to make us rethink this decision?
I am a bit confused by that. My understanding (from whenever I asked that question), was that a I am also not entirely sure, how will adding a Is my understanding correct that we only wouldn't need to call it in those places, where we are 100% sure the index pattern ID ran through the saved object migration? Which for a lot of the core applications is never true, due to the fact we're handling state within the URL - which we eventually want to get rid of, but are def still quiet far away from that. |
I realize what I wrote may have been a bit confusing, so let me start by clarifying:
I started by mentioning that we are not attempting to pass the So let me restate, here is what I was attempting to suggest: Option 1
Option 2
@kobelb Option 1 and Option 2 both break the user experience in 8.0 in the case of a "conflict" outcome, because they both throw an error. It's up to consumers to deal with that error.
@ppisljar I'm sorry, I understand that I wasn't clear. That isn't what I meant to suggest. All I'm saying is that in option 2, we identify the consumers that need to use All of the outcome handling can be tackled later in 8.x, in my opinion.
Thank you for the example, that really helps frame things.
@timroes sorry about the confusion. Correct me if I am misremembering, but I was under the impression that on the August 11th meeting, we decided to defer exposing the
Yes, a "conflict" should not occur during normal Kibana usage when you create, share, import, or copy saved objects. So, in my opinion, we need to treat these conflict scenarios as real possibilities and handle them in the best way we possibly can for the 8.0 release.
What I am trying to suggest is that the Assuming that we do have a legacy URL conflict scenario:
Can you clarify how many consumers rely on deep link URLs to load index pattern IDs? Out of those 62 plugin consumers, it would still be a minority, right? |
Sorry if this is a naive suggestion from someone who's never developed on Kibana, but... Why not embed something in the ID string that identifies the "new" generation of IDs as new? If I understand correctly from speaking with Peter P. and Stacey, the ID's are just strings. Why not embed some meta data in the ID, like an ID version |
@petrklapka we do deterministically generate new object IDs. However, the new ID isn't the problem here, it's the old ID. Let's say that you have an object "123", and then you upgrade Kibana to 8.0, and the object's ID gets changed to "456". During the upgrade, Kibana also creates an alias for "456 -> 123". So, after upgrade, if you try to However, let's say that after the upgrade, you (re)create object "123". Now, you have two objects: "123" and "456". This is what I have been calling a "conflict scenario"; it enables the "conflict" outcome. Now when you The The resolve outcomes are detailed in the docs here along with lots of other info about why the object IDs need to be changed, etc. That said: We have controls in place to prevent conflict scenarios from occurring in the first place when you 1. import, 2. copy, or 3. share objects. We currently have no such guardrails fo the direct SOC After speaking with tech leadership some more I think there is more we can do to try to prevent this scenario at So I'm going to submit an RFC for that. In the meantime, I think we can put a pin in this topic and revisit after the RFC is accepted or rejected 👍 |
@jportner i guess what @petrklapka is suggesting is that the new objects would look like and thanks for clarifying we don't need to do anything different for 8.0, regarding 8.x it still seems a big task but we can figure out later what/how exactly to do it. |
I may be misunderstanding this comment. Is the App Services team still planning to switch over usages of Eliminating the need to handle conflict scenarios makes it seem like the team can use Perhaps this question can wait for the RFC, however, I'm wondering how we will know when it's safe to switch calls from |
The RFC was approved and I created an issue for the work, which I plan to begin this week: #113335 Given that, our concerns regarding conflict scenarios are largely alleviated, since they should not be able to happen organically either by using the Kibana app or using its HTTP APIs. I think we should leave this issue open to track that work needs to be done, but it's safe to say that we can proceed as planned with Option 1 as outlined in this issue's description 🎉
@ppisljar Right, we just need to make sure that any method the data plugin exposes to consumers uses
@stacey-gammon Agreed, this was my intent as well.
I mentioned in the RFC, but will restate here for the general public 😄 we are collecting usage data on |
get
vs resolve
resolve
Overview
To support #100489, the data plugin needs to be able to use
SavedObjectsClient.resolve
to loadindex patternsdata views. This way, "deep link" URLs that depend on an index pattern ID (such as a global filter?) will not break after the 8.0 release.The issue to track that work is in #108335.
The current plan is to change all of the data plugin's usage of
SavedObjectsClient.get
under the hood to useSavedObjectsClient.resolve
instead. If aconflict
outcome occurs, it will throw an error. Otherwise, consumers will be unaffected and continue operating as expected.Eventually we intend to make additional changes so that the outcome is passed down to consumers, and they can handle it accordingly -- that is not tracked in an issue yet, it will need to happen sometime in the 8.x timeframe.
What's the problem?
As mentioned above:
This means that all downstream consumers of the data plugin will be using
resolve
more often than needed. I don't have a very clear picture of the exact impact, but a cursory search reveals that 62 plugins depend on the data plugin.I'll copy what I wrote in #111191:
As mentioned in the Sharing Saved Objects developer guide (FAQ 6), saved objects should only retrieved with
SavedObjectsClient.resolve
when loaded through a deep link URL. There are several reasons for this:resolve
is less performantresolve
is a temporary stop-gap to get us over this conversion hump without breaking existing deep link URLs, but we eventually want to get rid of it. To that end, we are trying to minimize usage ofresolve
, and we are collecting usage data on how often it's used / what the different outcomes are.aliasMatch
andconflict
outcomes versus theexactMatch
outcome; this usage data gets diluted if plugins callresolve
in a situation where the outcome will always be `exactMatch1.aliasMatch
andconflict
outcomes more often than necessary if they useresolve
in non-deep-link situations.What can we do about it?
Ultimately the "correct solution" to minimize usage of
resolve
is to add a separateresolve
API to the data plugin'sIndexPatternsService
. Doing this would mean that we would need to identify any downstream consumers of the data plugin who rely on index pattern IDs in deep link URLs, and change them to useresolve
instead.We have two options to move forward:
Continue with the current plan for now and implement the "correct solution" later in 8.xImplement the "correct solution" now, before the 8.0 releaseEdit for clarity (see #111196 (comment)):
Edit 2: we will proceed as planned with Option 1, see #111196 (comment) for details
Option 1
data
plugin changes itsget
API to useSOC.resolve
under the hood (which throws an error in case of a "conflict" outcome)data
plugin changes itsget
API to useSOC.get
under the hood, adds a separateresolve
API (which throws an error in case of a "conflict" outcome), and consumers change to use theresolve
API when necessary for deep link URLsdata
plugin changes itsresolve
API (or makes a separate API) to expose the actual outcome so that it can be handled by consumersOption 28.0: thedata
plugin changes itsget
API to useSOC.get
under the hood, adds a separateresolve
API (which throws an error in case of a "conflict" outcome), and consumers change to use theresolve
API when necessary for deep link URLs8.x: thedata
plugin changes itsresolve
API (or makes a separate API) to expose the actual outcome so that it can be handled by consumersI'm afraid that I don't have a full idea of the impact of approach (1), and I don't have a good enough understanding of the data plugin's consumers to really have a full idea of the work involved in implementing the "correct solution".
I am nervous that 62 plugins depend on the data plugin, and I am afraid that the current approach may cause usage of
SavedObjectsClient.resolve
to explode by an order of magnitude.The text was updated successfully, but these errors were encountered: