PutTraceSegments - AWS X-Ray (original) (raw)

Uploads segment documents to AWS X-Ray. A segment document can be a completed segment, an in-progress segment, or an array of subsegments.

Segments must include the following fields. For the full segment document schema, seeAWS X-Ray Segment Documents in the AWS X-Ray Developer Guide.

Required segment document fields

A trace_id consists of three numbers separated by hyphens. For example, 1-58406520-a006649127e371903a2de979. For trace IDs created by an X-Ray SDK, or by AWS services integrated with X-Ray, a trace ID includes:

Trace ID Format
Note

Trace IDs created via OpenTelemetry have a different format based on the W3C Trace Context specification. A W3C trace ID must be formatted in the X-Ray trace ID format when sending to X-Ray. For example, a W3C trace ID 4efaaf4d1e8720b39541901950019ee5 should be formatted as 1-4efaaf4d-1e8720b39541901950019ee5 when sending to X-Ray. While X-Ray trace IDs include the original request timestamp in Unix epoch time, this is not required or validated.

Request Syntax

POST /TraceSegments HTTP/1.1
Content-type: application/json

{
   "TraceSegmentDocuments": [ "string" ]
}

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.

TraceSegmentDocuments

A string containing a JSON document defining one or more segments or subsegments.

Type: Array of strings

Required: Yes

Response Syntax

HTTP/1.1 200
Content-type: application/json

{
   "UnprocessedTraceSegments": [ 
      { 
         "ErrorCode": "string",
         "Id": "string",
         "Message": "string"
      }
   ]
}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

Errors

For information about the errors that are common to all actions, see Common Errors.

InvalidRequestException

The request is missing required parameters or has invalid parameters.

HTTP Status Code: 400

ThrottledException

The request exceeds the maximum number of requests per second.

HTTP Status Code: 429

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: