These are chat archives for aws/aws-sdk-php

18th
Feb 2016
Ian Carpenter
@Sazpaimon
Feb 18 2016 20:31
Hey all, I'm migrating from v2 to v3, and I'm trying to find the best way to migrate stuff like "client.backoff.logger" and other log handlers
I understand that I may have to do so using middleware, but I don't see any good examples about middleware handing a command after it has an HTTP response
Ian Carpenter
@Sazpaimon
Feb 18 2016 22:15
It appears as though the retry middleware injects itself too early for me to do anything with it
Jonathan Eskew
@jeskew
Feb 18 2016 22:17
You may need to modify the client’s handler stack after the client has been instantiated
it sounds like you want to log all requests, even those that fail and are successfully retried; is that correct?
Ian Carpenter
@Sazpaimon
Feb 18 2016 22:18
No, I just want to log when there's a retry
Jonathan Eskew
@jeskew
Feb 18 2016 22:19
In that case, a separate middleware might not be appropriate
Ian Carpenter
@Sazpaimon
Feb 18 2016 22:20
in v2, client.backoff.logger would let me attach a guzzle log adapter that would fire whenever the sdk has to retry a request due to throttling
Jonathan Eskew
@jeskew
Feb 18 2016 22:20
it it’s higher in the stack than the retry middleware, it will never know about failed request
*requests
Ian Carpenter
@Sazpaimon
Feb 18 2016 22:21
it looks as though the sdk will attach a middleware for the retry handler, which itself seems to simply fire the next handler, but also attach a promise handler that handles the retry logic
at least as far as I can tell
Jonathan Eskew
@jeskew
Feb 18 2016 22:22
that’s correct
Ian Carpenter
@Sazpaimon
Feb 18 2016 22:23
so how would i be able to inject a logger into that flow?
Jonathan Eskew
@jeskew
Feb 18 2016 22:23
there isn’t any way to inject a retry logger ATM
Ian Carpenter
@Sazpaimon
Feb 18 2016 22:23
oh...
i guess that locks me down to v2
Jonathan Eskew
@jeskew
Feb 18 2016 22:23
well, there’s no reason it couldn’t be added to v3
Ian Carpenter
@Sazpaimon
Feb 18 2016 22:24
that would actually be a hard blocker for me, as we log our DynamoDB retries so we can action off of them if needed
Jonathan Eskew
@jeskew
Feb 18 2016 22:25
there might be a simpler way to port this to v3, though
Ian Carpenter
@Sazpaimon
Feb 18 2016 22:26
since I'm just getting started with v3, I don't feel comfortable enough to make a PR right now
Jonathan Eskew
@jeskew
Feb 18 2016 22:26
no worries; this is something I could work on
so long as I’ve got your attention though, what if instead of a logger, this information was attached to the response somehow?
Ian Carpenter
@Sazpaimon
Feb 18 2016 22:27
would that allow me to log every retry?
That would be what I need for feature parity
so if a request takes 4 retries, I log 4 times
Jonathan Eskew
@jeskew
Feb 18 2016 22:28
and it wouldn’t help if the response had a piece of metadata on it that reported the number of retries?
does it need to be a discrete action per retry?
Ian Carpenter
@Sazpaimon
Feb 18 2016 22:30
For parity purposes, yeah
anything that would be in more aggregate like you're suggesting would be something I'd need to bring up to the rest of the team
Jonathan Eskew
@jeskew
Feb 18 2016 22:31
sure… but if you’re using it to autoscale throughput on a dynamodb table, you really only care about the number of retries
maybe the timing, too
Ian Carpenter
@Sazpaimon
Feb 18 2016 22:32
we're using dynamic dynamodb to autoscale, the logging is more informational and realtime than what cloudwatch can give
I agree, though, that aggregate info would be easier for us to digest
Jonathan Eskew
@jeskew
Feb 18 2016 22:34
another alternative would be to allow the injection of an ‘on_retry’ callable that gets invoked with the exception or result
Ian Carpenter
@Sazpaimon
Feb 18 2016 22:34
On a quick check with the tech lead and other devs, they like the idea of the metadata actually
So if that'd be easier to implement, I can work with that
Jonathan Eskew
@jeskew
Feb 18 2016 22:35
I think there might be some good input if this were an issue on the repository
Ian Carpenter
@Sazpaimon
Feb 18 2016 22:35
I can open one
Jonathan Eskew
@jeskew
Feb 18 2016 22:35
I never had occasion to use a backoff logger as an SDK user, so I’m not familiar with how people are making use of it
thanks
Ian Carpenter
@Sazpaimon
Feb 18 2016 22:36
I figure it'd only be mostly useful for dynamodb users
Jonathan Eskew
@jeskew
Feb 18 2016 22:38
true; retries for other services don’t really have the same meaning
Ian Carpenter
@Sazpaimon
Feb 18 2016 22:43
I opened #913