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

Fix aggregate metrics issue #487

Merged
merged 4 commits into from
May 7, 2024
Merged

Fix aggregate metrics issue #487

merged 4 commits into from
May 7, 2024

Conversation

munishchouhan
Copy link
Member

This PR will add count to force redis to scan certain number of records

Comment on lines 58 to 62
final scanResult = conn.hscan(key, "0", new ScanParams().match(pattern).count(10000))
final scanResult = conn.hscan(key, "0", new ScanParams().match(pattern).count(hscanCount))
Copy link
Collaborator

Choose a reason for hiding this comment

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

what's the rationale?

Copy link
Member Author

Choose a reason for hiding this comment

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

so that it can be changed, if we want to scan more records than the default amount

Copy link
Member Author

@munishchouhan munishchouhan May 3, 2024

Choose a reason for hiding this comment

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

official docs of count
https://redis.io/docs/latest/commands/scan/

The COUNT option

While SCAN does not provide guarantees about the number of elements returned at every iteration, 
it is possible to empirically adjust the behavior of SCAN using the COUNT option. 
Basically with COUNT the user specifies the amount of work that should be done at every call in order to retrieve elements from the collection. 
This is just a hint for the implementation, however generally speaking this is what you could expect most of the times from the implementation.

    

- The default COUNT value is 10.
  
- When iterating the key space, or a Set, Hash or Sorted Set that is big enough to be represented by a hash table, assuming no MATCH option is used, the server will usually return count or a few more than count elements per call. Please check the why SCAN may return all the elements at once section later in this document.

- When iterating Sets encoded as intsets (small sets composed of just integers), or Hashes and Sorted Sets encoded as ziplists (small hashes and sets composed of small individual values), usually all the elements are returned in the first SCAN call regardless of the COUNT value.

@munishchouhan munishchouhan self-assigned this May 3, 2024
@pditommaso pditommaso merged commit e427960 into master May 7, 2024
3 checks passed
@pditommaso pditommaso deleted the fix-metrics branch May 7, 2024 09:12
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.

2 participants