-
Notifications
You must be signed in to change notification settings - Fork 4
Backend
Back-end of the CtrlB Control-Plane offers a set of APIs to control the associated agents. Currently the Back-end supports APIs to start, stop, update config, get current config and get current status. When an agent is initialized it registers itself to the back-end and informs about its configuration.
The Back-end uses SQLite to store the agent information and status into two tables.
-
The
agentstable stores the configuration of a particular agent, its type (fluent-bit/otel), version, hostname, and platform. While registering an agent, it assigns them an UUID as the primary key, and also a Name using its type, version and hostname. -
The
agent_infotable stores the status of an agent at any particular time that includes its uptime, total data exported/lost and any status information.
- The back-end loads the
envvariables, specifically the Port to run and the worker count. - Initializes the SQLite database - creates the agents table that stores the agent's registration data (name, type, version, hostname, platform and config), and also a agent_info table that stores agent's status when requested, containing data about the current status, exported data volume, uptime, and dropped records.
- Back-end initializes the agent queue with the worker count, and the agent repository with the db context. Agent repository is responsible for all the database communications (read/write).
- The agent service is initialized using the agent queue and agent repository. The agent services handles all the API request after being forwarded from the application routers.
- Back-end server starts running on the port specified by the
envvariable.
-
POST
/api/auth/v1/register: Creates a new user registration. -
POST
/api/auth/v1/login: Authenticates the user.
-
PUT
/api/agent/v1/agents: Creates or updates an agent.
-
GET
/api/frontend/v1/agents: Fetches all agents. -
GET
/api/frontend/v1/agents/{id}: Fetches a specific agent by ID. -
DELETE
/api/frontend/v1/agents/{id}: Deletes a specific agent by ID. -
POST
/api/frontend/v1/agents/{id}/start: Starts the agent. -
POST
/api/frontend/v1/agents/{id}/stop: Stops the agent. -
GET
/api/frontend/v1/agents/{id}/metrics: Retrieves metrics for the agent. -
POST
/api/frontend/v1/agents/{id}/restart-monitoring: Restarts monitoring for the agent.
-
GET
/api/frontend/v1/pipelines: Fetches all pipelines. -
GET
/api/frontend/v1/pipelines/{id}: Fetches a specific pipeline by ID. -
DELETE
/api/frontend/v1/pipelines/{id}: Deletes a specific pipeline. -
POST
/api/frontend/v1/pipelines/{id}/start: Starts the pipeline. -
POST
/api/frontend/v1/pipelines/{id}/stop: Stops the pipeline. -
GET
/api/frontend/v1/pipelines/{id}/metrics: Retrieves metrics for the pipeline. -
POST
/api/frontend/v1/pipelines/{id}/restart-monitoring: Restarts monitoring for the pipeline.
-
GET
/api/frontend/v1/configs: Fetches all configs. -
POST
/api/frontend/v1/configs: Creates a new config. -
GET
/api/frontend/v1/configs/{id}: Fetches a specific config by ID. -
DELETE
/api/frontend/v1/configs/{id}: Deletes a specific config. -
PATCH
/api/frontend/v1/configs/{id}: Updates a specific config.
To run the backend server, following environment variables shall be configured to the .env file
PORT: Port to use for running the collector agent ((No default value, this is required to be set)
WORKER_COUNT : Number of workers to run (No default value, this is required to be set)