I have a lambda who fetch trace summaries from X-RAY for the given time duration on basis of the user. When I enter startTime 17:10:03.021Z
& endTime 17:52:03.097Z
X-RAY is giving me traces present but when I changes time startTime 17:10:03.021Z
& endTime 18:00:03.097Z
it shows no traces present.
var params = {
EndTime: '2018-11-18T17:52:03.097Z',
StartTime: '2018-11-18T17:10:03.021Z' ,
FilterExpression: 'Annotation.User ="username"'
};
xray.getTraceSummaries(params, function(err, data) {
if (err) console.log(err, err.stack);
else {
console.log('data.TraceSummaries.length ',data.TraceSummaries.length);
var numberOfTraceIds = data.TraceSummaries.length;
if (numberOfTraceIds === 0) {
console.log('Data empty ',JSON.stringify(data))
return callback(null, 'no data');
}
This is the piece of code I have written. Output when the time is changed
{ "TraceSummaries": [], "ApproximateTime": "2018-11-18T18:00:00.000Z",
"TracesProcessedCount": 0, "NextToken": "****" }
In both time cases, traces is available on X-RAY console. How could I resolve this?
The X-Ray console calls GetTraceSummaries
on your behalf and it use the NextToken
returned from the response to keep calling until it finds something. For directly calling using js SDK you will also need to use the NextToken
so it has similar behavior with X-Ray console.