nodes: 0, module; 1, function_definition; 2, function_name:list_traces; 3, parameters; 4, block; 5, identifier:self; 6, identifier:project_id; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, default_parameter; 16, expression_statement; 17, comment:# Wrap the transport method to add retry and timeout logic.; 18, if_statement; 19, expression_statement; 20, if_statement; 21, expression_statement; 22, try_statement; 23, expression_statement; 24, return_statement; 25, identifier:view; 26, None; 27, identifier:page_size; 28, None; 29, identifier:start_time; 30, None; 31, identifier:end_time; 32, None; 33, identifier:filter_; 34, None; 35, identifier:order_by; 36, None; 37, identifier:retry; 38, attribute; 39, identifier:timeout; 40, attribute; 41, identifier:metadata; 42, None; 43, comment:"""
          Returns of a list of traces that match the specified filter conditions.
  
          Example:
              >>> from google.cloud import trace_v1
              >>>
              >>> client = trace_v1.TraceServiceClient()
              >>>
              >>> # TODO: Initialize `project_id`:
              >>> project_id = ''
              >>>
              >>> # Iterate over all results
              >>> for element in client.list_traces(project_id):
              ...     # process element
              ...     pass
              >>>
              >>>
              >>> # Alternatively:
              >>>
              >>> # Iterate over results one page at a time
              >>> for page in client.list_traces(project_id).pages:
              ...     for element in page:
              ...         # process element
              ...         pass
  
          Args:
              project_id (str): ID of the Cloud project where the trace data is stored.
              view (~google.cloud.trace_v1.types.ViewType): Type of data returned for traces in the list. Optional. Default is
                  ``MINIMAL``.
              page_size (int): The maximum number of resources contained in the
                  underlying API response. If page streaming is performed per-
                  resource, this parameter does not affect the return value. If page
                  streaming is performed per-page, this determines the maximum number
                  of resources in a page.
              start_time (Union[dict, ~google.cloud.trace_v1.types.Timestamp]): Start of the time interval (inclusive) during which the trace data was
                  collected from the application.
  
                  If a dict is provided, it must be of the same form as the protobuf
                  message :class:`~google.cloud.trace_v1.types.Timestamp`
              end_time (Union[dict, ~google.cloud.trace_v1.types.Timestamp]): End of the time interval (inclusive) during which the trace data was
                  collected from the application.
  
                  If a dict is provided, it must be of the same form as the protobuf
                  message :class:`~google.cloud.trace_v1.types.Timestamp`
              filter_ (str): An optional 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``.
              order_by (str): Field used to sort the returned traces. Optional. Can be one of the
                  following:
  
                  -  ``trace_id``
                  -  ``name`` (``name`` field of root span in the trace)
                  -  ``duration`` (difference between ``end_time`` and ``start_time``
                     fields of the root span)
                  -  ``start`` (``start_time`` 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.
              retry (Optional[google.api_core.retry.Retry]):  A retry object used
                  to retry requests. If ``None`` is specified, requests will not
                  be retried.
              timeout (Optional[float]): The amount of time, in seconds, to wait
                  for the request to complete. Note that if ``retry`` is
                  specified, the timeout applies to each individual attempt.
              metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
                  that is provided to the method.
  
          Returns:
              A :class:`~google.gax.PageIterator` instance. By default, this
              is an iterable of :class:`~google.cloud.trace_v1.types.Trace` instances.
              This object can also be configured to iterate over the pages
              of the response through the `options` parameter.
  
          Raises:
              google.api_core.exceptions.GoogleAPICallError: If the request
                      failed for any reason.
              google.api_core.exceptions.RetryError: If the request failed due
                      to a retryable error and retry attempts failed.
              ValueError: If the parameters are invalid.
          """; 44, comparison_operator:"list_traces" not in self._inner_api_calls; 45, block; 46, assignment; 47, comparison_operator:metadata is None; 48, block; 49, assignment; 50, block; 51, except_clause; 52, else_clause; 53, assignment; 54, identifier:iterator; 55, attribute; 56, identifier:DEFAULT; 57, attribute; 58, identifier:DEFAULT; 59, string:"list_traces"; 60, attribute; 61, expression_statement; 62, identifier:request; 63, call; 64, identifier:metadata; 65, None; 66, expression_statement; 67, identifier:metadata; 68, call; 69, expression_statement; 70, identifier:AttributeError; 71, block; 72, block; 73, identifier:iterator; 74, call; 75, attribute; 76, identifier:method; 77, attribute; 78, identifier:method; 79, identifier:self; 80, identifier:_inner_api_calls; 81, assignment; 82, attribute; 83, argument_list; 84, assignment; 85, identifier:list; 86, argument_list; 87, assignment; 88, pass_statement; 89, expression_statement; 90, expression_statement; 91, attribute; 92, argument_list; 93, attribute; 94, identifier:gapic_v1; 95, attribute; 96, identifier:gapic_v1; 97, subscript; 98, call; 99, identifier:trace_pb2; 100, identifier:ListTracesRequest; 101, keyword_argument; 102, keyword_argument; 103, keyword_argument; 104, keyword_argument; 105, keyword_argument; 106, keyword_argument; 107, keyword_argument; 108, identifier:metadata; 109, list; 110, identifier:metadata; 111, identifier:routing_header; 112, list; 113, assignment; 114, call; 115, attribute; 116, identifier:GRPCIterator; 117, keyword_argument; 118, keyword_argument; 119, keyword_argument; 120, keyword_argument; 121, keyword_argument; 122, keyword_argument; 123, identifier:google; 124, identifier:api_core; 125, identifier:google; 126, identifier:api_core; 127, attribute; 128, string:"list_traces"; 129, attribute; 130, argument_list; 131, identifier:project_id; 132, identifier:project_id; 133, identifier:view; 134, identifier:view; 135, identifier:page_size; 136, identifier:page_size; 137, identifier:start_time; 138, identifier:start_time; 139, identifier:end_time; 140, identifier:end_time; 141, identifier:filter; 142, identifier:filter_; 143, identifier:order_by; 144, identifier:order_by; 145, tuple; 146, identifier:routing_metadata; 147, call; 148, attribute; 149, argument_list; 150, attribute; 151, identifier:page_iterator; 152, identifier:client; 153, None; 154, identifier:method; 155, call; 156, identifier:request; 157, identifier:request; 158, identifier:items_field; 159, string:"traces"; 160, identifier:request_token_field; 161, string:"page_token"; 162, identifier:response_token_field; 163, string:"next_page_token"; 164, identifier:self; 165, identifier:_inner_api_calls; 166, attribute; 167, identifier:wrap_method; 168, attribute; 169, keyword_argument; 170, keyword_argument; 171, keyword_argument; 172, string:"project_id"; 173, identifier:project_id; 174, attribute; 175, argument_list; 176, identifier:metadata; 177, identifier:append; 178, identifier:routing_metadata; 179, identifier:google; 180, identifier:api_core; 181, attribute; 182, argument_list; 183, attribute; 184, identifier:method; 185, attribute; 186, identifier:list_traces; 187, identifier:default_retry; 188, attribute; 189, identifier:default_timeout; 190, attribute; 191, identifier:client_info; 192, attribute; 193, attribute; 194, identifier:to_grpc_metadata; 195, identifier:routing_header; 196, identifier:functools; 197, identifier:partial; 198, subscript; 199, keyword_argument; 200, keyword_argument; 201, keyword_argument; 202, attribute; 203, identifier:gapic_v1; 204, identifier:self; 205, identifier:transport; 206, subscript; 207, identifier:retry; 208, subscript; 209, identifier:timeout; 210, identifier:self; 211, identifier:_client_info; 212, attribute; 213, identifier:routing_header; 214, attribute; 215, string:"list_traces"; 216, identifier:retry; 217, identifier:retry; 218, identifier:timeout; 219, identifier:timeout; 220, identifier:metadata; 221, identifier:metadata; 222, identifier:google; 223, identifier:api_core; 224, attribute; 225, string:"ListTraces"; 226, attribute; 227, string:"ListTraces"; 228, attribute; 229, identifier:gapic_v1; 230, identifier:self; 231, identifier:_inner_api_calls; 232, identifier:self; 233, identifier:_method_configs; 234, identifier:self; 235, identifier:_method_configs; 236, identifier:google; 237, identifier:api_core
code: def list_traces(
          self,
          project_id,
          view=None,
          page_size=None,
          start_time=None,
          end_time=None,
          filter_=None,
          order_by=None,
          retry=google.api_core.gapic_v1.method.DEFAULT,
          timeout=google.api_core.gapic_v1.method.DEFAULT,
          metadata=None,
      ):
          """
          Returns of a list of traces that match the specified filter conditions.
  
          Example:
              >>> from google.cloud import trace_v1
              >>>
              >>> client = trace_v1.TraceServiceClient()
              >>>
              >>> # TODO: Initialize `project_id`:
              >>> project_id = ''
              >>>
              >>> # Iterate over all results
              >>> for element in client.list_traces(project_id):
              ...     # process element
              ...     pass
              >>>
              >>>
              >>> # Alternatively:
              >>>
              >>> # Iterate over results one page at a time
              >>> for page in client.list_traces(project_id).pages:
              ...     for element in page:
              ...         # process element
              ...         pass
  
          Args:
              project_id (str): ID of the Cloud project where the trace data is stored.
              view (~google.cloud.trace_v1.types.ViewType): Type of data returned for traces in the list. Optional. Default is
                  ``MINIMAL``.
              page_size (int): The maximum number of resources contained in the
                  underlying API response. If page streaming is performed per-
                  resource, this parameter does not affect the return value. If page
                  streaming is performed per-page, this determines the maximum number
                  of resources in a page.
              start_time (Union[dict, ~google.cloud.trace_v1.types.Timestamp]): Start of the time interval (inclusive) during which the trace data was
                  collected from the application.
  
                  If a dict is provided, it must be of the same form as the protobuf
                  message :class:`~google.cloud.trace_v1.types.Timestamp`
              end_time (Union[dict, ~google.cloud.trace_v1.types.Timestamp]): End of the time interval (inclusive) during which the trace data was
                  collected from the application.
  
                  If a dict is provided, it must be of the same form as the protobuf
                  message :class:`~google.cloud.trace_v1.types.Timestamp`
              filter_ (str): An optional 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``.
              order_by (str): Field used to sort the returned traces. Optional. Can be one of the
                  following:
  
                  -  ``trace_id``
                  -  ``name`` (``name`` field of root span in the trace)
                  -  ``duration`` (difference between ``end_time`` and ``start_time``
                     fields of the root span)
                  -  ``start`` (``start_time`` 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.
              retry (Optional[google.api_core.retry.Retry]):  A retry object used
                  to retry requests. If ``None`` is specified, requests will not
                  be retried.
              timeout (Optional[float]): The amount of time, in seconds, to wait
                  for the request to complete. Note that if ``retry`` is
                  specified, the timeout applies to each individual attempt.
              metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
                  that is provided to the method.
  
          Returns:
              A :class:`~google.gax.PageIterator` instance. By default, this
              is an iterable of :class:`~google.cloud.trace_v1.types.Trace` instances.
              This object can also be configured to iterate over the pages
              of the response through the `options` parameter.
  
          Raises:
              google.api_core.exceptions.GoogleAPICallError: If the request
                      failed for any reason.
              google.api_core.exceptions.RetryError: If the request failed due
                      to a retryable error and retry attempts failed.
              ValueError: If the parameters are invalid.
          """
          # Wrap the transport method to add retry and timeout logic.
          if "list_traces" not in self._inner_api_calls:
              self._inner_api_calls[
                  "list_traces"
              ] = google.api_core.gapic_v1.method.wrap_method(
                  self.transport.list_traces,
                  default_retry=self._method_configs["ListTraces"].retry,
                  default_timeout=self._method_configs["ListTraces"].timeout,
                  client_info=self._client_info,
              )
  
          request = trace_pb2.ListTracesRequest(
              project_id=project_id,
              view=view,
              page_size=page_size,
              start_time=start_time,
              end_time=end_time,
              filter=filter_,
              order_by=order_by,
          )
          if metadata is None:
              metadata = []
          metadata = list(metadata)
          try:
              routing_header = [("project_id", project_id)]
          except AttributeError:
              pass
          else:
              routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
                  routing_header
              )
              metadata.append(routing_metadata)
  
          iterator = google.api_core.page_iterator.GRPCIterator(
              client=None,
              method=functools.partial(
                  self._inner_api_calls["list_traces"],
                  retry=retry,
                  timeout=timeout,
                  metadata=metadata,
              ),
              request=request,
              items_field="traces",
              request_token_field="page_token",
              response_token_field="next_page_token",
          )
          return iterator