Our organization has a desire to log the requests made to third party providers, as well as the responses received, in order to help us ensure external API requests are successful and to implement monitoring should something go wrong. Consider a scenario where RudderStack's API goes down for 5 minutes, or an API key is accidentally deleted or expired within the web portal - we would want to capture this as soon as possible, and in an ideal world have the ability to replay the request later once the issue is resolved.
We are using Laravel, however that's just a technicality on our side - the RS library shouldn't rely on any specific framework (although if you decide to pick up this request and want to rely on a proven implementation method, expecting a Monolog instance which Laravel uses under the head would not be a bad approach).
After reviewing the RudderStack package here, there isn't any reliable way to track the requests or responses. Firstly, the requests are batched, so while we could track the individual payloads that are sent, this isn't what is actually pushed to RudderStack, which is realistically what we'd want to capture. Additionally, the current implementation largely ignores the responses, so there isn't a way to capture those. Finally, the actual requests are pushed within the Consumer libraries which we don't have any real manner of tapping in to.
Our request: It would be ideal if there was some manner of allowing code to tap into the request/response code to introduce logging, perhaps by allowing us to pass in a callback that is executed by the consumer, passing the curl handle in, before the curl instance is destroyed/reset. Alternatively, the library could introduce built in logging capabilities (perhaps by accepting a Monolog instance to be sent through as a library option for instance) which we could leverage.
Our organization has a desire to log the requests made to third party providers, as well as the responses received, in order to help us ensure external API requests are successful and to implement monitoring should something go wrong. Consider a scenario where RudderStack's API goes down for 5 minutes, or an API key is accidentally deleted or expired within the web portal - we would want to capture this as soon as possible, and in an ideal world have the ability to replay the request later once the issue is resolved.
We are using Laravel, however that's just a technicality on our side - the RS library shouldn't rely on any specific framework (although if you decide to pick up this request and want to rely on a proven implementation method, expecting a Monolog instance which Laravel uses under the head would not be a bad approach).
After reviewing the RudderStack package here, there isn't any reliable way to track the requests or responses. Firstly, the requests are batched, so while we could track the individual payloads that are sent, this isn't what is actually pushed to RudderStack, which is realistically what we'd want to capture. Additionally, the current implementation largely ignores the responses, so there isn't a way to capture those. Finally, the actual requests are pushed within the Consumer libraries which we don't have any real manner of tapping in to.
Our request: It would be ideal if there was some manner of allowing code to tap into the request/response code to introduce logging, perhaps by allowing us to pass in a callback that is executed by the consumer, passing the curl handle in, before the curl instance is destroyed/reset. Alternatively, the library could introduce built in logging capabilities (perhaps by accepting a Monolog instance to be sent through as a library option for instance) which we could leverage.
In our specific case we would prefer to log: