traccia 0.1.0__py3-none-any.whl → 0.1.2__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.
- {traccia-0.1.0.dist-info → traccia-0.1.2.dist-info}/METADATA +1 -1
- traccia-0.1.2.dist-info/RECORD +6 -0
- traccia-0.1.2.dist-info/top_level.txt +1 -0
- traccia/__init__.py +0 -73
- traccia/auto.py +0 -736
- traccia/auto_instrumentation.py +0 -74
- traccia/cli.py +0 -349
- traccia/config.py +0 -693
- traccia/errors.py +0 -48
- traccia/pricing_config.py +0 -58
- traccia/runtime_config.py +0 -106
- traccia-0.1.0.dist-info/RECORD +0 -14
- traccia-0.1.0.dist-info/top_level.txt +0 -1
- {traccia-0.1.0.dist-info → traccia-0.1.2.dist-info}/WHEEL +0 -0
- {traccia-0.1.0.dist-info → traccia-0.1.2.dist-info}/entry_points.txt +0 -0
- {traccia-0.1.0.dist-info → traccia-0.1.2.dist-info}/licenses/LICENSE +0 -0
traccia/errors.py
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"""Traccia SDK error hierarchy and exceptions."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class TracciaError(Exception):
|
|
7
|
-
"""Base exception for all Traccia SDK errors."""
|
|
8
|
-
|
|
9
|
-
def __init__(self, message: str, details: dict = None):
|
|
10
|
-
super().__init__(message)
|
|
11
|
-
self.message = message
|
|
12
|
-
self.details = details or {}
|
|
13
|
-
|
|
14
|
-
def __str__(self) -> str:
|
|
15
|
-
if self.details:
|
|
16
|
-
details_str = ", ".join(f"{k}={v}" for k, v in self.details.items())
|
|
17
|
-
return f"{self.message} ({details_str})"
|
|
18
|
-
return self.message
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class ConfigError(TracciaError):
|
|
22
|
-
"""Raised when configuration is invalid or conflicting."""
|
|
23
|
-
pass
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class ValidationError(TracciaError):
|
|
27
|
-
"""Raised when validation fails."""
|
|
28
|
-
pass
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class ExportError(TracciaError):
|
|
32
|
-
"""Raised when span export fails."""
|
|
33
|
-
pass
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
class RateLimitError(TracciaError):
|
|
37
|
-
"""Raised when rate limit is exceeded (in strict mode)."""
|
|
38
|
-
pass
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
class InitializationError(TracciaError):
|
|
42
|
-
"""Raised when SDK initialization fails."""
|
|
43
|
-
pass
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
class InstrumentationError(TracciaError):
|
|
47
|
-
"""Raised when instrumentation/patching fails."""
|
|
48
|
-
pass
|
traccia/pricing_config.py
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"""Pricing configuration fetcher with optional env override.
|
|
2
|
-
|
|
3
|
-
Pricing should be treated as configuration, not source code: vendors update
|
|
4
|
-
prices and model versions frequently. The SDK therefore supports:
|
|
5
|
-
- defaults (stub)
|
|
6
|
-
- env override: AGENT_DASHBOARD_PRICING_JSON
|
|
7
|
-
- direct override via start_tracing(pricing_override=...)
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
from __future__ import annotations
|
|
11
|
-
|
|
12
|
-
import json
|
|
13
|
-
import os
|
|
14
|
-
from typing import Dict, Literal, Tuple
|
|
15
|
-
|
|
16
|
-
from traccia.processors.cost_engine import DEFAULT_PRICING
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def fetch_remote_pricing() -> Dict[str, Dict[str, float]]:
|
|
20
|
-
"""
|
|
21
|
-
Placeholder for remote pricing sync.
|
|
22
|
-
In production this would fetch from backend service; here we return defaults.
|
|
23
|
-
"""
|
|
24
|
-
return DEFAULT_PRICING.copy()
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
PricingSource = Literal["default", "env", "override"]
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def load_pricing_with_source(
|
|
31
|
-
override: Dict[str, Dict[str, float]] | None = None,
|
|
32
|
-
) -> Tuple[Dict[str, Dict[str, float]], PricingSource]:
|
|
33
|
-
"""
|
|
34
|
-
Return (pricing_table, source_of_latest_override).
|
|
35
|
-
"""
|
|
36
|
-
pricing = fetch_remote_pricing()
|
|
37
|
-
source: PricingSource = "default"
|
|
38
|
-
|
|
39
|
-
env_override = os.getenv("AGENT_DASHBOARD_PRICING_JSON")
|
|
40
|
-
if env_override:
|
|
41
|
-
try:
|
|
42
|
-
env_pricing = json.loads(env_override)
|
|
43
|
-
if isinstance(env_pricing, dict):
|
|
44
|
-
pricing.update(env_pricing)
|
|
45
|
-
source = "env"
|
|
46
|
-
except Exception:
|
|
47
|
-
pass
|
|
48
|
-
if override:
|
|
49
|
-
pricing.update(override)
|
|
50
|
-
source = "override"
|
|
51
|
-
return pricing, source
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def load_pricing(override: Dict[str, Dict[str, float]] | None = None) -> Dict[str, Dict[str, float]]:
|
|
55
|
-
"""Backward-compatible helper returning only the pricing table."""
|
|
56
|
-
pricing, _ = load_pricing_with_source(override)
|
|
57
|
-
return pricing
|
|
58
|
-
|
traccia/runtime_config.py
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"""Runtime configuration state management."""
|
|
2
|
-
|
|
3
|
-
from typing import Optional, List
|
|
4
|
-
|
|
5
|
-
# Global runtime configuration state
|
|
6
|
-
_config = {
|
|
7
|
-
"auto_instrument_tools": False,
|
|
8
|
-
"tool_include": [],
|
|
9
|
-
"max_tool_spans": 1000,
|
|
10
|
-
"max_span_depth": 100,
|
|
11
|
-
"session_id": None,
|
|
12
|
-
"user_id": None,
|
|
13
|
-
"tenant_id": None,
|
|
14
|
-
"project_id": None,
|
|
15
|
-
"agent_id": None,
|
|
16
|
-
"debug": False,
|
|
17
|
-
"attr_truncation_limit": 1000,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def set_auto_instrument_tools(value: bool) -> None:
|
|
22
|
-
_config["auto_instrument_tools"] = value
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def get_auto_instrument_tools() -> bool:
|
|
26
|
-
return _config["auto_instrument_tools"]
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def set_tool_include(value: List[str]) -> None:
|
|
30
|
-
_config["tool_include"] = value
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def get_tool_include() -> List[str]:
|
|
34
|
-
return _config["tool_include"]
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def set_max_tool_spans(value: int) -> None:
|
|
38
|
-
_config["max_tool_spans"] = value
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def get_max_tool_spans() -> int:
|
|
42
|
-
return _config["max_tool_spans"]
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def set_max_span_depth(value: int) -> None:
|
|
46
|
-
_config["max_span_depth"] = value
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def get_max_span_depth() -> int:
|
|
50
|
-
return _config["max_span_depth"]
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
def set_session_id(value: Optional[str]) -> None:
|
|
54
|
-
_config["session_id"] = value
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def get_session_id() -> Optional[str]:
|
|
58
|
-
return _config["session_id"]
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
def set_user_id(value: Optional[str]) -> None:
|
|
62
|
-
_config["user_id"] = value
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
def get_user_id() -> Optional[str]:
|
|
66
|
-
return _config["user_id"]
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
def set_tenant_id(value: Optional[str]) -> None:
|
|
70
|
-
_config["tenant_id"] = value
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def get_tenant_id() -> Optional[str]:
|
|
74
|
-
return _config["tenant_id"]
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
def set_project_id(value: Optional[str]) -> None:
|
|
78
|
-
_config["project_id"] = value
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
def get_project_id() -> Optional[str]:
|
|
82
|
-
return _config["project_id"]
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
def set_agent_id(value: Optional[str]) -> None:
|
|
86
|
-
_config["agent_id"] = value
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
def get_agent_id() -> Optional[str]:
|
|
90
|
-
return _config["agent_id"]
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
def set_debug(value: bool) -> None:
|
|
94
|
-
_config["debug"] = value
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def get_debug() -> bool:
|
|
98
|
-
return _config["debug"]
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
def set_attr_truncation_limit(value: int) -> None:
|
|
102
|
-
_config["attr_truncation_limit"] = value
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def get_attr_truncation_limit() -> int:
|
|
106
|
-
return _config["attr_truncation_limit"]
|
traccia-0.1.0.dist-info/RECORD
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
traccia/__init__.py,sha256=O2Hs3GFVcFsmeBlJwJhqPvFH9kB-pAJarEfB9G4xLZU,1998
|
|
2
|
-
traccia/auto.py,sha256=S-T6edev59c3HEgAU9ENQjOtL2duUJdjJzlBk6hGek0,25792
|
|
3
|
-
traccia/auto_instrumentation.py,sha256=e2Gzt2AtGSXbv6BSZpAApAtMcTlEwc08dgZgQMfrREU,2107
|
|
4
|
-
traccia/cli.py,sha256=lQJU-dAxxcWyOew7OCBi2u7RbMXcwOxtLyfzFwlZ4f0,12362
|
|
5
|
-
traccia/config.py,sha256=BCj_N_zkuRlfPMsuTO-LpcZDQdKQjJ6QHxAIWfCg0HI,24527
|
|
6
|
-
traccia/errors.py,sha256=CMIS01M3pnr3oRhtzQkyKYkDgYkJNlGd6D9Zg2AohA0,1158
|
|
7
|
-
traccia/pricing_config.py,sha256=ZTccshJbAySWJw9Rdvpj2SMaHkEio325t8NkfJfNzfY,1732
|
|
8
|
-
traccia/runtime_config.py,sha256=LjeKCPYKkbZiI38ih4OX4XMkW72hA29Or0hso4W63-M,2157
|
|
9
|
-
traccia-0.1.0.dist-info/licenses/LICENSE,sha256=HNl57LOj88EfKh-IWmeqWxsDRh_FF6lj0l-E2A4Hr8w,10757
|
|
10
|
-
traccia-0.1.0.dist-info/METADATA,sha256=vYjnTMp2sclYNc-BT5nGDheiCu0XQYAk9orDBijDXDo,17986
|
|
11
|
-
traccia-0.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
12
|
-
traccia-0.1.0.dist-info/entry_points.txt,sha256=SG7gacPRmFzLw2HYTblUZsmC_TO3n14-dNi28SL-C2k,45
|
|
13
|
-
traccia-0.1.0.dist-info/top_level.txt,sha256=Kc56JudupqSkzJPOnuQ6mPHJmhtike7pssNX0u_p59w,8
|
|
14
|
-
traccia-0.1.0.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
traccia
|
|
File without changes
|
|
File without changes
|
|
File without changes
|