startTraceRetrieval method

Future<StartTraceRetrievalResult> startTraceRetrieval({
  1. required DateTime endTime,
  2. required DateTime startTime,
  3. required List<String> traceIds,
})

Initiates a trace retrieval process using the specified time range and for the given trace IDs in the Transaction Search generated CloudWatch log group. For more information, see Transaction Search.

API returns a RetrievalToken, which can be used with ListRetrievedTraces or GetRetrievedTracesGraph to fetch results. Retrievals will time out after 60 minutes. To execute long time ranges, consider segmenting into multiple retrievals.

If you are using CloudWatch cross-account observability, you can use this operation in a monitoring account to retrieve data from a linked source account, as long as both accounts have transaction search enabled.

For retrieving data from X-Ray directly as opposed to the Transaction-Search Log group, see BatchGetTraces.

May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ThrottledException.

Parameter endTime : The end of the time range to retrieve traces. The range is inclusive, so the specified end time is included in the query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC.

Parameter startTime : The start of the time range to retrieve traces. The range is inclusive, so the specified start time is included in the query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC.

Parameter traceIds : Specify the trace IDs of the traces to be retrieved.

Implementation

Future<StartTraceRetrievalResult> startTraceRetrieval({
  required DateTime endTime,
  required DateTime startTime,
  required List<String> traceIds,
}) async {
  final $payload = <String, dynamic>{
    'EndTime': unixTimestampToJson(endTime),
    'StartTime': unixTimestampToJson(startTime),
    'TraceIds': traceIds,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/StartTraceRetrieval',
    exceptionFnMap: _exceptionFns,
  );
  return StartTraceRetrievalResult.fromJson(response);
}