debugbundle-python 1.1.0__py3-none-any.whl → 1.1.3__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.
debugbundle/core.py CHANGED
@@ -528,23 +528,27 @@ class DebugBundleSdk:
528
528
  payload: dict[str, object],
529
529
  context: Mapping[str, object] | None = None,
530
530
  ) -> dict[str, object]:
531
- return {
531
+ merged_context = self._merged_context(context)
532
+ event: dict[str, object] = {
532
533
  "schema_version": SCHEMA_VERSION,
533
534
  "event_id": str(uuid.uuid4()),
534
535
  "event_type": event_type,
535
536
  "occurred_at": _iso_now(self._time_provider),
536
537
  "sdk_name": "debugbundle-python",
537
538
  "sdk_version": _sdk_version(),
538
- "sdk_language": "python",
539
539
  "service": {
540
540
  "name": self._service,
541
541
  "runtime": "python",
542
542
  "framework": None,
543
543
  "environment": self._environment,
544
544
  },
545
- "correlation": _correlation_payload(self._merged_context(context)),
545
+ "correlation": _correlation_payload(merged_context),
546
546
  "payload": payload,
547
547
  }
548
+ envelope_context = _event_context(merged_context)
549
+ if envelope_context:
550
+ event["context"] = envelope_context
551
+ return event
548
552
 
549
553
  def _merged_context(self, context: Mapping[str, object] | None = None) -> dict[str, object]:
550
554
  merged = dict(self._context)
@@ -861,6 +865,14 @@ def _correlation_payload(context: Mapping[str, object]) -> dict[str, str | None]
861
865
  }
862
866
 
863
867
 
868
+ def _event_context(context: Mapping[str, object]) -> dict[str, object]:
869
+ return {
870
+ str(key): value
871
+ for key, value in context.items()
872
+ if key not in {"request", "response", "correlation", "request_id", "trace_id", "session_id", "user_id_hash"}
873
+ }
874
+
875
+
864
876
  def _coerce_optional_string(value: object) -> str | None:
865
877
  if value is None:
866
878
  return None
@@ -942,7 +954,7 @@ def _sdk_version() -> str:
942
954
  try:
943
955
  return metadata.version("debugbundle-python")
944
956
  except metadata.PackageNotFoundError:
945
- return "1.1.0"
957
+ return "1.1.3"
946
958
 
947
959
 
948
960
  def _sdk_config_endpoint(events_endpoint: str) -> str:
debugbundle/relay.py CHANGED
@@ -25,6 +25,7 @@ ACCEPTED_EVENT_TYPES = frozenset(
25
25
  "frontend_breadcrumb",
26
26
  "request_event",
27
27
  "probe_event",
28
+ "analytics_event",
28
29
  }
29
30
  )
30
31
 
