Skip to main content

Module metrics

Module metrics 

Source
Expand description

The metrics CodoSEO records, named and labelled in one place. The metrics facade does nothing until a recorder is installed (the codoseo binary installs a Prometheus one for its server roles when CODOSEO_METRICS_BIND is set), so library code and tests can call these freely.

Labels are a closed set of short words (a lane number, an outcome, a channel kind). Never put a URL, a domain, an email or an id in one: every distinct value is a new time series.

Structs§

RunningCrawl
Holds one running crawl in the gauges: crawls_running goes up by one and the reserved memory by reserved_bytes, both undone when this is dropped (a panic included).

Enums§

Surface
Which API an agent call came through.
Tier
Whether the caller sent an API key (key) or is one of the no-key MCP clients (anon).

Constants§

ALERT_DELIVERIES_TOTAL
ALL
Every metric name, for the tests and the docs.
API_REQUESTS_TOTAL
API_RESULTS
What api_requests_total’s result is: ok, an AgentError::code or error.
CHANNELS
The alert channel kinds (ChannelKind::as_str).
CRAWLS_FINISHED_TOTAL
CRAWLS_RUNNING
CRAWL_QUEUE_WAIT_SECONDS
DB_POOL_CONNECTIONS
JOBS_FAILED_TOTAL
JOB_KINDS
The job kinds (JobKind::slug).
LANES
Crawl priorities run 0 (most urgent) to 5; the label is the lane.
PAGES_CRAWLED_TOTAL
SCHEDULER_LAST_TICK_TIMESTAMP_SECONDS
WORKER_MEMORY_BUDGET_BYTES
WORKER_MEMORY_RESERVED_BYTES

Functions§

alert_delivery
One delivery attempt on a channel of kind channel (ChannelKind::as_str).
api_request
One agent API call that ended with result (ok or an error code).
crawl_finished
A crawl run ended: completed when its results were stored, otherwise failed.
crawl_started
Marks a crawl as running, reserving reserved_bytes of the worker’s memory budget.
db_pool
The pool’s connections right now: idle ones are free, active ones are checked out.
job_failed
A job of kind kind (JobKind::slug) failed or panicked.
pages_crawled
queue_wait
A claimed crawl waited seconds in the queue. priority is the crawl’s priority (its lane).
register
Describes every metric and creates the series that are known up front at zero, so a scrape right after startup already lists them (and rate() sees the first increment).
scheduler_tick
worker_memory_budget