Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XRAY batch_get_traces pagination does not work #3924

Closed
harrisonbarlow opened this issue Nov 9, 2023 · 4 comments
Closed

XRAY batch_get_traces pagination does not work #3924

harrisonbarlow opened this issue Nov 9, 2023 · 4 comments
Assignees
Labels
service-api This issue is caused by the service API, not the SDK implementation.

Comments

@harrisonbarlow
Copy link

Describe the bug

Passing more than 5 trace IDs to client.batch_get_traces produces an error

botocore.errorfactory.InvalidRequestException: An error occurred (InvalidRequestException) when calling the BatchGetTraces operation: Exceeding maximum query size: 5

As per the documentation, a NextToken can be supplied to client.batch_get_traces in order to paginate the request.

However, attempting this gives the error

botocore.errorfactory.InvalidRequestException: An error occurred (InvalidRequestException) when calling the BatchGetTraces operation: NextToken is currently not supported

I am using:
Python=3.7.17
boto3=1.28.80
botocore=1.31.80

Am I doing something wrong?

Expected Behavior

To simply receive a NextToken in the body of the request in order to paginate the results, as is currently the case with client.get_trace_summaries (which works as expected)

Current Behavior

Attempting to supply a NextToken produces an error which says that it is unsupported, which conflicts with the documentation.

Reproduction Steps

Call client.batch_get_traces with a list of trace ID, and an empty NextToken

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.28.80

Environment details (OS name and version, etc.)

MacOS, running in a Python container.

@harrisonbarlow harrisonbarlow added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Nov 9, 2023
@tim-finnigan tim-finnigan self-assigned this Nov 14, 2023
@tim-finnigan
Copy link
Contributor

Hi @harrisonbarlow thanks for reaching out. I could reproduce the error you referenced.

The batch_get_traces command corresponds to the X-Ray BatchGetTraces API, so we'll need to reach out to the X-Ray team to understand what's going on here.

As an alternative, have you tried using the paginator? For example:

import boto3

client = boto3.client('xray')

paginator = client.get_paginator('batch_get_traces')

page_iterator = paginator.paginate(
    TraceIds=['1-5759e988-bd862e3fe1be46a994272793']
)

for page in page_iterator:
    print(page)

@tim-finnigan tim-finnigan added response-requested Waiting on additional information or feedback. service-api This issue is caused by the service API, not the SDK implementation. and removed bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Nov 14, 2023
@harrisonbarlow
Copy link
Author

Hi @tim-finnigan thanks for your reply.

I did attempt to use the paginator as a workaround, however this produces the Exceeding maximum query size: 5 error.

No problem! Interested to hear how you go.

@github-actions github-actions bot removed the response-requested Waiting on additional information or feedback. label Nov 15, 2023
@tim-finnigan
Copy link
Contributor

Thanks for following up - I will also ask the service team about their paginator model and if this relates to the NextToken issue. Since service APIs and paginators are used across AWS SDKs, I created this issue in our cross-SDK repository for tracking going forward. Please refer to that for updates, and thanks again for reporting this.

Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-api This issue is caused by the service API, not the SDK implementation.
Projects
None yet
Development

No branches or pull requests

2 participants