langtrace-python-sdk 2.3.19__py3-none-any.whl → 2.3.21__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.
@@ -43,20 +43,26 @@ class WeaviateInstrumentation(BaseInstrumentor):
43
43
  tracer_provider = kwargs.get("tracer_provider")
44
44
  tracer = get_tracer(__name__, "", tracer_provider)
45
45
  version = importlib.metadata.version("weaviate-client")
46
-
47
- for api_name, api_config in APIS.items():
48
- if api_config.get("OPERATION") in ["query", "generate"]:
49
- wrap_function_wrapper(
50
- api_config["MODULE"],
51
- api_config["METHOD"],
52
- generic_query_patch(api_name, version, tracer),
53
- )
54
- elif api_config.get("OPERATION") == "create":
55
- wrap_function_wrapper(
56
- api_config["MODULE"],
57
- api_config["METHOD"],
58
- generic_collection_patch(api_name, version, tracer),
59
- )
46
+ try:
47
+ for api_name, api_config in APIS.items():
48
+ if api_config.get("OPERATION") in ["query", "generate"]:
49
+ wrap_function_wrapper(
50
+ api_config["MODULE"],
51
+ api_config["METHOD"],
52
+ generic_query_patch(api_name, version, tracer),
53
+ )
54
+ elif api_config.get("OPERATION") == "create":
55
+ print(
56
+ api_config["MODULE"],
57
+ api_config["METHOD"],
58
+ )
59
+ wrap_function_wrapper(
60
+ api_config["MODULE"],
61
+ api_config["METHOD"],
62
+ generic_collection_patch(api_name, version, tracer),
63
+ )
64
+ except ModuleNotFoundError as e:
65
+ pass
60
66
 
61
67
  def _instrument_module(self, module_name):
62
68
  pass
@@ -69,6 +69,7 @@ from langtrace_python_sdk.utils import (
69
69
  )
70
70
  from langtrace_python_sdk.utils.langtrace_sampler import LangtraceSampler
71
71
  import sentry_sdk
72
+ from sentry_sdk.types import Event, Hint
72
73
 
73
74
 
