opentelemetry-instrumentation-llamaindex 0.12.0__tar.gz → 0.12.2__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.12.0 → opentelemetry_instrumentation_llamaindex-0.12.2}/PKG-INFO +1 -1
- {opentelemetry_instrumentation_llamaindex-0.12.0 → opentelemetry_instrumentation_llamaindex-0.12.2}/opentelemetry/instrumentation/llamaindex/__init__.py +4 -0
- opentelemetry_instrumentation_llamaindex-0.12.2/opentelemetry/instrumentation/llamaindex/query_pipeline_instrumentor.py +71 -0
- opentelemetry_instrumentation_llamaindex-0.12.2/opentelemetry/instrumentation/llamaindex/version.py +1 -0
- {opentelemetry_instrumentation_llamaindex-0.12.0 → opentelemetry_instrumentation_llamaindex-0.12.2}/pyproject.toml +5 -3
- opentelemetry_instrumentation_llamaindex-0.12.0/opentelemetry/instrumentation/llamaindex/version.py +0 -1
- {opentelemetry_instrumentation_llamaindex-0.12.0 → opentelemetry_instrumentation_llamaindex-0.12.2}/README.md +0 -0
- {opentelemetry_instrumentation_llamaindex-0.12.0 → opentelemetry_instrumentation_llamaindex-0.12.2}/opentelemetry/instrumentation/llamaindex/base_embedding_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.12.0 → opentelemetry_instrumentation_llamaindex-0.12.2}/opentelemetry/instrumentation/llamaindex/base_retriever_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.12.0 → opentelemetry_instrumentation_llamaindex-0.12.2}/opentelemetry/instrumentation/llamaindex/base_synthesizer_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.12.0 → opentelemetry_instrumentation_llamaindex-0.12.2}/opentelemetry/instrumentation/llamaindex/custom_llm_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.12.0 → opentelemetry_instrumentation_llamaindex-0.12.2}/opentelemetry/instrumentation/llamaindex/retriever_query_engine_instrumentor.py +0 -0
- {opentelemetry_instrumentation_llamaindex-0.12.0 → opentelemetry_instrumentation_llamaindex-0.12.2}/opentelemetry/instrumentation/llamaindex/utils.py +0 -0
|
@@ -22,6 +22,9 @@ from opentelemetry.instrumentation.llamaindex.base_embedding_instrumentor import
|
|
|
22
22
|
from opentelemetry.instrumentation.llamaindex.custom_llm_instrumentor import (
|
|
23
23
|
CustomLLMInstrumentor,
|
|
24
24
|
)
|
|
25
|
+
from opentelemetry.instrumentation.llamaindex.query_pipeline_instrumentor import (
|
|
26
|
+
QueryPipelineInstrumentor,
|
|
27
|
+
)
|
|
25
28
|
from opentelemetry.instrumentation.llamaindex.version import __version__
|
|
26
29
|
|
|
27
30
|
logger = logging.getLogger(__name__)
|
|
@@ -44,6 +47,7 @@ class LlamaIndexInstrumentor(BaseInstrumentor):
|
|
|
44
47
|
BaseSynthesizerInstrumentor(tracer).instrument()
|
|
45
48
|
BaseEmbeddingInstrumentor(tracer).instrument()
|
|
46
49
|
CustomLLMInstrumentor(tracer).instrument()
|
|
50
|
+
QueryPipelineInstrumentor(tracer).instrument()
|
|
47
51
|
|
|
48
52
|
def _uninstrument(self, **kwargs):
|
|
49
53
|
pass
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
from importlib.metadata import version as package_version, PackageNotFoundError
|
|
2
|
+
|
|
3
|
+
from wrapt import wrap_function_wrapper
|
|
4
|
+
from opentelemetry.context import attach, set_value
|
|
5
|
+
|
|
6
|
+
from opentelemetry.instrumentation.llamaindex.utils import (
|
|
7
|
+
_with_tracer_wrapper,
|
|
8
|
+
start_as_current_span_async,
|
|
9
|
+
)
|
|
10
|
+
from opentelemetry.semconv.ai import SpanAttributes, TraceloopSpanKindValues
|
|
11
|
+
|
|
12
|
+
V9_MODULE_NAME = "llama_index.query_pipeline.query"
|
|
13
|
+
V10_MODULE_NAME = "llama_index.core.query_pipeline.query"
|
|
14
|
+
V10_LEGACY_MODULE_NAME = "llama_index.legacy.query_pipeline.query"
|
|
15
|
+
|
|
16
|
+
CLASS_NAME = "QueryPipeline"
|
|
17
|
+
WORKFLOW_NAME = "llama_index_query_pipeline"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class QueryPipelineInstrumentor:
|
|
21
|
+
def __init__(self, tracer):
|
|
22
|
+
self._tracer = tracer
|
|
23
|
+
|
|
24
|
+
def instrument(self):
|
|
25
|
+
try:
|
|
26
|
+
package_version("llama-index-core")
|
|
27
|
+
self._instrument_module(V10_MODULE_NAME)
|
|
28
|
+
self._instrument_module(V10_LEGACY_MODULE_NAME)
|
|
29
|
+
|
|
30
|
+
except PackageNotFoundError:
|
|
31
|
+
self._instrument_module(V9_MODULE_NAME)
|
|
32
|
+
|
|
33
|
+
def _instrument_module(self, module_name):
|
|
34
|
+
wrap_function_wrapper(
|
|
35
|
+
module_name, f"{CLASS_NAME}.run", run_wrapper(self._tracer)
|
|
36
|
+
)
|
|
37
|
+
wrap_function_wrapper(
|
|
38
|
+
module_name, f"{CLASS_NAME}.arun", arun_wrapper(self._tracer)
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def set_workflow_context():
|
|
43
|
+
attach(set_value("workflow_name", WORKFLOW_NAME))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@_with_tracer_wrapper
|
|
47
|
+
def run_wrapper(tracer, wrapped, instance, args, kwargs):
|
|
48
|
+
set_workflow_context()
|
|
49
|
+
|
|
50
|
+
with tracer.start_as_current_span(f"{WORKFLOW_NAME}.workflow") as span:
|
|
51
|
+
span.set_attribute(
|
|
52
|
+
SpanAttributes.TRACELOOP_SPAN_KIND,
|
|
53
|
+
TraceloopSpanKindValues.WORKFLOW.value,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
return wrapped(*args, **kwargs)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@_with_tracer_wrapper
|
|
60
|
+
async def arun_wrapper(tracer, wrapped, instance, args, kwargs):
|
|
61
|
+
set_workflow_context()
|
|
62
|
+
|
|
63
|
+
async with start_as_current_span_async(
|
|
64
|
+
tracer=tracer, name=f"{WORKFLOW_NAME}.workflow"
|
|
65
|
+
) as span:
|
|
66
|
+
span.set_attribute(
|
|
67
|
+
SpanAttributes.TRACELOOP_SPAN_KIND,
|
|
68
|
+
TraceloopSpanKindValues.WORKFLOW.value,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
return await wrapped(*args, **kwargs)
|
opentelemetry_instrumentation_llamaindex-0.12.2/opentelemetry/instrumentation/llamaindex/version.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.12.2"
|
|
@@ -8,7 +8,7 @@ show_missing = true
|
|
|
8
8
|
|
|
9
9
|
[tool.poetry]
|
|
10
10
|
name = "opentelemetry-instrumentation-llamaindex"
|
|
11
|
-
version = "0.12.
|
|
11
|
+
version = "0.12.2"
|
|
12
12
|
description = "OpenTelemetry LlamaIndex instrumentation"
|
|
13
13
|
authors = [
|
|
14
14
|
"Gal Kleinman <gal@traceloop.com>",
|
|
@@ -40,8 +40,10 @@ chromadb = "^0.4.22"
|
|
|
40
40
|
openai = "^1.12.0"
|
|
41
41
|
opentelemetry-sdk = "^1.22.0"
|
|
42
42
|
llama-index = "^0.10.10"
|
|
43
|
-
|
|
44
|
-
opentelemetry-instrumentation-
|
|
43
|
+
llama-index-postprocessor-cohere-rerank = "^0.1.2"
|
|
44
|
+
opentelemetry-instrumentation-openai = "^0.12.2"
|
|
45
|
+
opentelemetry-instrumentation-cohere = "^0.12.2"
|
|
46
|
+
opentelemetry-instrumentation-chromadb = "^0.12.2"
|
|
45
47
|
|
|
46
48
|
|
|
47
49
|
[build-system]
|
opentelemetry_instrumentation_llamaindex-0.12.0/opentelemetry/instrumentation/llamaindex/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.12.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|