Matt Menzenski
01/29/2024, 6:46 PMGET /healthchecks
endpoint that returns all healthchecks (this is the parent stream), and a GET /healthchecks/{id}/response-time
endpoint that returns raw response time data for the healthcheck with id {id}
(this is the child stream). The response that’s returned from the response-time endpoint doesn’t contain the id
of the healthcheck, and I want to add it to the records emitted by the child stream.
In the parent stream, I’m overriding the get_child_context
method to set the id
. This makes it available to the child stream to an extent - the path
string can interpolate it. But I need to do some reshaping of the raw response data from the response-time endpoint and I don’t see a way to do that within the parse_response
method (that method doesn’t receive a context
argument).
The post_process
method does receive a context
argument so I’m hoping I can add the id
if I override that method. Is that accurate? Override parse_response
to reshape the response data into an iterable of dicts, and then add the id
field in an overridden post_process
method?Pat Nadolny (Arch)
01/29/2024, 7:35 PMpost_process
will have your parent context id
. I recently did something similar. Usually I dont need to actually override the parse_response method though if I'm using the rest stream because the records_jsonpath
property handles extracting the list field that contains all the resultsMatt Menzenski
01/29/2024, 8:02 PM