-
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
[Usage Collection] Extend the APIs provided to the fetch
method
#75875
Comments
Pinging @elastic/kibana-telemetry (Team:KibanaTelemetry) |
+1 for adding the ES client and SO client helpers to the collector. We trigger the collector from the server side thus most cases we are not bound to a requesting user. Generally I'd say its not a good design to send user scoped data back to telemetry. I'd love to hear more about the usecase you have in mind for this @chrisronline |
We'd love to collect telemetry on what monitoring-specific alerts exist for users. We are interested in an overall count, but in order to get this data from the alerting APIs, we need a valid user-scoped request object. While I understand that this type of data is user-specific (and could be different from user to user), we still think it's valuable. Right now, the alerting team collects some telemetry data that looks like:
It does offer a total count, but as you can see, the monitoring alerts span across multiple types and we'd need to use a scripted field in the telemetry Kibana to properly sum those up. However, that scripted field would also need to know the names of all the monitoring alert types, which will grow large over time. We currently maintain the list of alerts explicitly so for us, it'd be nice to be able call the alerting APIs from our usage collector, provide the array of alert types, and get back a count of which ones are enabled. In the future, we'd also like to get configuration details from each one (like if the user changed the default threshold to something else). |
@Bamieh from the technical POV, even on the server side, the Alert API requires the request context in the API they expose on their Start contract: kibana/x-pack/plugins/alerts/server/plugin.ts Lines 77 to 80 in 67e28ac
I wonder if we can create a fake |
FWIW, the alerting team themselves have a need for something like:
in #59813 so it might be worth collaborating for a common solution. |
Thanks for explaining. I argee, I think we'd need to collaborate with @elastic/kibana-alerting-services for a solution |
I added a note here: #59813 (comment) so we consider or revisit this issue at the same time. |
Related issue: #74840 |
In #82638 (comment) we've identified another possible use case for the need for This doesn't change the situation with the Alerting APIs (since they still require it for every request and |
That's part of #39430. It has been opened for quite a long time now, but we are supposed to tackle this during |
I'm not a fan of exposing the Do we really need to execute these requests with the credentials of the If the former, then I need some help understanding the benefits. It seems like you'd end up with wildly inconsistent usage data if it's all scoped to the current user's privileges, and so I'm having a hard time seeing the benefit to capturing that at all. Is bad data better than no data? If the latter (we want service clients created), then my preference is to wait for #39430, where we can solve this properly. Inconsistent data/data quality issues aside, my other primary concern is that consumers will not consider the end user's credentials when building their usage collectors. It's very possible that the user "chosen" to transmit telemetry won't have access to much of anything themselves. As an example, you can create a user who only has |
Thank you @legrego for your comments. I feel like we are missing a bit of context in this issue to fully describe the current behaviour and the reason why we are considering exposing the At the moment, the Why do we scope the clients?In our efforts to be transparent about the data that is sent to our remote telemetry service, we offer the users a way to retrieve the telemetry sample that we would send via the Advanced Settings page: There is the risk that some users with limited access might gain access to some information they shouldn't see (i.e.: if the user doesn't have access to Stack Monitoring, it shouldn't be able to see any Monitoring-related stats). For that purpose, when requesting the sample in this way, we scope the response to what that user can actually see. However, when requesting the telemetry payload that will be sent to the remote telemetry service, the clients are scoped to the Kibana Internal user. This payload is encrypted on the server-side and decrypted on the remote telemetry service. This way we mask the data when using the browser sending mechanism for those users with limited access. Why do we need to provide
|
@afharo I appreciate the additional context, thanks for taking the time to explain this to me.
That makes sense, and I'm happy to see that we're taking this into consideration. Based on my limited exposure to the usage collectors that plugins register, I assume that this is handled transparently by the usage collection service? In other words, the individual collectors don't need to know when they're retrieving data for the unencrypted sample payload vs the actual encrypted payload?
❤️ Happy to hear this. I'm a fan of forcing consumers to explicitly request the
My understanding is that this wouldn't expose data to unauthorized users. If a usage collector creates a scoped client using the If my understanding is correct (that we don't expose data to unauthorized users), then I don't have a strong objection from a security standpoint. I'm certainly not one to dictate the design, and you may have already considered this, but this sounds like a problem that the ContextContainer was designed to solve. (cc @elastic/kibana-platform). This would allow plugins like Alerting to provide scoped clients to all usage collectors, so they wouldn't have to create their own. |
For Stack Monitoring, I think the root cause of our issue is that the data we want to report on isn't really user-specific, but it's contained in a system which is only user-specific. I know the alerting team is working on making alerts that exist outside the scope of a user so once that is better supported, we might have a better way of getting this data without needing a request object. |
Pinging @elastic/kibana-core (Team:Core) |
Describe the feature:
As originally mentioned in #74840, it might be interesting to provide the new ES client and a scoped Saved Objects client in addition to the current
callCluster
we provide to thefetch
method.@chrisronline recently suggested it would be very useful for them to know the
req: KibanaRequest
themselves when triggering their collector, so they can properly scope other APIs like the Alerting one.The text was updated successfully, but these errors were encountered: