Background
otel_lifecycle.py (PR #601) declares _installed_instrumentors: list[Any] and def attach_instrumentor(instrumentor: Any) -> None. CodeRabbit suggested a Protocol-typed list during review and the orchestrator deferred:
The four OpenInference instrumentors we attach (LangChainInstrumentor, GuardrailsInstrumentor, VertexAIInstrumentor, MCPInstrumentor) come from separate packages with no shared base class — Any is honest about the FFI boundary. A Protocol would add maintenance burden against four packages that may evolve independently.
Trigger
Open this issue when OpenInference publishes a common Instrumentor base class (or a stable Protocol) across its instrumentor packages — at which point this trade-off flips.
Fix when triggered
from typing import Protocol
class Instrumentor(Protocol):
def instrument(self, tracer_provider: TracerProvider) -> None: ...
def uninstrument(self) -> None: ...
_installed_instrumentors: list[Instrumentor] = []
def attach_instrumentor(instrumentor: Instrumentor) -> None: ...
Watch out for instrumentor variants that accept **kwargs in instrument(...) — the Protocol may need to be loosened.
References
🤖 Filed during PR #601 wrap-up.
Background
otel_lifecycle.py(PR #601) declares_installed_instrumentors: list[Any]anddef attach_instrumentor(instrumentor: Any) -> None. CodeRabbit suggested aProtocol-typed list during review and the orchestrator deferred:Trigger
Open this issue when OpenInference publishes a common
Instrumentorbase class (or a stableProtocol) across its instrumentor packages — at which point this trade-off flips.Fix when triggered
Watch out for instrumentor variants that accept
**kwargsininstrument(...)— the Protocol may need to be loosened.References
_installed_instrumentors").🤖 Filed during PR #601 wrap-up.