8000 Processing component · Issue #248 · coder/internal · GitHub
[go: up one dir, main page]

Skip to c 8000 ontent
Processing component #248
Closed
coder/coder
#16436
Closed
@defelmnq

Description

@defelmnq

The coderd processor part is the one connecting all the other components and defining, based on inputs, the state of the workspace.

This issue requires to :

  1. Create a migration in the database to store the state of workspaces. The migration is :
CREATE TYPE workspace_monitor_state AS ENUM ('OK', 'NOK');

CREATE TABLE workspace_monitors (
    workspace_id uuid NOT NULL,
    state workspace_monitor_state NOT NULL,
    created_at timestamp with time zone NOT NULL,
    updated_at timestamp with time zone NOT NULL,
    debounced_until timestamp with time zone NOT NULL
);

The workspace_monitors describes - for each workspace - what is the current state. It is used to keep track of the current state and choose what action to take next based on the current state.

This monitor will be fetched and potentially updated at each tick.

  1. Implement the processor logic that determine if a workspace is in an healthy state or not.

Image

  1. Definition of the different states for a workspace can be defined based on the above diagram :
  • A workspace switch to OK when all the last points sent are OK.
  • A workspace switch to NOK when :
    • either 4 points in a row
    • either 10 out of the last 20 points

are NOK.

  1. Push the state in the database based on the determined value
  2. Push a notification to notifier if the workspace goes from healthy to unhealthy - also using the debounced_until logic :

This extra layer works in a very simple way - whenever a notification is sent, the debounced_until field is set to now() + x minutes.

Whenever we want to send a notification, if now() < debounced_until - then we ignore it.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0