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

Define the Diagnostics gRPC Service and the relevent message type #13581

Closed
lonng opened this issue Nov 19, 2019 · 0 comments
Closed

Define the Diagnostics gRPC Service and the relevent message type #13581

lonng opened this issue Nov 19, 2019 · 0 comments
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@lonng
Copy link
Contributor

lonng commented Nov 19, 2019

This issue is part of proposal #13481 about Diagnostics gRPC Service

Proto definition

// Diagnostics service for TiDB cluster componenets.
service Diagnostics {
	// Searchs log in the target node
	rpc search_log(SearchLogRequest) returns (SearchLogResponse) {};
	// Retrieves server info in the target node
	rpc server_info(ServerInfoRequest) returns (ServerInfoResponse) {};
}

enum LogLevel {
	Debug = 0;
	Info = 1;
	Warn = 2;
	Trace = 3;
	Critical = 4;
	Error = 5;
}

message SearchLogRequest {
	int64 start_time = 1;
	int64 end_time = 2;
	LogLevel level = 3;
	string pattern = 4;
	int64 limit = 5;
}

message SearchLogResponse {
	repeated LogMessage messages = 1;
}

message LogMessage {
	int64 time = 1;
	LogLevel level = 2;
	string message = 3;
}

enum ServerInfoType {
	All = 0;
	HardwareInfo = 1;
	SystemInfo = 2;
	LoadInfo = 3;
}

message ServerInfoRequest {
	ServerInfoType tp = 1;
}

message ServerInfoItem {
	// cpu, memory, disk, network ...
	string tp = 1;
	// eg. network: lo1/eth0, cpu: core1/core2, disk: sda1/sda2 
	string name = 2;
	string key = 3;
	string value = 4;
}

message ServerInfoResponse {
	repeated ServerInfoItem items = 1;
}

Rationale

Unifying the information obtained into the same interface and using a unified structure for the returned data types facilitates the flexibility to add new system information. If we define a separate interface for each type of system information, it will lead to the expansion of the relevant data structure.

@lonng lonng added the type/enhancement The issue or PR belongs to an enhancement. label Nov 19, 2019
@lonng lonng closed this as completed Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

1 participant