traccia 0.1.2__py3-none-any.whl → 0.1.6__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.
Files changed (57) hide show
  1. traccia/__init__.py +73 -0
  2. traccia/auto.py +748 -0
  3. traccia/auto_instrumentation.py +74 -0
  4. traccia/cli.py +349 -0
  5. traccia/config.py +699 -0
  6. traccia/context/__init__.py +33 -0
  7. traccia/context/context.py +67 -0
  8. traccia/context/propagators.py +283 -0
  9. traccia/errors.py +48 -0
  10. traccia/exporter/__init__.py +8 -0
  11. traccia/exporter/console_exporter.py +31 -0
  12. traccia/exporter/file_exporter.py +178 -0
  13. traccia/exporter/http_exporter.py +214 -0
  14. traccia/exporter/otlp_exporter.py +190 -0
  15. traccia/instrumentation/__init__.py +26 -0
  16. traccia/instrumentation/anthropic.py +92 -0
  17. traccia/instrumentation/decorator.py +263 -0
  18. traccia/instrumentation/fastapi.py +38 -0
  19. traccia/instrumentation/http_client.py +21 -0
  20. traccia/instrumentation/http_server.py +25 -0
  21. traccia/instrumentation/openai.py +358 -0
  22. traccia/instrumentation/requests.py +68 -0
  23. traccia/integrations/__init__.py +39 -0
  24. traccia/integrations/langchain/__init__.py +14 -0
  25. traccia/integrations/langchain/callback.py +418 -0
  26. traccia/integrations/langchain/utils.py +129 -0
  27. traccia/integrations/openai_agents/__init__.py +73 -0
  28. traccia/integrations/openai_agents/processor.py +262 -0
  29. traccia/pricing_config.py +58 -0
  30. traccia/processors/__init__.py +35 -0
  31. traccia/processors/agent_enricher.py +159 -0
  32. traccia/processors/batch_processor.py +140 -0
  33. traccia/processors/cost_engine.py +71 -0
  34. traccia/processors/cost_processor.py +70 -0
  35. traccia/processors/drop_policy.py +44 -0
  36. traccia/processors/logging_processor.py +31 -0
  37. traccia/processors/rate_limiter.py +223 -0
  38. traccia/processors/sampler.py +22 -0
  39. traccia/processors/token_counter.py +216 -0
  40. traccia/runtime_config.py +127 -0
  41. traccia/tracer/__init__.py +15 -0
  42. traccia/tracer/otel_adapter.py +577 -0
  43. traccia/tracer/otel_utils.py +24 -0
  44. traccia/tracer/provider.py +155 -0
  45. traccia/tracer/span.py +286 -0
  46. traccia/tracer/span_context.py +16 -0
  47. traccia/tracer/tracer.py +243 -0
  48. traccia/utils/__init__.py +19 -0
  49. traccia/utils/helpers.py +95 -0
  50. {traccia-0.1.2.dist-info → traccia-0.1.6.dist-info}/METADATA +72 -15
  51. traccia-0.1.6.dist-info/RECORD +55 -0
  52. traccia-0.1.6.dist-info/top_level.txt +1 -0
  53. traccia-0.1.2.dist-info/RECORD +0 -6
  54. traccia-0.1.2.dist-info/top_level.txt +0 -1
  55. {traccia-0.1.2.dist-info → traccia-0.1.6.dist-info}/WHEEL +0 -0
  56. {traccia-0.1.2.dist-info → traccia-0.1.6.dist-info}/entry_points.txt +0 -0
  57. {traccia-0.1.2.dist-info → traccia-0.1.6.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,127 @@
1
+ """Runtime configuration state management."""
2
+
3
+ from typing import Optional, List, Any
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
+ "openai_agents": True,
19
+ }
20
+
21
+
22
+ def set_auto_instrument_tools(value: bool) -> None:
23
+ _config["auto_instrument_tools"] = value
24
+
25
+
26
+ def get_auto_instrument_tools() -> bool:
27
+ return _config["auto_instrument_tools"]
28
+
29
+
30
+ def set_tool_include(value: List[str]) -> None:
31
+ _config["tool_include"] = value
32
+
33
+
34
+ def get_tool_include() -> List[str]:
35
+ return _config["tool_include"]
36
+
37
+
38
+ def set_max_tool_spans(value: int) -> None:
39
+ _config["max_tool_spans"] = value
40
+
41
+
42
+ def get_max_tool_spans() -> int:
43
+ return _config["max_tool_spans"]
44
+
45
+
46
+ def set_max_span_depth(value: int) -> None:
47
+ _config["max_span_depth"] = value
48
+
49
+
50
+ def get_max_span_depth() -> int:
51
+ return _config["max_span_depth"]
52
+
53
+
54
+ def set_session_id(value: Optional[str]) -> None:
55
+ _config["session_id"] = value
56
+
57
+
58
+ def get_session_id() -> Optional[str]:
59
+ return _config["session_id"]
60
+
61
+
62
+ def set_user_id(value: Optional[str]) -> None:
63
+ _config["user_id"] = value
64
+
65
+
66
+ def get_user_id() -> Optional[str]:
67
+ return _config["user_id"]
68
+
69
+
70
+ def set_tenant_id(value: Optional[str]) -> None:
71
+ _config["tenant_id"] = value
72
+
73
+
74
+ def get_tenant_id() -> Optional[str]:
75
+ return _config["tenant_id"]
76
+
77
+
78
+ def set_project_id(value: Optional[str]) -> None:
79
+ _config["project_id"] = value
80
+
81
+
82
+ def get_project_id() -> Optional[str]:
83
+ return _config["project_id"]
84
+
85
+
86
+ def set_agent_id(value: Optional[str]) -> None:
87
+ _config["agent_id"] = value
88
+
89
+
90
+ def get_agent_id() -> Optional[str]:
91
+ return _config["agent_id"]
92
+
93
+
94
+ def set_debug(value: bool) -> None:
95
+ _config["debug"] = value
96
+
97
+
98
+ def get_debug() -> bool:
99
+ return _config["debug"]
100
+
101
+
102
+ def set_attr_truncation_limit(value: int) -> None:
103
+ _config["attr_truncation_limit"] = value
104
+
105
+
106
+ def get_attr_truncation_limit() -> int:
107
+ return _config["attr_truncation_limit"]
108
+
109
+
110
+ def get_openai_agents() -> bool:
111
+ """Get whether OpenAI Agents SDK integration is enabled."""
112
+ return _config.get("openai_agents", True)
113
+
114
+
115
+ def set_openai_agents(value: bool) -> None:
116
+ """Set whether OpenAI Agents SDK integration is enabled."""
117
+ _config["openai_agents"] = value
118
+
119
+
120
+ def set_config_value(key: str, value: Any) -> None:
121
+ """Set a runtime config value."""
122
+ _config[key] = value
123
+
124
+
125
+ def get_config_value(key: str, default: Any = None) -> Any:
126
+ """Get a runtime config value."""
127
+ return _config.get(key, default)
@@ -0,0 +1,15 @@
1
+ """Tracer components for the tracing SDK."""
2
+
3
+ from traccia.tracer.provider import SpanProcessor, TracerProvider
4
+ from traccia.tracer.span import Span, SpanStatus
5
+ from traccia.tracer.span_context import SpanContext
6
+ from traccia.tracer.tracer import Tracer
7
+
8
+ __all__ = [
9
+ "Span",
10
+ "SpanStatus",
11
+ "SpanContext",
12
+ "Tracer",
13
+ "TracerProvider",
14
+ "SpanProcessor",
15
+ ]