Metering & schedules
Compute accounting and recurring work. MeteringService reports the compute units (CU) that
fetch runs have consumed and manages the tenant’s dedicated CU budget. SchedulesService keeps
the recurring fetch schedules shown on the cockpit’s Active Schedules screen.
Summary
| Service | RPC | Kind | Purpose |
|---|---|---|---|
| MeteringService | GetResourceUsage | Unary | CU consumed by the caller’s tenant |
| MeteringService | GetComputeBudget | Unary | Read the dedicated CU budget |
| MeteringService | SetComputeBudget | Unary | Set the dedicated CU budget to an absolute value |
| SchedulesService | ListSchedules | Unary | List schedules |
| SchedulesService | CreateSchedule | Unary | Create an active schedule |
| SchedulesService | UpdateSchedule | Unary | Replace a schedule’s title, description and frequency |
| SchedulesService | SetScheduleActive | Unary | Pause or resume a schedule |
| SchedulesService | DeleteSchedule | Unary | Delete a schedule |
MeteringService
Full name semantics.v1.MeteringService.
Scope. Every figure belongs to the caller’s tenant, taken from the verified session. The
instance_id in these requests is accepted but not used to choose what is reported, because CU
is recorded per tenant and not per runner. Do not add up responses across instance_id values:
each one is the same tenant total.
What is measured. Only the CU charged by fetch runs is recorded. Data units (RAM) and cost are
not metered. They are sent as 0 with an explanation in unmeasured_reason. Show that explanation
instead of the number, and never display the 0 as $0.00 or 0 GB.
GetResourceUsage
rpc GetResourceUsage(GetResourceUsageRequest) returns (GetResourceUsageResponse);- Kind: Unary.
- Auth: Bearer session.
- Errors: None beyond authentication.
Request: GetResourceUsageRequest
| Field | Type | Description |
|---|---|---|
instance_id | string | Accepted but not used for scoping. See usage_scope. |
Response: GetResourceUsageResponse
| Field | Type | Description |
|---|---|---|
compute_units | double | CU consumed by the tenant’s fetch runs. |
data_units | double | Not metered. Always 0. See unmeasured_reason. |
estimated_cost | double | Not metered. Always 0. See unmeasured_reason. |
unmeasured_reason | string | Non-empty exactly when a numeric field above is not a real measurement. Show it in place of those numbers. |
usage_scope | string | The scope the figures describe, as <prefix>:<key>. Parse it as a prefix: tenant:<id> is the tenant’s total, and is the only form an authenticated client sees. instance:<id> and unattributed:<key> are also defined. Show the scope wherever you show the numbers. |
GetComputeBudget
rpc GetComputeBudget(GetComputeBudgetRequest) returns (ComputeBudgetResponse);- Kind: Unary.
- Auth: Bearer session.
- Errors: None beyond authentication.
Returns the tenant’s dedicated CU allotment, what has been consumed and what remains. A tenant that has never set a budget reports the default of 1,000 CU.
Request: GetComputeBudgetRequest
| Field | Type | Description |
|---|---|---|
instance_id | string | Accepted but not used for scoping. The budget is the tenant’s. |
Response: ComputeBudgetResponse
| Field | Type | Description |
|---|---|---|
instance_id | string | The budget key actually used, which is the tenant id. |
dedicated_compute_units | double | The dedicated CU allotment. |
consumed_compute_units | double | CU consumed by fetch runs. |
remaining_compute_units | double | dedicated - consumed, never below 0. |
SetComputeBudget
rpc SetComputeBudget(SetComputeBudgetRequest) returns (ComputeBudgetResponse);- Kind: Unary.
- Auth: Bearer session.
ROLE_READERis refused. - Errors:
PERMISSION_DENIEDfor a reader.INVALID_ARGUMENTifdedicated_compute_unitsis negative.
Sets the dedicated allotment to an absolute value, so applying the same value twice has no
further effect. With an idempotency_key, a request that repeats the key of the last applied set
is not applied again. Consumption is not changed. The response is the budget after the call.
Request: SetComputeBudgetRequest
| Field | Type | Description |
|---|---|---|
instance_id | string | Accepted but not used for scoping. The budget is the tenant’s. |
dedicated_compute_units | double | The new allotment. Must be 0 or more. |
idempotency_key | string | Optional. Resending the key of the last applied set leaves the budget unchanged. |
Response
SchedulesService
Full name semantics.v1.SchedulesService.
A schedule triggers a fetch at a fixed interval. Its title is sent as the fetch command, and it
runs on the managed runner under a short-lived service-account session. Schedules are stored
durably and fire on the control plane only.
<time> — skipped (execution disabled), with
last_run_success: false, and run_count does not increase.Frequency. frequency is free text. The server reads the interval from it, case-insensitively:
| Text contains | Interval |
|---|---|
6 hour | 6 hours |
hour | 1 hour |
dail or day | 1 day |
week | 1 week |
month | 30 days |
custom | 1 day |
| anything else, or empty | 1 hour |
The stored label is the text you sent, with its first letter capitalised and the rest lowercase.
On create, an empty frequency is labelled Daily but, per the table, fires hourly. Send an
explicit frequency.
If a run is still in progress when the schedule is next due, that interval is skipped.
ListSchedules
rpc ListSchedules(ListSchedulesRequest) returns (ListSchedulesResponse);- Kind: Unary.
- Auth: Bearer session.
- Errors: None beyond authentication.
Returns every schedule. The first time a new instance starts, it may already hold example schedules.
Request: ListSchedulesRequest
No fields.
Response: ListSchedulesResponse
| Field | Type | Description |
|---|---|---|
schedules | repeated Schedule | All schedules. |
CreateSchedule
rpc CreateSchedule(CreateScheduleRequest) returns (Schedule);- Kind: Unary.
- Auth: Bearer session.
- Errors:
INVALID_ARGUMENTiftitleis empty.
Creates an active schedule whose first run is one interval from now. The id is a slug of the
title, with -2, -3 and so on added when the slug is taken.
Request: CreateScheduleRequest
| Field | Type | Description |
|---|---|---|
title | string | Required. Also the fetch command the schedule runs. |
description | string | Free-text description. |
frequency | string | Interval text. See Frequency. |
Response
The created Schedule.
UpdateSchedule
rpc UpdateSchedule(UpdateScheduleRequest) returns (Schedule);- Kind: Unary.
- Auth: Bearer session.
- Errors:
INVALID_ARGUMENTiftitleis empty.NOT_FOUNDif no schedule hasid.
Replaces the title and description with the values sent, so an empty description clears it. An
empty frequency keeps the current one. If the frequency changes and the schedule is active, the
next run is one new interval from now. The run history and the active flag cannot be changed
here.
Request: UpdateScheduleRequest
| Field | Type | Description |
|---|---|---|
id | string | The schedule to edit. |
title | string | Required. New title. |
description | string | New description. Replaces the old one. |
frequency | string | New interval text. Empty keeps the current frequency. |
Response
The updated Schedule.
SetScheduleActive
rpc SetScheduleActive(SetScheduleActiveRequest) returns (Schedule);- Kind: Unary.
- Auth: Bearer session.
- Errors:
NOT_FOUNDif no schedule hasid.
Resuming schedules the next run one interval from now. Pausing clears the next run
(next_run_unix: 0, next_run: "Manual Resume Req.").
Request: SetScheduleActiveRequest
| Field | Type | Description |
|---|---|---|
id | string | The schedule. |
active | bool | true to resume, false to pause. |
Response
The updated Schedule.
DeleteSchedule
rpc DeleteSchedule(DeleteScheduleRequest) returns (DeleteScheduleResponse);- Kind: Unary.
- Auth: Bearer session.
- Errors: None. An unknown id returns
success: false.
Request: DeleteScheduleRequest
| Field | Type | Description |
|---|---|---|
id | string | The schedule to delete. |
Response: DeleteScheduleResponse
| Field | Type | Description |
|---|---|---|
success | bool | true if a schedule was deleted. |
Messages
Schedule
| Field | Type | Description |
|---|---|---|
id | string | Schedule id, a slug of the title. |
title | string | Title. Also the fetch command. |
description | string | Description. |
frequency | string | Frequency label. |
next_run | string | Human-readable next-run label, for example in 6h. |
last_run_success | bool | Whether the last run succeeded. |
active | bool | Whether the schedule fires. |
interval_seconds | int64 | Interval the executor uses. |
next_run_unix | int64 | Next due time. 0 when paused. |
last_run | string | Human-readable last-run label, with — failed or — skipped (execution disabled) appended when relevant. |
run_count | int64 | Runs attempted. Skipped runs are not counted. |