# Google Cloud Trace API . projects

## Instance Methods

Returns the traces Resource.

Sends new traces to Stackdriver Trace or updates existing traces. If the ID of a trace that you send matches that of an existing trace, any fields in the existing trace and its spans are overwritten by the provided values, and any new fields provided are merged with the existing trace data. If the ID does not match, a new trace is created.

### Method Details

`patchTraces(projectId, body, x__xgafv=None)`

    Sends new traces to Stackdriver Trace or updates existing traces. If the ID of a trace that you send matches that of an existing trace, any fields in the existing trace and its spans are overwritten by the provided values, and any new fields provided are merged with the existing trace data. If the ID does not match, a new trace is created.

    Args:
      projectId: string, ID of the Cloud project where the trace data is stored. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # List of new or updated traces.
        "traces": [ # List of traces.
          { # A trace describes how long it takes for an application to perform an operation. It consists of a set of spans, each of which represent a single timed event within the operation.
            "projectId": "A String", # Project ID of the Cloud project where the trace data is stored.
            "traceId": "A String", # Globally unique identifier for the trace. This identifier is a 128-bit numeric value formatted as a 32-byte hex string.
            "spans": [ # Collection of spans in the trace.
              { # A span represents a single timed event within a trace. Spans can be nested and form a trace tree. Often, a trace contains a root span that describes the end-to-end latency of an operation and, optionally, one or more subspans for its suboperations. Spans do not need to be contiguous. There may be gaps between spans in a trace.
                "kind": "A String", # Distinguishes between spans generated in a particular context. For example, two spans with the same name may be distinguished using `RPC_CLIENT` and `RPC_SERVER` to identify queueing latency associated with the span.
                "name": "A String", # Name of the trace. The trace name is sanitized and displayed in the Stackdriver Trace tool in the {% dynamic print site_values.console_name %}. The name may be a method name or some other per-call site name. For the same executable and the same call point, a best practice is to use a consistent name, which makes it easier to correlate cross-trace spans.
                "labels": { # Collection of labels associated with the span.
                  "a_key": "A String",
                },
                "parentSpanId": "A String", # ID of the parent span, if any. Optional.
                "startTime": "A String", # Start time of the span in nanoseconds from the UNIX epoch.
                "spanId": "A String", # Identifier for the span. This identifier must be unique within a trace.
                "endTime": "A String", # End time of the span in nanoseconds from the UNIX epoch.
              },
            ],
          },
        ],
      }

      x__xgafv: string, V1 error format.

    Returns:
      An object of the form:

        { # A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`.
      }