Skip to main content

Examples

Query examples from trivial to advanced. These showcase ROSQL's unique robotics-native features — things that would take pages of SQL, ROSQL expresses in a single line.

Find the navigation action that failed

Start any investigation by finding which action failed. Filter the traces data source by status and action name.

FROM traces WHERE status = 'ERROR' AND action_name = '/navigate_to_pose'

Cross-signal correlation: failures during low battery

The DURING() clause correlates two data sources by time. Here we find navigation failures that occurred while battery percentage was critically low — combining a trace query with a topic message query in a single statement.

SELECT trace_id, span_name_col, service_name, duration, status_code, span_attributes
FROM traces
WHERE status = 'ERROR' AND action_name = '/navigate_to_pose'
DURING(
FROM topics WHERE topic_name = '/battery_state'
AND fields['percentage'] < 15
)
SINCE 6 hours ago

💡 DURING() is ROSQL's most powerful feature. It replaces complex multi-table JOINs with a single, readable clause.

Trace the full message causality chain

MESSAGE JOURNEY walks parent_span_id → span_id recursively and returns every span in the causality tree. This reveals exactly which nodes were involved and in what order — something plain SQL has no primitive for.

MESSAGE JOURNEY FOR TRACE 'a3f1c9d2e8b04f7a'

💡 Requires ParentSpanId to be set correctly in your OTel instrumentation. See Schema Reference for details.

Find all message paths for a topic

MESSAGE PATHS reveals which nodes published and subscribed to a given topic. Useful for understanding your robot's communication graph.

MESSAGE PATHS FOR TOPIC '/cmd_vel'

Robot health assessment

HEALTH() fans out across traces, logs, and metrics to produce a composite health assessment for a robot. Combines error rates, log severity counts, and metric status into a single result.

HEALTH() FOR ROBOT 'robot_sim_001'

Detect path deviation

PATH DEVIATION queries /odom trajectory data to detect if a robot deviated from its planned path. Requires topic_messages table with /odom data.

PATH DEVIATION FOR ROBOT 'robot_sim_001'

Find the MCAP recording for a failure

SHOW RECORDING returns the MCAP recording metadata (S3 key, time range, topics) that covers the most recent event window. Use this to quickly find recordings for replay.

SHOW RECORDING

Statistical anomaly detection

ANOMALY() uses z-score analysis (AVG/STDDEV) to find outlier spans — those whose duration deviates significantly from the mean. Surfaces latency spikes without needing a fixed threshold.

ANOMALY(duration)

Pipeline syntax: slow errors grouped by robot

Pipeline syntax uses | to chain stages, making multi-step queries readable at a glance. Each stage filters or transforms the output of the previous one.

FROM traces
| WHERE duration > 500 ms
| WHERE status = 'ERROR'
| FACET robot_id

Compare navigation failures to last week

COMPARE TO shows current and baseline counts side by side. Instantly see if error rates are trending up or down relative to a historical baseline.

FROM traces
| WHERE action_name = '/navigate_to_pose'
| WHERE status = 'ERROR'
| FACET robot_id
| COMPARE TO last week

Ready to try these against your own data?

Quickstart →