netra-sdk 0.1.21__tar.gz → 0.1.23__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.21 → netra_sdk-0.1.23}/PKG-INFO +4 -4
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/README.md +3 -3
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/span_wrapper.py +3 -19
- netra_sdk-0.1.23/netra/version.py +1 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/pyproject.toml +1 -1
- netra_sdk-0.1.21/netra/version.py +0 -1
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/LICENCE +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/__init__.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/anonymizer/__init__.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/anonymizer/anonymizer.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/anonymizer/base.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/anonymizer/fp_anonymizer.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/config.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/decorators.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/exceptions/__init__.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/exceptions/injection.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/exceptions/pii.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/input_scanner.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/__init__.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/aiohttp/__init__.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/aiohttp/version.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/cohere/__init__.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/cohere/version.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/fastapi/__init__.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/fastapi/version.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/google_genai/__init__.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/google_genai/config.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/google_genai/utils.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/google_genai/version.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/httpx/__init__.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/httpx/version.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/instruments.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/mistralai/__init__.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/mistralai/config.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/mistralai/utils.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/mistralai/version.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/openai/__init__.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/openai/version.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/openai/wrappers.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/weaviate/__init__.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/instrumentation/weaviate/version.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/pii.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/processors/__init__.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/processors/session_span_processor.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/scanner.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/netra/session_manager.py +0 -0
- {netra_sdk-0.1.21 → netra_sdk-0.1.23}/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.23
|
|
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
|
|
@@ -620,7 +620,7 @@ with Netra.start_span("image_generation") as span:
|
|
|
620
620
|
|
|
621
621
|
# Track database operations and other actions
|
|
622
622
|
action = ActionModel(
|
|
623
|
-
start_time="
|
|
623
|
+
start_time="1753857049844249088", # timestamp in nanoseconds
|
|
624
624
|
action="DB",
|
|
625
625
|
action_type="INSERT",
|
|
626
626
|
affected_records=[
|
|
@@ -638,7 +638,7 @@ with Netra.start_span("image_generation") as span:
|
|
|
638
638
|
|
|
639
639
|
# Record API calls
|
|
640
640
|
api_action = ActionModel(
|
|
641
|
-
start_time="
|
|
641
|
+
start_time="1753857049844249088", # timestamp in nanoseconds
|
|
642
642
|
action="API",
|
|
643
643
|
action_type="CALL",
|
|
644
644
|
metadata={
|
|
@@ -659,7 +659,7 @@ Action tracking follows this schema:
|
|
|
659
659
|
```python
|
|
660
660
|
[
|
|
661
661
|
{
|
|
662
|
-
"start_time": str, # Start time of the action in
|
|
662
|
+
"start_time": str, # Start time of the action in nanoseconds
|
|
663
663
|
"action": str, # Type of action (e.g., "DB", "API", "CACHE")
|
|
664
664
|
"action_type": str, # Action subtype (e.g., "INSERT", "SELECT", "CALL")
|
|
665
665
|
"affected_records": [ # Optional: List of records affected
|
|
@@ -540,7 +540,7 @@ with Netra.start_span("image_generation") as span:
|
|
|
540
540
|
|
|
541
541
|
# Track database operations and other actions
|
|
542
542
|
action = ActionModel(
|
|
543
|
-
start_time="
|
|
543
|
+
start_time="1753857049844249088", # timestamp in nanoseconds
|
|
544
544
|
action="DB",
|
|
545
545
|
action_type="INSERT",
|
|
546
546
|
affected_records=[
|
|
@@ -558,7 +558,7 @@ with Netra.start_span("image_generation") as span:
|
|
|
558
558
|
|
|
559
559
|
# Record API calls
|
|
560
560
|
api_action = ActionModel(
|
|
561
|
-
start_time="
|
|
561
|
+
start_time="1753857049844249088", # timestamp in nanoseconds
|
|
562
562
|
action="API",
|
|
563
563
|
action_type="CALL",
|
|
564
564
|
metadata={
|
|
@@ -579,7 +579,7 @@ Action tracking follows this schema:
|
|
|
579
579
|
```python
|
|
580
580
|
[
|
|
581
581
|
{
|
|
582
|
-
"start_time": str, # Start time of the action in
|
|
582
|
+
"start_time": str, # Start time of the action in nanoseconds
|
|
583
583
|
"action": str, # Type of action (e.g., "DB", "API", "CACHE")
|
|
584
584
|
"action_type": str, # Action subtype (e.g., "INSERT", "SELECT", "CALL")
|
|
585
585
|
"affected_records": [ # Optional: List of records affected
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import logging
|
|
3
|
-
import re
|
|
4
3
|
import time
|
|
5
|
-
from datetime import datetime
|
|
4
|
+
from datetime import datetime
|
|
6
5
|
from typing import Any, Dict, List, Literal, Optional
|
|
7
6
|
|
|
8
7
|
from opentelemetry import context as context_api
|
|
9
8
|
from opentelemetry import trace
|
|
10
9
|
from opentelemetry.trace import SpanKind, Status, StatusCode
|
|
11
10
|
from opentelemetry.trace.propagation import set_span_in_context
|
|
12
|
-
from pydantic import BaseModel
|
|
11
|
+
from pydantic import BaseModel
|
|
13
12
|
|
|
14
13
|
from netra.config import Config
|
|
15
14
|
|
|
@@ -19,28 +18,13 @@ logger = logging.getLogger(__name__)
|
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
class ActionModel(BaseModel): # type: ignore[misc]
|
|
22
|
-
start_time: str = datetime.now(
|
|
21
|
+
start_time: str = str((datetime.now().timestamp() * 1_000_000_000))
|
|
23
22
|
action: str
|
|
24
23
|
action_type: str
|
|
25
24
|
success: bool
|
|
26
25
|
affected_records: Optional[List[Dict[str, str]]] = None
|
|
27
26
|
metadata: Optional[Dict[str, str]] = None
|
|
28
27
|
|
|
29
|
-
@field_validator("start_time") # type: ignore[misc]
|
|
30
|
-
@classmethod
|
|
31
|
-
def validate_time_format(cls, value: str) -> str:
|
|
32
|
-
"""Validate that start_time is in ISO 8601 format with microseconds and Z suffix."""
|
|
33
|
-
# Pattern for ISO 8601 with microseconds: YYYY-MM-DDTHH:MM:SS.ffffffZ
|
|
34
|
-
pattern = r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}Z$"
|
|
35
|
-
|
|
36
|
-
if not re.match(pattern, value):
|
|
37
|
-
raise ValueError(
|
|
38
|
-
f"start_time must be in ISO 8601 format with microseconds: "
|
|
39
|
-
f"YYYY-MM-DDTHH:MM:SS.ffffffZ (e.g., 2025-07-18T14:30:45.123456Z). "
|
|
40
|
-
f"Got: {value}"
|
|
41
|
-
)
|
|
42
|
-
return value
|
|
43
|
-
|
|
44
28
|
|
|
45
29
|
class UsageModel(BaseModel): # type: ignore[misc]
|
|
46
30
|
model: str
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.23"
|
|
@@ -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.23"
|
|
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.21"
|
|
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
|