iii-helpers 0.21.0.dev1__tar.gz → 0.21.2.dev1__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.
Files changed (25) hide show
  1. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/PKG-INFO +1 -1
  2. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/pyproject.toml +1 -1
  3. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/__init__.py +1 -2
  4. iii_helpers-0.21.2.dev1/src/iii_helpers/observability/baggage_span_processor.py +40 -0
  5. iii_helpers-0.21.0.dev1/src/iii_helpers/observability/baggage_span_processor.py +0 -42
  6. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/.gitignore +0 -0
  7. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/README.md +0 -0
  8. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/__init__.py +0 -0
  9. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/http/__init__.py +0 -0
  10. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/http_instrumentation.py +0 -0
  11. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/logger.py +0 -0
  12. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/payload.py +0 -0
  13. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/reconnection.py +0 -0
  14. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/span_ops.py +0 -0
  15. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/telemetry.py +0 -0
  16. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/telemetry_exporters.py +0 -0
  17. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/telemetry_types.py +0 -0
  18. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/py.typed +0 -0
  19. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/queue/__init__.py +0 -0
  20. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/stream/__init__.py +0 -0
  21. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/worker_connection_manager/__init__.py +0 -0
  22. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/tests/__init__.py +0 -0
  23. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/tests/test_observability_http_instrumentation.py +0 -0
  24. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/tests/test_observability_telemetry.py +0 -0
  25. {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iii-helpers
3
- Version: 0.21.0.dev1
3
+ Version: 0.21.2.dev1
4
4
  Summary: Shared helper primitives across iii SDKs.
5
5
  Project-URL: Homepage, https://github.com/iii-hq/iii
6
6
  Project-URL: Repository, https://github.com/iii-hq/iii
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "iii-helpers"
7
- version = "0.21.0.dev1"
7
+ version = "0.21.2.dev1"
8
8
  description = "Shared helper primitives across iii SDKs."
9
9
  authors = [{ name = "III" }]
10
10
  license = { text = "Apache-2.0" }
@@ -1,6 +1,6 @@
1
1
  """iii_helpers.observability: shared OTel + Logger primitives."""
2
2
 
3
- from .baggage_span_processor import DEFAULT_ALLOWLIST, BaggageSpanProcessor
3
+ from .baggage_span_processor import BaggageSpanProcessor
4
4
  from .http_instrumentation import execute_traced_request
5
5
  from .logger import Logger
6
6
  from .payload import (
@@ -32,7 +32,6 @@ from .telemetry_types import OtelConfig
32
32
 
33
33
  __all__ = [
34
34
  "BaggageSpanProcessor",
35
- "DEFAULT_ALLOWLIST",
36
35
  "Logger",
37
36
  "OtelConfig",
38
37
  "REDACTED_PLACEHOLDER",
@@ -0,0 +1,40 @@
1
+ """Baggage -> span attribute processor.
2
+
3
+ Copies EVERY baggage entry onto every span started in its scope,
4
+ unconditionally -- the same contract as the upstream OTel contrib
5
+ ``BaggageSpanProcessor``. There is deliberately no key filtering here: a
6
+ filtering policy baked into worker binaries has to be kept in lockstep
7
+ across every SDK language and every deployed worker, and a stale binary
8
+ silently drops newer keys. Which attributes *mean* something (e.g. the
9
+ ``iii.tag.*`` trace-tag namespace, ``iii.session.*``) is a query-side
10
+ convention owned by the engine's traces API, where it can evolve without
11
+ touching workers.
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ from opentelemetry import baggage
17
+ from opentelemetry.context import Context
18
+ from opentelemetry.sdk.trace import ReadableSpan, Span, SpanProcessor
19
+
20
+
21
+ class BaggageSpanProcessor(SpanProcessor):
22
+
23
+ def on_start(self, span: Span, parent_context: Context | None = None) -> None:
24
+ # NoOp guard: skip allocation when sampler drops the span.
25
+ if not span.is_recording():
26
+ return
27
+
28
+ for key, value in baggage.get_all(parent_context).items():
29
+ if value is None:
30
+ continue
31
+ span.set_attribute(key, str(value))
32
+
33
+ def on_end(self, span: ReadableSpan) -> None: # noqa: ARG002
34
+ pass
35
+
36
+ def shutdown(self) -> None:
37
+ pass
38
+
39
+ def force_flush(self, timeout_millis: int = 30000) -> bool: # noqa: ARG002
40
+ return True
@@ -1,42 +0,0 @@
1
- """Baggage -> span attribute processor."""
2
-
3
- from __future__ import annotations
4
-
5
- from typing import Sequence
6
-
7
- from opentelemetry import baggage
8
- from opentelemetry.context import Context
9
- from opentelemetry.sdk.trace import ReadableSpan, Span, SpanProcessor
10
-
11
- #: DEFAULT_ALLOWLIST drift across languages would break worker chains;
12
- #: lockstep tests in each SDK pin this constant at CI time.
13
- DEFAULT_ALLOWLIST: tuple[str, ...] = (
14
- "iii.session.id",
15
- "iii.message.id",
16
- "iii.function.id",
17
- )
18
-
19
-
20
- class BaggageSpanProcessor(SpanProcessor):
21
-
22
- def __init__(self, allowlist: Sequence[str] = DEFAULT_ALLOWLIST) -> None:
23
- self._allowlist: tuple[str, ...] = tuple(allowlist)
24
-
25
- def on_start(self, span: Span, parent_context: Context | None = None) -> None:
26
- # NoOp guard: skip allocation when sampler drops the span.
27
- if not span.is_recording():
28
- return
29
-
30
- for key in self._allowlist:
31
- value = baggage.get_baggage(key, parent_context)
32
- if value is not None:
33
- span.set_attribute(key, str(value))
34
-
35
- def on_end(self, span: ReadableSpan) -> None: # noqa: ARG002
36
- pass
37
-
38
- def shutdown(self) -> None:
39
- pass
40
-
41
- def force_flush(self, timeout_millis: int = 30000) -> bool: # noqa: ARG002
42
- return True