Skip to content

Commit

Permalink
📝 add api status code description
Browse files Browse the repository at this point in the history
Signed-off-by: vankichi <[email protected]>
  • Loading branch information
vankichi committed May 26, 2022
1 parent f3f0823 commit 8cb56c9
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 57 deletions.
86 changes: 47 additions & 39 deletions docs/api/object.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ Exists RPC is the method to check the a vector exists in the `vald-agent`.
```

- Object.ID
|field|type|label|required|desc.|
|:---:|:---|:---|:---:|:---|
|id|string| | \* | the ID of a vector. ID should consist of 1 or more characters. |
| field | type | label | required | desc. |
| :---: | :----- | :---- | :------: | :------------------------------------------------------------- |
| id | string | | \* | the ID of a vector. ID should consist of 1 or more characters. |

### Output

Expand All @@ -50,18 +50,20 @@ Exists RPC is the method to check the a vector exists in the `vald-agent`.
```

- Object.ID
|field|type|label|desc.|
|:---:|:---|:---|:---|
|id|string| | the ID of a vector. ID should consist of 1 or more characters. |

| field | type | label | desc. |
| :---: | :----- | :---- | :------------------------------------------------------------- |
| id | string | | the ID of a vector. ID should consist of 1 or more characters. |

### Status Code

| code | desc. |
| :--: | :--------------- |
| 0 | OK |
| 3 | INVALID_ARGUMENT |
| 5 | NOT_FOUND |
| 13 | INTERNAL |
| code | desc. |
| :--: | :---------------- |
| 0 | OK |
| 3 | INVALID_ARGUMENT |
| 4 | DEADLINE_EXCEEDED |
| 5 | NOT_FOUND |
| 13 | INTERNAL |

## GetObject RPC

Expand All @@ -85,15 +87,17 @@ GetObject RPC is the method to get the metadata of a vector inserted into the `v
```

- Object.VectorRequest
|field|type|label|required|desc.|
|:---:|:---|:---|:---:|:---|
|id|Object.ID| | \* | the ID of a vector. ID should consist of 1 or more characters. |
|filters|Filter.Config| | | configuration for filter. |

| field | type | label | required | desc. |
| :-----: | :------------ | :---- | :------: | :------------------------------------------------------------- |
| id | Object.ID | | \* | the ID of a vector. ID should consist of 1 or more characters. |
| filters | Filter.Config | | | configuration for filter. |

- Object.ID
|field|type|label|required|desc.|
|:---:|:---|:---|:---:|:---|
|id|string| | \* | the ID of a vector. ID should consist of 1 or more characters. |

| field | type | label | required | desc. |
| :---: | :----- | :---- | :------: | :------------------------------------------------------------- |
| id | string | | \* | the ID of a vector. ID should consist of 1 or more characters. |

### Output

Expand All @@ -109,10 +113,11 @@ GetObject RPC is the method to get the metadata of a vector inserted into the `v
```

- Object.Vector
|field|type|label|desc.|
|:---:|:---|:---|:---|
|id|string| | the ID of a vector. ID should consist of 1 or more characters. |
|vector|float| repeated(Array[float]) | the vector data. its dimension is between 2 and 65,536. |

| field | type | label | desc. |
| :----: | :----- | :--------------------- | :------------------------------------------------------------- |
| id | string | | the ID of a vector. ID should consist of 1 or more characters. |
| vector | float | repeated(Array[float]) | the vector data. its dimension is between 2 and 65,536. |

### Status Code

