Loading...
Loading...
Query and analyze distributed traces and spans using DataPrime syntax. Use this skill whenever the user wants to investigate request latency, find slow operations, debug service-to-service calls, look up a trace ID, analyze span durations, check error spans, examine distributed traces, investigate OpenTelemetry/Jaeger tracing data, or query Coralogix spans in any way - even if they don't explicitly mention "DataPrime" or "cx spans".
npx skill4agent add coralogix/cx-cli cx-query-spanscx spanstraceID$m.*$l.*$d.*traceIDspanIDparentSpanID$dcx spans '<dataprime_query>'source spans| Flag | Default | Description |
|---|---|---|
| | Start time (ISO 8601 or relative, e.g. |
| | End time |
| | Maximum number of results |
| | Storage tier: |
| | Output format: |
| Field | Description |
|---|---|
| Span start timestamp |
| Span duration in microseconds (see Duration Units) |
| Application name - highest-level label. Meaning varies by customer (environment, team, region) but it always exists. |
| Subsystem name - second-level label. Typically maps to a component. |
| Service name - the logical service unit emitting the span. |
| Operation name - the span title (e.g. "POST /checkout", "db.query"). |
| Trace ID - groups spans into a single trace. |
| Unique span identifier. |
| Parent span ID (empty string for root spans). |
| Application-specific tags and attributes (see Field Discovery). |
Note on label fields: The meaning ofand$l.applicationNamevaries by customer - they may represent environments, teams, regions, or something else entirely. Don't assume what they map to. Use$l.subsystemNameor sample queries to verify actual values.cx search-fields
$m.duration500000100000060000000# Computed field for milliseconds
create latency_ms from $m.duration / 1000$m.severity$d.tags.error == true$d.http.status_code$d.grpc.status_code$d.tags.error-o jsoncx spans "filter \$l.serviceName == 'api'" --limit 5 -o json# Get all spans for a trace
cx spans "filter \$d.traceID == '4f6a8f3c2e8a1b97'"
# Find spans for a service
cx spans "filter \$l.serviceName == 'checkout-service'"
# Find slow spans (> 1 second)
cx spans 'filter $m.duration > 1000000'
# Find error spans
cx spans 'filter $d.tags.error == true'
# Aggregate latency by operation
cx spans 'groupby $l.operationName aggregate avg($m.duration) as avg_latency | orderby avg_latency desc'
# Wider time range
cx spans "filter \$l.serviceName == 'api'" --start now-6hwildfindcx spans "wildfind 'connection refused'"filtercx search-fieldsTip:can also serve as a last-resort field discovery method - whenwildfinddoesn't find what you need, runcx search-fieldswith a known value, then inspect the matching spans to see which fields contain it.wildfind
$m.duration$l.serviceName$l.operationName$d.traceID$d.*cx search-fields "customer identifier" --dataset spans
cx search-fields "order ID" --dataset spans
cx search-fields "http response code" --dataset spanscx search-fieldscx spans "filter \$l.serviceName == 'api'" --limit 5 -o json--start now-6h--start now-24h-o json--tier archive --start now-30dcx-dataprimecx dataprime list # List all commands and functions
cx dataprime show filter # Detailed help for a specific commandcx-metrics-querycx-query-logscx-telemetry-querying