-
Notifications
You must be signed in to change notification settings - Fork 465
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
[slack] Choose the correct value for the oldest
param
#8217
[slack] Choose the correct value for the oldest
param
#8217
Conversation
🌐 Coverage report
|
…there's no next page.
56f9996
to
9c75369
Compare
992b05d
to
42704b6
Compare
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
Do we know that Slack's API will tolerate this param being present? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should test this against a slack instance to see if the API tolerates the new param
oldest
param
The extra parameter will be okay. Infosec ran this request with a real api token and confirmed that it does return results:
|
@chrisberkhout Thanks for checking that. Would you mind including a note in the commit message that this technique is used to stash the value? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry was a bit late..!
Package slack - 1.15.1 containing this change is available at https://epr.elastic.co/search?package=slack |
Choosing the correct value means: - Use the chosen `oldest` value for all requests in a pagination sequence. - Choose the `oldest` value for a new pagination sequence based on results from the first page of the previous sequence. - Save the `oldest` value in cursor data in order to facilitate resumption of an interrupted pagination sequence. The `max_date_seen_so_far` request parameter is added as a workaround for the HTTP JSON input's `cursor:` section not being able to read existing cursor values when generating new values. It will be ignored by the Slack API. Another change was to use the saved `next_cursor` value to indicate whether a pagination sequence is in progress, rather than spreading this information across multiple values.
Proposed commit message
API behavior and test scenario explanation
The system test scenario is updated here to match the recently observed behavior of the live API. It attempts to cover all the pagination logic required for non-interrupted operation.
Relevant behavior of the live API includes:
oldest
parameter in order to know where to stop, even if acursor
parameter is given. In slack: fix handling of oldest parameter when paginating #8169 theoldest
parameter was included in all requests, but further changes are required to ensure that its value is correct and does not change for a given sequence of pages..response_metadata.next_cursor
field is always returned, as an empty string if there is no further page.date_create
timestamp. Often this is a few entries, sometimes it is many more.oldest
parameter is inclusive, so when a new sequence sets theoldest
value to the maximumdate_create
of the previous sequence, there will be repeated results.date_create
andid
. The entries returned are ordered bydate_create
descending, but for a givendate_create
, theid
values are not in order.The new scenario is summarized in the following table:
The table's time N and identifier NNN match the system test data's timestamp suffix and ID prefix. The table shows which entry a cursor points to, but cursor values in the test data are random. Green entries are new records for ingestion, red entries are repeated records that we should avoid duplicating.
Without the new fix that scenario fails, having missed entries
3-813
and3-212
.Things needed for this test to pass:
oldest
value should be used for each sequence of pages._id
to the fingerprintedid
).Example request logs from successful system test execution
Checklist
changelog.yml
file.How to test this PR locally
Related issues