class baseplate.context.thrift.ThriftContextFactory(pool, client_cls)

Thrift client pool context factory.

This factory will attach a proxy object with the same interface as your thrift client to an attribute on the context object. When a thrift method is called on this proxy object, it will check out a connection from the connection pool and execute the RPC, automatically recording diagnostic information.


The proxy object has a retrying method which takes the same parameters as and acts as a context manager. The context manager returns another proxy object where Thrift service method calls will be automatically retried with the specified retry policy when transient errors occur:

with context.my_service.retrying(attempts=3) as svc: