trodo-python 2.23.0__py3-none-any.whl → 2.23.1__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.
- trodo/otel/auto_instrument.py +49 -1
- {trodo_python-2.23.0.dist-info → trodo_python-2.23.1.dist-info}/METADATA +1 -1
- {trodo_python-2.23.0.dist-info → trodo_python-2.23.1.dist-info}/RECORD +5 -5
- {trodo_python-2.23.0.dist-info → trodo_python-2.23.1.dist-info}/WHEEL +0 -0
- {trodo_python-2.23.0.dist-info → trodo_python-2.23.1.dist-info}/top_level.txt +0 -0
trodo/otel/auto_instrument.py
CHANGED
|
@@ -438,7 +438,44 @@ def _instrument(module_name: str, *preferred: str) -> None:
|
|
|
438
438
|
)
|
|
439
439
|
if cls is None:
|
|
440
440
|
raise ImportError(f"no Instrumentor class exported by {module_name}")
|
|
441
|
-
|
|
441
|
+
|
|
442
|
+
instr = cls()
|
|
443
|
+
|
|
444
|
+
# An instrumentor whose target library is the wrong VERSION does not raise:
|
|
445
|
+
# OpenTelemetry logs a DependencyConflict and returns without patching
|
|
446
|
+
# anything. We would then append it to `active` and report auto-capture that
|
|
447
|
+
# is not happening -- the same lie as listing a framework whose
|
|
448
|
+
# instrumentation cannot patch the installed SDK. Ask first, and let the
|
|
449
|
+
# caller report it honestly.
|
|
450
|
+
conflict = _dependency_conflict(instr)
|
|
451
|
+
if conflict is not None:
|
|
452
|
+
raise _IncompatibleInstrumentation(str(conflict))
|
|
453
|
+
|
|
454
|
+
instr.instrument()
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
class _IncompatibleInstrumentation(ImportError):
|
|
458
|
+
"""The instrumentor loaded, but its target library is an unsupported version."""
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
def _dependency_conflict(instr: Any) -> Any:
|
|
462
|
+
"""The version conflict OpenTelemetry would hit, or None.
|
|
463
|
+
|
|
464
|
+
Returns None when we cannot tell -- an older OTel without the helper, or an
|
|
465
|
+
instrumentor that declares nothing. Falsely reporting a working setup as
|
|
466
|
+
broken is worse than the silence this replaces.
|
|
467
|
+
"""
|
|
468
|
+
try:
|
|
469
|
+
from opentelemetry.instrumentation.dependencies import ( # type: ignore
|
|
470
|
+
get_dependency_conflicts,
|
|
471
|
+
)
|
|
472
|
+
|
|
473
|
+
deps = instr.instrumentation_dependencies()
|
|
474
|
+
if not deps:
|
|
475
|
+
return None
|
|
476
|
+
return get_dependency_conflicts(deps)
|
|
477
|
+
except Exception: # noqa: BLE001
|
|
478
|
+
return None
|
|
442
479
|
|
|
443
480
|
|
|
444
481
|
_INSTRUMENTORS: List[tuple[str, Callable[[], Any]]] = []
|
|
@@ -556,6 +593,17 @@ def enable_auto_instrument(
|
|
|
556
593
|
try:
|
|
557
594
|
register()
|
|
558
595
|
active.append(name)
|
|
596
|
+
except _IncompatibleInstrumentation as e:
|
|
597
|
+
# Loud, because this is the case where everything LOOKS installed:
|
|
598
|
+
# the package is present, the import worked, and no spans will ever
|
|
599
|
+
# appear. Silence here is what costs people an afternoon.
|
|
600
|
+
_warn_once(
|
|
601
|
+
f"version-{name}",
|
|
602
|
+
f"auto-instrument: {name} will NOT be auto-captured and is not "
|
|
603
|
+
f"reported as active -- {e}. Wrap the call with trodo.llm(...) "
|
|
604
|
+
f"to capture it, or pin the library to a supported version.",
|
|
605
|
+
)
|
|
606
|
+
continue
|
|
559
607
|
except Exception:
|
|
560
608
|
continue
|
|
561
609
|
return active
|
|
@@ -16,7 +16,7 @@ trodo/managers/people_manager.py,sha256=mMVnx40Mlifx6NGgChvohC9ViK6dQu2mkXNHbV8p
|
|
|
16
16
|
trodo/managers/prompt_manager.py,sha256=qFVHgh7PW-SlgHp62ybirdYsJBg-fcQVMTTU3jPqFvo,13435
|
|
17
17
|
trodo/managers/user_manager.py,sha256=faJYX3CHrD7ulYiShV7FhThSMX9aJ3kdOgU4Qtdy5FM,2844
|
|
18
18
|
trodo/otel/__init__.py,sha256=yiRFXWUU45bAM2CV37XeO7zf1hmnmjufdP4XO50yEyE,624
|
|
19
|
-
trodo/otel/auto_instrument.py,sha256=
|
|
19
|
+
trodo/otel/auto_instrument.py,sha256=dA7IZ9cTSNTFK-oVwkYL2OwfTH3wDKM4iKXtPvZoK-Y,23800
|
|
20
20
|
trodo/otel/context.py,sha256=Jd0aTc0Q-1dM5kXXinhZD8YtnpdKgvneNiODyboVGKY,1418
|
|
21
21
|
trodo/otel/helpers.py,sha256=XOMWcgZHaq5SQbkFxDaXPE4CDFjn01xjJmJ1vIxvwpw,20730
|
|
22
22
|
trodo/otel/processor.py,sha256=LKlXxP3BeQ7DP8SzYAgXZZOeJ6-6b7e43i19gCUC_0Y,7939
|
|
@@ -36,7 +36,7 @@ trodo/session/server_session.py,sha256=McsudEiq33XDq3nqxgzBcUvIjQxCMscwEuAPnYXrT
|
|
|
36
36
|
trodo/session/session_manager.py,sha256=7ht5LeeZX1HLLfPeNV_a8NkXGbHl3up0CRtCGr3EzjQ,2995
|
|
37
37
|
trodo/util/__init__.py,sha256=Z9c4rPPdKg06Kk3byKheDqksSgR4WNvS475oQ5sNljc,54
|
|
38
38
|
trodo/util/lru.py,sha256=QIsM7s6J_E9ZjiXatSyReZIEeGypTAcgrPWWy8YsRa4,2465
|
|
39
|
-
trodo_python-2.23.
|
|
40
|
-
trodo_python-2.23.
|
|
41
|
-
trodo_python-2.23.
|
|
42
|
-
trodo_python-2.23.
|
|
39
|
+
trodo_python-2.23.1.dist-info/METADATA,sha256=WDaY32vkP94_NzHjeE38-nnxCaUS3bGRYa5YgCA3qYI,25308
|
|
40
|
+
trodo_python-2.23.1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
41
|
+
trodo_python-2.23.1.dist-info/top_level.txt,sha256=VCQu1CJWFmNsqTs1YxMcw4Mq35Tc3z3uI9RwHEXAayQ,6
|
|
42
|
+
trodo_python-2.23.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|