netra-sdk 0.1.27__tar.gz → 0.1.28__tar.gz
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.
Potentially problematic release.
This version of netra-sdk might be problematic. Click here for more details.
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/PKG-INFO +1 -1
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/__init__.py +25 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/config.py +9 -0
- netra_sdk-0.1.28/netra/version.py +1 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/pyproject.toml +1 -1
- netra_sdk-0.1.27/netra/version.py +0 -1
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/LICENCE +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/README.md +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/anonymizer/__init__.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/anonymizer/anonymizer.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/anonymizer/base.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/anonymizer/fp_anonymizer.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/decorators.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/exceptions/__init__.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/exceptions/injection.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/exceptions/pii.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/input_scanner.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/__init__.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/aiohttp/__init__.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/aiohttp/version.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/cohere/__init__.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/cohere/version.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/fastapi/__init__.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/fastapi/version.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/google_genai/__init__.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/google_genai/config.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/google_genai/utils.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/google_genai/version.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/httpx/__init__.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/httpx/version.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/instruments.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/mistralai/__init__.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/mistralai/config.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/mistralai/utils.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/mistralai/version.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/openai/__init__.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/openai/version.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/openai/wrappers.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/pydantic_ai/__init__.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/pydantic_ai/utils.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/pydantic_ai/version.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/pydantic_ai/wrappers.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/weaviate/__init__.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/instrumentation/weaviate/version.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/pii.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/processors/__init__.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/processors/session_span_processor.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/scanner.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/session_manager.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/span_wrapper.py +0 -0
- {netra_sdk-0.1.27 → netra_sdk-0.1.28}/netra/tracer.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: netra-sdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.28
|
|
4
4
|
Summary: A Python SDK for AI application observability that provides OpenTelemetry-based monitoring, tracing, and PII protection for LLM and vector database applications. Enables easy instrumentation, session tracking, and privacy-focused data collection for AI systems in production environments.
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Keywords: netra,tracing,observability,sdk,ai,llm,vector,database
|
|
@@ -12,7 +12,10 @@ from .session_manager import SessionManager
|
|
|
12
12
|
from .span_wrapper import ActionModel, SpanWrapper, UsageModel
|
|
13
13
|
from .tracer import Tracer
|
|
14
14
|
|
|
15
|
+
# Package-level logger. Attach NullHandler by default so library does not emit logs
|
|
16
|
+
# unless explicitly enabled by the user via debug_mode.
|
|
15
17
|
logger = logging.getLogger(__name__)
|
|
18
|
+
logger.addHandler(logging.NullHandler())
|
|
16
19
|
|
|
17
20
|
|
|
18
21
|
class Netra:
|
|
@@ -42,6 +45,7 @@ class Netra:
|
|
|
42
45
|
headers: Optional[str] = None,
|
|
43
46
|
disable_batch: Optional[bool] = None,
|
|
44
47
|
trace_content: Optional[bool] = None,
|
|
48
|
+
debug_mode: Optional[bool] = None,
|
|
45
49
|
resource_attributes: Optional[Dict[str, Any]] = None,
|
|
46
50
|
environment: Optional[str] = None,
|
|
47
51
|
instruments: Optional[Set[NetraInstruments]] = None,
|
|
@@ -61,10 +65,31 @@ class Netra:
|
|
|
61
65
|
headers=headers,
|
|
62
66
|
disable_batch=disable_batch,
|
|
63
67
|
trace_content=trace_content,
|
|
68
|
+
debug_mode=debug_mode,
|
|
64
69
|
resource_attributes=resource_attributes,
|
|
65
70
|
environment=environment,
|
|
66
71
|
)
|
|
67
72
|
|
|
73
|
+
# Configure package logging based on debug mode
|
|
74
|
+
pkg_logger = logging.getLogger("netra")
|
|
75
|
+
# Prevent propagating to root to avoid duplicate logs
|
|
76
|
+
pkg_logger.propagate = False
|
|
77
|
+
# Clear existing handlers to avoid duplicates across repeated init attempts
|
|
78
|
+
pkg_logger.handlers.clear()
|
|
79
|
+
if cfg.debug_mode:
|
|
80
|
+
pkg_logger.setLevel(logging.DEBUG)
|
|
81
|
+
handler = logging.StreamHandler()
|
|
82
|
+
formatter = logging.Formatter(
|
|
83
|
+
fmt="%(asctime)s | %(levelname)s | %(name)s | %(message)s",
|
|
84
|
+
datefmt="%Y-%m-%d %H:%M:%S",
|
|
85
|
+
)
|
|
86
|
+
handler.setFormatter(formatter)
|
|
87
|
+
pkg_logger.addHandler(handler)
|
|
88
|
+
else:
|
|
89
|
+
# Silence SDK logs entirely unless debug is enabled
|
|
90
|
+
pkg_logger.setLevel(logging.CRITICAL)
|
|
91
|
+
pkg_logger.addHandler(logging.NullHandler())
|
|
92
|
+
|
|
68
93
|
# Initialize tracer (OTLP exporter, span processor, resource)
|
|
69
94
|
Tracer(cfg)
|
|
70
95
|
|
|
@@ -16,6 +16,7 @@ class Config:
|
|
|
16
16
|
- headers: Additional headers (W3C Correlation-Context format)
|
|
17
17
|
- disable_batch: Whether to disable batch span processor (bool)
|
|
18
18
|
- trace_content: Whether to capture prompt/completion content (bool)
|
|
19
|
+
- debug_mode: Whether to enable SDK logging; default False (bool)
|
|
19
20
|
- resource_attributes: Custom resource attributes dict (e.g., {'env': 'prod', 'version': '1.0.0'})
|
|
20
21
|
"""
|
|
21
22
|
|
|
@@ -30,6 +31,7 @@ class Config:
|
|
|
30
31
|
headers: Optional[str] = None,
|
|
31
32
|
disable_batch: Optional[bool] = None,
|
|
32
33
|
trace_content: Optional[bool] = None,
|
|
34
|
+
debug_mode: Optional[bool] = None,
|
|
33
35
|
resource_attributes: Optional[Dict[str, Any]] = None,
|
|
34
36
|
environment: Optional[str] = None,
|
|
35
37
|
):
|
|
@@ -91,6 +93,13 @@ class Config:
|
|
|
91
93
|
else:
|
|
92
94
|
os.environ["TRACELOOP_TRACE_CONTENT"] = "true"
|
|
93
95
|
|
|
96
|
+
# Debug mode: enable SDK logging only when True. Default False.
|
|
97
|
+
if debug_mode is not None:
|
|
98
|
+
self.debug_mode = debug_mode
|
|
99
|
+
else:
|
|
100
|
+
env_dbg = os.getenv("NETRA_DEBUG")
|
|
101
|
+
self.debug_mode = True if (env_dbg is not None and env_dbg.lower() in ("1", "true")) else False
|
|
102
|
+
|
|
94
103
|
# 7. Environment: param override, else env
|
|
95
104
|
if environment is not None:
|
|
96
105
|
self.environment = environment
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.28"
|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "netra-sdk"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.28"
|
|
8
8
|
description = "A Python SDK for AI application observability that provides OpenTelemetry-based monitoring, tracing, and PII protection for LLM and vector database applications. Enables easy instrumentation, session tracking, and privacy-focused data collection for AI systems in production environments."
|
|
9
9
|
authors = [
|
|
10
10
|
{name = "Sooraj Thomas",email = "sooraj@keyvalue.systems"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.27"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|