Expand Down Expand Up @@ -145,15 +150,17 @@ Each Upsert request and response are independent.
```

- Object.VectorRequest
|field|type|label|required|desc.|
|:---:|:---|:---|:---:|:---|
|id|Object.ID| | \* | the ID of a vector. ID should consist of 1 or more characters. |
|filters|Filter.Config| | | configuration for filter. |

| field | type | label | required | desc. |
| :-----: | :------------ | :---- | :------: | :------------------------------------------------------------- |
| id | Object.ID | | \* | the ID of a vector. ID should consist of 1 or more characters. |
| filters | Filter.Config | | | configuration for filter. |

- Object.ID
|field|type|label|required|desc.|
|:---:|:---|:---|:---:|:---|
|id|string| | \* | the ID of a vector. ID should consist of 1 or more characters. |

| field | type | label | required | desc. |
| :---: | :----- | :---- | :------: | :------------------------------------------------------------- |
| id | string | | \* | the ID of a vector. ID should consist of 1 or more characters. |

### Output

Expand All @@ -175,16 +182,18 @@ Each Upsert request and response are independent.
```

- Object.StreamVector
|field|type|label|desc.|
|:---:|:---|:---|:---|
|vector|Vector| | the information of Object.Vector data. |
|status|google.rpc.Status| | the status of google RPC. |

| field | type | label | desc. |
| :----: | :---------------- | :---- | :------------------------------------- |
| vector | Vector | | the information of Object.Vector data. |
| status | google.rpc.Status | | the status of google RPC. |

- Object.Vector
|field|type|label|desc.|
|:---:|:---|:---|:---|
|id|string| | the ID of a vector. ID should consist of 1 or more characters. |
|vector|float| repeated(Array[float]) | the vector data. its dimension is between 2 and 65,536. |

| field | type | label | desc. |
| :----: | :----- | :--------------------- | :------------------------------------------------------------- |
| id | string | | the ID of a vector. ID should consist of 1 or more characters. |
| vector | float | repeated(Array[float]) | the vector data. its dimension is between 2 and 65,536. |

### Status Code

Expand All @@ -194,4 +203,3 @@ Each Upsert request and response are independent.
| 3 | INVALID_ARGUMENT |
| 5 | NOT_FOUND |
| 13 | INTERNAL |

39 changes: 21 additions & 18 deletions docs/api/remove.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,13 @@ Remove RPC is the method to remove a single vector.

### Status Code

| code | desc. |
| :--: | :--------------- |
| 0 | OK |
| 3 | INVALID_ARGUMENT |
| 5 | NOT_FOUND |
| 13 | INTERNAL |
| code | desc. |
| :--: | :---------------- |
| 0 | OK |
| 3 | INVALID_ARGUMENT |
| 4 | DEADLINE_EXCEEDED |
| 5 | NOT_FOUND |
| 13 | INTERNAL |

## StreamRemove RPC

Expand Down Expand Up @@ -183,12 +184,13 @@ It's the recommended method to remove the large amount of vectors.

### Status Code

| code | desc. |
| :--: | :--------------- |
| 0 | OK |
| 3 | INVALID_ARGUMENT |
| 5 | NOT_FOUND |
| 13 | INTERNAL |
| code | desc. |
| :--: | :---------------- |
| 0 | OK |
| 3 | INVALID_ARGUMENT |
| 4 | DEADLINE_EXCEEDED |
| 5 | NOT_FOUND |
| 13 | INTERNAL |

## MultiRemove RPC

Expand Down Expand Up @@ -279,9 +281,10 @@ Please be careful that the size of the request exceed the limit.

### Status Code

| code | desc. |
| :--: | :--------------- |
| 0 | OK |
| 3 | INVALID_ARGUMENT |
| 5 | NOT_FOUND |
| 13 | INTERNAL |
| code | desc. |
| :--: | :---------------- |
| 0 | OK |
| 3 | INVALID_ARGUMENT |
| 4 | DEADLINE_EXCEEDED |
| 5 | NOT_FOUND |
| 13 | INTERNAL |
101 changes: 101 additions & 0 deletions docs/api/status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Response Status Code

This page describes each status code from API response.

## Status Codes

This table shows the main status code and its name using Vald.
Below sections describes the meaning of each code and the reason why API returns.

| code | name |
| :--: | :---------------------------------------- |
| 0 | [OK](#OK) |
| 3 | [INVALID_ARGUMENT](#INVALID_ARGUMENT) |
| 4 | [DEADLINE_EXCEEDED](#DEADLINE_EXCEEDED) |
| 5 | [NOT_FOUND](#NOT_FOUND) |
| 6 | [ALREADY_EXISTS](#ALREADY_EXISTS) |
| 8 | [RESOURCE_EXHAUSTED](#RESOURCE_EXHAUSTED) |
| 13 | [INTERNAL](#INTERNAL) |
| 14 | [UNAVAILABLE](#UNAVAILABLE) |

## OK

`OK` means complete process with success.

Services that return this code are all services.

## INVALID_ARGUMENT

`INVALID_ARGUMENT` means the something wrong in the request configuration.

Services that return status are all services.
If you get this code, please verify your request is correct.

## DEADLINE_EXCEEDED

`DEADLINE_EXCEEDED` returns when the process ends due to timeout.

Services that returns status are:

- [Object Service(only Exists RPC)](../api/object.md#Exists-RPC)
- [Insert Service](../api/insert.md)
- [Remove Service](../api/insert.md)
- [Search Service](../api/search.md)

The timeout configuration is on the Vald cluster side.
If it appears constantly, you need to review the cluster settings.
However, it appears only when using search service, you can overwrite timeout configuration by lengthening the time setting in the search config.

## NOT_FOUND

`NOT_FOUND` appears when there is no result corresponding to the request.

The example cases are:

- No search result when using SearchById api
- No index data corresponding to the request vector when using Update/Exists/GetObject api

Services that returns status are:

- [Object Service](../api/object.md)
- [Update Service](../api/update.md)
- [Remove Service](../api/insert.md)
- [Search Service](../api/search.md)

There are two reasons.
One is there is no index data in Vald Agent components or index process is running in.
When Vald Agent component runs the index process (createIndex/saveIndex), the any process won't run and it will return with no result.

The other one, which occurs using search / update / remove service, is the request query vector or id is wrong.
Especially, both of update service and remove service requires the ID of vector Vald Agent component already indexed.

## ALREADY_EXISTS

`ALREADY_EXISTS` means that Vald Agent component already index the vector same as the query vector when set `skip_strict_exist_check` as `true` in request config.

Services that returns status are:

- [Insert Service](../api/insert.md)
- [Update Service](../api/update.md)

The way to avoid it, you have to change the query vector with `skip_strict_exist_check` is `true` or set `skip_strict_exist_check` as `false` instead of change the query vector.

## RESOURCE_EXHAUSTED

`RESOURCE_EXHAUSTED` means the gRPC message size is bigger than limit (default is 4MB).

Services that returns status are all services.
The most case in the Vald is the query vector is too large in other word setting vector dimension size it too large.

## INTERNAL

`INTERNAL` appears when some wrong happens in the Vald cluster.

Services that returns status are all services.
If you get it, please verify the state of Vald cluster.

## UNAVAILABLE

`UNAVAILABLE` means the gRPC message cannot reach to the Vald cluster.

You need to verify whether the Vald cluster is running and host and port is correct.
3 changes: 3 additions & 0 deletions docs/api/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Update RPC is the method to update a single vector.
| :--: | :--------------- |
| 0 | OK |
| 3 | INVALID_ARGUMENT |
| 5 | NOT_FOUND |
| 6 | ALREADY_EXISTS |
| 13 | INTERNAL |

Expand Down Expand Up @@ -191,6 +192,7 @@ It's the recommended method to update the large amount of vectors.
| :--: | :--------------- |
| 0 | OK |
| 3 | INVALID_ARGUMENT |
| 5 | NOT_FOUND |
| 6 | ALREADY_EXISTS |
| 13 | INTERNAL |

Expand Down Expand Up @@ -289,5 +291,6 @@ Please be careful that the size of the request exceed the limit.
| :--: | :--------------- |
| 0 | OK |
| 3 | INVALID_ARGUMENT |
| 5 | NOT_FOUND |
| 6 | ALREADY_EXISTS |
| 13 | INTERNAL |

0 comments on commit 8cb56c9

Please sign in to comment.