Search Traces

SigNoz Cloud - This page applies to SigNoz Cloud editions.
Self-Host - This page applies to self-hosted SigNoz editions.

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= hotrod
  • http_method= GET
  • has_error = true

Attributes and Columns

  • Resource Attribute: deployment_name
  • Tag Attributes + Columns: http_method, has_error
  • Selected Columns: service.name, http_method, response_status_code, http_url

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,
    "requestType": "raw",
    "variables": {},
    "compositeQuery": {
        "queries": [
            {
                "type": "builder_query",
                "spec": {
                    "name": "A",
                    "signal": "traces",
                    "filter": {
                        "expression": "deployment_name = 'hotrod' AND http_method = 'GET' AND has_error = true"
                    },
                    "selectFields": [
                        {
                            "name": "service.name",
                            "fieldContext": "resource"
                        },
                        {
                            "name": "http_method",
                            "fieldContext": "span"
                        },
                        {
                            "name": "response_status_code",
                            "fieldContext": "span"
                        },
                        {
                            "name": "http_url",
                            "fieldContext": "span"
                        }
                    ],
                    "order": [
                        {
                            "key": {
                                "name": "timestamp"
                            },
                            "direction": "desc"
                        }
                    ],
                    "limit": 10,
                    "offset": 0,
                    "disabled": false
                }
            }
        ]
    }
}

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= hotrod
  • http_method= GET

Attributes and Columns

  • Resource Attribute: deployment_name
  • Tag Attributes + Columns: http_method
  • Selected Columns: service.name, http_method, response_status_code, some_custom_tag

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,
    "requestType": "raw",
    "variables": {},
    "compositeQuery": {
        "queries": [
            {
                "type": "builder_query",
                "spec": {
                    "name": "A",
                    "signal": "traces",
                    "filter": {
                        "expression": "deployment_name = 'hotrod' AND http_method = 'GET' AND parent_span_id = ''"
                    },
                    "selectFields": [
                        {
                            "name": "service.name",
                            "fieldContext": "resource"
                        },
                        {
                            "name": "http_method",
                            "fieldContext": "span"
                        },
                        {
                            "name": "response_status_code",
                            "fieldContext": "span"
                        },
                        {
                            "name": "some_custom_tag"
                        }
                    ],
                    "order": [
                        {
                            "key": {
                                "name": "timestamp"
                            },
                            "direction": "desc"
                        }
                    ],
                    "limit": 10,
                    "offset": 0,
                    "disabled": false
                }
            }
        ]
    }
}

Is this page helpful

Last updated—June 27, 2026

Edit on GitHub