netra-sdk 0.1.22__py3-none-any.whl → 0.1.24__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.

Potentially problematic release.


This version of netra-sdk might be problematic. Click here for more details.

@@ -34,16 +34,11 @@ def init_instrumentations(
34
34
  else:
35
35
  traceloop_block_instruments.add(getattr(Instruments, instrument.name))
36
36
 
37
- # If no instruments are provided for instrumentation
38
- if instruments is None:
39
- traceloop_block_instruments = set(Instruments)
40
- netra_custom_block_instruments = set(CustomInstruments)
41
-
42
- # If only custom instruments from netra are provided for instrumentation
37
+ # If no instruments in traceloop are provided for instrumentation
43
38
  if instruments is not None and not traceloop_instruments and not traceloop_block_instruments:
44
39
  traceloop_block_instruments = set(Instruments)
45
40
 
46
- # If only traceloop instruments are provided for instrumentation
41
+ # If no custom instruments in netra are provided for instrumentation
47
42
  if instruments is not None and not netra_custom_instruments and not netra_custom_block_instruments:
48
43
  netra_custom_block_instruments = set(CustomInstruments)
49
44
 
netra/span_wrapper.py CHANGED
@@ -1,15 +1,14 @@
1
1
  import json
2
2
  import logging
3
- import re
4
3
  import time
5
- from datetime import datetime, timezone
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, field_validator
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(timezone.utc).strftime("%Y-%m-%dT%H:%M:%S.%fZ")
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
netra/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.22"
1
+ __version__ = "0.1.24"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: netra-sdk
3
- Version: 0.1.22
3
+ Version: 0.1.24
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="2025-07-18T10:29:30.855287Z",
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="2025-07-18T10:29:30.855287Z",
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 ISO 8601 format with microseconds and Z suffix (e.g., 2025-07-18T14:30:45.123456Z)
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
@@ -9,7 +9,7 @@ netra/exceptions/__init__.py,sha256=uDgcBxmC4WhdS7HRYQk_TtJyxH1s1o6wZmcsnSHLAcM,
9
9
  netra/exceptions/injection.py,sha256=ke4eUXRYUFJkMZgdSyPPkPt5PdxToTI6xLEBI0hTWUQ,1332
10
10
  netra/exceptions/pii.py,sha256=MT4p_x-zH3VtYudTSxw1Z9qQZADJDspq64WrYqSWlZc,2438
11
11
  netra/input_scanner.py,sha256=At6N9gNY8cR0O6S8x3K6swWBV3P1a_9O-XBNM_pcKz4,5348
12
- netra/instrumentation/__init__.py,sha256=ckV_tYPCQhEQ03tT0NU0ZrPD0o_1x0RnxLja3Esi97Q,40252
12
+ netra/instrumentation/__init__.py,sha256=OhJ3VkyUAIqocZ47beEYJTiQC7tcRkHVbGqZ81a2JHQ,40044
13
13
  netra/instrumentation/aiohttp/__init__.py,sha256=M1kuF0R3gKY5rlbhEC1AR13UWHelmfokluL2yFysKWc,14398
14
14
  netra/instrumentation/aiohttp/version.py,sha256=Zy-0Aukx-HS_Mo3NKPWg-hlUoWKDzS0w58gLoVtJec8,24
15
15
  netra/instrumentation/cohere/__init__.py,sha256=3XwmCAZwZiMkHdNN3YvcBOLsNCx80ymbU31TyMzv1IY,17685
@@ -37,10 +37,10 @@ netra/processors/__init__.py,sha256=wfnSskRBtMT90hO7LqFJoEW374LgoH_gnTxhynqtByI,
37
37
  netra/processors/session_span_processor.py,sha256=qcsBl-LnILWefsftI8NQhXDGb94OWPc8LvzhVA0JS_c,2432
38
38
  netra/scanner.py,sha256=kyDpeZiscCPb6pjuhS-sfsVj-dviBFRepdUWh0sLoEY,11554
39
39
  netra/session_manager.py,sha256=EVcnWcSj4NdkH--HmqHx0mmzivQiM4GCyFLu6lwi33M,6252
40
- netra/span_wrapper.py,sha256=DA5jjXkHBUJ8_mdlYP06rcZzFoSih4gdP71Wwr3btcQ,8104
40
+ netra/span_wrapper.py,sha256=ec2WLYTRLZ02WSSCYEsMn1PgUGVji9rFyq_CRCV9rog,7388
41
41
  netra/tracer.py,sha256=In5QPVLz_6BxrolWpav9EuR9_hirD2UUIlyY75QUaKk,3450
42
- netra/version.py,sha256=zmP2TRnzKPjZJ1eiBcT-cRInsji6FW-OVD3FafQFCc4,23
43
- netra_sdk-0.1.22.dist-info/LICENCE,sha256=8B_UoZ-BAl0AqiHAHUETCgd3I2B9yYJ1WEQtVb_qFMA,11359
44
- netra_sdk-0.1.22.dist-info/METADATA,sha256=C5cJrEu84Km4eDk4GvYUyK549BRs155tK4j1aHHP9Bw,27796
45
- netra_sdk-0.1.22.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
46
- netra_sdk-0.1.22.dist-info/RECORD,,
42
+ netra/version.py,sha256=Jq7e1LcKcQSNVg4EOJ-acPyPgs8Os5cYEZWXrQsI7Pg,23
43
+ netra_sdk-0.1.24.dist-info/LICENCE,sha256=8B_UoZ-BAl0AqiHAHUETCgd3I2B9yYJ1WEQtVb_qFMA,11359
44
+ netra_sdk-0.1.24.dist-info/METADATA,sha256=wyqkG0Dzyrw3oQ_YSP-o_FfOhqdhUTNcV5SKx6Vemog,27765
45
+ netra_sdk-0.1.24.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
46
+ netra_sdk-0.1.24.dist-info/RECORD,,