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

Add CLUSTER SLOT-STATS document. #150

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

kyle-yh-kim
Copy link

@kyle-yh-kim kyle-yh-kim commented Jun 25, 2024

- Valkey PR link; valkey-io/valkey#351.

Signed-off-by: Kyle Kim <[email protected]>
commands.json Outdated
@@ -3095,6 +3095,87 @@
"nondeterministic_output"
]
},
"CLUSTER SLOT-STATS": {
Copy link
Member

Choose a reason for hiding this comment

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

We no longer use this file AFAIK. We generate it dynamically on the fly.

Copy link
Author

Choose a reason for hiding this comment

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

Question - if dynamically generated, how is the history section generated?
For example, for FLUSHDB;

"history": [
    [
        "4.0.0",
        "Added the `ASYNC` flushing mode modifier."
    ],
    [
        "6.2.0",
        "Added the `SYNC` flushing mode modifier."
    ]
],

Copy link
Contributor

Choose a reason for hiding this comment

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

From the JSON file in the code repo.

- Removed commands.json changes.
- Added ordering invariance within the markdown.

Signed-off-by: Kyle Kim <[email protected]>
- Added RESP3 response.

Signed-off-by: Kyle Kim <[email protected]>
- Added cpu, network-bytes-in and network-bytes-out metrics.
- Added a tie breaker condition for ORDERBY argument.

Signed-off-by: Kyle Kim <[email protected]>
commands/cluster-slot-stats.md Outdated Show resolved Hide resolved
commands/cluster-slot-stats.md Outdated Show resolved Hide resolved
commands/cluster-slot-stats.md Outdated Show resolved Hide resolved
commands/cluster-slot-stats.md Outdated Show resolved Hide resolved
commands/cluster-slot-stats.md Show resolved Hide resolved
commands/cluster-slot-stats.md Outdated Show resolved Hide resolved
commands/cluster-slot-stats.md Outdated Show resolved Hide resolved
commands/cluster-slot-stats.md Outdated Show resolved Hide resolved
@@ -0,0 +1,99 @@
`CLUSTER SLOT-STATS` returns an array of slot usage statistics for slots assigned to the current shard.
Copy link
Member

Choose a reason for hiding this comment

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

I just realize we kind of use metrics and statistics sort of interchangeably which now bothers me, but maybe it's fine.

Copy link
Author

Choose a reason for hiding this comment

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

Agreed. We could consolidate the wording into “stats / statistics” throughout the documentation, given that SLOT-STATS is the chosen name for the command.

Copy link
Contributor

@zuiderkwast zuiderkwast Oct 24, 2024

Choose a reason for hiding this comment

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

The command name is the title of the page, so it doesn't need to be here.

Suggested change
`CLUSTER SLOT-STATS` returns an array of slot usage statistics for slots assigned to the current shard.
Returns an array of slot usage statistics for slots assigned to the current shard.

Copy link
Member

@madolson madolson left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, finally really looked through everything and left a few comments about clarity.

@zuiderkwast
Copy link
Contributor

@kyle-yh-kim Will you update this PR? It would be good to have docs for the feature. 8.0 is already released.

- Consolidated metrics/statistics wording into statistics.
- Remove verbosity.

Signed-off-by: Kyle Kim <[email protected]>
@kyle-yh-kim
Copy link
Author

Thanks for the reminder. All comments have been addressed, now awaiting for approval.

Copy link
Contributor

@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

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

Thanks! I have some comments about the structure of the page.

When we generate the man pages, stuff like Reply, ACL categories and History are inserted above Examples. (It looks for certain headings.)

Example man page HSET screenshot

image

The `SLOTSRANGE` argument allows for request pagination.
The response is ordered in ascending slot number.

##### Response in RESP2
Copy link
Contributor

Choose a reason for hiding this comment

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

Level 5 heading under a level 3 heading?

So many levels are not easy to distinguish. The fontsizes will not be different enough. Not to mention the man pages. I think we should not use more than 3 levels.

Let's add an ## Examples heading and move the examples as level 3 headings under that?

I would like to loosely follow the order within the page that's normal for man pages, as described under "Sections within a manual page" on the man-pages.7 man page: https://www.man7.org/linux/man-pages/man7/man-pages.7.html

Comment on lines +56 to +61
### ORDERBY
The `ORDERBY` argument returns an ordered slot statistics based on the specified statistic and sub-arguments to identify hot / cold slots across the cluster. In the event of a tie in the stats, ascending slot number is used as a tie breaker.

##### Response in RESP2
```
> CLUSTER SLOT-STATS ORDERBY KEY-COUNT LIMIT 2 DESC
Copy link
Contributor

Choose a reason for hiding this comment

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

Parameter documentation mixed with examples.

Let's put the parameter descriptions above under ## Options and all the examples below under ## Examples. See the page for the SET command for how options are documented.

Comment on lines +10 to +16
## Supported filtering and ordering arguments
There exist two mutually exclusive arguments for controlling the output, namely;

### SLOTSRANGE
Returns slot statistics based on the slots range provided. The range is inclusive.
The `SLOTSRANGE` argument allows for request pagination.
The response is ordered in ascending slot number.
Copy link
Contributor

Choose a reason for hiding this comment

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

The syntax is also inserted automatically above this text, from the JSON file. We should document the options. If they're mutually exclusive, the syntax will display this as < SLOTRANGE xxxx | ORDERBY yyy > so I don't think we need to mention that.

Suggested change
## Supported filtering and ordering arguments
There exist two mutually exclusive arguments for controlling the output, namely;
### SLOTSRANGE
Returns slot statistics based on the slots range provided. The range is inclusive.
The `SLOTSRANGE` argument allows for request pagination.
The response is ordered in ascending slot number.
## Options
* `SLOTSRANGE`: Returns slot statistics based on the slots range provided.
The range is inclusive.
The `SLOTSRANGE` argument allows for request pagination.
The response is ordered in ascending slot number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants