Search Traces
This section provides detailed examples of searching traces using the SigNoz Trace API. The example queries demonstrate querying traces with specific attributes and filters.
Searching All Spans
This query is useful when identifying all spans with specific characteristics, such as method type or error status.
Query Description
This query searches for all spans where:
deployment_name
= hotrodhttpMethod
= GEThasError
= true
Attributes and Columns
- Resource Attribute:
deployment_name
- Tag Attributes + Columns:
httpMethod
,hasError
- Selected Columns:
serviceName
,httpMethod
,responseStatusCode
,httpUrl
You can specify the start and end timestamps in Unix format (milliseconds).
Sample Payload
This is the JSON payload for the example query.
{
"start": 1702009280000,
"end": 1702011080000,
"step": 60,
"variables": {},
"compositeQuery": {
"queryType": "builder",
"panelType": "list",
"builderQueries": {
"A": {
"dataSource": "traces",
"queryName": "A",
"aggregateOperator": "noop",
"aggregateAttribute": {},
"filters": {
"items": [
{
"key": {
"key": "deployment_name",
"dataType": "string",
"type": "resource",
"isColumn": false
},
"op": "=",
"value": "hotrod"
},
{
"key": {
"key": "httpMethod",
"dataType": "string",
"type": "tag",
"isColumn": true
},
"op": "=",
"value": "GET"
},
{
"key": {
"key": "hasError",
"dataType": "bool",
"type": "tag",
"isColumn": true
},
"op": "=",
"value": "true"
}
],
"op": "AND"
},
"expression": "A",
"disabled": false,
"having": [],
"stepInterval": 60,
"limit": 10,
"orderBy": [
{
"columnName": "timestamp",
"order": "desc"
}
],
"groupBy": [],
"legend": "",
"reduceTo": "sum",
"offset": 0,
"selectColumns": [
{
"key": "serviceName",
"dataType": "string",
"type": "tag",
"isColumn": true
},
{
"key": "httpMethod",
"dataType": "string",
"type": "tag",
"isColumn": true
},
{
"key": "responseStatusCode",
"dataType": "string",
"type": "tag",
"isColumn": true
},
{
"key": "httpUrl",
"dataType": "string",
"type": "tag",
"isColumn": true
}
]
}
}
},
"dataSource": "traces"
}
Searching Root Spans
This type of query can be useful to find the initial operation or root spans in a set of traces, which can be crucial for tracing the origin of an issue.
Query Description
This query searches for root spans with:
deployment_name
= hotrodhttpMethod
= GET
Attributes and Columns
- Resource Attribute:
deployment_name
- Tag Attributes + Columns:
httpMethod
- Selected Columns:
serviceName
,httpMethod
,responseStatusCode
,some_custom_tag
You can specify the start and end timestamps in Unix format (milliseconds).
To search for root spans, you need to add parentSpanID
value to ""
in filters
Sample Payload
This is the JSON payload for the example query.
{
"start": 1702009280000,
"end": 1702011080000,
"step": 60,
"variables": {},
"compositeQuery": {
"queryType": "builder",
"panelType": "list",
"builderQueries": {
"A": {
"dataSource": "traces",
"queryName": "A",
"aggregateOperator": "noop",
"aggregateAttribute": {},
"filters": {
"items": [
{
"key": {
"key": "deployment_name",
"dataType": "string",
"type": "resource",
"isColumn": false
},
"op": "=",
"value": "hotrod"
},
{
"key": {
"key": "httpMethod",
"dataType": "string",
"type": "tag",
"isColumn": true
},
"op": "=",
"value": "GET"
},
{
"key": {
"key": "parentSpanID",
"dataType": "string",
"type": "tag",
"isColumn": true
},
"op": "=",
"value": ""
}
],
"op": "AND"
},
"expression": "A",
"disabled": false,
"having": [],
"stepInterval": 60,
"limit": 10,
"orderBy": [
{
"columnName": "timestamp",
"order": "desc"
}
],
"groupBy": [],
"legend": "",
"reduceTo": "sum",
"offset": 0,
"selectColumns": [
{
"key": "serviceName",
"dataType": "string",
"type": "tag",
"isColumn": true
},
{
"key": "httpMethod",
"dataType": "string",
"type": "tag",
"isColumn": true
},
{
"key": "responseStatusCode",
"dataType": "string",
"type": "tag",
"isColumn": true
},
{
"key": "some_custom_tag",
"dataType": "string",
"type": "tag",
"isColumn": false
}
]
}
}
},
"dataSource": "traces"
}