opentelemetry-instrumentation-llamaindex 0.41.0__tar.gz → 0.42.0__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.
Potentially problematic release.
This version of opentelemetry-instrumentation-llamaindex might be problematic. Click here for more details.
- {opentelemetry_instrumentation_llamaindex-0.41.0 → opentelemetry_instrumentation_llamaindex-0.42.0}/PKG-INFO +3 -2
- {opentelemetry_instrumentation_llamaindex-0.41.0 → opentelemetry_instrumentation_llamaindex-0.42.0}/opentelemetry/instrumentation/llamaindex/__init__.py +9 -0
- opentelemetry_instrumentation_llamaindex-0.42.0/opentelemetry/instrumentation/llamaindex/llamaparse_instrumentor.py +169 -0
- opentelemetry_instrumentation_llamaindex-0.42.0/opentelemetry/instrumentation/llamaindex/version.py +1 -0
- {opentelemetry_instrumentation_llamaindex-0.41.0 → opentelemetry_instrumentation_llamaindex-0.42.0}/pyproject.toml +7 -5
- opentelemetry_instrumentation_llamaindex-0.41.0/opentelemetry/instrumentation/llamaindex/version.py +0 -1
- {opentelemetry_instrumentation_llamaindex-0.41.0 → opentelemetry_instrumentation_llamaindex-0.42.0}/README.md +0 -0
- {opentelemetry_instrumentation_llamaindex-0.41.0 → opentelemetry_instrumentation_llamaindex-0.42.0}/opentelemetry/instrumentation/llamaindex/base_agent_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.41.0 → opentelemetry_instrumentation_llamaindex-0.42.0}/opentelemetry/instrumentation/llamaindex/base_embedding_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.41.0 → opentelemetry_instrumentation_llamaindex-0.42.0}/opentelemetry/instrumentation/llamaindex/base_retriever_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.41.0 → opentelemetry_instrumentation_llamaindex-0.42.0}/opentelemetry/instrumentation/llamaindex/base_synthesizer_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.41.0 → opentelemetry_instrumentation_llamaindex-0.42.0}/opentelemetry/instrumentation/llamaindex/base_tool_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.41.0 → opentelemetry_instrumentation_llamaindex-0.42.0}/opentelemetry/instrumentation/llamaindex/config.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.41.0 → opentelemetry_instrumentation_llamaindex-0.42.0}/opentelemetry/instrumentation/llamaindex/custom_llm_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.41.0 → opentelemetry_instrumentation_llamaindex-0.42.0}/opentelemetry/instrumentation/llamaindex/dispatcher_wrapper.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.41.0 → opentelemetry_instrumentation_llamaindex-0.42.0}/opentelemetry/instrumentation/llamaindex/event_emitter.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.41.0 → opentelemetry_instrumentation_llamaindex-0.42.0}/opentelemetry/instrumentation/llamaindex/event_models.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.41.0 → opentelemetry_instrumentation_llamaindex-0.42.0}/opentelemetry/instrumentation/llamaindex/query_pipeline_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.41.0 → opentelemetry_instrumentation_llamaindex-0.42.0}/opentelemetry/instrumentation/llamaindex/retriever_query_engine_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.41.0 → opentelemetry_instrumentation_llamaindex-0.42.0}/opentelemetry/instrumentation/llamaindex/span_utils.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.41.0 → opentelemetry_instrumentation_llamaindex-0.42.0}/opentelemetry/instrumentation/llamaindex/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: opentelemetry-instrumentation-llamaindex
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.42.0
|
|
4
4
|
Summary: OpenTelemetry LlamaIndex instrumentation
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Author: Gal Kleinman
|
|
@@ -14,11 +14,12 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
16
16
|
Provides-Extra: instruments
|
|
17
|
+
Provides-Extra: llamaparse
|
|
17
18
|
Requires-Dist: inflection (>=0.5.1,<0.6.0)
|
|
18
19
|
Requires-Dist: opentelemetry-api (>=1.28.0,<2.0.0)
|
|
19
20
|
Requires-Dist: opentelemetry-instrumentation (>=0.50b0)
|
|
20
21
|
Requires-Dist: opentelemetry-semantic-conventions (>=0.50b0)
|
|
21
|
-
Requires-Dist: opentelemetry-semantic-conventions-ai (==0.4.
|
|
22
|
+
Requires-Dist: opentelemetry-semantic-conventions-ai (==0.4.11)
|
|
22
23
|
Project-URL: Repository, https://github.com/traceloop/openllmetry/tree/main/packages/opentelemetry-instrumentation-llamaindex
|
|
23
24
|
Description-Content-Type: text/markdown
|
|
24
25
|
|
|
@@ -28,6 +28,9 @@ from opentelemetry.instrumentation.llamaindex.custom_llm_instrumentor import (
|
|
|
28
28
|
from opentelemetry.instrumentation.llamaindex.dispatcher_wrapper import (
|
|
29
29
|
instrument_with_dispatcher,
|
|
30
30
|
)
|
|
31
|
+
from opentelemetry.instrumentation.llamaindex.llamaparse_instrumentor import (
|
|
32
|
+
LlamaParseInstrumentor,
|
|
33
|
+
)
|
|
31
34
|
from opentelemetry.instrumentation.llamaindex.query_pipeline_instrumentor import (
|
|
32
35
|
QueryPipelineInstrumentor,
|
|
33
36
|
)
|
|
@@ -90,6 +93,12 @@ class LlamaIndexInstrumentor(BaseInstrumentor):
|
|
|
90
93
|
BaseAgentInstrumentor(tracer).instrument()
|
|
91
94
|
BaseToolInstrumentor(tracer).instrument()
|
|
92
95
|
|
|
96
|
+
# LlamaParse instrumentation doesn't work for all versions
|
|
97
|
+
try:
|
|
98
|
+
LlamaParseInstrumentor(tracer).instrument()
|
|
99
|
+
except Exception:
|
|
100
|
+
pass
|
|
101
|
+
|
|
93
102
|
|
|
94
103
|
class LlamaIndexInstrumentorCore(BaseInstrumentor):
|
|
95
104
|
"""An instrumentor for core LlamaIndex SDK."""
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
from wrapt import wrap_function_wrapper
|
|
2
|
+
|
|
3
|
+
from opentelemetry.instrumentation.llamaindex.utils import (
|
|
4
|
+
_with_tracer_wrapper,
|
|
5
|
+
process_request,
|
|
6
|
+
process_response,
|
|
7
|
+
start_as_current_span_async,
|
|
8
|
+
)
|
|
9
|
+
from opentelemetry.semconv_ai import SpanAttributes, TraceloopSpanKindValues
|
|
10
|
+
|
|
11
|
+
MODULE_NAME = "llama_parse"
|
|
12
|
+
CLASS_NAME = "LlamaParse"
|
|
13
|
+
TASK_NAME = "llamaparse"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class LlamaParseInstrumentor:
|
|
17
|
+
def __init__(self, tracer):
|
|
18
|
+
self._tracer = tracer
|
|
19
|
+
|
|
20
|
+
def instrument(self):
|
|
21
|
+
methods_to_wrap = [
|
|
22
|
+
("load_data", load_data_wrapper),
|
|
23
|
+
("aload_data", aload_data_wrapper),
|
|
24
|
+
("get_json_result", get_json_wrapper),
|
|
25
|
+
("aget_json", aget_json_wrapper),
|
|
26
|
+
("get_images", get_images_wrapper),
|
|
27
|
+
("aget_images", aget_images_wrapper),
|
|
28
|
+
("get_charts", get_charts_wrapper),
|
|
29
|
+
("aget_charts", aget_charts_wrapper),
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
for method_name, wrapper_func in methods_to_wrap:
|
|
33
|
+
try:
|
|
34
|
+
wrap_function_wrapper(
|
|
35
|
+
MODULE_NAME,
|
|
36
|
+
f"{CLASS_NAME}.{method_name}",
|
|
37
|
+
wrapper_func(self._tracer),
|
|
38
|
+
)
|
|
39
|
+
except AttributeError:
|
|
40
|
+
# Method doesn't exist, skip it
|
|
41
|
+
continue
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@_with_tracer_wrapper
|
|
45
|
+
def get_json_wrapper(tracer, wrapped, instance, args, kwargs):
|
|
46
|
+
with tracer.start_as_current_span(f"{TASK_NAME}.task") as span:
|
|
47
|
+
span.set_attribute(
|
|
48
|
+
SpanAttributes.TRACELOOP_SPAN_KIND,
|
|
49
|
+
TraceloopSpanKindValues.TASK.value,
|
|
50
|
+
)
|
|
51
|
+
span.set_attribute(SpanAttributes.TRACELOOP_ENTITY_NAME, TASK_NAME)
|
|
52
|
+
|
|
53
|
+
process_request(span, args, kwargs)
|
|
54
|
+
result = wrapped(*args, **kwargs)
|
|
55
|
+
process_response(span, result)
|
|
56
|
+
return result
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@_with_tracer_wrapper
|
|
60
|
+
async def aget_json_wrapper(tracer, wrapped, instance, args, kwargs):
|
|
61
|
+
async with start_as_current_span_async(
|
|
62
|
+
tracer=tracer, name=f"{TASK_NAME}.task"
|
|
63
|
+
) as span:
|
|
64
|
+
span.set_attribute(
|
|
65
|
+
SpanAttributes.TRACELOOP_SPAN_KIND,
|
|
66
|
+
TraceloopSpanKindValues.TASK.value,
|
|
67
|
+
)
|
|
68
|
+
span.set_attribute(SpanAttributes.TRACELOOP_ENTITY_NAME, TASK_NAME)
|
|
69
|
+
|
|
70
|
+
process_request(span, args, kwargs)
|
|
71
|
+
result = await wrapped(*args, **kwargs)
|
|
72
|
+
process_response(span, result)
|
|
73
|
+
return result
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@_with_tracer_wrapper
|
|
77
|
+
def get_images_wrapper(tracer, wrapped, instance, args, kwargs):
|
|
78
|
+
with tracer.start_as_current_span(f"{TASK_NAME}.task") as span:
|
|
79
|
+
span.set_attribute(
|
|
80
|
+
SpanAttributes.TRACELOOP_SPAN_KIND,
|
|
81
|
+
TraceloopSpanKindValues.TASK.value,
|
|
82
|
+
)
|
|
83
|
+
span.set_attribute(SpanAttributes.TRACELOOP_ENTITY_NAME, TASK_NAME)
|
|
84
|
+
|
|
85
|
+
process_request(span, args, kwargs)
|
|
86
|
+
result = wrapped(*args, **kwargs)
|
|
87
|
+
process_response(span, result)
|
|
88
|
+
return result
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
@_with_tracer_wrapper
|
|
92
|
+
async def aget_images_wrapper(tracer, wrapped, instance, args, kwargs):
|
|
93
|
+
async with start_as_current_span_async(
|
|
94
|
+
tracer=tracer, name=f"{TASK_NAME}.task"
|
|
95
|
+
) as span:
|
|
96
|
+
span.set_attribute(
|
|
97
|
+
SpanAttributes.TRACELOOP_SPAN_KIND,
|
|
98
|
+
TraceloopSpanKindValues.TASK.value,
|
|
99
|
+
)
|
|
100
|
+
span.set_attribute(SpanAttributes.TRACELOOP_ENTITY_NAME, TASK_NAME)
|
|
101
|
+
|
|
102
|
+
process_request(span, args, kwargs)
|
|
103
|
+
result = await wrapped(*args, **kwargs)
|
|
104
|
+
process_response(span, result)
|
|
105
|
+
return result
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@_with_tracer_wrapper
|
|
109
|
+
def get_charts_wrapper(tracer, wrapped, instance, args, kwargs):
|
|
110
|
+
with tracer.start_as_current_span(f"{TASK_NAME}.task") as span:
|
|
111
|
+
span.set_attribute(
|
|
112
|
+
SpanAttributes.TRACELOOP_SPAN_KIND,
|
|
113
|
+
TraceloopSpanKindValues.TASK.value,
|
|
114
|
+
)
|
|
115
|
+
span.set_attribute(SpanAttributes.TRACELOOP_ENTITY_NAME, TASK_NAME)
|
|
116
|
+
|
|
117
|
+
process_request(span, args, kwargs)
|
|
118
|
+
result = wrapped(*args, **kwargs)
|
|
119
|
+
process_response(span, result)
|
|
120
|
+
return result
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@_with_tracer_wrapper
|
|
124
|
+
async def aget_charts_wrapper(tracer, wrapped, instance, args, kwargs):
|
|
125
|
+
async with start_as_current_span_async(
|
|
126
|
+
tracer=tracer, name=f"{TASK_NAME}.task"
|
|
127
|
+
) as span:
|
|
128
|
+
span.set_attribute(
|
|
129
|
+
SpanAttributes.TRACELOOP_SPAN_KIND,
|
|
130
|
+
TraceloopSpanKindValues.TASK.value,
|
|
131
|
+
)
|
|
132
|
+
span.set_attribute(SpanAttributes.TRACELOOP_ENTITY_NAME, TASK_NAME)
|
|
133
|
+
|
|
134
|
+
process_request(span, args, kwargs)
|
|
135
|
+
result = await wrapped(*args, **kwargs)
|
|
136
|
+
process_response(span, result)
|
|
137
|
+
return result
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
@_with_tracer_wrapper
|
|
141
|
+
def load_data_wrapper(tracer, wrapped, instance, args, kwargs):
|
|
142
|
+
with tracer.start_as_current_span(f"{TASK_NAME}.task") as span:
|
|
143
|
+
span.set_attribute(
|
|
144
|
+
SpanAttributes.TRACELOOP_SPAN_KIND,
|
|
145
|
+
TraceloopSpanKindValues.TASK.value,
|
|
146
|
+
)
|
|
147
|
+
span.set_attribute(SpanAttributes.TRACELOOP_ENTITY_NAME, TASK_NAME)
|
|
148
|
+
|
|
149
|
+
process_request(span, args, kwargs)
|
|
150
|
+
result = wrapped(*args, **kwargs)
|
|
151
|
+
process_response(span, result)
|
|
152
|
+
return result
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
@_with_tracer_wrapper
|
|
156
|
+
async def aload_data_wrapper(tracer, wrapped, instance, args, kwargs):
|
|
157
|
+
async with start_as_current_span_async(
|
|
158
|
+
tracer=tracer, name=f"{TASK_NAME}.task"
|
|
159
|
+
) as span:
|
|
160
|
+
span.set_attribute(
|
|
161
|
+
SpanAttributes.TRACELOOP_SPAN_KIND,
|
|
162
|
+
TraceloopSpanKindValues.TASK.value,
|
|
163
|
+
)
|
|
164
|
+
span.set_attribute(SpanAttributes.TRACELOOP_ENTITY_NAME, TASK_NAME)
|
|
165
|
+
|
|
166
|
+
process_request(span, args, kwargs)
|
|
167
|
+
result = await wrapped(*args, **kwargs)
|
|
168
|
+
process_response(span, result)
|
|
169
|
+
return result
|
opentelemetry_instrumentation_llamaindex-0.42.0/opentelemetry/instrumentation/llamaindex/version.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.42.0"
|
|
@@ -8,7 +8,7 @@ show_missing = true
|
|
|
8
8
|
|
|
9
9
|
[tool.poetry]
|
|
10
10
|
name = "opentelemetry-instrumentation-llamaindex"
|
|
11
|
-
version = "0.
|
|
11
|
+
version = "0.42.0"
|
|
12
12
|
description = "OpenTelemetry LlamaIndex instrumentation"
|
|
13
13
|
authors = [
|
|
14
14
|
"Gal Kleinman <gal@traceloop.com>",
|
|
@@ -27,7 +27,7 @@ python = ">=3.9,<4"
|
|
|
27
27
|
opentelemetry-api = "^1.28.0"
|
|
28
28
|
opentelemetry-instrumentation = ">=0.50b0"
|
|
29
29
|
opentelemetry-semantic-conventions = ">=0.50b0"
|
|
30
|
-
opentelemetry-semantic-conventions-ai = "0.4.
|
|
30
|
+
opentelemetry-semantic-conventions-ai = "0.4.11"
|
|
31
31
|
inflection = "^0.5.1"
|
|
32
32
|
|
|
33
33
|
[tool.poetry.group.dev.dependencies]
|
|
@@ -43,15 +43,16 @@ openai = "^1.52.2"
|
|
|
43
43
|
opentelemetry-sdk = "^1.27.0"
|
|
44
44
|
llama-index = "^0.12.6"
|
|
45
45
|
llama-index-postprocessor-cohere-rerank = "^0.3.0"
|
|
46
|
-
opentelemetry-instrumentation-openai = "==0.
|
|
47
|
-
opentelemetry-instrumentation-cohere = "==0.
|
|
48
|
-
opentelemetry-instrumentation-chromadb = "==0.
|
|
46
|
+
opentelemetry-instrumentation-openai = "==0.42.0"
|
|
47
|
+
opentelemetry-instrumentation-cohere = "==0.42.0"
|
|
48
|
+
opentelemetry-instrumentation-chromadb = "==0.42.0"
|
|
49
49
|
sqlalchemy = "^2.0.31"
|
|
50
50
|
llama-index-agent-openai = "^0.4.1"
|
|
51
51
|
llama-index-vector-stores-chroma = "^0.4.1"
|
|
52
52
|
llama-index-llms-cohere = "^0.4.0"
|
|
53
53
|
llama-index-embeddings-openai = "^0.3.1"
|
|
54
54
|
onnxruntime = "<1.20.0"
|
|
55
|
+
llama-parse = "^0.5.20"
|
|
55
56
|
|
|
56
57
|
[build-system]
|
|
57
58
|
requires = ["poetry-core"]
|
|
@@ -59,6 +60,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
59
60
|
|
|
60
61
|
[tool.poetry.extras]
|
|
61
62
|
instruments = ["llama-index"]
|
|
63
|
+
llamaparse = ["llama-parse"]
|
|
62
64
|
|
|
63
65
|
[tool.poetry.plugins."opentelemetry_instrumentor"]
|
|
64
66
|
llama-index = "opentelemetry.instrumentation.llamaindex:LlamaIndexInstrumentor"
|
opentelemetry_instrumentation_llamaindex-0.41.0/opentelemetry/instrumentation/llamaindex/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.41.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|