My googling suggests that the answer to this is a simple 'no' but I have to ask anyway.
I'm trying to add in some logging/metrics emitting to a service's retry strategy so that we can get an idea of what our actual real world retrying and timeout profile looks like. I wrote a wrapper/decorator to sit on top of the underlying strategy object, but the issue is of course that we're currently just injecting a generic RetryStrategy
object and I want my specific behavior to be aware of some context; minimally the name of the requester, so that I can emit a metric saying that such-and-such client timed out after n millis on its kth retry.
Is something like this possible in Guice, either out of the box or with relatively light modification?
That is, I'd like something along these lines in my module file:
@Provides
RetryStrategy getNewDefaultRetryStrategy() {
RetryStrategy baseStrategy = getOldRetryStrategy();
String clientName = NAME_OF_THING_WE_ARE_INJECTING_INTO; // this is the magic I want
return new WrappedStrategy(baseStrategy, clientName);
}