lmnr 0.6.21__py3-none-any.whl → 0.7.0__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.
Files changed (28) hide show
  1. lmnr/__init__.py +0 -4
  2. lmnr/opentelemetry_lib/decorators/__init__.py +38 -28
  3. lmnr/opentelemetry_lib/opentelemetry/instrumentation/anthropic/__init__.py +6 -2
  4. lmnr/opentelemetry_lib/opentelemetry/instrumentation/google_genai/__init__.py +4 -0
  5. lmnr/opentelemetry_lib/opentelemetry/instrumentation/groq/__init__.py +3 -0
  6. lmnr/opentelemetry_lib/opentelemetry/instrumentation/langgraph/__init__.py +16 -16
  7. lmnr/opentelemetry_lib/opentelemetry/instrumentation/openai/shared/chat_wrappers.py +3 -0
  8. lmnr/opentelemetry_lib/opentelemetry/instrumentation/openai/shared/completion_wrappers.py +3 -0
  9. lmnr/opentelemetry_lib/opentelemetry/instrumentation/openai/v1/assistant_wrappers.py +3 -0
  10. lmnr/opentelemetry_lib/opentelemetry/instrumentation/openai/v1/responses_wrappers.py +7 -0
  11. lmnr/opentelemetry_lib/opentelemetry/instrumentation/threading/__init__.py +190 -0
  12. lmnr/opentelemetry_lib/tracing/__init__.py +89 -1
  13. lmnr/opentelemetry_lib/tracing/context.py +109 -0
  14. lmnr/opentelemetry_lib/tracing/processor.py +5 -6
  15. lmnr/opentelemetry_lib/tracing/tracer.py +29 -0
  16. lmnr/sdk/browser/browser_use_otel.py +5 -5
  17. lmnr/sdk/browser/patchright_otel.py +14 -0
  18. lmnr/sdk/browser/playwright_otel.py +32 -6
  19. lmnr/sdk/browser/pw_utils.py +78 -6
  20. lmnr/sdk/client/asynchronous/resources/browser_events.py +1 -0
  21. lmnr/sdk/laminar.py +109 -164
  22. lmnr/sdk/types.py +0 -6
  23. lmnr/version.py +1 -1
  24. {lmnr-0.6.21.dist-info → lmnr-0.7.0.dist-info}/METADATA +3 -2
  25. {lmnr-0.6.21.dist-info → lmnr-0.7.0.dist-info}/RECORD +27 -26
  26. {lmnr-0.6.21.dist-info → lmnr-0.7.0.dist-info}/WHEEL +1 -1
  27. lmnr/opentelemetry_lib/tracing/context_properties.py +0 -65
  28. {lmnr-0.6.21.dist-info → lmnr-0.7.0.dist-info}/entry_points.txt +0 -0
@@ -1,65 +0,0 @@
1
- import copy
2
-
3
- from lmnr.opentelemetry_lib.tracing.attributes import (
4
- ASSOCIATION_PROPERTIES,
5
- TRACING_LEVEL,
6
- )
7
-
8
- from opentelemetry.context import Context, attach, set_value, get_value
9
- from opentelemetry.sdk.trace import Span
10
- from opentelemetry import trace
11
-
12
-
13
- # TODO: delete this once deprecated Laminar.with_labels is removed. The logic
14
- # should be moved into Laminar.set_tracing_level
15
- def set_association_properties(properties: dict) -> None:
16
- attach(set_value("association_properties", properties))
17
-
18
- span = trace.get_current_span()
19
- _set_association_properties_attributes(span, properties)
20
-
21
-
22
- # TODO: delete this once deprecated Laminar.with_labels is removed
23
- def get_association_properties(context: Context | None = None) -> dict:
24
- return get_value("association_properties", context) or {}
25
-
26
-
27
- # TODO: delete this once deprecated Laminar.with_labels is removed. The logic
28
- # should be moved into Laminar.set_tracing_level
29
- def update_association_properties(
30
- properties: dict,
31
- set_on_current_span: bool = True,
32
- context: Context | None = None,
33
- ) -> None:
34
- """Only adds or updates properties that are not already present"""
35
- association_properties = get_value("association_properties", context) or {}
36
- association_properties.update(properties)
37
-
38
- attach(set_value("association_properties", association_properties, context))
39
-
40
- if set_on_current_span:
41
- span = trace.get_current_span()
42
- _set_association_properties_attributes(span, properties)
43
-
44
-
45
- # TODO: this logic should be moved into Laminar.set_tracing_level
46
- def remove_association_properties(properties: dict) -> None:
47
- props: dict = copy.copy(get_value("association_properties") or {})
48
- for k in properties.keys():
49
- props.pop(k, None)
50
- set_association_properties(props)
51
-
52
-
53
- def _set_association_properties_attributes(span: Span, properties: dict) -> None:
54
- if not span.is_recording():
55
- return
56
- for key, value in properties.items():
57
- if key == TRACING_LEVEL:
58
- span.set_attribute(f"lmnr.internal.{TRACING_LEVEL}", value)
59
- continue
60
- if (
61
- key in ["langgraph.edges", "langgraph.nodes"]
62
- and span.name != "LangGraph.workflow"
63
- ):
64
- continue
65
- span.set_attribute(f"{ASSOCIATION_PROPERTIES}.{key}", value)