langtrace-python-sdk 3.8.12__py3-none-any.whl → 3.8.14__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.
- langtrace_python_sdk/langtrace.py +87 -28
- langtrace_python_sdk/version.py +1 -1
- {langtrace_python_sdk-3.8.12.dist-info → langtrace_python_sdk-3.8.14.dist-info}/METADATA +1 -1
- {langtrace_python_sdk-3.8.12.dist-info → langtrace_python_sdk-3.8.14.dist-info}/RECORD +7 -7
- {langtrace_python_sdk-3.8.12.dist-info → langtrace_python_sdk-3.8.14.dist-info}/WHEEL +0 -0
- {langtrace_python_sdk-3.8.12.dist-info → langtrace_python_sdk-3.8.14.dist-info}/entry_points.txt +0 -0
- {langtrace_python_sdk-3.8.12.dist-info → langtrace_python_sdk-3.8.14.dist-info}/licenses/LICENSE +0 -0
@@ -17,47 +17,79 @@ limitations under the License.
|
|
17
17
|
import logging
|
18
18
|
import os
|
19
19
|
import sys
|
20
|
+
import warnings
|
20
21
|
from typing import Any, Dict, Optional
|
21
22
|
|
22
23
|
import sentry_sdk
|
23
24
|
from colorama import Fore
|
24
25
|
from opentelemetry import trace
|
25
|
-
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import
|
26
|
-
OTLPSpanExporter as GRPCExporter
|
27
|
-
|
28
|
-
|
26
|
+
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import (
|
27
|
+
OTLPSpanExporter as GRPCExporter,
|
28
|
+
)
|
29
|
+
from opentelemetry.exporter.otlp.proto.http.trace_exporter import (
|
30
|
+
OTLPSpanExporter as HTTPExporter,
|
31
|
+
)
|
29
32
|
from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor
|
30
33
|
from opentelemetry.sdk.resources import SERVICE_NAME, Resource
|
31
34
|
from opentelemetry.sdk.trace import TracerProvider
|
32
|
-
from opentelemetry.sdk.trace.export import (
|
33
|
-
|
34
|
-
|
35
|
+
from opentelemetry.sdk.trace.export import (
|
36
|
+
BatchSpanProcessor,
|
37
|
+
ConsoleSpanExporter,
|
38
|
+
SimpleSpanProcessor,
|
39
|
+
)
|
35
40
|
from opentelemetry.util.re import parse_env_headers
|
36
41
|
from sentry_sdk.types import Event, Hint
|
37
42
|
|
38
43
|
from langtrace_python_sdk.constants import LANGTRACE_SDK_NAME, SENTRY_DSN
|
39
44
|
from langtrace_python_sdk.constants.exporter.langtrace_exporter import (
|
40
|
-
LANGTRACE_REMOTE_URL,
|
41
|
-
|
42
|
-
|
45
|
+
LANGTRACE_REMOTE_URL,
|
46
|
+
LANGTRACE_SESSION_ID_HEADER,
|
47
|
+
)
|
48
|
+
from langtrace_python_sdk.extensions.langtrace_exporter import LangTraceExporter
|
43
49
|
from langtrace_python_sdk.instrumentation import (
|
44
|
-
AgnoInstrumentation,
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
50
|
+
AgnoInstrumentation,
|
51
|
+
AnthropicInstrumentation,
|
52
|
+
AutogenInstrumentation,
|
53
|
+
AWSBedrockInstrumentation,
|
54
|
+
CerebrasInstrumentation,
|
55
|
+
ChromaInstrumentation,
|
56
|
+
CleanLabInstrumentation,
|
57
|
+
CohereInstrumentation,
|
58
|
+
CrewAIInstrumentation,
|
59
|
+
CrewaiToolsInstrumentation,
|
60
|
+
DspyInstrumentation,
|
61
|
+
EmbedchainInstrumentation,
|
62
|
+
GeminiInstrumentation,
|
63
|
+
GoogleGenaiInstrumentation,
|
64
|
+
GraphlitInstrumentation,
|
65
|
+
GroqInstrumentation,
|
66
|
+
LangchainCommunityInstrumentation,
|
67
|
+
LangchainCoreInstrumentation,
|
68
|
+
LangchainInstrumentation,
|
69
|
+
LanggraphInstrumentation,
|
70
|
+
LiteLLMInstrumentation,
|
71
|
+
LlamaindexInstrumentation,
|
72
|
+
MilvusInstrumentation,
|
73
|
+
MistralInstrumentation,
|
74
|
+
Neo4jInstrumentation,
|
75
|
+
Neo4jGraphRAGInstrumentation,
|
76
|
+
OllamaInstrumentor,
|
77
|
+
OpenAIAgentsInstrumentation,
|
78
|
+
OpenAIInstrumentation,
|
79
|
+
PhiDataInstrumentation,
|
80
|
+
PineconeInstrumentation,
|
81
|
+
PyMongoInstrumentation,
|
82
|
+
QdrantInstrumentation,
|
83
|
+
VertexAIInstrumentation,
|
84
|
+
WeaviateInstrumentation,
|
85
|
+
)
|
86
|
+
from langtrace_python_sdk.types import DisableInstrumentations, InstrumentationMethods
|
87
|
+
from langtrace_python_sdk.utils import (
|
88
|
+
check_if_sdk_is_outdated,
|
89
|
+
get_sdk_version,
|
90
|
+
is_package_installed,
|
91
|
+
validate_instrumentations,
|
92
|
+
)
|
61
93
|
from langtrace_python_sdk.utils.langtrace_sampler import LangtraceSampler
|
62
94
|
|
63
95
|
|
@@ -173,7 +205,30 @@ def add_span_processor(provider: TracerProvider, config: LangtraceConfig, export
|
|
173
205
|
)
|
174
206
|
else:
|
175
207
|
provider.add_span_processor(BatchSpanProcessor(exporter))
|
176
|
-
|
208
|
+
project = get_project(config)
|
209
|
+
if project:
|
210
|
+
print(Fore.BLUE + f"Exporting spans to {project['name']}.." + Fore.RESET)
|
211
|
+
print(
|
212
|
+
Fore.BLUE
|
213
|
+
+ f"Langtrace Project URL: {LANGTRACE_REMOTE_URL}/project/{project['id']}/traces"
|
214
|
+
+ Fore.RESET
|
215
|
+
)
|
216
|
+
else:
|
217
|
+
print(Fore.BLUE + "Exporting spans to Langtrace cloud.." + Fore.RESET)
|
218
|
+
|
219
|
+
|
220
|
+
def get_project(config: LangtraceConfig):
|
221
|
+
import requests
|
222
|
+
|
223
|
+
try:
|
224
|
+
|
225
|
+
response = requests.get(
|
226
|
+
f"{LANGTRACE_REMOTE_URL}/api/project",
|
227
|
+
headers={"x-api-key": config.api_key},
|
228
|
+
)
|
229
|
+
return response.json()["project"]
|
230
|
+
except Exception as error:
|
231
|
+
return None
|
177
232
|
|
178
233
|
|
179
234
|
def init_sentry(config: LangtraceConfig, host: str):
|
@@ -329,6 +384,8 @@ def init_instrumentations(
|
|
329
384
|
if is_package_installed(name):
|
330
385
|
try:
|
331
386
|
v.instrument()
|
387
|
+
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
388
|
+
warnings.filterwarnings("ignore", category=UserWarning)
|
332
389
|
except Exception as e:
|
333
390
|
print(f"Skipping {name} due to error while instrumenting: {e}")
|
334
391
|
|
@@ -354,5 +411,7 @@ def init_instrumentations(
|
|
354
411
|
if is_package_installed(name):
|
355
412
|
try:
|
356
413
|
v.instrument()
|
414
|
+
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
415
|
+
warnings.filterwarnings("ignore", category=UserWarning)
|
357
416
|
except Exception as e:
|
358
417
|
print(f"Skipping {name} due to error while instrumenting: {e}")
|
langtrace_python_sdk/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "3.8.
|
1
|
+
__version__ = "3.8.14"
|
@@ -120,8 +120,8 @@ examples/vertexai_example/main.py,sha256=gndId5X5ksD-ycxnAWMdEqIDbLc3kz5Vt8vm4YP
|
|
120
120
|
examples/weaviate_example/__init__.py,sha256=8JMDBsRSEV10HfTd-YC7xb4txBjD3la56snk-Bbg2Kw,618
|
121
121
|
examples/weaviate_example/query_text.py,sha256=wPHQTc_58kPoKTZMygVjTj-2ZcdrIuaausJfMxNQnQc,127162
|
122
122
|
langtrace_python_sdk/__init__.py,sha256=VZM6i71NR7pBQK6XvJWRelknuTYUhqwqE7PlicKa5Wg,1166
|
123
|
-
langtrace_python_sdk/langtrace.py,sha256=
|
124
|
-
langtrace_python_sdk/version.py,sha256=
|
123
|
+
langtrace_python_sdk/langtrace.py,sha256=JYBCbklWv463lzRUH7pfkHAVoc3YHh-q_2Iv6LZ2HhU,14896
|
124
|
+
langtrace_python_sdk/version.py,sha256=o1YxXVHZc6TZFzK0b_XFqGQHEQN04JFH9ZHn5KGykdE,23
|
125
125
|
langtrace_python_sdk/constants/__init__.py,sha256=3CNYkWMdd1DrkGqzLUgNZXjdAlM6UFMlf_F-odAToyc,146
|
126
126
|
langtrace_python_sdk/constants/exporter/langtrace_exporter.py,sha256=EVCrouYCpY98f0KSaKr4PzNxPULTZZO6dSA_crEOyJU,106
|
127
127
|
langtrace_python_sdk/constants/instrumentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -312,8 +312,8 @@ tests/pinecone/cassettes/test_query.yaml,sha256=b5v9G3ssUy00oG63PlFUR3JErF2Js-5A
|
|
312
312
|
tests/pinecone/cassettes/test_upsert.yaml,sha256=neWmQ1v3d03V8WoLl8FoFeeCYImb8pxlJBWnFd_lITU,38607
|
313
313
|
tests/qdrant/conftest.py,sha256=9n0uHxxIjWk9fbYc4bx-uP8lSAgLBVx-cV9UjnsyCHM,381
|
314
314
|
tests/qdrant/test_qdrant.py,sha256=pzjAjVY2kmsmGfrI2Gs2xrolfuaNHz7l1fqGQCjp5_o,3353
|
315
|
-
langtrace_python_sdk-3.8.
|
316
|
-
langtrace_python_sdk-3.8.
|
317
|
-
langtrace_python_sdk-3.8.
|
318
|
-
langtrace_python_sdk-3.8.
|
319
|
-
langtrace_python_sdk-3.8.
|
315
|
+
langtrace_python_sdk-3.8.14.dist-info/METADATA,sha256=cXX15evxHYxT3H0ZnwQym26pmT4cvZX2YJHUCs2p3Wc,15845
|
316
|
+
langtrace_python_sdk-3.8.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
317
|
+
langtrace_python_sdk-3.8.14.dist-info/entry_points.txt,sha256=1_b9-qvf2fE7uQNZcbUei9vLpFZBbbh9LrtGw95ssAo,70
|
318
|
+
langtrace_python_sdk-3.8.14.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
319
|
+
langtrace_python_sdk-3.8.14.dist-info/RECORD,,
|
File without changes
|
{langtrace_python_sdk-3.8.12.dist-info → langtrace_python_sdk-3.8.14.dist-info}/entry_points.txt
RENAMED
File without changes
|
{langtrace_python_sdk-3.8.12.dist-info → langtrace_python_sdk-3.8.14.dist-info}/licenses/LICENSE
RENAMED
File without changes
|