Aliyun LlamaIndex Instrumentation
Project description
阿里云LlamaIndex自动检测库
这是Python自动检测库,专为LlamaIndex框架设计。通过此库产生的追踪信息完全兼容OpenTelemetry,可以发送到OpenTelemetry收集器进行查看,例如xtrace。
安装
通过下列命令安装aliyun-instrumentation-llama-index
:
pip3 install aliyun-instrumentation-llama-index
兼容性
llama-index
与aliyun-instrumentation-llama-index
两者间的版本兼容性以下所述:
llama-index版本 | aliyun-instrumentation-llama-index版本 |
---|---|
>=0.10.0, < 0.10.43 | >=1.0.0 |
快速开始
安装必须的包
首先,安装本示范所需的包:
pip install aliyun-instrumentation-llama-index llama-index opentelemetry-sdk opentelemetry-exporter-otlp
设置追踪
以下Python代码用于设置AliyunLlamaIndexInstrumentor
来追踪llama-index
,并将追踪信息输出至控制台。
from aliyun.instrumentation.llama_index import AliyunLlamaIndexInstrumentor
from opentelemetry import trace
from opentelemetry.sdk.resources import Resource, SERVICE_NAME, SERVICE_VERSION
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor, ConsoleSpanExporter
resource = Resource(
attributes={
SERVICE_NAME: 'aliyun_llama_index_test',
SERVICE_VERSION: '0.0.1',
# "telemetry.sdk.language": "Python",
}
)
provider = TracerProvider(resource=resource)
provider.add_span_processor(SimpleSpanProcessor(ConsoleSpanExporter())) # 在控制台输出Trace
trace.set_tracer_provider(provider)
# aliyun llama-index instrumentor
AliyunLlamaIndexInstrumentor().instrument()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file aliyun_instrumentation_llama_index-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: aliyun_instrumentation_llama_index-1.0.1-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 570c32ac13e00f402ff2a8d2fb6d7db460a712d172e0e75f8b8f73a177e8c572 |
|
MD5 | e99275625faa612a38f040b4abe96d70 |
|
BLAKE2b-256 | 5196444d78afb3915dba282b791be7087de5793e4206dfc9d91bce40e61c81bb |