feat: implement and compare LLM tracing options to Grafana. #269#313
feat: implement and compare LLM tracing options to Grafana. #269#313Azamat0315277 wants to merge 20 commits into
Conversation
Add MLflow as a dependency and configure LangChain autologging for LLM tracing. Set up an OpenTelemetry TracerProvider with a BatchSpanProcessor backed by OTLPSpanExporter to forward traces to Grafana.
|
/deploy-review
|
|
/deploy-review
|
…in app.py and into the FastAPI lifespan, delete the manual TracerProvider, which was overriding the provider already registered by aidial-sdk via TelemetryConfig.
|
/deploy-review
|
…D=true in the code; will be reverted after testing.
|
/deploy-review
|
|
/deploy-review
|
|
/deploy-review
|
|
/deploy-review
|
…flow library for testing purposes
…using-mlflow-autologger
|
/deploy-review
|
|
/deploy-review
|
|
/deploy-review
|
…IMIT; this chage will be removed after testing
|
/deploy-review
|
|
/deploy-review
|
Applicable issue
PR #313 was opened to implement MLflow autologging. The branch evolved significantly — MLflow was replaced with OpenInference LangChainInstrumentor
Description of changes
What was changed
Replaces MLflow autologging with OpenInference
LangChainInstrumentorfor LLM tracing to Grafana, and includes several improvements merged from development.LLM Tracing (core change)
pyproject.toml- addedopeninference-instrumentation-langchain;statgpt/app/application/application.py- addedLangChainInstrumentor().instrument()inside the FastAPI lifespan.ort.yml- added license curations for new OpenInference transitive dependencies.Why OpenInference over MLflow
ContextVartracking crashes underasyncio.gather. OpenInference usescontext.attach()/detach()which asyncio copies correctly across task boundaries.Configuration
❗ Set
OTEL_EXPORTER_OTLP_TRACES_ENDPOINTenvironment variable for the Grafana OTLP endpoint.❗ Set
OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMITto cap span attribute size (gRPC 4 MB limit).Checklist
Reviewenvironment.By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.
Status
Draft