Skip to content

[FEATURE]: Remove observability service dependency from plugin framework #2828

@araujof

Description

@araujof

Create a protocol-based abstraction for observability:

# plugins/framework/observability.py
from typing import Protocol, Optional
from contextvars import ContextVar

current_trace_id: ContextVar[Optional[str]] = ContextVar("current_trace_id", default=None)

class ObservabilityProvider(Protocol):
    """Interface for observability - host application implements this."""
    def start_trace(self, name: str, **kwargs) -> Optional[str]: ...
    def end_trace(self, trace_id: str, **kwargs) -> None: ...

class NullObservability:
    """Default no-op implementation for standalone operation."""
    def start_trace(self, name: str, **kwargs) -> None:
        return None
    def end_trace(self, trace_id: str, **kwargs) -> None:
        pass

Tasks:

  • Create plugins/framework/observability.py with ObservabilityProvider protocol
  • Implement NullObservability as default
  • Refactor PluginManager to accept optional observability parameter
  • Remove mcpgateway.db.SessionLocal import

Metadata

Metadata

Assignees

Labels

SHOULDP2: Important but not vital; high-value items that are not crucial for the immediate releaseenhancementNew feature or requestplugins

Type

No fields configured for Task.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions