Unify log and error report for easier trouble shooting
- Dominant language
- C++
- Stars
- 3.6k
- Forks
- 468
- Avg merge
- 29m
- Merged PRs (30d)
- 1
Description
**Motivations and proposal**
- a unified error code, easy to find a concrete reason for failure.
- easy to identify which engine; Within each engine, it can have its own status code.
- easy to find which machine(node), and easy to get the full log.
- no engine should revise/omit the original error info.
**Current status**
- vineyard/gie are using status codes.
- coordinator would convert to [internal error](https://github.com/alibaba/GraphScope/blob/698f5c38d5abe3381576f9553487aa96e7b0420e/coordinator/gscoordinator/coordinator.py#L297)
- enumerate the status code: TBF
**Proposal**
update:
- Append error code, error type and engine to error message.
** deprecated!!!**
- Each engine can maintain its original status code
- Add a unified `EngineIdentifier` to indicate the status belong to which engine
- Revise the `Status` implementation to check the error
Example:
- Status Code (assume is analytical engine)
```c++
Enum class StatusCode {
Ok = 0;
Invalid = 1;
Unknown = 255;
}
```
- Engine Identifier
```c++
Enum class EngineIdentifier {
null = 0;
analytical = 1;
interactive = 2;
learning = 3;
vineyard = 4;
graphar = 5;
gart = 6;
}
```
- Status Implementation
replace the `code_` value type from `StatusCode` to `uint32` , which high 16 bits store the engine identifier, the low 16 bits store the status code
```c++
// assume this is Status of analytical engine
class Status {
Status(uint32_t code, std::string message);
Status InvalidError(std::string message) {
return Status(((static_cast(EngineIdentifier::analytical) << 16) | static_cast(ErrorCode::Invalid)), message);
}
// check is invalid error occur in analytical engine.
bool IsInvalid() {
return static_cast(code_ >> 16) == EngineIdentifier::analytical && static_cast(code_ & 0xFF) == ErrorCode::Invalid;
}
// check is error occur in vineyard module.
bool IsVineyardError() {
return static_cast(code_ >> 16) == EngineIdentifier::vineyard;
}
private:
uint32_t code_;
std::string message;
}
```
**Corner cases**
Contributor guide
Assessment
This issue has not been assessed yet.