Looking for advice on handling the paging object in the Genesys Cloud Analytics API while maintaining distributed trace context.
I am building a Python wrapper around the /api/v2/analytics/queues/summary endpoint. I need to iterate through all pages to aggregate metrics, but I want to inject the W3C trace context (traceparent, tracestate) into the headers of every subsequent request to ensure the spans are linked correctly in Jaeger.
The issue arises with the pageNumber and pageSize logic. If I set pageSize to 1000, the API returns pageCount as 5. However, when I manually increment pageNumber in my loop and resend the request with the OTel headers, the response seems to reset or drop spans if the request takes longer than the initial context window.
Here is the payload structure I am using for the initial request:
{
"interval": "2023-10-01T00:00:00Z/2023-10-01T01:00:00Z",
"paging": {
"pageNumber": 1,
"pageSize": 1000
},
"groupings": ["queue.id"]
}
Is there a recommended pattern for propagating the traceparent header across paginated requests without losing context? I am currently using requests.Session() but suspect the context might be detached on the second call.