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

#829: audited and made LATENCY docs consistent #945

Merged
merged 4 commits into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 28 additions & 25 deletions docs/src/content/docs/commands/LATENCY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: LATENCY
description: The `LATENCY` command in DiceDB is used to measure and analyze the latency of various operations within the DiceDB server. This command provides insights into the performance and responsiveness of the DiceDB instance, helping administrators to identify and troubleshoot latency issues.
---
Note: `Not yet supported`

The `LATENCY` command in DiceDB is used to measure and analyze the latency of various operations within the DiceDB server. This command provides insights into the performance and responsiveness of the DiceDB instance, helping administrators to identify and troubleshoot latency issues.

Expand All @@ -13,25 +14,26 @@ LATENCY [SUBCOMMAND] [ARGUMENTS]

## Parameters

- `SUBCOMMAND`: The specific operation to perform. The available subcommands are:

- `LATEST`: Returns the latest latency spikes.
- `HISTORY`: Returns the latency history for a specific event.
- `RESET`: Resets the latency data for specific events or all events.
- `GRAPH`: Returns a latency graph for a specific event.
- `DOCTOR`: Provides a human-readable report of latency issues.

- `ARGUMENTS`: Additional arguments required by certain subcommands. The arguments vary based on the subcommand used.

## Return Value

The return value of the `LATENCY` command depends on the subcommand used:

- `LATEST`: Returns an array of the latest latency spikes.
- `HISTORY`: Returns an array of latency samples for a specific event.
- `RESET`: Returns the number of events reset.
- `GRAPH`: Returns a string representing the latency graph.
- `DOCTOR`: Returns a string with a human-readable latency report.
| Parameter | Subcommand | Description | Return Type | Required |
|--------------|------------|----------------------------------------------------------------------|-------------|----------|
| `SUBCOMMAND` | | Specifies the operation to perform. Available subcommands are: | String | Yes |
| | `LATEST` | Returns the latest latency spikes. | Array | Yes |
| | `HISTORY` | Returns the latency history for a specific event. | Array | Yes |
| | `RESET` | Resets the latency data for specific events or all events. | Integer | Yes |
| | `GRAPH` | Returns a latency graph for a specific event. | String | Yes |
| | `DOCTOR` | Provides a human-readable report of latency issues. | String | Yes |
| `ARGUMENTS` | N/A | Additional arguments required by certain subcommands (if applicable).| Varies | No |

## Return Values

| Condition | Return Value |
|--------------------------------------------------|---------------------------------------------------|
| `LATEST` | Array of latency spikes |
| `HISTORY` | Array of latency samples (timestamp, latency) |
| `RESET` | Integer (number of events reset) |
| `GRAPH` | String (graph representing latency data) |
| `DOCTOR` | String (detailed report with suggestions) |
| `Syntax or specified constraints are invalid` | error |

## Behaviour

Expand All @@ -43,21 +45,22 @@ When the `LATENCY` command is executed, it performs the specified subcommand ope
- `GRAPH`: Generates and returns a visual representation of the latency data for a specified event.
- `DOCTOR`: Analyzes the latency data and provides a human-readable report with potential causes and suggestions for mitigation.

## Error Handling

Errors may be raised in the following scenarios:
## Errors

- `Invalid Subcommand`: If an unrecognized subcommand is provided, DiceDB will return an error.
- `Invalid Subcommand`:

- Error Message: `ERR unknown subcommand 'subcommand'`
- If an unrecognized subcommand is provided, DiceDB will return an error.

- `Missing Arguments`: If required arguments for a subcommand are missing, DiceDB will return an error.
- `Missing Arguments`:

- Error Message: `ERR wrong number of arguments for 'latency subcommand' command`
- If required arguments for a subcommand are missing, DiceDB will return an error.

- `Invalid Event Name`: If an invalid event name is provided for subcommands like `HISTORY`, `RESET`, or `GRAPH`, DiceDB will return an error.
- `Invalid Event Name`:

- Error Message: `ERR no such event 'event_name'`
- If an invalid event name is provided for subcommands like `HISTORY`, `RESET`, or `GRAPH`, DiceDB will return an error.

## Example Usage

Expand Down