Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

refine config server v2 protocol #1564

Merged
merged 2 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
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
28 changes: 18 additions & 10 deletions config_server/protocol/v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
repeated ConfigInfo process_configs = 11; // Information about the current AGENT_CONFIG held by the Agent
repeated CommandInfo custom_commands = 12; // Information about command history
uint64 flags = 13; // Predefined command flag
// 14-99 reserved for future official fields
bytes opaque = 14; // Opaque data for extension
// before 100 (inclusive) are reserved for future official fields
}

message AgentGroupTag {
Expand Down Expand Up @@ -64,8 +65,8 @@
bytes version = 1; // Agent's version
bytes ip = 2; // Agent's ip
bytes hostname = 3; // Agent's hostname
// 4-99 reserved for future official fields
map<string, bytes> extras = 100; // Agent's other attributes
// before 100 (inclusive) are reserved for future official fields
}

enum AgentCapabilities {
Expand All @@ -78,7 +79,7 @@
// The Agent can accept custom command from the Server.
AcceptsCustomCommand = 0x00000004;

// Add new capabilities here, continuing with the least significant unused bit.
// bits before 2^16 (inclusive) are reserved for future official fields
}

enum RequestFlags {
Expand All @@ -88,20 +89,21 @@

// Must be set if this request contains full state
FullState = 0x00000001;
// bits before 2^16 (inclusive) are reserved for future official fields
}

### HeartbeatResponse 消息

message HeartbeatResponse {
bytes request_id = 1;
int32 code = 2;
string message = 3;
uint64 capabilities = 4; // Bitmask of flags defined by ServerCapabilities enum
ServerErrorResponse error_response = 2; // Set value indicates error
uint64 capabilities = 3; // Bitmask of flags defined by ServerCapabilities enum

repeated ConfigDetail pipeline_config_updates = 5; // Agent's pipeline config update status
repeated ConfigDetail process_config_updates = 6; // Agent's process config update status
repeated CommandDetail custom_command_updates = 7; // Agent's commands updates
repeated ConfigDetail pipeline_config_updates = 4; // Agent's pipeline config update status
repeated ConfigDetail process_config_updates = 5; // Agent's process config update status
repeated CommandDetail custom_command_updates = 6; // Agent's commands updates
uint64 flags = 7; // Predefined command flag
bytes opaque = 8; // Opaque data for extension
}

message ConfigDetail {
Expand Down Expand Up @@ -129,7 +131,12 @@
// The Server can remember custom command status.
RembersCustomCommandStatus = 0x00000008;

// Add new capabilities here, continuing with the least significant unused bit.
// bits before 2^16 (inclusive) are reserved for future official fields
}

message ServerErrorResponse {
int32 error_code = 1; // None-zero value indicates error
string error_message = 2; // Error message
}

enum ResponseFlags {
Expand All @@ -144,6 +151,7 @@
ReportFullState = 0x00000001;
FetchPipelineConfigDetail = 0x00000002;
FetchProcessConfigDetail = 0x00000004;
// bits before 2^16 (inclusive) are reserved for future official fields
}

## 行为规范
Expand Down
31 changes: 19 additions & 12 deletions config_server/protocol/v2/agent.proto
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ message AgentAttributes {
bytes version = 1; // Agent's version
bytes ip = 2; // Agent's ip
bytes hostname = 3; // Agent's hostname
// 4-99 reserved for future official fields
map<string, bytes> extras = 100; // Agent's other attributes
// before 100 (inclusive) are reserved for future official fields
}

enum AgentCapabilities {
Expand All @@ -64,6 +64,7 @@ enum RequestFlags {

// Must be set if this request contains full state
FullState = 0x00000001;
// bits before 2^16 (inclusive) are reserved for future official fields
}

// API: /Agent/Heartbeat
Expand All @@ -83,7 +84,8 @@ message HearbeatRequest {
repeated ConfigInfo process_configs = 11; // Information about the current AGENT_CONFIG held by the Agent
repeated CommandInfo custom_commands = 12; // Information about command history
uint64 flags = 13; // Predefined command flag
// 14-99 reserved for future official fields
bytes opaque = 14; // Opaque data for extension
// before 100 (inclusive) are reserved for future official fields}
}

// Define Config's detail
Expand All @@ -100,6 +102,11 @@ message CommandDetail {
int64 expire_time = 4; // After which the command can be safely removed from history
}

message ServerErrorResponse {
int32 error_code = 1; // None-zero value indicates error
string error_message = 2; // Error message
}

enum ServerCapabilities {
// The capabilities field is unspecified.
UnspecifiedServerCapability = 0;
Expand All @@ -112,7 +119,7 @@ enum ServerCapabilities {
// The Server can remember custom command status.
RembersCustomCommandStatus = 0x00000008;

// Add new capabilities here, continuing with the least significant unused bit.
// bits before 2^16 (inclusive) are reserved for future official fields
}

enum ResponseFlags {
Expand All @@ -127,19 +134,20 @@ enum ResponseFlags {
ReportFullState = 0x00000001;
FetchPipelineConfigDetail = 0x00000002;
FetchProcessConfigDetail = 0x00000004;
// bits before 2^16 (inclusive) are reserved for future official fields
}

// ConfigServer's response to Agent's request
message HeartbeatResponse {
bytes request_id = 1;
int32 code = 2;
string message = 3;
uint64 capabilities = 4; // Bitmask of flags defined by ServerCapabilities enum
ServerErrorResponse error_response = 2; // Set value indicates error
uint64 capabilities = 3; // Bitmask of flags defined by ServerCapabilities enum

repeated ConfigDetail pipeline_config_updates = 5; // Agent's pipeline config update status
repeated ConfigDetail process_config_updates = 6; // Agent's process config update status
repeated CommandDetail custom_command_updates = 7; // Agent's commands updates
repeated ConfigDetail pipeline_config_updates = 4; // Agent's pipeline config update status
repeated ConfigDetail process_config_updates = 5; // Agent's process config update status
repeated CommandDetail custom_command_updates = 6; // Agent's commands updates
uint64 flags = 7; // Predefined command flag
bytes opaque = 8; // Opaque data for extension
}

// API: /Agent/FetchPipelineConfig/
Expand All @@ -154,7 +162,6 @@ message FetchConfigRequest {
// ConfigServer response to Agent's request
message FetchConfigResponse {
bytes request_id = 1;
int32 code = 2;
string message = 3;
repeated ConfigDetail config_details = 4; // config detail
ServerErrorResponse error_response = 2;
repeated ConfigDetail config_details = 3; // config detail
}
Loading