feat: integrate agentAPI with resources monitoring logic (#16438)

As part of the new resources monitoring logic - more specifically for
OOM & OOD Notifications , we need to update the AgentAPI , and the
agents logic.

This PR aims to do it, and more specifically :  
We are updating the AgentAPI & TailnetAPI to version 24 to add two new
methods in the AgentAPI :
- One method to fetch the resources monitoring configuration
- One method to push the datapoints for the resources monitoring.

Also, this PR adds a new logic on the agent side, with a routine running
and ticking - fetching the resources usage each time , but also storing
it in a FIFO like queue.

Finally, this PR fixes a problem we had with RBAC logic on the resources
monitoring model, applying the same logic than we have for similar
entities.
This commit is contained in:
Vincent Vielle
2025-02-14 10:28:15 +01:00
committed by GitHub
parent edd982e852
commit bc609d0056
19 changed files with 1830 additions and 218 deletions
+6
View File
@@ -34,3 +34,9 @@ type DRPCTailnetClient23 interface {
RefreshResumeToken(ctx context.Context, in *RefreshResumeTokenRequest) (*RefreshResumeTokenResponse, error)
WorkspaceUpdates(ctx context.Context, in *WorkspaceUpdatesRequest) (DRPCTailnet_WorkspaceUpdatesClient, error)
}
// DRPCTailnetClient24 is the Tailnet API at v2.4. It is functionally identical to 2.3, because the
// change was to the Agent API (ResourcesMonitoring methods).
type DRPCTailnetClient24 interface {
DRPCTailnetClient23
}
+6 -1
View File
@@ -38,9 +38,14 @@ import (
// shipped in Coder v2.16.0, but we forgot to increment the API version. If
// you dial for API v2.2, you MAY be connected to a server that supports
// ScriptCompleted, but be prepared to process "unsupported" errors.)
//
// API v2.4:
// - Shipped in Coder v2.{{placeholder}} // TODO Vincent: Replace with the correct version
// - Added support for GetResourcesMonitoringConfiguration and
// PushResourcesMonitoringUsage RPCs on the Agent API.
const (
CurrentMajor = 2
CurrentMinor = 3
CurrentMinor = 4
)
var CurrentVersion = apiversion.New(CurrentMajor, CurrentMinor)