sancho-observer 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sancho_observer/__init__.py +43 -0
- sancho_observer/_client.py +667 -0
- sancho_observer/_config.py +175 -0
- sancho_observer/_events.py +366 -0
- sancho_observer/_identity.py +225 -0
- sancho_observer/_instrument.py +688 -0
- sancho_observer/_version.py +1 -0
- sancho_observer/py.typed +0 -0
- sancho_observer-0.2.0.dist-info/METADATA +290 -0
- sancho_observer-0.2.0.dist-info/RECORD +12 -0
- sancho_observer-0.2.0.dist-info/WHEEL +4 -0
- sancho_observer-0.2.0.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Sancho SDK for Python: records one event per MCP request and exports them in batches.
|
|
2
|
+
|
|
3
|
+
Quick start::
|
|
4
|
+
|
|
5
|
+
from mcp.server.mcpserver import MCPServer # or: from mcp.server.fastmcp import FastMCP
|
|
6
|
+
import sancho_observer
|
|
7
|
+
|
|
8
|
+
mcp = MCPServer("issue-tracker")
|
|
9
|
+
sancho_observer.instrument(mcp)
|
|
10
|
+
|
|
11
|
+
Configuration comes from ``SANCHO_TOKEN`` and ``SANCHO_ENDPOINT`` (see :class:`Options`).
|
|
12
|
+
Without a token the SDK does nothing at all.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
from ._client import Client, _shutdown_all, current_event_id, feedback
|
|
18
|
+
from ._config import Options
|
|
19
|
+
from ._events import capability_keys
|
|
20
|
+
from ._identity import IdentifyContext, Identity, hash_identity, set_identity
|
|
21
|
+
from ._instrument import SanchoMiddleware, instrument
|
|
22
|
+
from ._version import __version__
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"Client",
|
|
26
|
+
"IdentifyContext",
|
|
27
|
+
"Identity",
|
|
28
|
+
"Options",
|
|
29
|
+
"SanchoMiddleware",
|
|
30
|
+
"__version__",
|
|
31
|
+
"capability_keys",
|
|
32
|
+
"current_event_id",
|
|
33
|
+
"feedback",
|
|
34
|
+
"hash_identity",
|
|
35
|
+
"instrument",
|
|
36
|
+
"set_identity",
|
|
37
|
+
"shutdown",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def shutdown() -> None:
|
|
42
|
+
"""Flush (best effort, bounded) and stop every client in this process. Also runs at exit."""
|
|
43
|
+
_shutdown_all()
|