@@ -376,8 +377,15 @@ def _sanitize_event(
376
377
  correlation = event.get("correlation")
377
378
  if isinstance(correlation, dict):
378
379
  normalized_correlation: dict[str, Any] = {}
379
- for key in ("request_id", "trace_id", "session_id", "user_id_hash"):
380
- value = correlation.get(key)
380
+ correlation_keys = (
381
+ ("session_id", "visitor_id_hash", "user_id_hash", "trace_id", "deploy_id")
382
+ if event_type == "analytics_event"
383
+ else ("request_id", "trace_id", "session_id", "user_id_hash")
384
+ )
385
+ for key in correlation_keys:
386
+ if key not in correlation:
387
+ continue
388
+ value = correlation[key]
381
389
  if isinstance(value, str) or value is None:
382
390
  normalized_correlation[key] = value
383
391
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: debugbundle-python
3
- Version: 1.1.0
3
+ Version: 1.1.3
4
4
  Summary: DebugBundle SDK for Python
5
5
  Author: DebugBundle
6
6
  License-Expression: AGPL-3.0-only
@@ -1,10 +1,10 @@
1
1
  debugbundle/__init__.py,sha256=mqibduUrdcr_fnb6k3Gwf93H7iqVBS8zd6SceX-U3Q4,5011
2
2
  debugbundle/config.py,sha256=ENRSR5jUI7xYdBqUakWws3GIjBk00GWFmwXVE_iQp2Y,9296
3
- debugbundle/core.py,sha256=oeCuJgaHPk3LNObrD54IDB_YrzuZFYlvYJUmTi-2PfE,37322
3
+ debugbundle/core.py,sha256=Qjli_IvbQV47LeYyJOrPpVrf2lE4_nzrNdncL1zepPQ,37776
4
4
  debugbundle/logger_integrations.py,sha256=RuTNaD9RRVmiE-BBkksAXWVEGaMzLrWavVpQdgGZBpE,4564
5
5
  debugbundle/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  debugbundle/redaction.py,sha256=QTaPkSsYv54yR1mz8SB6Q4vWjvp7Ddcui4WXaH2RVz8,736
7
- debugbundle/relay.py,sha256=IVBLm4jqhaWpAoEYRNyy1dr19hp_aIOVjxTvTFXeBwA,14072
7
+ debugbundle/relay.py,sha256=p5-tFXsgH8TZfB7Va3C2XFJsi8mYOMnGjr01W_kApME,14366
8
8
  debugbundle/relay_delivery.py,sha256=VL-nIgJR6mYXqKy-EbA0USWeY_iS_uAr1KBzrnwBnnk,4676
9
9
  debugbundle/suppression.py,sha256=XMn0GfF_-WZk2wHWk3KfbO5_u5QhEunues5h3jOInLs,4098
10
10
  debugbundle/transport.py,sha256=oOk0xazHxq9h4CneJdRODKtwDciwikvpHVJM_6iBYXU,1791
@@ -17,8 +17,8 @@ debugbundle/integrations/flask.py,sha256=cgyHbsAH96gpNPf_5IGJYzp2va28JdDgXROBsF-
17
17
  debugbundle/integrations/relay_django.py,sha256=Wj8BE9D5otU2KmtjgqdKIJ-BvXVcagCKgpLYvnPZ6WE,2281
18
18
  debugbundle/integrations/relay_fastapi.py,sha256=-Zl6bvhYMLii__mP6-UvSdwxS5VKsb9OZvk-yy-3hEw,2227
19
19
  debugbundle/integrations/relay_flask.py,sha256=VFHkDTJy4LkZzL_Ry_Ba-e_gW6UTG4PBwnLcvB_oXuQ,2011
20
- debugbundle_python-1.1.0.dist-info/licenses/LICENSE,sha256=AKZZ5DQAHrOKGwt24VoRd-SXJLM9OloxlsX8ZgENdEY,735
21
- debugbundle_python-1.1.0.dist-info/METADATA,sha256=dJKpk66J95YPT9BuTuzJKIgZXJsflZGUdE5p9U1QDM4,13841
22
- debugbundle_python-1.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
23
- debugbundle_python-1.1.0.dist-info/top_level.txt,sha256=RCB9STTFnl1OKdojxz-xhaks2zkRFs1meZXsKnm18LM,12
24
- debugbundle_python-1.1.0.dist-info/RECORD,,
20
+ debugbundle_python-1.1.3.dist-info/licenses/LICENSE,sha256=AKZZ5DQAHrOKGwt24VoRd-SXJLM9OloxlsX8ZgENdEY,735
21
+ debugbundle_python-1.1.3.dist-info/METADATA,sha256=F924FNTS23l25aFkfDefrdDC4F3UMVrsqxQSisfIUfk,13841
22
+ debugbundle_python-1.1.3.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
23
+ debugbundle_python-1.1.3.dist-info/top_level.txt,sha256=RCB9STTFnl1OKdojxz-xhaks2zkRFs1meZXsKnm18LM,12
24
+ debugbundle_python-1.1.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (82.0.1)
2
+ Generator: setuptools (83.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5