Skip to main content

traces

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

Overview​

Nametraces
TypeResource
Idrailway.observability.traces

Fields​

The following fields are returned by SELECT queries:

One row per TraceSummary. One trace of an environment: the request as a whole, summarised from its spans.

NameDatatypeDescription
root_service_idstringRailway service the root span belongs to
trace_idstringW3C trace id, 32 lower-case hex characters
root_service_namestringThe root span's service.name
root_span_namestringName of the root span, or of the earliest span when the root is missing
service_namestringservice.name of the earliest span a service exported; null when the request never reached one
duration_msnumberFrom the earliest span start to the latest span end
error_countintegerSpans with an error status
has_edgebooleanWhether the edge exported any span of the trace
root_componentstringWhich hop exported the root span: edge (hikari), proxy (tcp-proxy) or service
root_server_addressstringThe root span's server.address, when it set one
root_url_pathstringThe root span's url.path, when it set one
span_countinteger
started_atstringStart of the earliest span (ISO timestamp)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectenvironment_idend_date, filter, service_id, start_dateTraces of an environment with at least one span matching the filter, newest first. Backed by the Railway GraphQL query traces. A SQL LIMIT is pushed down to the limit argument.

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
environment_idstring
end_datestringLatest span start to consider (ISO); defaults to now.
filterstringFilter expression over spans, e.g. @status:error @component:edge @duration:>500 @http.route:/api/users. Built-in fields: trace, span, name, serviceName, service, deployment, replica, component, kind, status, duration (ms). Any other @key looks the key up in the span and resource attributes; free text matches the span name. Prefix a term with - to exclude it.
service_idstringOnly traces with a span from this Railway service (optional).
start_datestringOldest span start to consider (ISO). Clamped to the project's retention; defaults to one hour ago.

SELECT examples​

Traces of an environment with at least one span matching the filter, newest first. Backed by the Railway GraphQL query traces. A SQL LIMIT is pushed down to the limit argument.

SELECT
root_service_id,
trace_id,
root_service_name,
root_span_name,
service_name,
duration_ms,
error_count,
has_edge,
root_component,
root_server_address,
root_url_path,
span_count,
started_at
FROM railway.observability.traces
WHERE environment_id = '{{ environment_id }}' -- required
AND end_date = '{{ end_date }}'
AND filter = '{{ filter }}'
AND service_id = '{{ service_id }}'
AND start_date = '{{ start_date }}'
;