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

@@ -30,13 +30,15 @@ class InstrumentationSpanProcessor(SpanProcessor): # type: ignore[misc]
30
30
  if scope is not None:
31
31
  name = getattr(scope, "name", None)
32
32
  if isinstance(name, str) and name:
33
- # Normalize common pattern like 'opentelemetry.instrumentation.httpx' -> 'httpx'
34
- try:
35
- base = name.rsplit(".", 1)[-1].strip()
36
- if base:
37
- return base
38
- except Exception:
39
- pass
33
+ # Only truncate when coming from known namespaces
34
+ if name.startswith("opentelemetry.instrumentation.") or name.startswith("netra.instrumentation."):
35
+ try:
36
+ base = name.rsplit(".", 1)[-1].strip()
37
+ if base:
38
+ return base
39
+ except Exception:
40
+ pass
41
+ # Otherwise, return as-is
40
42
  return name
41
43
  return None
42
44
 
@@ -87,7 +89,7 @@ class InstrumentationSpanProcessor(SpanProcessor): # type: ignore[misc]
87
89
 
88
90
  # Set this span's instrumentation name
89
91
  name = self._detect_raw_instrumentation_name(span)
90
- if name and any(allowed in name for allowed in ALLOWED_INSTRUMENTATION_NAMES):
92
+ if name in ALLOWED_INSTRUMENTATION_NAMES:
91
93
  span.set_attribute(f"{Config.LIBRARY_NAME}.instrumentation.name", name)
92
94
  except Exception:
93
95
  pass
netra/session_manager.py CHANGED
@@ -225,26 +225,7 @@ class SessionManager:
225
225
  ctx = baggage.set_baggage("user_id", value, ctx)
226
226
  elif session_key == "tenant_id":
227
227
  ctx = baggage.set_baggage("tenant_id", value, ctx)
228
- elif isinstance(value, dict) and value:
229
- if session_key == "custom_attributes":
230
- custom_keys = list(value.keys())
231
- ctx = baggage.set_baggage("custom_keys", ",".join(custom_keys), ctx)
232
- for key, val in value.items():
233
- ctx = baggage.set_baggage(f"custom.{key}", str(val), ctx)
234
-
235
- # Decide whether to attach globally. We only attach if there is no
236
- # active recording span (safe point) or if the caller forces it.
237
- current_span = trace.get_current_span()
238
- has_active_span = bool(current_span and getattr(current_span, "is_recording", lambda: False)())
239
- if attach_globally or not has_active_span:
240
228
  otel_context.attach(ctx)
241
- else:
242
- # Best-effort: annotate the current span for observability
243
- if isinstance(value, str) and value:
244
- current_span.set_attribute(f"{Config.LIBRARY_NAME}.session.{session_key}", value)
245
- elif isinstance(value, dict) and value and session_key == "custom_attributes":
246
- for key, val in value.items():
247
- current_span.set_attribute(f"{Config.LIBRARY_NAME}.session.custom.{key}", str(val))
248
229
  except Exception as e:
249
230
  logger.exception(f"Failed to set session context for key={session_key}: {e}")
250
231
 
netra/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.37"
1
+ __version__ = "0.1.39"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: netra-sdk
3
- Version: 0.1.37
3
+ Version: 0.1.39
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
@@ -41,15 +41,15 @@ netra/instrumentation/weaviate/__init__.py,sha256=EOlpWxobOLHYKqo_kMct_7nu26x1hr
41
41
  netra/instrumentation/weaviate/version.py,sha256=PiCZHjonujPbnIn0KmD3Yl68hrjPRG_oKe5vJF3mmG8,24
42
42
  netra/pii.py,sha256=Rn4SjgTJW_aw9LcbjLuMqF3fKd9b1ndlYt1CaK51Ge0,33125
43
43
  netra/processors/__init__.py,sha256=TLVBKk4Bli7MOyHTy_F-4NSm0thzIcJcZAVVNoq6gK8,333
44
- netra/processors/instrumentation_span_processor.py,sha256=Ef5FTr8O5FLHcIkBAW3ueU1nlkV2DuOi-y5iIwHzldQ,4252
44
+ netra/processors/instrumentation_span_processor.py,sha256=VzurzwtGleFltxzKD_gjVkUQiRC6SGlb0oG4Nlpu85A,4365
45
45
  netra/processors/scrubbing_span_processor.py,sha256=dJ86Ncmjvmrhm_uAdGTwcGvRpZbVVWqD9AOFwEMWHZY,6701
46
46
  netra/processors/session_span_processor.py,sha256=qcsBl-LnILWefsftI8NQhXDGb94OWPc8LvzhVA0JS_c,2432
47
47
  netra/scanner.py,sha256=kyDpeZiscCPb6pjuhS-sfsVj-dviBFRepdUWh0sLoEY,11554
48
- netra/session_manager.py,sha256=E-LAvmhlmSED7iNsfrfVHXD4-vES2K-EQaiOQoYpE78,14709
48
+ netra/session_manager.py,sha256=aMnIzKBMkTfEeYLpmWL-5_BjUL5b-y-RiHAdqYqT_JM,13453
49
49
  netra/span_wrapper.py,sha256=IygQX78xQRlL_Z1MfKfUbv0okihx92qNClnRlYFtRNc,8004
50
50
  netra/tracer.py,sha256=FJO8Cine-WL9K_4wn6RVjQOgX6c1JCp_8QowUbRSVHk,7718
51
- netra/version.py,sha256=fZtrhA5kKp_n3T2sxpEh-YEt3P1ZAtGrg_Xuu1JX3ZQ,23
52
- netra_sdk-0.1.37.dist-info/LICENCE,sha256=8B_UoZ-BAl0AqiHAHUETCgd3I2B9yYJ1WEQtVb_qFMA,11359
53
- netra_sdk-0.1.37.dist-info/METADATA,sha256=sQ6ffqXCyKgOLtaIUIvBfV01nfecgVY3OrEOTTEwLgc,28210
54
- netra_sdk-0.1.37.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
55
- netra_sdk-0.1.37.dist-info/RECORD,,
51
+ netra/version.py,sha256=sfc5YqMhonehojmfXWQszjknUHF_Q-G6tt4E1pfsXOY,23
52
+ netra_sdk-0.1.39.dist-info/LICENCE,sha256=8B_UoZ-BAl0AqiHAHUETCgd3I2B9yYJ1WEQtVb_qFMA,11359
53
+ netra_sdk-0.1.39.dist-info/METADATA,sha256=NhZt7a8g4g7oNbIwLSIsT4bp8HjDJij6uLV2yfyK1Ho,28210
54
+ netra_sdk-0.1.39.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
55
+ netra_sdk-0.1.39.dist-info/RECORD,,