-
Notifications
You must be signed in to change notification settings - Fork 31
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
[Task] API requests should be able to specify which rules to evaluate #918
Comments
I'm sort of lost on how rules work. I understand that we can create Automated Rules in the Cryostat web ui which can match against target applications with a match expression, and the rules can be of a certain Event Template, which dictates which events are triggered during the Flight Recording, I think. In the issue, what do you mean by "uploaded recording"? And how can a client limit rules by disabling events before recording? And also where do I should I start looking? |
I think by "uploaded recording" I just mean the JFR file for which we are generating a report. The primary way to do that nowadays is by delegating the work to https://github.com/cryostatio/cryostat-reports , which means that the main Cryostat container uploads the recording file to the reports container sidecar, which generates the report and sends the document back to Crysotat, which then relays it to the original client/user.
This is all correct but it's suffering from an overloaded term: "rules". In this issue it's talking about the JMC Automated Analysis Report. Each of those coloured boxes with a 0-100 score is referred to there as a "rule". What you're describing is the Cryostat feature of Automated Rules, which have to do with automatically starting recordings on target applications.
They can't, that's the feature to be added here ;-) This issue is one individual Task, but it's part of a larger Story (#946) that will take a few PRs to put together into a cohesive feature. In this specific task we need to implement some way for the client to request a report with only certain rules evaluated. Right now a client can request a report, and we will always evaluate every rule possible. So, the specific small feature for this issue would be to modify the Cryostat API handlers that are responsible for report generation, and enhance them so that the client can somehow specify a list of rule names to evaluate. But, that won't actually be able to do anything until these two tasks are also completed: |
So if I understand this correctly, when the user wants to upload a recording to obtain a report, they should have an extra optional field or HTTP header that dictates JMC "rules" to filtered in the report. I am also wondering about the difference between TargetRecordingUploadPostHandler vs RecordingUploadPostHandler.
|
If the recording is coming from archives then there may already be a cached report for us to retrieve, but that's only the case if we've received this request once before. When a recording is first copied into archives there will be no cached report available for it, until that report is requested and we generate and cache it on-demand.
The caching case is one to pay some extra attention to, since if a report is generated and cached with set of rules A, then a subsequent request for a report on the same recording with set of rules B should not be served the same cached result. |
For this concern, let's just consider for now that any request using the non-default rule set just doesn't get cached. And the default rule set is "all of them". Later we can consider a better caching strategy. |
Right now I am looking on how I should have an endpoint have optional categories. I notice in the v2 API, i.e. RulesPostHandler But the RecordingUploadPostHandler does not use this so I was thinking of using parameters like in TargetRecordingsPostHander and using ctx.request().formAttributes()
I am also not quite sure on how we would signal that these rules are being applied to the recording, in order to generate a filtered report. I'm thinking most of the work is done in TargetRecordingUploadPostHandler (and the Archive one) and it looks like the when a post request is received here, the backend sends another POST request, containing the file in binary, to a Grafana backend and waits for a response and sends this finally back to the client.
|
Using the
As for the credentials errors, this depends on your testing environment. You probably need to set an |
I think I was being confused by the So about |
Also, unrelated question, why is there two |
I think you had it right the first time. When a user wants to see an automated report for an active recording from the web-client and with a
So what we want to implement is that at Step 1, the user can somehow specify which rules they are actually interested in by adding a form field or a header or something. Cryostat would include that information in Step 3. In Step 4, This is all pretty modular, so it can change around somewhat. If the user is using the web-client and wants to see the report for an archived recording:
It's also possible that there is no We don't want to perform the whole reports analysis for all rules if the user is only interested in the results for a single rule for example, because that's a lot more computationally expensive and time consuming.
tl;dr is that the More details in this PR: cryostatio/cryostat#719 |
To sum up what I think will be the easiest approach for you: Start with cryostatio/cryostat-core#136 . This is where the actual call out to JMC code is done and the reports are really generated at the lowest level within Cryostat. There is no HTTP API to worry about here, just plain Java method calls. Then continue to cryostatio/cryostat-reports#28 . This way you can modify or add an API endpoint on |
Sorry, one more question because I have finished most of what needs to be done in the comment above, if I do what you said here https://github.com/cryostatio/cryostat/issues/918#issuecomment-1141484278
If I use v2 RequestParameters in the classes |
Hmm... let me think about this actually. The |
I'll open a PR soon that makes it possible to use the @turkeychikken how are you anticipating you will implement the rule/topic IDs that the client provides? Since the client's original request is something like If we're just adding a query parameter then there is no need to add whole new |
I think query parameters make sense too, so I'm leaning towards that. |
Currently, all possible rules will be evaluated against the JFR file provided in the uploaded recording, and a requesting client can only try to limit the rules evaluations performed by disabling events before collecting the recording data. Once they do have a JFR file however there is no way to remove events that they are not interested in. The report generation endpoint should allow some way for clients to include a specification for names or categories of rules to evaluate against the accompanying JFR file, for example as a separate field in the POST form body, or as HTTP header. If this information is not provided then the report generation should default to evaluating all rules.
The text was updated successfully, but these errors were encountered: