spike source emit request and response #17839
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
The connector builder requires access to the requests and responses that produced a given set of records.
This functionality is not currently implemented in the CDK.
Its implementation requires modifying the CDK at multiple layer because the
Source
andStream
classes are not aware of HTTP requests and responses.How
Intercepting the requests and responses
The
HttpStream
class already logs the HTTP requests sent to the API as well as the HTTP responses we receive.Instead of directly logging the requests and responses, the class can implement 2 new methods
log_request
log_response
By default, these methods will log the requests/responses like the
HttpStream
currently does.Exposing the requests/responses to the Source
The
SimpleRetriever
class can then overwrite these methods to keep track of them in memory:Before returning the parsed records from
parse_response
, theSimpleRetriever
can amend the records with metadata representing the request and response that produced the recordExposing the requests/responses as
AirbyteMessage
sSince the
AirbyteRecord
s produced by theAbstractSource
now contain metadata, theDeclarativeSource
can extract the metadata from the records and emit the requests and responses as their ownAirbyteMessage
.Exposing the requests/responses to the UI
The backend server that will run the
DeclarativeSource
can then extract theAirbyteRecord
s and group them as needed for the connector builder.Additional decisions to make
SimpleRetriever
amending the data produced? It tightly couples it with theDeclarativeSource
, but I don't see them being used separately anyway