74
75
  def init(
@@ -177,6 +178,7 @@ def init(
177
178
  dsn=SENTRY_DSN,
178
179
  traces_sample_rate=1.0,
179
180
  profiles_sample_rate=1.0,
181
+ before_send=before_send,
180
182
  )
181
183
  sdk_options = {
182
184
  "service_name": os.environ.get("OTEL_SERVICE_NAME")
@@ -195,6 +197,22 @@ def init(
195
197
  sentry_sdk.set_context("sdk_init_options", sdk_options)
196
198
 
197
199
 
200
+ def before_send(event: Event, hint: Hint):
201
+ # Check if there's an exception and stacktrace in the event
202
+ if "exception" in event:
203
+ exception = event["exception"]["values"][0]
204
+ stacktrace = exception.get("stacktrace", {})
205
+ frames = stacktrace.get("frames", [])
206
+ if frames:
207
+ last_frame = frames[-1]
208
+ absolute_path = last_frame.get("abs_path") # Absolute path
209
+ # Check if the error is from the SDK
210
+ if "langtrace-python-sdk" in absolute_path:
211
+ return event
212
+
213
+ return None
214
+
215
+
198
216
  def init_instrumentations(
199
217
  disable_instrumentations: Optional[DisableInstrumentations],
200
218
  all_instrumentations: dict,
@@ -1 +1 @@
1
- __version__ = "2.3.19"
1
+ __version__ = "2.3.21"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: langtrace-python-sdk
3
- Version: 2.3.19
3
+ Version: 2.3.21
4
4
  Summary: Python SDK for LangTrace
5
5
  Project-URL: Homepage, https://github.com/Scale3-Labs/langtrace-python-sdk
6
6
  Author-email: Scale3 Labs <engineering@scale3labs.com>
@@ -95,8 +95,8 @@ examples/vertexai_example/main.py,sha256=gndId5X5ksD-ycxnAWMdEqIDbLc3kz5Vt8vm4YP
95
95
  examples/weaviate_example/__init__.py,sha256=8JMDBsRSEV10HfTd-YC7xb4txBjD3la56snk-Bbg2Kw,618
96
96
  examples/weaviate_example/query_text.py,sha256=wPHQTc_58kPoKTZMygVjTj-2ZcdrIuaausJfMxNQnQc,127162
97
97
  langtrace_python_sdk/__init__.py,sha256=VZM6i71NR7pBQK6XvJWRelknuTYUhqwqE7PlicKa5Wg,1166
98
- langtrace_python_sdk/langtrace.py,sha256=sNCOHq5dBsNAHkNLB9VsR-FgbnrQ_2Tjo7jiyR8svgk,8218
99
- langtrace_python_sdk/version.py,sha256=UgFVQHHCwNbEJUac-AaH2Q_JZJPlxrEZiAuyZ9dlqyo,23
98
+ langtrace_python_sdk/langtrace.py,sha256=vfDVtcWIDf8_01qp15zfRB92qbGEBUGu0daF9BlyspY,8863
99
+ langtrace_python_sdk/version.py,sha256=TFqy6zAnse9cNqw1cAEbkzgx35wTL1grwvwajOcRgtE,23
100
100
  langtrace_python_sdk/constants/__init__.py,sha256=3CNYkWMdd1DrkGqzLUgNZXjdAlM6UFMlf_F-odAToyc,146
101
101
  langtrace_python_sdk/constants/exporter/langtrace_exporter.py,sha256=5MNjnAOg-4am78J3gVMH6FSwq5N8TOj72ugkhsw4vi0,46
102
102
  langtrace_python_sdk/constants/instrumentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -181,7 +181,7 @@ langtrace_python_sdk/instrumentation/vertexai/__init__.py,sha256=ZzKxB7bl0FaRlgJ
181
181
  langtrace_python_sdk/instrumentation/vertexai/instrumentation.py,sha256=Keeb1D7nJDYu33w6H8Q8jLS7OOJtSIHqngvJMipWqJo,1143
182
182
  langtrace_python_sdk/instrumentation/vertexai/patch.py,sha256=vPxwuSKgA3cUtelgot4XZEox8AD4ehsi3bNTKD_HS_M,4394
183
183
  langtrace_python_sdk/instrumentation/weaviate/__init__.py,sha256=Mc-Je6evPo-kKQzerTG7bd1XO5JOh4YGTE3wBxaUBwg,99
184
- langtrace_python_sdk/instrumentation/weaviate/instrumentation.py,sha256=bzPwtoQD0X6beLYXe6ZL7XRkyRkqdiqKiGc4gOlCQdU,2295
184
+ langtrace_python_sdk/instrumentation/weaviate/instrumentation.py,sha256=ow081UHPLZqsmMrVjbzNoZ0tU2JComhTCz_x1xhdWTU,2558
185
185
  langtrace_python_sdk/instrumentation/weaviate/patch.py,sha256=aWLDbNGz35V6XQUv4lkMD0O689suqh6KdTa33VDtUkE,6905
186
186
  langtrace_python_sdk/types/__init__.py,sha256=VnfLV5pVHIB9VRIpEwIDQjWSPEAqQKnq6VNbqsm9W3Q,4287
187
187
  langtrace_python_sdk/utils/__init__.py,sha256=O-Ra9IDd1MnxihdQUC8HW_wYFhk7KbTCK2BIl02yacQ,2935
@@ -235,8 +235,8 @@ tests/pinecone/cassettes/test_query.yaml,sha256=b5v9G3ssUy00oG63PlFUR3JErF2Js-5A
235
235
  tests/pinecone/cassettes/test_upsert.yaml,sha256=neWmQ1v3d03V8WoLl8FoFeeCYImb8pxlJBWnFd_lITU,38607
236
236
  tests/qdrant/conftest.py,sha256=9n0uHxxIjWk9fbYc4bx-uP8lSAgLBVx-cV9UjnsyCHM,381
237
237
  tests/qdrant/test_qdrant.py,sha256=pzjAjVY2kmsmGfrI2Gs2xrolfuaNHz7l1fqGQCjp5_o,3353
238
- langtrace_python_sdk-2.3.19.dist-info/METADATA,sha256=ax4B75ZAAGFpbgai3ZNRLIAJZ9Rrp6P4JcsOQm7Pzvk,15380
239
- langtrace_python_sdk-2.3.19.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
240
- langtrace_python_sdk-2.3.19.dist-info/entry_points.txt,sha256=1_b9-qvf2fE7uQNZcbUei9vLpFZBbbh9LrtGw95ssAo,70
241
- langtrace_python_sdk-2.3.19.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
242
- langtrace_python_sdk-2.3.19.dist-info/RECORD,,
238
+ langtrace_python_sdk-2.3.21.dist-info/METADATA,sha256=PpzO9NrNE901yxWYrCuy4eBWqxpo2tKPN-Yilv5_Rfg,15380
239
+ langtrace_python_sdk-2.3.21.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
240
+ langtrace_python_sdk-2.3.21.dist-info/entry_points.txt,sha256=1_b9-qvf2fE7uQNZcbUei9vLpFZBbbh9LrtGw95ssAo,70
241
+ langtrace_python_sdk-2.3.21.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
242
+ langtrace_python_sdk-2.3.21.dist-info/RECORD,,