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

Support config server v2 provider(HeartBeat、FetchPipelineConfig、FetchProcessConfig) #1710

Open
wants to merge 56 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
d9becf2
Support config server v2 provider(HeartBeat、FetchPipelineConfig、Fetch…
ww67652 Aug 21, 2024
10032e8
Merge branch 'alibaba:main' into main
ww67652 Aug 21, 2024
23bfe88
Update file due to changes of 'Process ->Instance' in proto
ww67652 Aug 22, 2024
4dc3434
change the structure of project
ww67652 Aug 22, 2024
d482825
fix:fix the slow sql while creating agent
ww67652 Aug 22, 2024
e3eb7b7
Merge remote-tracking branch 'origin/main'
ww67652 Aug 25, 2024
ccbdc2d
add: Implement support for multiple data sources
ww67652 Aug 26, 2024
838836c
add: Support interaction between user and config-server.
ww67652 Sep 4, 2024
f6aac54
Merge remote-tracking branch 'origin/main'
ww67652 Sep 4, 2024
065744e
fix: Optimized the error handling logic and added error chaining for …
ww67652 Sep 4, 2024
f4f3a20
Merge remote-tracking branch 'origin/main'
ww67652 Sep 4, 2024
56355f1
fix: fix the error of error handler
ww67652 Sep 4, 2024
fec3d7f
fix: fix the bug in backend code
ww67652 Sep 9, 2024
4c7e8b6
init frontend and finish backend
ww67652 Sep 10, 2024
e8237b6
fix:fix the bug in backend and post a demo request with protobuf from…
ww67652 Sep 10, 2024
097b052
fix:fix the bug in backend and post a demo request with protobuf from…
ww67652 Sep 10, 2024
e6810cb
add : add features and functions
ww67652 Sep 15, 2024
10f9102
add : Implemented regular checks on the correspondence between config…
ww67652 Sep 15, 2024
173211c
add: finish basic function
ww67652 Sep 15, 2024
96f9876
finish:finish the all project
ww67652 Sep 16, 2024
db4c001
finish:add document
ww67652 Sep 16, 2024
dd9d368
finish:add document
ww67652 Sep 16, 2024
beee4b6
finish:add document
ww67652 Sep 16, 2024
9b51d72
modify the directory structure
ww67652 Sep 19, 2024
fb2f913
add necessary document
ww67652 Sep 20, 2024
51f12d3
Optimize container startup logic
ww67652 Sep 20, 2024
81fc239
Rollback: Merge exception caused by incorrect file modifications
ww67652 Sep 20, 2024
47c1a1a
update: service for v2 protocol (ConfigService)
ww67652 Sep 29, 2024
2c21809
update: add deployment for v2 protocol (ConfigServer)
ww67652 Sep 29, 2024
9acea84
update: add ui for v2 protocol (ConfigServer)
ww67652 Sep 29, 2024
9772c47
update: add docs for config-server v2
ww67652 Sep 29, 2024
754ef22
update: delete agent config in docker-compose.yml
ww67652 Sep 30, 2024
ab9cbf5
update: change directory structure
ww67652 Sep 30, 2024
ea7aad0
Merge branch 'deployment'
ww67652 Sep 30, 2024
712931e
Merge branch 'ui'
ww67652 Sep 30, 2024
946d27d
update: change directory structure
ww67652 Sep 30, 2024
6349b70
merge:merge service
ww67652 Sep 30, 2024
5bf0644
update: simplify the handler code
ww67652 Oct 16, 2024
73b355f
update: update server2agent logic
ww67652 Oct 19, 2024
6404b66
update: update proto file
ww67652 Oct 19, 2024
d85e5b4
update: add decodeBase64 fix:service bug
ww67652 Oct 20, 2024
f9ed609
fix:fix the bug in frontend
ww67652 Oct 20, 2024
6536768
clean: clean useless code
ww67652 Oct 21, 2024
56bb076
Add key annotations for main logic
ww67652 Oct 27, 2024
f12b42c
feat: support for agent hostid
ww67652 Oct 27, 2024
177466b
feat: Join the default group upon backend startup
ww67652 Oct 27, 2024
6da8c47
feat: support for http status
ww67652 Oct 27, 2024
f2dada2
feat: add two api about status query
ww67652 Oct 28, 2024
1779fa9
modify the image tag in deployment
ww67652 Oct 28, 2024
7b9d7b2
modify the image tag in deployment
ww67652 Oct 28, 2024
52f6f70
feat: Distinguish between test API and logs based on the environment …
ww67652 Oct 28, 2024
a97e48c
test: add test cases
ww67652 Oct 30, 2024
a4c51c1
refactor config-server directory
ww67652 Oct 30, 2024
b2f1eb6
feat: Delete instance related functions and modify directory structure
ww67652 Oct 30, 2024
4a30f99
feat: sync agent.pb
ww67652 Oct 30, 2024
b397a48
fix: solve conflict
ww67652 Oct 30, 2024
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
22 changes: 11 additions & 11 deletions config_server/protocol/v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
string running_status = 8; // Human readable running status
int64 startup_time = 9; // Required, Agent's startup time
repeated ConfigInfo pipeline_configs = 10; // Information about the current PIPELINE_CONFIG held by the Agent
repeated ConfigInfo process_configs = 11; // Information about the current AGENT_CONFIG held by the Agent
repeated ConfigInfo instance_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
bytes opaque = 14; // Opaque data for extension
Expand Down Expand Up @@ -74,8 +74,8 @@
UnspecifiedAgentCapability = 0;
// The Agent can accept pipeline configuration from the Server.
AcceptsPipelineConfig = 0x00000001;
// The Agent can accept process configuration from the Server.
AcceptsProcessConfig = 0x00000002;
// The Agent can accept instance configuration from the Server.
AcceptsInstanceConfig = 0x00000002;
// The Agent can accept custom command from the Server.
AcceptsCustomCommand = 0x00000004;

Expand All @@ -100,7 +100,7 @@
uint64 capabilities = 3; // Bitmask of flags defined by ServerCapabilities enum

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 ConfigDetail instance_config_updates = 5; // Agent's instance 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
Expand All @@ -126,8 +126,8 @@
RembersAttribute = 0x00000001;
// The Server can remember pipeline config status.
RembersPipelineConfigStatus = 0x00000002;
// The Server can remember process config status.
RembersProcessConfigStatus = 0x00000004;
// The Server can remember instance config status.
RembersInstanceConfigStatus = 0x00000004;
// The Server can remember custom command status.
RembersCustomCommandStatus = 0x00000008;

Expand All @@ -150,7 +150,7 @@
// restarted and lost state).
ReportFullState = 0x00000001;
FetchPipelineConfigDetail = 0x00000002;
FetchProcessConfigDetail = 0x00000004;
FetchInstanceConfigDetail = 0x00000004;
// bits before 2^16 (inclusive) are reserved for future official fields
}

Expand All @@ -168,7 +168,7 @@ Server:应当通过capbilitiies上报Server自身的能力,这样如果新

Client:Agent启动后第一次向Server汇报全量信息,request字段应填尽填。request\_id、sequence\_num、capabilities、instance\_id、agent\_type、startup\_time为必填字段。

Server:Server根据上报的信息返回响应。pipeline\_config\_updates、process\_config\_updates中包含agent需要同步的配置,updates中必然包含name和version,是否包含详情context和detail取决于server端实现。custom\_command_updates包含要求agent执行的命令command中必然包含type、name和expire\_time。
Server:Server根据上报的信息返回响应。pipeline\_config\_updates、instance\_config\_updates中包含agent需要同步的配置,updates中必然包含name和version,是否包含详情context和detail取决于server端实现。custom\_command_updates包含要求agent执行的命令command中必然包含type、name和expire\_time。

Server是否保存Client信息取决于Server实现,如果服务端找不到或保存的sequence\_num + 1 ≠ 心跳的sequence\_num,那么就立刻返回并且flags中必须设置ReportFullStatus标识位。

Expand All @@ -192,15 +192,15 @@ Server:同注册

### 进程配置

若Server的注册/心跳响应中有process\_config\_updates.detail
若Server的注册/心跳响应中有instance\_config\_updates.detail

Client:直接从response中获得detail,应用成功后下次心跳需要上报完整状态。

若Server的响应不包含detail

Client:根据process\_config\_updates的信息构造FetchProcessConfigRequest
Client:根据instance\_config\_updates的信息构造FetchInstanceConfigRequest

Server:返回FetchProcessConfigResponse
Server:返回FetchInstanceConfigResponse

Client获取到多个进程配置时,自动合并,若产生冲突默认行为是未定义。

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ message AgentAttributes {
bytes version = 1; // Agent's version
bytes ip = 2; // Agent's ip
bytes hostname = 3; // Agent's hostname
bytes hostid = 4; // Agent's hostid https://opentelemetry.io/docs/specs/semconv/attributes-registry/host/
map<string, bytes> extras = 100; // Agent's other attributes
// before 100 (inclusive) are reserved for future official fields
}
Expand All @@ -49,8 +50,8 @@ enum AgentCapabilities {
UnspecifiedAgentCapability = 0;
// The Agent can accept pipeline configuration from the Server.
AcceptsPipelineConfig = 0x00000001;
// The Agent can accept process configuration from the Server.
AcceptsProcessConfig = 0x00000002;
// The Agent can accept instance configuration from the Server.
AcceptsInstanceConfig = 0x00000002;
// The Agent can accept custom command from the Server.
AcceptsCustomCommand = 0x00000004;

Expand Down Expand Up @@ -81,7 +82,7 @@ message HeartbeatRequest {
string running_status = 8; // Human readable running status
int64 startup_time = 9; // Required, Agent's startup time
repeated ConfigInfo pipeline_configs = 10; // Information about the current PIPELINE_CONFIG held by the Agent
repeated ConfigInfo process_configs = 11; // Information about the current AGENT_CONFIG held by the Agent
repeated ConfigInfo instance_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
bytes opaque = 14; // Opaque data for extension
Expand All @@ -102,20 +103,15 @@ 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;
// The Server can remember agent attributes.
RembersAttribute = 0x00000001;
// The Server can remember pipeline config status.
RembersPipelineConfigStatus = 0x00000002;
// The Server can remember process config status.
RembersProcessConfigStatus = 0x00000004;
// The Server can remember instance config status.
RembersInstanceConfigStatus = 0x00000004;
// The Server can remember custom command status.
RembersCustomCommandStatus = 0x00000008;

Expand All @@ -133,25 +129,25 @@ enum ResponseFlags {
// restarted and lost state).
ReportFullState = 0x00000001;
FetchPipelineConfigDetail = 0x00000002;
FetchProcessConfigDetail = 0x00000004;
FetchInstanceConfigDetail = 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;
ServerErrorResponse error_response = 2; // Set value indicates error
CommonResponse commonResponse = 2; // Set common response
uint64 capabilities = 3; // Bitmask of flags defined by ServerCapabilities enum

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 ConfigDetail instance_config_updates = 5; // Agent's instance 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/
// API: /Agent/FetchProcessConfig/
// API: /Agent/FetchInstanceConfig/
// Agent request to ConfigServer, pulling details of the config
message FetchConfigRequest {
bytes request_id = 1;
Expand All @@ -162,6 +158,12 @@ message FetchConfigRequest {
// ConfigServer response to Agent's request
message FetchConfigResponse {
bytes request_id = 1;
ServerErrorResponse error_response = 2;
CommonResponse commonResponse = 2;
repeated ConfigDetail config_details = 3; // config detail
}

message CommonResponse
{
int32 status = 1;
bytes errorMessage = 2;
}
221 changes: 221 additions & 0 deletions config_server/protocol/v2/user.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
syntax = "proto3";
option go_package = "/protov2;";
import "agentV2.proto";


message Agent{
uint64 capabilities = 1; // Bitmask of flags defined by AgentCapabilities enum
bytes instance_id = 2; // Required, Agent's unique identification, consistent throughout the process lifecycle
string agent_type = 3; // Required, Agent's type(ilogtail, ..)
AgentAttributes attributes = 4; // Agent's basic attributes
string running_status = 5; // Human readable running status
int64 startup_time = 6; // Required, Agent's startup time
}


// API: /User/CreateAgentGroup

message CreateAgentGroupRequest {
bytes request_id = 1;
AgentGroupTag agent_group = 2;
}

message CreateAgentGroupResponse {
bytes request_id = 1;
CommonResponse common_response=2;
}

// API: /User/UpdateAgentGroup

message UpdateAgentGroupRequest {
bytes request_id = 1;
AgentGroupTag agent_group = 2;
}

message UpdateAgentGroupResponse {
bytes request_id = 1;
CommonResponse common_response=2;
}

// API: /User/DeleteAgentGroup/

message DeleteAgentGroupRequest {
bytes request_id = 1;
string group_name = 2;
}

message DeleteAgentGroupResponse {
bytes request_id = 1;
CommonResponse common_response=2;
}

// API: /User/GetAgentGroup/

message GetAgentGroupRequest {
bytes request_id = 1;
string group_name = 2;
}

message GetAgentGroupResponse {
bytes request_id = 1;
CommonResponse common_response=2;
AgentGroupTag agent_group = 3;
}

// API: /User/ListAgentGroups/

message ListAgentGroupsRequest {
bytes request_id = 1;
}

message ListAgentGroupsResponse {
bytes request_id = 1;
CommonResponse common_response=2;

repeated AgentGroupTag agent_groups = 4;
}

// API: /User/CreatePipelineConfig
// API: /User/CreateInstanceConfig
message CreateConfigRequest {
bytes request_id = 1;
ConfigDetail config_detail = 2;
}

message CreateConfigResponse {
bytes request_id = 1;
CommonResponse common_response =2;
}

// API: /User/UpdatePipelineConfig
// API: /User/UpdateInstanceConfig
message UpdateConfigRequest {
bytes request_id = 1;
ConfigDetail config_detail = 2;
}

message UpdateConfigResponse {
bytes request_id = 1;
CommonResponse common_response=2;
}

// API: /User/DeletePipelineConfig
// API: /User/DeleteInstanceConfig
message DeleteConfigRequest {
bytes request_id = 1;
string config_name = 2;
}

message DeleteConfigResponse {
bytes request_id = 1;
CommonResponse common_response=2;
}

// API: /User/GetPipelineConfig
// API: /User/GetInstanceConfig
message GetConfigRequest {
bytes request_id = 1;
string config_name = 2;
}

message GetConfigResponse {
bytes request_id = 1;
CommonResponse common_response=2;

ConfigDetail config_detail = 3;
}

// API: /User/GetPipelineConfigStatusList
// API: /User/GetInstanceConfigStatusList
message GetConfigStatusListRequest{
bytes request_id = 1;
bytes instance_id = 2;
}

message GetConfigStatusListResponse{
bytes request_id = 1;
CommonResponse common_response = 2;
repeated ConfigInfo config_status = 3;
}

// API: /User/ListPipelineConfigs
// API: /User/ListInstanceConfigs
message ListConfigsRequest {
bytes request_id = 1;
}

message ListConfigsResponse {
bytes request_id = 1;
CommonResponse common_response = 2;

repeated ConfigDetail config_details = 3;
}

// API: /User/ApplyPipelineConfigToAgentGroup
// API: /User/ApplyInstanceConfigToAgentGroup
message ApplyConfigToAgentGroupRequest {
bytes request_id = 1;
string config_name = 2;
string group_name = 3;
}

message ApplyConfigToAgentGroupResponse {
bytes request_id = 1;
CommonResponse common_response = 2;
}

// API: /User/RemovePipelineConfigFromAgentGroup/
// API: /User/RemoveInstanceConfigFromAgentGroup/
message RemoveConfigFromAgentGroupRequest {
bytes request_id = 1;
string config_name = 2;
string group_name = 3;
}

message RemoveConfigFromAgentGroupResponse {
bytes request_id = 1;
CommonResponse common_response = 2;
}


// API: /User/GetAppliedPipelineConfigsForAgentGroup/
// API: /User/GetAppliedInstanceConfigsForAgentGroup/
message GetAppliedConfigsForAgentGroupRequest {
bytes request_id = 1;
string group_name = 2;
}

message GetAppliedConfigsForAgentGroupResponse {
bytes request_id = 1;
CommonResponse common_response = 2;

repeated string config_names = 4;
}

// API: /User/GetAppliedAgentGroupsWithPipelineConfig/
// API: /User/GetAppliedAgentGroupsWithInstanceConfig/
message GetAppliedAgentGroupsRequest {
bytes request_id = 1;
string config_name = 2;
}

message GetAppliedAgentGroupsResponse {
bytes request_id = 1;
CommonResponse common_response = 2;

repeated string agent_group_names = 3;
}

// API: /User/ListAgents/

message ListAgentsRequest {
bytes request_id = 1;
string group_name = 2;
}

message ListAgentsResponse {
bytes request_id = 1;
CommonResponse common_response = 2;

repeated Agent agents = 3;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading