opentelemetry-instrumentation-llamaindex 0.33.12__tar.gz → 0.34.1__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.33.12 → opentelemetry_instrumentation_llamaindex-0.34.1}/PKG-INFO +3 -3
- {opentelemetry_instrumentation_llamaindex-0.33.12 → opentelemetry_instrumentation_llamaindex-0.34.1}/opentelemetry/instrumentation/llamaindex/dispatcher_wrapper.py +26 -15
- opentelemetry_instrumentation_llamaindex-0.34.1/opentelemetry/instrumentation/llamaindex/version.py +1 -0
- {opentelemetry_instrumentation_llamaindex-0.33.12 → opentelemetry_instrumentation_llamaindex-0.34.1}/pyproject.toml +14 -13
- opentelemetry_instrumentation_llamaindex-0.33.12/opentelemetry/instrumentation/llamaindex/version.py +0 -1
- {opentelemetry_instrumentation_llamaindex-0.33.12 → opentelemetry_instrumentation_llamaindex-0.34.1}/README.md +0 -0
- {opentelemetry_instrumentation_llamaindex-0.33.12 → opentelemetry_instrumentation_llamaindex-0.34.1}/opentelemetry/instrumentation/llamaindex/__init__.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.33.12 → opentelemetry_instrumentation_llamaindex-0.34.1}/opentelemetry/instrumentation/llamaindex/base_agent_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.33.12 → opentelemetry_instrumentation_llamaindex-0.34.1}/opentelemetry/instrumentation/llamaindex/base_embedding_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.33.12 → opentelemetry_instrumentation_llamaindex-0.34.1}/opentelemetry/instrumentation/llamaindex/base_retriever_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.33.12 → opentelemetry_instrumentation_llamaindex-0.34.1}/opentelemetry/instrumentation/llamaindex/base_synthesizer_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.33.12 → opentelemetry_instrumentation_llamaindex-0.34.1}/opentelemetry/instrumentation/llamaindex/base_tool_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.33.12 → opentelemetry_instrumentation_llamaindex-0.34.1}/opentelemetry/instrumentation/llamaindex/config.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.33.12 → opentelemetry_instrumentation_llamaindex-0.34.1}/opentelemetry/instrumentation/llamaindex/custom_llm_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.33.12 → opentelemetry_instrumentation_llamaindex-0.34.1}/opentelemetry/instrumentation/llamaindex/query_pipeline_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.33.12 → opentelemetry_instrumentation_llamaindex-0.34.1}/opentelemetry/instrumentation/llamaindex/retriever_query_engine_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.33.12 → opentelemetry_instrumentation_llamaindex-0.34.1}/opentelemetry/instrumentation/llamaindex/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: opentelemetry-instrumentation-llamaindex
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.34.1
|
|
4
4
|
Summary: OpenTelemetry LlamaIndex instrumentation
|
|
5
5
|
Home-page: https://github.com/traceloop/openllmetry/tree/main/packages/opentelemetry-instrumentation-llamaindex
|
|
6
6
|
License: Apache-2.0
|
|
@@ -17,8 +17,8 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
17
17
|
Provides-Extra: instruments
|
|
18
18
|
Requires-Dist: inflection (>=0.5.1,<0.6.0)
|
|
19
19
|
Requires-Dist: opentelemetry-api (>=1.28.0,<2.0.0)
|
|
20
|
-
Requires-Dist: opentelemetry-instrumentation (>=0.
|
|
21
|
-
Requires-Dist: opentelemetry-semantic-conventions (>=0.
|
|
20
|
+
Requires-Dist: opentelemetry-instrumentation (>=0.50b0)
|
|
21
|
+
Requires-Dist: opentelemetry-semantic-conventions (>=0.50b0)
|
|
22
22
|
Requires-Dist: opentelemetry-semantic-conventions-ai (==0.4.2)
|
|
23
23
|
Project-URL: Repository, https://github.com/traceloop/openllmetry/tree/main/packages/opentelemetry-instrumentation-llamaindex
|
|
24
24
|
Description-Content-Type: text/markdown
|
|
@@ -24,6 +24,7 @@ from llama_index.core.instrumentation.events.llm import (
|
|
|
24
24
|
from llama_index.core.instrumentation.events.rerank import ReRankStartEvent
|
|
25
25
|
from llama_index.core.instrumentation.event_handlers import BaseEventHandler
|
|
26
26
|
from llama_index.core.instrumentation.span_handlers import BaseSpanHandler
|
|
27
|
+
from llama_index.core.workflow import Workflow
|
|
27
28
|
from opentelemetry import context as context_api
|
|
28
29
|
from opentelemetry.instrumentation.llamaindex.utils import (
|
|
29
30
|
JSONEncoder,
|
|
@@ -44,7 +45,7 @@ from opentelemetry.trace.span import Span
|
|
|
44
45
|
# we use the regular OpenLLMetry instrumentations
|
|
45
46
|
AVAILABLE_OPENLLMETRY_INSTRUMENTATIONS = ["OpenAI"]
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
CLASS_ANDMETHOD_NAME_FROM_ID_REGEX = re.compile(r"([a-zA-Z]+)\.([a-zA-Z_]+)-")
|
|
48
49
|
STREAMING_END_EVENTS = (
|
|
49
50
|
LLMChatEndEvent,
|
|
50
51
|
LLMCompletionEndEvent,
|
|
@@ -188,14 +189,14 @@ class SpanHolder:
|
|
|
188
189
|
return [self.parent] + self.parent.notify_parent()
|
|
189
190
|
return []
|
|
190
191
|
|
|
191
|
-
def end(self):
|
|
192
|
+
def end(self, should_detach_context: bool = True):
|
|
192
193
|
if not self._active:
|
|
193
194
|
return
|
|
194
195
|
|
|
195
196
|
self._active = False
|
|
196
197
|
if self.otel_span:
|
|
197
198
|
self.otel_span.end()
|
|
198
|
-
if self.token:
|
|
199
|
+
if self.token and should_detach_context:
|
|
199
200
|
context_api.detach(self.token)
|
|
200
201
|
|
|
201
202
|
@singledispatchmethod
|
|
@@ -245,24 +246,33 @@ class OpenLLMetrySpanHandler(BaseSpanHandler[SpanHolder]):
|
|
|
245
246
|
**kwargs: Any,
|
|
246
247
|
) -> Optional[SpanHolder]:
|
|
247
248
|
"""Create a span."""
|
|
248
|
-
|
|
249
|
-
kind = (
|
|
250
|
-
TraceloopSpanKindValues.TASK.value
|
|
251
|
-
if parent
|
|
252
|
-
else TraceloopSpanKindValues.WORKFLOW.value
|
|
253
|
-
)
|
|
254
|
-
# Take the class name from id_ where id_ is e.g.
|
|
249
|
+
# Take the class name and method name from id_ where id_ is e.g.
|
|
255
250
|
# 'SentenceSplitter.split_text_metadata_aware-a2f2a780-2fa6-4682-a88e-80dc1f1ebe6a'
|
|
256
|
-
|
|
251
|
+
matches = CLASS_ANDMETHOD_NAME_FROM_ID_REGEX.match(id_)
|
|
252
|
+
class_name = matches.groups()[0]
|
|
253
|
+
method_name = matches.groups()[1]
|
|
254
|
+
|
|
255
|
+
parent = self.open_spans.get(parent_span_id)
|
|
256
|
+
|
|
257
257
|
if class_name in AVAILABLE_OPENLLMETRY_INSTRUMENTATIONS:
|
|
258
|
-
context_api.attach(
|
|
258
|
+
token = context_api.attach(
|
|
259
259
|
context_api.set_value(
|
|
260
260
|
SUPPRESS_LANGUAGE_MODEL_INSTRUMENTATION_KEY, False
|
|
261
261
|
)
|
|
262
262
|
)
|
|
263
|
-
return SpanHolder(id_, parent)
|
|
263
|
+
return SpanHolder(id_, parent, token=token)
|
|
264
|
+
|
|
265
|
+
kind = (
|
|
266
|
+
TraceloopSpanKindValues.TASK.value
|
|
267
|
+
if parent
|
|
268
|
+
else TraceloopSpanKindValues.WORKFLOW.value
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
if isinstance(instance, Workflow):
|
|
272
|
+
span_name = f"{instance.__class__.__name__}.{kind}" if not parent_span_id else f"{method_name}.{kind}"
|
|
273
|
+
else:
|
|
274
|
+
span_name = f"{class_name}.{kind}"
|
|
264
275
|
|
|
265
|
-
span_name = f"{class_name}.{kind}"
|
|
266
276
|
span = self._tracer.start_span(
|
|
267
277
|
span_name,
|
|
268
278
|
context=parent.context if parent else None,
|
|
@@ -322,7 +332,8 @@ class OpenLLMetrySpanHandler(BaseSpanHandler[SpanHolder]):
|
|
|
322
332
|
self.waiting_for_streaming_spans[id_] = span_holder
|
|
323
333
|
return span_holder
|
|
324
334
|
else:
|
|
325
|
-
|
|
335
|
+
should_detach_context = not isinstance(instance, Workflow)
|
|
336
|
+
span_holder.end(should_detach_context)
|
|
326
337
|
return span_holder
|
|
327
338
|
|
|
328
339
|
def prepare_to_drop_span(
|
opentelemetry_instrumentation_llamaindex-0.34.1/opentelemetry/instrumentation/llamaindex/version.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.34.1"
|
|
@@ -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.34.1"
|
|
12
12
|
description = "OpenTelemetry LlamaIndex instrumentation"
|
|
13
13
|
authors = [
|
|
14
14
|
"Gal Kleinman <gal@traceloop.com>",
|
|
@@ -25,8 +25,8 @@ include = "opentelemetry/instrumentation/llamaindex"
|
|
|
25
25
|
[tool.poetry.dependencies]
|
|
26
26
|
python = ">=3.9,<4"
|
|
27
27
|
opentelemetry-api = "^1.28.0"
|
|
28
|
-
opentelemetry-instrumentation = "
|
|
29
|
-
opentelemetry-semantic-conventions = "
|
|
28
|
+
opentelemetry-instrumentation = ">=0.50b0"
|
|
29
|
+
opentelemetry-semantic-conventions = ">=0.50b0"
|
|
30
30
|
opentelemetry-semantic-conventions-ai = "0.4.2"
|
|
31
31
|
inflection = "^0.5.1"
|
|
32
32
|
|
|
@@ -38,19 +38,20 @@ flake8 = "7.0.0"
|
|
|
38
38
|
vcrpy = "^6.0.1"
|
|
39
39
|
pytest-recording = "^0.13.1"
|
|
40
40
|
pytest-asyncio = "^0.23.7"
|
|
41
|
-
chromadb = "
|
|
41
|
+
chromadb = "^0.5.23"
|
|
42
42
|
openai = "^1.52.2"
|
|
43
43
|
opentelemetry-sdk = "^1.27.0"
|
|
44
|
-
llama-index = "^0.
|
|
45
|
-
llama-index-postprocessor-cohere-rerank = "^0.
|
|
46
|
-
opentelemetry-instrumentation-openai = "==0.
|
|
47
|
-
opentelemetry-instrumentation-cohere = "==0.
|
|
48
|
-
opentelemetry-instrumentation-chromadb = "==0.
|
|
44
|
+
llama-index = "^0.12.6"
|
|
45
|
+
llama-index-postprocessor-cohere-rerank = "^0.3.0"
|
|
46
|
+
opentelemetry-instrumentation-openai = "==0.34.1"
|
|
47
|
+
opentelemetry-instrumentation-cohere = "==0.34.1"
|
|
48
|
+
opentelemetry-instrumentation-chromadb = "==0.34.1"
|
|
49
49
|
sqlalchemy = "^2.0.31"
|
|
50
|
-
llama-index-agent-openai = "^0.
|
|
51
|
-
llama-index-vector-stores-chroma = "^0.
|
|
52
|
-
llama-index-llms-cohere = "^0.
|
|
53
|
-
llama-index-embeddings-openai = "^0.
|
|
50
|
+
llama-index-agent-openai = "^0.4.1"
|
|
51
|
+
llama-index-vector-stores-chroma = "^0.4.1"
|
|
52
|
+
llama-index-llms-cohere = "^0.4.0"
|
|
53
|
+
llama-index-embeddings-openai = "^0.3.1"
|
|
54
|
+
onnxruntime = "<1.20.0"
|
|
54
55
|
|
|
55
56
|
[build-system]
|
|
56
57
|
requires = ["poetry-core"]
|
opentelemetry_instrumentation_llamaindex-0.33.12/opentelemetry/instrumentation/llamaindex/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.33.12"
|
|
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
|