(self, context, action)
| 100 | ] |
| 101 | |
| 102 | def do_action(self, context, action): |
| 103 | trace_middleware = context.get_middleware("trace") |
| 104 | if trace_middleware: |
| 105 | TraceContext.set_trace_id(trace_middleware.trace_id) |
| 106 | if action.type == "get-trace-id": |
| 107 | if self.delegate: |
| 108 | for result in self.delegate.do_action(action): |
| 109 | yield result |
| 110 | else: |
| 111 | trace_id = TraceContext.current_trace_id().encode("utf-8") |
| 112 | print("Returning trace ID:", trace_id) |
| 113 | buf = pa.py_buffer(trace_id) |
| 114 | yield pa.flight.Result(buf) |
| 115 | else: |
| 116 | raise KeyError(f"Unknown action {action.type!r}") |
| 117 | |
| 118 | |
| 119 | def main(): |
no test coverage detected