def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["simple_rpc"] = ContextProcessor.process_simple_rpc self._priorityMap["simple_rpc"] = TPriority.NORMAL
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._processMap["query"] = ContextProcessor.process_query self._processMap[ "has_arg_docs"] = ContextProcessor.process_has_arg_docs
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["init"] = Processor.process_init self._priorityMap["init"] = TPriority.NORMAL
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["init"] = ContextProcessor.process_init self._priorityMap["init"] = TPriority.NORMAL
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["bar"] = ContextProcessor.process_bar self._priorityMap["bar"] = TPriority.NORMAL
def __init__(self, handler, executor=None): TProcessor.__init__(self) self._handler = handler self._executor = executor or ThreadPoolExecutor(max_workers=32) self._processMap = {} self._processMap["sleep"] = Processor.future_process_sleep self._processMap["isPrime"] = Processor.future_process_isPrime self._processMap["getResult"] = Processor.future_process_getResult
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["global"] = ContextProcessor.process_global self._priorityMap["global"] = TPriority.NORMAL self._processMap["import"] = ContextProcessor.process_import self._priorityMap["import"] = TPriority.NORMAL
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["query"] = Processor.process_query self._priorityMap["query"] = TPriority.NORMAL self._processMap["has_arg_docs"] = Processor.process_has_arg_docs self._priorityMap["has_arg_docs"] = TPriority.NORMAL
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["getDataByKey0"] = Processor.process_getDataByKey0 self._priorityMap["getDataByKey0"] = TPriority.NORMAL self._processMap["getDataByKey1"] = Processor.process_getDataByKey1 self._priorityMap["getDataByKey1"] = TPriority.NORMAL
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["ping"] = ContextProcessor.process_ping self._priorityMap["ping"] = TPriority.NORMAL self._processMap["echo"] = ContextProcessor.process_echo self._priorityMap["echo"] = TPriority.NORMAL
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["ping"] = ContextProcessor.process_ping self._priorityMap["ping"] = TPriority.IMPORTANT self._processMap["pong"] = ContextProcessor.process_pong self._priorityMap["pong"] = TPriority.HIGH_IMPORTANT
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["bounce_map"] = ContextProcessor.process_bounce_map self._priorityMap["bounce_map"] = TPriority.NORMAL self._processMap[ "binary_keyed_map"] = ContextProcessor.process_binary_keyed_map self._priorityMap["binary_keyed_map"] = TPriority.NORMAL
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["foo"] = Processor.process_foo self._priorityMap["foo"] = TPriority.NORMAL self._processMap["interact"] = Processor.process_interact self._priorityMap["interact"] = TPriority.NORMAL self._processMap["interactFast"] = Processor.process_interactFast self._priorityMap["interactFast"] = TPriority.NORMAL
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["authenticate"] = ContextProcessor.process_authenticate self._priorityMap["authenticate"] = TPriority.NORMAL self._processMap["signout"] = ContextProcessor.process_signout self._priorityMap["signout"] = TPriority.NORMAL self._processMap["execute"] = ContextProcessor.process_execute self._priorityMap["execute"] = TPriority.NORMAL
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["get"] = ContextProcessor.process_get self._priorityMap["get"] = TPriority.NORMAL self._processMap["put"] = ContextProcessor.process_put self._priorityMap["put"] = TPriority.NORMAL self._processMap["remove"] = ContextProcessor.process_remove self._priorityMap["remove"] = TPriority.NORMAL
def __init__(self, handler, loop=None): TProcessor.__init__(self) self._handler = handler self._loop = loop or asyncio.get_event_loop() self._processMap = {} self._priorityMap = {} self._processMap["authenticate"] = Processor.process_authenticate self._priorityMap["authenticate"] = TPriority.NORMAL self._processMap["signout"] = Processor.process_signout self._priorityMap["signout"] = TPriority.NORMAL self._processMap["execute"] = Processor.process_execute self._priorityMap["execute"] = TPriority.NORMAL
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["doBland"] = Processor.process_doBland self._priorityMap["doBland"] = TPriority.NORMAL self._processMap["doRaise"] = Processor.process_doRaise self._priorityMap["doRaise"] = TPriority.NORMAL self._processMap["get200"] = Processor.process_get200 self._priorityMap["get200"] = TPriority.NORMAL self._processMap["get500"] = Processor.process_get500 self._priorityMap["get500"] = TPriority.NORMAL
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {} self._processMap["doBland"] = ContextProcessor.process_doBland self._priorityMap["doBland"] = TPriority.NORMAL self._processMap["doRaise"] = ContextProcessor.process_doRaise self._priorityMap["doRaise"] = TPriority.NORMAL self._processMap["get200"] = ContextProcessor.process_get200 self._priorityMap["get200"] = TPriority.NORMAL self._processMap["get500"] = ContextProcessor.process_get500 self._priorityMap["get500"] = TPriority.NORMAL
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._priorityMap = {}
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._processMap["init"] = ContextProcessor.process_init
def baseplateify_processor( processor: TProcessor, logger: Logger, baseplate: Baseplate, edge_context_factory: Optional[EdgeContextFactory] = None, ) -> TProcessor: """Wrap a Thrift Processor with Baseplate's span lifecycle. :param processor: The service's processor to wrap. :param logger: The logger to use for error and debug logging. :param baseplate: The baseplate instance for your application. :param edge_context_factory: A configured factory for handling edge request context. """ def make_processor_fn( fn_name: str, processor_fn: Callable[..., Any]) -> Callable[..., Any]: def call_processor_with_span_context(self: Any, seqid: int, iprot: TProtocolBase, oprot: TProtocolBase) -> Any: context = baseplate.make_context_object() # Allow case-insensitivity for THeader headers headers: Mapping[bytes, bytes] = CaseInsensitiveDict( # type: ignore data=iprot.get_headers()) trace_info: Optional[TraceInfo] try: sampled = bool(headers.get(b"Sampled") == b"1") flags = headers.get(b"Flags", None) trace_info = TraceInfo.from_upstream( int(headers[b"Trace"]), int(headers[b"Parent"]), int(headers[b"Span"]), sampled, int(flags) if flags is not None else None, ) except (KeyError, ValueError): trace_info = None edge_payload = headers.get(b"Edge-Request", None) context.raw_edge_context = edge_payload if edge_context_factory: context.edge_context = edge_context_factory.from_upstream( edge_payload) span = baseplate.make_server_span(context, name=fn_name, trace_info=trace_info) try: service_name = headers[b"User-Agent"].decode() except (KeyError, UnicodeDecodeError): pass else: span.set_tag("peer.service", service_name) context.headers = headers handler = processor._handler context_aware_handler = _ContextAwareHandler( handler, context, logger) context_aware_processor = processor.__class__( context_aware_handler) return processor_fn(context_aware_processor, seqid, iprot, oprot) return call_processor_with_span_context instrumented_process_map = {} for fn_name, processor_fn in processor._processMap.items(): context_aware_processor_fn = make_processor_fn(fn_name, processor_fn) instrumented_process_map[fn_name] = context_aware_processor_fn processor._processMap = instrumented_process_map processor.baseplate = baseplate return processor
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._processMap["add"] = Processor.process_add
def __init__(self, handler): TProcessor.__init__(self) self._handler = handler self._processMap = {} self._processMap["init"] = Processor.process_init