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

update: add ui for v2 protocol (config_server) #1789

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 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
5f492aa
Delete config_server/deployment directory
ww67652 Sep 28, 2024
347cee6
Delete config_server/service directory
ww67652 Sep 28, 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
12 changes: 12 additions & 0 deletions config_server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Config-server

这是基于阿里巴巴 iLogtail 项目 Config Server v2通信协议的一个前后端实现。

后端使用GO基于gin框架开发,针对https://github.com/alibaba/ilogtail/tree/main/config_server/protocol/v2 中提到的Agent行为进行了V2版本的适配,基本实现了能力报告、心跳压缩、配置状态上报等功能,并包含用户端接口,详情见[service](service/README.md)。

前端使用 Vue + Element plus 组件库 + Vue cli 脚手架工具进行开发,旨在为用户提供一个简单、实用、易嵌入的 Config Server 前端控制台,详情见[ui](ui/README.md)。

本项目提供了docker compose一键部署脚本,帮助用户快速搭建可用可视化与agent连通的config-server应用,详情见[deployment](deployment/README.md)。



10 changes: 5 additions & 5 deletions config_server/protocol/v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
// The Agent can accept pipeline configuration from the Server.
AcceptsPipelineConfig = 0x00000001;
// The Agent can accept process configuration from the Server.
AcceptsProcessConfig = 0x00000002;
AcceptsInstanceConfig = 0x00000002;
// The Agent can accept custom command from the Server.
AcceptsCustomCommand = 0x00000004;

Expand Down Expand Up @@ -127,7 +127,7 @@
// The Server can remember pipeline config status.
RembersPipelineConfigStatus = 0x00000002;
// The Server can remember process config status.
RembersProcessConfigStatus = 0x00000004;
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 Down Expand Up @@ -198,9 +198,9 @@ Client:直接从response中获得detail,应用成功后下次心跳需要上

若Server的响应不包含detail

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

Server:返回FetchProcessConfigResponse
Server:返回FetchInstanceConfigResponse

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

Expand Down
40 changes: 20 additions & 20 deletions config_server/protocol/v2/agent.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
syntax = "proto3";
package configserver.proto.v2;
option go_package = "/config_server/service/protov2;configserver_proto_v2";
option go_package = "/protov2;";

message AgentGroupTag {
string name = 1;
Expand Down Expand Up @@ -49,8 +48,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 +80,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 +101,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,35 +127,41 @@ 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
bytes request_id = 1;
CommonResponse common_response = 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;
bytes request_id = 1;
bytes instance_id = 2; // Agent's unique identification
repeated ConfigInfo req_configs = 3; // Config's name and version/hash
}

// ConfigServer response to Agent's request
message FetchConfigResponse {
bytes request_id = 1;
ServerErrorResponse error_response = 2;
bytes request_id = 1;
CommonResponse common_response = 2;
repeated ConfigDetail config_details = 3; // config detail
}

message CommonResponse
{
int32 status = 1;
bytes error_message = 2;
}
226 changes: 226 additions & 0 deletions config_server/protocol/v2/user.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
syntax = "proto3";
option go_package = "/protov2;";
import "agent.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
}

message AgentConfigStatus{
string name=1;
ConfigStatus status = 2; // Config's status
string message = 3; // Optional error message
}

// 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 AgentConfigStatus agent_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;
}
4 changes: 0 additions & 4 deletions config_server/service/.gitignore

This file was deleted.

Loading