Skip to main content

http_metrics

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

Overview​

Namehttp_metrics
TypeResource
Idrailway.observability.http_metrics

Fields​

The following fields are returned by SELECT queries:

One row per HttpMetricsSample. A single sample of an HTTP metric.

NameDatatypeDescription
tsintegerThe timestamp of the sample. Represented as number of seconds since the Unix epoch.
valuenumberThe value of the sample (count of requests).

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectend_date, environment_id, service_id, start_datemethod, path, status_code, step_secondsGet HTTP request metrics for a service. Backed by the Railway GraphQL query httpMetrics.

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)The end of the period to get metrics for.
environment_idstring
service_idstring
start_datestring (date-time)The start of the period to get metrics for.
methodstringFilter by HTTP method (e.g., GET, POST).
pathstringFilter by request path.
status_codeintegerFilter by HTTP status code (e.g., 200, 404, 500).
step_secondsintegerThe frequency of data points in the response. If the stepSeconds is 60, then the response will contain one data point per minute.

SELECT examples​

Get HTTP request metrics for a service. Backed by the Railway GraphQL query httpMetrics.

SELECT
ts,
value
FROM railway.observability.http_metrics
WHERE end_date = '{{ end_date }}' -- required
AND environment_id = '{{ environment_id }}' -- required
AND service_id = '{{ service_id }}' -- required
AND start_date = '{{ start_date }}' -- required
AND method = '{{ method }}'
AND path = '{{ path }}'
AND status_code = '{{ status_code }}'
AND step_seconds = '{{ step_seconds }}'
;