agent

package
v0.0.57 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

README

api/routes/agent

HTTP handlers for the agent-facing API endpoints. These routes are the interface between the scoring API and the agents that run check scripts in the field. They are not intended for use by operators or frontends.

This package exposes two endpoints: one that hands out the next service check for an agent to execute, and one that accepts a completed check result. Both operate on the same data types used throughout the rest of the system.

Check dispatch consults the competition's check-pause state before pulling from the queue. While checks are paused the handler returns a no-op assignment instead of real work, which agents recognize and treat as an instruction to idle until their next poll; the queue is not advanced, so no check is skipped by the pause. A scoring pause is deliberately invisible here — it is applied when a result is recorded, not when work is dispatched — so agents keep checking normally through one.

Both endpoints handle the absence of a database sink gracefully. Score submission becomes a no-op, and check retrieval skips both the pause lookup and credential attachment, falling back to the credentials in the config file rather than failing.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddScore

func AddScore(c *gin.Context)

AddScore is a POST route for submitting a completed scorecheck, only meant for interaction from an agent.

@Summary		Submit a completed score check
@Description	Accepts a completed score check result from an agent and forwards it to all configured sinks. The timestamp field is assigned by the server on receipt and must not be included in the request body.
@Tags			agent
@Accept			json
@Produce		json
@Param			score	body		types.Score	true	"Completed score check"
@Success		200		{object}	object
@Failure		400		{object}	object
@Failure		500		{object}	object
@Router			/agent/completed-score [post]

func GetCheck

func GetCheck(c *gin.Context)

GetCheck is a route that returns the next check to run. This is meant for interaction from the agents.

@Summary		Get next check to run
@Description	Returns the next fully-rendered service check for the agent to execute. Rotates round-robin across all services and teams. While checks are paused this returns a no-op assignment instead (`no_op: true`) with no check details, which tells the agent to idle until its next poll; the queue is not advanced, so no check is lost to the pause.
@Tags			agent
@Produce		json
@Success		200	{object}	types.Service
@Failure		400	{object}	object
@Failure		500	{object}	object
@Router			/agent/new-check [get]

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL