-
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
Rewrite log stream routes to HTTP+JSON #51047
Comments
Pinging @elastic/logs-metrics-ui (Team:logs-metrics-ui) |
Thanks for laying this out in advance - it's really useful to get an overview. ❤️ Maybe we can add the HTTP method for each route to be more specific?
Are you planning to add this? And technically speaking it's not arbitrary strings but term sequences 😉 That's why it is done in ES.
Should the client be able to specify the page size?
Do we want to model this such that it can't be specified independently of the cursors? Specifying both would be invalid. Maybe the cursor type could be type Cursor = [number, number];
type BeforeCursor = Cursor | 'last';
type AfterCursor = Cursor | 'first';
type LogEntriesPaginatedRequest = {
startDate: ESDate;
endDate: ESDate;
} & ({ before: BeforeCursor } | { after: AfterCursor }); ?
Do we want this to be |
Thanks for the comments! I've added some remarks and updated the original description
Ah! Good to know. I thought it was just a normal highlighting. I want to do it but I want to find a way that works and is efficient. Right now it works so-so when the date is not the most recent point in time, I guess because the query to get the highlights and the query to do the filtering are different (and return different pages in the search) Since now we have a date range maybe the problem is solved because we know better where to search.
Yes, indeed specifying both is invalid. I like your suggestion :) I wasn't happy with the
I couldn't think of a use case where it would be needed, and since it's not a public API I'm not trying to make it super flexible. With that said, it takes zero effort to add it.
I'd go with POST+body for consistency (...although it saddens my heart how unRESTful it is 💔). I would be happy going for everything GET with params :). |
Highlighting: The reason why the highlight is fetched independently from the log entries is twofold:
It might be a good idea to have the highlighting in a separate route as to not overload one route with features. What do you think? Page size: I'm good with keeping the page size fixed until we require it differently. POST method: I agree. (ReST is misunderstood anyway and rarely implemented correctly.) |
yes, sorry. I wasnt' clear at all in my previous comment. If we do need to query ES I'd keep a separate endpoint |
Part of #49154
We want to adapt the log stream UI to use a date range. To do so we need to adapt our APIs. Since we also want to stop using GraphQL this is an opportunity to migrate the necessary APIs to a traditional REST-ish format.
Requirements for APIs
APIs to implement
/api/log_entries/summary
=> For the log minimap./api/log_entries/summary_highlights
=> For the log minimap highlights/api/log_entries/entries
=> Log entries for the stream/api/log_entries/item
=> Specific log item for the flyout.log_entries/summary
(#51047)It will return a date histogram aggregation of the selected time range. The client will query it only once to render the minimap when the user changes the time range.
As a first step, it will keep the same functionality as the existing API. Later we can refine.
The response contains the number of logs per bucket.
log_entries/entries
It will return a list of log entries within the specified time range, on pages of 500 entries.
The request takes five arguments:
startDate
: beginning of the date range.endDate
: end of the date range.query
: elasticsearch query to filter results.after
(optional): return results after the specified cursor. Used for pagination. It returns the first page of results with a value of"first"
before
(optional): return results that occur before the specified cursor. It returns the last page of results with a value of"last"
.The response has the following interface:
To get different pages of the range, use the
before
orafter
parameters with a cursor.log_entries/item
(#53485)It returns a full log entry object to show in the flyout. It takes an
id
argument to fetch the specific log entryThe response contains the full log entry object
The text was updated successfully, but these errors were encountered: