Method: projects.traces.list

Returns a list of traces that match the specified filter conditions.

HTTP request

GET https://cloudtrace.googleapis.com/v1/projects/{projectId}/traces

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
projectId

string

Required. ID of the Cloud project where the trace data is stored.

Authorization requires the following IAM permission on the specified resource projectId:

  • cloudtrace.traces.list

Query parameters

Parameters
view

enum (ViewType)

Optional. Type of data returned for traces in the list. Default is MINIMAL.

pageSize

integer

Optional. Maximum number of traces to return. If not specified or <= 0, the implementation selects a reasonable value. The implementation may return fewer traces than the requested page size.

pageToken

string

Token identifying the page of results to return. If provided, use the value of the nextPageToken field from a previous request.

startTime

string (Timestamp format)

Start of the time interval (inclusive) during which the trace data was collected from the application.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

endTime

string (Timestamp format)

End of the time interval (inclusive) during which the trace data was collected from the application.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

filter

string

Optional. A filter against labels for the request.

By default, searches use prefix matching. To specify exact match, prepend a plus symbol (+) to the search term. Multiple terms are ANDed. Syntax:

  • root:NAME_PREFIX or NAME_PREFIX: Return traces where any root span starts with NAME_PREFIX.
  • +root:NAME or +NAME: Return traces where any root span's name is exactly NAME.
  • span:NAME_PREFIX: Return traces where any span starts with NAME_PREFIX.
  • +span:NAME: Return traces where any span's name is exactly NAME.
  • latency:DURATION: Return traces whose overall latency is greater or equal to than DURATION. Accepted units are nanoseconds (ns), milliseconds (ms), and seconds (s). Default is ms. For example, latency:24ms returns traces whose overall latency is greater than or equal to 24 milliseconds.
  • label:LABEL_KEY: Return all traces containing the specified label key (exact match, case-sensitive) regardless of the key:value pair's value (including empty values).
  • LABEL_KEY:VALUE_PREFIX: Return all traces containing the specified label key (exact match, case-sensitive) whose value starts with VALUE_PREFIX. Both a key and a value must be specified.
  • +LABEL_KEY:VALUE: Return all traces containing a key:value pair exactly matching the specified text. Both a key and a value must be specified.
  • method:VALUE: Equivalent to /http/method:VALUE.
  • url:VALUE: Equivalent to /http/url:VALUE.
orderBy

string

Optional. Field used to sort the returned traces. Can be one of the following:

  • traceId
  • name (name field of root span in the trace)
  • duration (difference between endTime and startTime fields of the root span)
  • start (startTime field of the root span)

Descending order can be specified by appending desc to the sort field (for example, name desc).

Only one sort field is permitted.

Request body

The request body must be empty.

Response body

If successful, the response body contains data with the following structure:

The response message for the traces.list method.

JSON representation
{
  "traces": [
    {
      object (Trace)
    }
  ],
  "nextPageToken": string
}
Fields
traces[]

object (Trace)

List of trace records as specified by the view parameter.

nextPageToken

string

If defined, indicates that there are more traces that match the request and that this value should be passed to the next request to continue retrieving additional traces.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/trace.readonly
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

ViewType

Type of data returned for traces in the list.

Enums
VIEW_TYPE_UNSPECIFIED Default is MINIMAL if unspecified.
MINIMAL Minimal view of the trace record that contains only the project and trace IDs.
ROOTSPAN Root span view of the trace record that returns the root spans along with the minimal trace data.
COMPLETE Complete view of the trace record that contains the actual trace data. This is equivalent to calling the REST get or RPC traces.get method using the ID of each listed trace.