Skip to main content

project_service_usage

Creates, updates, deletes, gets or lists a project_service_usage resource.

Overview​

Nameproject_service_usage
TypeResource
Idrailway.billing.project_service_usage

Fields​

The following fields are returned by SELECT queries:

One row per AggregatedUsage. The aggregated usage of a single measurement.

NameDatatypeDescription
measurementstringThe measurement that was aggregated. (AGENT_CACHE_READ_TOKENS, AGENT_CACHE_WRITE_TOKENS, AGENT_INPUT_TOKENS, AGENT_OUTPUT_TOKENS, AGENT_SPEND_USD, BACKUP_USAGE_GB, CPU_LIMIT, CPU_USAGE, CPU_USAGE_2, DISK_USAGE_GB, EPHEMERAL_DISK_USAGE_GB, MEASUREMENT_UNSPECIFIED, MEMORY_LIMIT_GB, MEMORY_USAGE_GB, NETWORK_RX_GB, NETWORK_TX_GB, UNRECOGNIZED)
tagsobjectThe tags that were used to group the metric. Only the tags that were used in the groupBy will be present.
valuenumberThe aggregated value.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectend_date, measurements, start_date, workspace_idinclude_deletedGet paginated usage grouped by project and service for a workspace. Backed by the Railway GraphQL query projectServiceUsage.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
end_datestring (date-time)
measurementsstringGraphQL list literal of MetricMeasurement values, for example [AGENT_CACHE_READ_TOKENS, AGENT_CACHE_WRITE_TOKENS].
start_datestring (date-time)
workspace_idstring
include_deletedbooleanWhether to include deleted projects in usage.

SELECT examples​

Get paginated usage grouped by project and service for a workspace. Backed by the Railway GraphQL query projectServiceUsage.

SELECT
measurement,
tags,
value
FROM railway.billing.project_service_usage
WHERE end_date = '{{ end_date }}' -- required
AND measurements = '{{ measurements }}' -- required
AND start_date = '{{ start_date }}' -- required
AND workspace_id = '{{ workspace_id }}' -- required
AND include_deleted = '{{ include_deleted }}'
;