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.
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/PKG-INFO +1 -1
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/pyproject.toml +1 -1
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/__init__.py +1 -2
- iii_helpers-0.21.2.dev1/src/iii_helpers/observability/baggage_span_processor.py +40 -0
- iii_helpers-0.21.0.dev1/src/iii_helpers/observability/baggage_span_processor.py +0 -42
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/.gitignore +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/README.md +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/__init__.py +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/http/__init__.py +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/http_instrumentation.py +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/logger.py +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/payload.py +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/reconnection.py +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/span_ops.py +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/telemetry.py +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/telemetry_exporters.py +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/telemetry_types.py +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/py.typed +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/queue/__init__.py +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/stream/__init__.py +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/worker_connection_manager/__init__.py +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/tests/__init__.py +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/tests/test_observability_http_instrumentation.py +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/tests/test_observability_telemetry.py +0 -0
- {iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/uv.lock +0 -0
{iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/__init__.py
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""iii_helpers.observability: shared OTel + Logger primitives."""
|
|
2
2
|
|
|
3
|
-
from .baggage_span_processor import
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/payload.py
RENAMED
|
File without changes
|
{iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/reconnection.py
RENAMED
|
File without changes
|
{iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/span_ops.py
RENAMED
|
File without changes
|
{iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/telemetry.py
RENAMED
|
File without changes
|
|
File without changes
|
{iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/src/iii_helpers/observability/telemetry_types.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{iii_helpers-0.21.0.dev1 → iii_helpers-0.21.2.dev1}/tests/test_observability_http_instrumentation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|