Skip to content
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

chore: Better timing and requestId detail for slower store db queries #2994

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

Ivansete-status
Copy link
Collaborator

@Ivansete-status Ivansete-status commented Aug 22, 2024

Description

Better track the requestId that comes from store requests to lower layers (archive/database) so that we can link requests with slow queries

Changes

  • Pass down the requestId value from store layer to the database layer.
  • pgasyncpool.nim: Print information for queries slower than 2 seconds.
  • client.nim: allow sending custom requestId.
  • Adapt tests a little because now some tests checks the returned requested vs the sent requestId and they failed because we are adding the requestId field in the ArchiveQuery object.

Copy link

This PR may contain changes to database schema of one of the drivers.

If you are introducing any changes to the schema, make sure the upgrade from the latest release to this change passes without any errors/issues.

Please make sure the label release-notes is added to make sure upgrade instructions properly highlight this change.

Copy link

github-actions bot commented Aug 22, 2024

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:2994

Built from 1b3419e

Copy link
Contributor

@gabrielmer gabrielmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing addition! Thanks so much!

Copy link
Contributor

@NagyZoltanPeter NagyZoltanPeter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just some questions I made.

@@ -41,6 +41,7 @@ method getMessagesV2*(
endTime = none(Timestamp),
maxPageSize = DefaultPageSize,
ascendingOrder = true,
requestId: string,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If requestId is mandatory here, would it be better at the front of the args?
Maybe it is just my old habit, I know it works in nim though...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If requestId is mandatory here, would it be better at the front of the args? Maybe it is just my old habit, I know it works in nim though...

Ah yes you are right! Nevertheless let me take the license to leave it as is given that we will deprecate this code soon. Thanks for the comment!

@@ -55,6 +56,7 @@ method getMessages*(
hashes = newSeq[WakuMessageHash](0),
maxPageSize = DefaultPageSize,
ascendingOrder = true,
requestId = "",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't that mandatory to set here if it is with V2 method?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't that mandatory to set here if it is with V2 method?

Yes in this case I set it a default value to prevent changing too many tests that we will remove shortly.

@Ivansete-status Ivansete-status merged commit e8a49b7 into master Aug 29, 2024
22 of 26 checks passed
@Ivansete-status Ivansete-status deleted the better-query-timing-insight branch August 29, 2024 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants