swagger_zipkin Package¶
swagger_zipkin Package¶
decorate_client Module¶
-
class
swagger_zipkin.decorate_client.OperationDecorator(operation, func)¶ Bases:
objectA helper to preserve attributes of
swaggerpy.client.Operationandbravado.client.CallableOperationwhile decorating their __call__() methodsParameters: - operation (
swaggerpy.client.Operationorbravado.client.CallableOperation) – callable operation, e.g., attributes ofswaggerpy.client.Resourceorbravado_core.resource.Resource - func (callable) – a callable which accepts *args, **kwargs
- operation (
-
swagger_zipkin.decorate_client.decorate_client(api_client, func, name)¶ A helper for decorating
bravado.client.SwaggerClient.bravado.client.SwaggerClientcan be extended by creating a class which wraps all calls to it. This helper is used in a__getattr__()to check if the attr exists on the api_client. If the attr does not exist raiseAttributeError, if it exists and is not callable return it, and if it is callable return a partial function calling func with name.Example usage:
class SomeClientDecorator(object): def __init__(self, api_client, ...): self.api_client = api_client # First arg should be suffiently unique to not conflict with any of # the kwargs def wrap_call(self, client_call_name, *args, **kwargs): ... def __getattr__(self, name): return decorate_client(self.api_client, self.wrap_call, name)
Parameters: Returns: the attribute from the api_client or a partial of func
Raises: AttributeError
zipkin_decorator Module¶
-
class
swagger_zipkin.zipkin_decorator.ZipkinClientDecorator(client)¶ Bases:
objectA wrapper to swagger client (swagger-py or bravado) to pass on zipkin headers to the service call.
Even though client is initialised once, all the calls made will have independent spans.
Parameters: client ( swaggerpy.client.SwaggerClientorbravado.client.SwaggerClient.) – Swagger Client