Skip to content

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

ServiceRPCKindPurpose
MeteringServiceGetResourceUsageUnaryCU consumed by the caller’s tenant
MeteringServiceGetComputeBudgetUnaryRead the dedicated CU budget
MeteringServiceSetComputeBudgetUnarySet the dedicated CU budget to an absolute value
SchedulesServiceListSchedulesUnaryList schedules
SchedulesServiceCreateScheduleUnaryCreate an active schedule
SchedulesServiceUpdateScheduleUnaryReplace a schedule’s title, description and frequency
SchedulesServiceSetScheduleActiveUnaryPause or resume a schedule
SchedulesServiceDeleteScheduleUnaryDelete 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

FieldTypeDescription
instance_idstringAccepted but not used for scoping. See usage_scope.

Response: GetResourceUsageResponse

FieldTypeDescription
compute_unitsdoubleCU consumed by the tenant’s fetch runs.
data_unitsdoubleNot metered. Always 0. See unmeasured_reason.
estimated_costdoubleNot metered. Always 0. See unmeasured_reason.
unmeasured_reasonstringNon-empty exactly when a numeric field above is not a real measurement. Show it in place of those numbers.
usage_scopestringThe 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

FieldTypeDescription
instance_idstringAccepted but not used for scoping. The budget is the tenant’s.

Response: ComputeBudgetResponse

FieldTypeDescription
instance_idstringThe budget key actually used, which is the tenant id.
dedicated_compute_unitsdoubleThe dedicated CU allotment.
consumed_compute_unitsdoubleCU consumed by fetch runs.
remaining_compute_unitsdoublededicated - consumed, never below 0.

SetComputeBudget

rpc SetComputeBudget(SetComputeBudgetRequest) returns (ComputeBudgetResponse);
  • Kind: Unary.
  • Auth: Bearer session. ROLE_READER is refused.
  • Errors: PERMISSION_DENIED for a reader. INVALID_ARGUMENT if dedicated_compute_units is 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

FieldTypeDescription
instance_idstringAccepted but not used for scoping. The budget is the tenant’s.
dedicated_compute_unitsdoubleThe new allotment. Must be 0 or more.
idempotency_keystringOptional. Resending the key of the last applied set leaves the budget unchanged.

Response

ComputeBudgetResponse.

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.

Firing a schedule runs a real fetch only when the operator has enabled scheduled execution on the deployment. Otherwise each due run is recorded as <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 containsInterval
6 hour6 hours
hour1 hour
dail or day1 day
week1 week
month30 days
custom1 day
anything else, or empty1 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

FieldTypeDescription
schedulesrepeated ScheduleAll schedules.

CreateSchedule

rpc CreateSchedule(CreateScheduleRequest) returns (Schedule);
  • Kind: Unary.
  • Auth: Bearer session.
  • Errors: INVALID_ARGUMENT if title is 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

FieldTypeDescription
titlestringRequired. Also the fetch command the schedule runs.
descriptionstringFree-text description.
frequencystringInterval text. See Frequency.

Response

The created Schedule.

UpdateSchedule

rpc UpdateSchedule(UpdateScheduleRequest) returns (Schedule);
  • Kind: Unary.
  • Auth: Bearer session.
  • Errors: INVALID_ARGUMENT if title is empty. NOT_FOUND if no schedule has id.

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

FieldTypeDescription
idstringThe schedule to edit.
titlestringRequired. New title.
descriptionstringNew description. Replaces the old one.
frequencystringNew interval text. Empty keeps the current frequency.

Response

The updated Schedule.

SetScheduleActive

rpc SetScheduleActive(SetScheduleActiveRequest) returns (Schedule);
  • Kind: Unary.
  • Auth: Bearer session.
  • Errors: NOT_FOUND if no schedule has id.

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

FieldTypeDescription
idstringThe schedule.
activebooltrue 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

FieldTypeDescription
idstringThe schedule to delete.

Response: DeleteScheduleResponse

FieldTypeDescription
successbooltrue if a schedule was deleted.

Messages

Schedule

FieldTypeDescription
idstringSchedule id, a slug of the title.
titlestringTitle. Also the fetch command.
descriptionstringDescription.
frequencystringFrequency label.
next_runstringHuman-readable next-run label, for example in 6h.
last_run_successboolWhether the last run succeeded.
activeboolWhether the schedule fires.
interval_secondsint64Interval the executor uses.
next_run_unixint64Next due time. 0 when paused.
last_runstringHuman-readable last-run label, with — failed or — skipped (execution disabled) appended when relevant.
run_countint64Runs attempted. Skipped runs are not counted.